Fixes form change when using switch moves (#3463)

* Fixes form change with switch moves
This commit is contained in:
Alex 2023-10-25 09:33:43 +02:00 committed by GitHub
parent 5fe564f014
commit 591ef71e3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 1 deletions

View File

@ -7045,6 +7045,7 @@ static void Cmd_returntoball(void)
u32 battler = GetBattlerForBattleScript(cmd->battler); u32 battler = GetBattlerForBattleScript(cmd->battler);
BtlController_EmitReturnMonToBall(battler, BUFFER_A, TRUE); BtlController_EmitReturnMonToBall(battler, BUFFER_A, TRUE);
MarkBattlerForControllerExec(battler); MarkBattlerForControllerExec(battler);
TryBattleFormChange(battler, FORM_CHANGE_BATTLE_SWITCH);
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
} }

View File

@ -126,4 +126,46 @@ DOUBLE_BATTLE_TEST("Flower Gift increases the Sp. Def of Cherrim and its allies
} }
} }
SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim back when it switches out")
{
GIVEN {
ASSUME(B_WEATHER_FORMS >= GEN_5);
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); }
TURN { SWITCH(player, 1); }
} SCENE {
// transforms in sun
ABILITY_POPUP(player, ABILITY_FLOWER_GIFT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Cherrim transformed!");
MESSAGE("Cherrim, that's enough! Come back!");
} THEN {
EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_CHERRIM);
}
}
SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim back when it uses a move that forces it to switch out")
{
GIVEN {
ASSUME(B_WEATHER_FORMS >= GEN_5);
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); }
TURN { MOVE(player, MOVE_U_TURN); SEND_OUT(player, 1); }
} SCENE {
// transforms in sun
ABILITY_POPUP(player, ABILITY_FLOWER_GIFT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Cherrim transformed!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_U_TURN, player);
} THEN {
EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_CHERRIM);
}
}
TO_DO_BATTLE_TEST("Flower Gift does not transform Cherrim back to normal when suppressed if Cherrim is Dynamaxed"); TO_DO_BATTLE_TEST("Flower Gift does not transform Cherrim back to normal when suppressed if Cherrim is Dynamaxed");

View File

@ -353,3 +353,45 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when its ability
EXPECT_EQ(player->species, SPECIES_CASTFORM); EXPECT_EQ(player->species, SPECIES_CASTFORM);
} }
} }
SINGLE_BATTLE_TEST("Forecast transforms Castform back when it switches out")
{
GIVEN {
ASSUME(B_WEATHER_FORMS >= GEN_5);
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); }
TURN { SWITCH(player, 1); }
} SCENE {
// transforms in sun
ABILITY_POPUP(player, ABILITY_FORECAST);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Castform transformed!");
MESSAGE("Castform, that's enough! Come back!");
} THEN {
EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_CASTFORM);
}
}
SINGLE_BATTLE_TEST("Forecast transforms Castform back when it uses a move that forces it to switch out")
{
GIVEN {
ASSUME(B_WEATHER_FORMS >= GEN_5);
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); }
TURN { MOVE(player, MOVE_U_TURN); SEND_OUT(player, 1); }
} SCENE {
// transforms in sun
ABILITY_POPUP(player, ABILITY_FORECAST);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Castform transformed!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_U_TURN, player);
} THEN {
EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_CASTFORM);
}
}