Fixes Effects activating when move wasn't successful (#7803)

Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
Alex 2025-09-27 19:55:12 +02:00 committed by GitHub
parent b995857b44
commit 567a1290d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 2 deletions

View File

@ -5698,6 +5698,7 @@ static bool32 HandleMoveEndMoveBlock(u32 moveEffect)
case EFFECT_KNOCK_OFF:
if (gBattleStruct->battlerState[gBattlerTarget].itemCanBeKnockedOff
&& gBattleMons[gBattlerTarget].item != ITEM_NONE
&& IsBattlerTurnDamaged(gBattlerTarget)
&& IsBattlerAlive(gBattlerAttacker))
{
u32 side = GetBattlerSide(gBattlerTarget);
@ -5873,7 +5874,9 @@ static bool32 HandleMoveEndMoveBlock(u32 moveEffect)
}
break;
case EFFECT_STONE_AXE:
if (!IsHazardOnSide(GetBattlerSide(gBattlerTarget), HAZARDS_STEALTH_ROCK) && IsBattlerAlive(gBattlerAttacker))
if (!IsHazardOnSide(GetBattlerSide(gBattlerTarget), HAZARDS_STEALTH_ROCK)
&& IsBattlerTurnDamaged(gBattlerTarget)
&& IsBattlerAlive(gBattlerAttacker))
{
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_POINTEDSTONESFLOAT;
BattleScriptPushCursor();
@ -5882,7 +5885,9 @@ static bool32 HandleMoveEndMoveBlock(u32 moveEffect)
}
break;
case EFFECT_CEASELESS_EDGE:
if (gSideTimers[GetBattlerSide(gBattlerTarget)].spikesAmount < 3 && IsBattlerAlive(gBattlerAttacker))
if (gSideTimers[GetBattlerSide(gBattlerTarget)].spikesAmount < 3
&& IsBattlerTurnDamaged(gBattlerTarget)
&& IsBattlerAlive(gBattlerAttacker))
{
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SPIKESSCATTERED;
BattleScriptPush(gBattlescriptCurrInstr + 1);

View File

@ -7091,6 +7091,7 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler)
break;
case HOLD_EFFECT_THROAT_SPRAY: // Does NOT need to be a damaging move
if (IsSoundMove(gCurrentMove)
&& !(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
&& IsBattlerAlive(gBattlerAttacker)
&& IsAnyTargetAffected(gBattlerAttacker)
&& CompareStat(gBattlerAttacker, STAT_SPATK, MAX_STAT_STAGE, CMP_LESS_THAN)

View File

@ -88,3 +88,19 @@ SINGLE_BATTLE_TEST("Throat Spray does not activate if move fails")
}
}
}
SINGLE_BATTLE_TEST("Throat Spray does not activate if user flinches")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_THROAT_SPRAY); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_FAKE_OUT); MOVE(player, MOVE_HYPER_VOICE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FAKE_OUT, opponent);
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_HYPER_VOICE, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
}
}
}

View File

@ -78,3 +78,19 @@ SINGLE_BATTLE_TEST("Ceaseless Edge fails to set up hazards if user faints")
NOT MESSAGE("Spikes were scattered on the ground all around the opposing team!");
}
}
SINGLE_BATTLE_TEST("Ceaseless Edge does not set up hazards if target was not hit")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_PROTECT); MOVE(player, MOVE_CEASELESS_EDGE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PROTECT, opponent);
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_CEASELESS_EDGE, player);
MESSAGE("Spikes were scattered on the ground all around the opposing team!");
}
}
}