From 487dc921197c72524879c15b9cf20407fb762347 Mon Sep 17 00:00:00 2001 From: hedara90 <90hedara@gmail.com> Date: Sun, 26 May 2024 17:01:20 +0200 Subject: [PATCH] Fixing bugs with Moxie clones+Dynamax, Fling Flinch infinite loop and Focus Sash+foreseen moves (#4625) * Fixed Elixirs not being able to be used unless the first move was missing PP * Revert "Pokedex Plus fixes (#4514)" This reverts commit 982934c4aad64c75468e2ae6642cb74e50aa0944. * Pokedex Plus fixes (#4514) * Pokedex plus no longer allows browsing unseen evos * Restore "has no evolutions" printing * only print "has no evolution" text at 0 depth * Revert config changes * fix duplicate icons and removed eevee hardcodes * add new scope and indentation fixes * actually introduce new scope * Revert "Fixed Elixirs not being able to be used unless the first move was missing PP" This reverts commit 313f2e552672cae9506c6a647464c247b9b39928. * Initial Testing of Focus Sash+Future Sight * Fixed infinite loop when flinging Razor Fang on a mon that's already moved * Fixed Moxie clones not triggering on pokemon fainted by Max Moves * Fixed Focus Sash enduring another time if broken by foreseen moves * Update src/battle_script_commands.c Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Update src/battle_script_commands.c Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Added assumptions to tests --------- Co-authored-by: Hedara Co-authored-by: sneed <56992013+Sneed69@users.noreply.github.com> Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> --- src/battle_script_commands.c | 10 +++++++++- test/battle/move_effect/future_sight.c | 21 +++++++++++++++++++++ test/dynamax.c | 16 ++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 235c11d14d..af1bcfe1aa 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2096,6 +2096,9 @@ static void Cmd_adjustdamage(void) { gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; gLastUsedItem = gBattleMons[gBattlerTarget].item; + gSpecialStatuses[gBattlerTarget].focusBanded = FALSE; + gSpecialStatuses[gBattlerTarget].focusSashed = FALSE; + } else if (gSpecialStatuses[gBattlerTarget].sturdied) { @@ -3212,6 +3215,10 @@ void SetMoveEffect(bool32 primary, bool32 certain) { gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]; gBattlescriptCurrInstr++; + } + else + { + gBattlescriptCurrInstr++; } break; case MOVE_EFFECT_UPROAR: @@ -8406,7 +8413,7 @@ static bool32 HasAttackerFaintedTarget(void) && gBattleStruct->moveTarget[gBattlerAttacker] == gBattlerTarget && gBattlerTarget != gBattlerAttacker && gCurrentTurnActionNumber == GetBattlerTurnOrderNum(gBattlerAttacker) - && (gChosenMove == gChosenMoveByBattler[gBattlerAttacker] || gChosenMove == gBattleMons[gBattlerAttacker].moves[gChosenMovePos])) + && (gChosenMove == gChosenMoveByBattler[gBattlerAttacker] || gChosenMove == gBattleMons[gBattlerAttacker].moves[gChosenMovePos] || gChosenMove == GetMaxMove(gBattlerAttacker, gChosenMoveByBattler[gBattlerAttacker]))) return TRUE; else return FALSE; @@ -9486,6 +9493,7 @@ static void Cmd_various(void) case VARIOUS_TRY_ACTIVATE_BEAST_BOOST: { VARIOUS_ARGS(); + i = GetHighestStatId(battler); if (GetBattlerAbility(battler) == ABILITY_BEAST_BOOST && HasAttackerFaintedTarget() diff --git a/test/battle/move_effect/future_sight.c b/test/battle/move_effect/future_sight.c index 7ebac1ac97..fa78461a9d 100644 --- a/test/battle/move_effect/future_sight.c +++ b/test/battle/move_effect/future_sight.c @@ -5,6 +5,8 @@ ASSUMPTIONS { ASSUME(gMovesInfo[MOVE_SEED_FLARE].power == gMovesInfo[MOVE_FUTURE_SIGHT].power); ASSUME(gMovesInfo[MOVE_SEED_FLARE].category == gMovesInfo[MOVE_FUTURE_SIGHT].category); + ASSUME(gMovesInfo[MOVE_FUTURE_SIGHT].effect == EFFECT_FUTURE_SIGHT); + ASSUME(gMovesInfo[MOVE_FUTURE_SIGHT].power > 0); } SINGLE_BATTLE_TEST("Future Sight uses Sp. Atk stat of the original user without modifiers") @@ -153,3 +155,22 @@ SINGLE_BATTLE_TEST("Future Sight will miss timing if target faints by residual d NOT MESSAGE("Foe Wynaut took the Future Sight attack!"); } } + +SINGLE_BATTLE_TEST("Future Sight breaks Focus Sash and doesn't make the holder endure another move") +{ + ASSUME(gMovesInfo[MOVE_PSYCHIC].power > 0); + ASSUME(gItemsInfo[ITEM_FOCUS_SASH].holdEffect == HOLD_EFFECT_FOCUS_SASH); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_PIDGEY) { Level(1); Item(ITEM_FOCUS_SASH); } + } WHEN { + TURN { MOVE(player, MOVE_FUTURE_SIGHT); } + TURN { } + TURN { } + TURN { MOVE(player, MOVE_PSYCHIC); } + } SCENE { + MESSAGE("Foe Pidgey hung on using its Focus Sash!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHIC, player); + MESSAGE("Foe Pidgey fainted!"); + } +} diff --git a/test/dynamax.c b/test/dynamax.c index 2db55d87b6..03ff3c2ade 100644 --- a/test/dynamax.c +++ b/test/dynamax.c @@ -1470,3 +1470,19 @@ SINGLE_BATTLE_TEST("(DYNAMAX) Max Moves don't execute effects on fainted battler NOT MESSAGE("Foe Wobbuffet's Speed fell!"); } } + +SINGLE_BATTLE_TEST("(DYNAMAX) Moxie clones can be triggered by Max Moves fainting opponents") +{ + ASSUME(gMovesInfo[MOVE_WATERFALL].power > 0); + GIVEN { + PLAYER(SPECIES_GYARADOS) { Ability(ABILITY_MOXIE); } + OPPONENT(SPECIES_WOBBUFFET) { HP(1); } + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_WATERFALL, dynamax: TRUE); SEND_OUT(opponent, 1); } + } SCENE { + MESSAGE("Foe Wobbuffet fainted!"); + ABILITY_POPUP(player, ABILITY_MOXIE); + MESSAGE("Gyarados's Moxie raised its Attack!"); + } +}