Fix max move message against semi invulnerable target (#8313)
Some checks are pending
CI / build (push) Waiting to run
CI / allcontributors (push) Waiting to run
Docs / deploy (push) Waiting to run

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
FosterProgramming 2025-11-21 15:15:01 +01:00 committed by GitHub
parent 7ec0a1db9a
commit 7229305ff9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 2 deletions

View File

@ -9333,8 +9333,10 @@ BattleScript_TargetAbilityStatRaiseRet_End:
@@@ MAX MOVES @@@
BattleScript_EffectMaxMove::
attackcanceler
attackstring
ppreduce
accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON
goto BattleScript_HitFromAtkString
goto BattleScript_HitFromCritCalc
BattleScript_EffectRaiseStatAllies::
savetarget

View File

@ -1370,8 +1370,23 @@ static void AccuracyCheck(bool32 recalcDragonDarts, const u8 *nextInstr, const u
if (gBattleMons[gBattlerTarget].volatiles.lockOn && gDisableStructs[gBattlerTarget].battlerWithSureHit == gBattlerAttacker)
gBattlescriptCurrInstr = nextInstr;
else if (IsSemiInvulnerable(gBattlerTarget, CHECK_ALL))
{
if (gBattlerTarget != BATTLE_PARTNER(gBattlerAttacker))
{
gBattleStruct->moveResultFlags[gBattlerTarget] |= MOVE_RESULT_MISSED;
gBattleStruct->missStringId[gBattlerTarget] = gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_ATK;
}
gBattlescriptCurrInstr = failInstr;
else if (!JumpIfMoveAffectedByProtect(gCurrentMove, gBattlerTarget, TRUE, failInstr))
}
else if (IsBattlerProtected(gBattlerAttacker, gBattlerTarget, gCurrentMove))
{
gBattleStruct->moveResultFlags[gBattlerTarget] |= MOVE_RESULT_MISSED;
gBattleStruct->missStringId[gBattlerTarget] = gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED;
gLastLandedMoves[gBattlerTarget] = 0;
gLastHitByType[gBattlerTarget] = 0;
gBattlescriptCurrInstr = failInstr;
}
else
gBattlescriptCurrInstr = nextInstr;
if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_DYNAMAX)
{

View File

@ -1671,6 +1671,20 @@ SINGLE_BATTLE_TEST("Dynamax: Destiny Bond fails if a dynamaxed battler is presen
}
}
SINGLE_BATTLE_TEST("Dynamax: max move against semi-invulnerable target prints the correct message")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Speed(1);};
OPPONENT(SPECIES_WOBBUFFET) {Speed(2);};
} WHEN {
TURN { MOVE(player, MOVE_SCRATCH, gimmick: GIMMICK_DYNAMAX); MOVE(opponent, MOVE_FLY); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_DYNAMAX_GROWTH, player);
MESSAGE("Wobbuffet used Max Strike!");
MESSAGE("The opposing Wobbuffet avoided the attack!");
}
}
DOUBLE_BATTLE_TEST("Dynamax stat lowering moves don't make stat-changing abilities apply to partner")
{
u32 move, stat, ability;