Fix Mimicry Only Activating Once per Turn (#7537)

Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
This commit is contained in:
ghoulslash 2025-08-12 09:40:10 -04:00 committed by GitHub
parent cc736c4233
commit 18363207d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 0 deletions

View File

@ -1737,6 +1737,10 @@
callnative BS_ActivateTerrainChangeAbilities
.byte \battler
.endm
.macro resetterrainabilityflags
callnative BS_ResetTerrainAbilityFlags
.endm
@ Stores Healing Wish effect.
.macro storehealingwish battler:req

View File

@ -7889,6 +7889,7 @@ BattleScript_SnowWarningActivatesSnow::
BattleScript_ActivateTerrainEffects:
saveattacker
savetarget
resetterrainabilityflags
setbyte gBattlerAttacker, 0
BattleScript_ActivateTerrainSeed:
copyarraywithindex gBattlerTarget, gBattlerByTurnOrder, gBattlerAttacker, 1

View File

@ -18175,6 +18175,16 @@ void BS_ActivateTerrainChangeAbilities(void)
AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, battler, 0, 0, 0);
}
void BS_ResetTerrainAbilityFlags(void)
{
NATIVE_ARGS();
// reset terrain ability checks
for (u32 i = 0; i < gBattlersCount; i++)
gDisableStructs[i].terrainAbilityDone = 0;
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_StoreHealingWish(void)
{
NATIVE_ARGS(u8 battler);

View File

@ -70,3 +70,28 @@ SINGLE_BATTLE_TEST("Mimicry restores the battler's types when terrain is removed
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].types[1], TYPE_STEEL);
}
}
DOUBLE_BATTLE_TEST("Mimicry can trigger multiple times in a turn")
{
GIVEN {
PLAYER(SPECIES_STUNFISK_GALAR) { Speed(50); Ability(ABILITY_MIMICRY); }
PLAYER(SPECIES_MORELULL) { Speed(40); }
OPPONENT(SPECIES_IGGLYBUFF) { Speed(60); }
OPPONENT(SPECIES_BAGON) { Speed(70); }
} WHEN {
TURN { MOVE(opponentRight, MOVE_ELECTRIC_TERRAIN); MOVE(opponentLeft, MOVE_MISTY_TERRAIN); }
} SCENE {
MESSAGE("The opposing Bagon used Electric Terrain!");
ABILITY_POPUP(playerLeft, ABILITY_MIMICRY);
MESSAGE("Stunfisk's type changed to Electric!");
// igglybuff
MESSAGE("The opposing Igglybuff used Misty Terrain!");
ABILITY_POPUP(playerLeft, ABILITY_MIMICRY);
MESSAGE("Stunfisk's type changed to Fairy!");
} THEN {
EXPECT_EQ(gBattleMons[0].types[0], TYPE_FAIRY);
EXPECT_EQ(gBattleMons[0].types[1], TYPE_FAIRY);
EXPECT_EQ(gBattleMons[0].types[2], TYPE_MYSTERY);
}
}