switchinabilities also runs ON_WEATHER and ON_TERRAIN (#7612)

Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
This commit is contained in:
ghoulslash 2025-08-25 05:40:52 -04:00 committed by GitHub
parent e3178d3ff6
commit 9b5b69ae49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 0 deletions

View File

@ -10639,6 +10639,13 @@ static void Cmd_various(void)
gBattlescriptCurrInstr = cmd->nextInstr;
AbilityBattleEffects(ABILITYEFFECT_NEUTRALIZINGGAS, battler, 0, 0, 0);
AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, battler, 0, 0, 0);
if (gBattleWeather & B_WEATHER_ANY && HasWeatherEffect())
AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, battler, 0, 0, 0);
if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, battler, 0, 0, 0);
AbilityBattleEffects(ABILITYEFFECT_OPPORTUNIST, battler, 0, 0, 0);
return;
}

View File

@ -95,3 +95,32 @@ DOUBLE_BATTLE_TEST("Mimicry can trigger multiple times in a turn")
}
}
DOUBLE_BATTLE_TEST("Mimicry triggers after Skill Swap")
{
GIVEN {
PLAYER(SPECIES_STUNFISK_GALAR) { Speed(40); Ability(ABILITY_MIMICRY); }
PLAYER(SPECIES_SHIFTRY) { Speed(50); Ability(ABILITY_CHLOROPHYLL); }
OPPONENT(SPECIES_SHUCKLE) { Speed(30); }
OPPONENT(SPECIES_CHANSEY) { Speed(20); }
} WHEN {
TURN { MOVE(playerRight, MOVE_GRASSY_TERRAIN); }
TURN { MOVE(playerRight, MOVE_SKILL_SWAP, target: playerLeft);
MOVE(playerLeft, MOVE_SPLASH);
}
} SCENE {
// turn 1
MESSAGE("Shiftry used Grassy Terrain!");
ABILITY_POPUP(playerLeft, ABILITY_MIMICRY);
MESSAGE("Stunfisk's type changed to Grass!");
// turn 2
MESSAGE("Shiftry used Skill Swap!");
ABILITY_POPUP(playerRight, ABILITY_MIMICRY);
MESSAGE("Shiftry's type changed to Grass!");
MESSAGE("Stunfisk used Splash!"); // make sure popup occurs before the subsequent move
} THEN {
EXPECT_EQ(playerLeft->types[0], TYPE_GRASS);
EXPECT_EQ(playerLeft->types[1], TYPE_GRASS);
EXPECT_EQ(playerRight->types[0], TYPE_GRASS);
EXPECT_EQ(playerRight->types[1], TYPE_GRASS);
}
}