From 2d1b2f28c4f5865edd5a2df5cabc039c8429099d Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Thu, 17 Apr 2025 19:46:16 +0200 Subject: [PATCH] Fixes Gulp Missile freezing the game if when attacker fainted --- src/battle_script_commands.c | 1 + src/battle_util.c | 1 + test/battle/ability/gulp_missile.c | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ee367133dd..dc71bc1a25 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -17993,6 +17993,7 @@ void BS_TryActivateGulpMissile(void) if (!(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT) && !gProtectStructs[gBattlerAttacker].confusionSelfDmg + && IsBattlerAlive(gBattlerAttacker) && IsBattlerTurnDamaged(gBattlerTarget) && gBattleMons[gBattlerTarget].species != SPECIES_CRAMORANT && GetBattlerAbility(gBattlerTarget) == ABILITY_GULP_MISSILE) diff --git a/src/battle_util.c b/src/battle_util.c index 1597674c17..7ae8a63205 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6092,6 +6092,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && IsBattlerTurnDamaged(gBattlerTarget) && IsBattlerAlive(battler) + && IsBattlerAlive(gBattlerAttacker) && gBattleMons[gBattlerTarget].species != SPECIES_CRAMORANT) { if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) diff --git a/test/battle/ability/gulp_missile.c b/test/battle/ability/gulp_missile.c index 72e826b252..76d66c4fb8 100644 --- a/test/battle/ability/gulp_missile.c +++ b/test/battle/ability/gulp_missile.c @@ -190,3 +190,13 @@ SINGLE_BATTLE_TEST("(Gulp Missile) Transformed Cramorant Gulping lowers defense HP_BAR(opponent); } } + +SINGLE_BATTLE_TEST("Gulp Missile triggered by explosion doesn't freeze the game") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_CRAMORANT); + } WHEN { + TURN { MOVE(opponent, MOVE_SURF); MOVE(player, MOVE_EXPLOSION); } + } +}