Fix toxic debris setting hazards on the wrong side when hit by an ally (#8026)

This commit is contained in:
FosterProgramming 2025-10-24 11:50:19 +02:00 committed by GitHub
parent 5b4403ddfe
commit 8c87522415
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 4 deletions

View File

@ -6048,9 +6048,8 @@ BattleScript_ToxicDebrisActivates::
printstring STRINGID_POISONSPIKESSCATTERED
waitmessage B_WAIT_TIME_LONG
BattleScript_ToxicDebrisRet:
copybyte sBATTLER, gBattlerTarget
copybyte gBattlerTarget, gBattlerAttacker
copybyte gBattlerAttacker, sBATTLER
restoretarget
restoreattacker
return
BattleScript_EarthEaterActivates::

View File

@ -4959,7 +4959,10 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
&& IsBattlerTurnDamaged(gBattlerTarget)
&& (gSideTimers[GetBattlerSide(gBattlerAttacker)].toxicSpikesAmount != 2))
{
SWAP(gBattlerAttacker, gBattlerTarget, i);
SaveBattlerTarget(gBattlerTarget);
SaveBattlerAttacker(gBattlerAttacker);
gBattlerAttacker = gBattlerTarget;
gBattlerTarget = BATTLE_OPPOSITE(gBattlerAttacker);
BattleScriptCall(BattleScript_ToxicDebrisActivates);
effect++;
}

View File

@ -120,3 +120,23 @@ SINGLE_BATTLE_TEST("Air Balloon is popped after Toxic Debris activates")
MESSAGE("Glimmora's Air Balloon popped!");
}
}
DOUBLE_BATTLE_TEST("Toxic Debris sets Toxic Spikes on the opposing side even when hit by an ally")
{
struct BattlePokemon *user = NULL;
PARAMETRIZE{ user = opponentLeft; }
PARAMETRIZE{ user = opponentRight; }
PARAMETRIZE{ user = playerRight; }
GIVEN {
PLAYER(SPECIES_GLIMMORA) { Ability(ABILITY_TOXIC_DEBRIS); }
PLAYER(SPECIES_WYNAUT) { }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT) { }
} WHEN {
TURN { MOVE(user, MOVE_SCRATCH, target: playerLeft); }
} SCENE {
ABILITY_POPUP(playerLeft, ABILITY_TOXIC_DEBRIS);
MESSAGE("Poison spikes were scattered on the ground all around the opposing team!");
}
}