reworked weather form reversion + added more tests

This commit is contained in:
AgustinGDLV 2023-05-16 16:24:25 -07:00
parent a5f28afe42
commit 0c182345bf
9 changed files with 150 additions and 51 deletions

View File

@ -1346,7 +1346,7 @@
callnative BS_ItemRestorePP callnative BS_ItemRestorePP
.endm .endm
.macro trytorevertweatherform .macro tryrevertweatherform
callnative BS_TryRevertWeatherForm callnative BS_TryRevertWeatherForm
.endm .endm

View File

@ -1580,7 +1580,7 @@ BattleScript_MoveEffectCoreEnforcer::
printstring STRINGID_PKMNSABILITYSUPPRESSED printstring STRINGID_PKMNSABILITYSUPPRESSED
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
trytoclearprimalweather trytoclearprimalweather
trytorevertweatherform tryrevertweatherform
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
waitmessage 1 waitmessage 1
BattleScript_CoreEnforcerRet: BattleScript_CoreEnforcerRet:
@ -2729,7 +2729,7 @@ BattleScript_EffectSimpleBeam:
printstring STRINGID_PKMNACQUIREDSIMPLE printstring STRINGID_PKMNACQUIREDSIMPLE
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
trytoclearprimalweather trytoclearprimalweather
trytorevertweatherform tryrevertweatherform
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
waitmessage 1 waitmessage 1
tryendneutralizinggas BS_TARGET tryendneutralizinggas BS_TARGET
@ -2829,7 +2829,7 @@ BattleScript_EffectWorrySeed:
printstring STRINGID_PKMNACQUIREDABILITY printstring STRINGID_PKMNACQUIREDABILITY
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
trytoclearprimalweather trytoclearprimalweather
trytorevertweatherform tryrevertweatherform
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
waitmessage 1 waitmessage 1
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
@ -2961,7 +2961,7 @@ BattleScript_EffectGastroAcid:
printstring STRINGID_PKMNSABILITYSUPPRESSED printstring STRINGID_PKMNSABILITYSUPPRESSED
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
trytoclearprimalweather trytoclearprimalweather
trytorevertweatherform tryrevertweatherform
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
waitmessage 1 waitmessage 1
tryendneutralizinggas BS_TARGET tryendneutralizinggas BS_TARGET
@ -8003,9 +8003,7 @@ BattleScript_CudChewActivates::
setbyte sBERRY_OVERRIDE, 0 setbyte sBERRY_OVERRIDE, 0
end3 end3
BattleScript_TargetFormChange:: BattleScript_TargetFormChangeNoPopup:
pause 5
call BattleScript_AbilityPopUpTarget
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
waitmessage 1 waitmessage 1
handleformchange BS_TARGET, 0 handleformchange BS_TARGET, 0
@ -8015,32 +8013,25 @@ BattleScript_TargetFormChange::
handleformchange BS_TARGET, 2 handleformchange BS_TARGET, 2
return return
BattleScript_TargetFormChange::
pause 5
call BattleScript_AbilityPopUpTarget
call BattleScript_TargetFormChangeNoPopup
return
BattleScript_TargetFormChangeWithString:: BattleScript_TargetFormChangeWithString::
pause 5 pause 5
call BattleScript_AbilityPopUpTarget call BattleScript_AbilityPopUpTarget
printstring STRINGID_EMPTYSTRING3 call BattleScript_TargetFormChangeNoPopup
waitmessage 1
handleformchange BS_TARGET, 0
handleformchange BS_TARGET, 1
playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL
waitanimation
handleformchange BS_TARGET, 2
printstring STRINGID_PKMNTRANSFORMED printstring STRINGID_PKMNTRANSFORMED
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
return return
BattleScript_TargetFormChangeWithStringNoPopupEnd3:: BattleScript_TargetFormChangeWithStringNoPopup::
pause 5 call BattleScript_TargetFormChangeNoPopup
printstring STRINGID_EMPTYSTRING3
waitmessage 1
handleformchange BS_TARGET, 0
handleformchange BS_TARGET, 1
playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL
waitanimation
handleformchange BS_TARGET, 2
printstring STRINGID_PKMNTRANSFORMED printstring STRINGID_PKMNTRANSFORMED
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
end3 return
BattleScript_BattlerFormChangeWithStringEnd3:: BattleScript_BattlerFormChangeWithStringEnd3::
pause 5 pause 5

View File

@ -465,7 +465,7 @@ extern const u8 BattleScript_MoveEffectStockpileWoreOff[];
extern const u8 BattleScript_StealthRockActivates[]; extern const u8 BattleScript_StealthRockActivates[];
extern const u8 BattleScript_SpikesActivates[]; extern const u8 BattleScript_SpikesActivates[];
extern const u8 BattleScript_BerserkGeneRet[]; extern const u8 BattleScript_BerserkGeneRet[];
extern const u8 BattleScript_TargetFormChangeWithStringNoPopupEnd3[]; extern const u8 BattleScript_TargetFormChangeWithStringNoPopup[];
// zmoves // zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[]; extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -89,6 +89,7 @@
// Form change that activates when a specific weather is set during battle. // Form change that activates when a specific weather is set during battle.
// param1: weather to check // param1: weather to check
// param2: (optional) revert if specified ability is lost
#define FORM_CHANGE_BATTLE_WEATHER 14 #define FORM_CHANGE_BATTLE_WEATHER 14
// Form change that activates automatically when the turn ends. // Form change that activates automatically when the turn ends.

View File

@ -16567,13 +16567,12 @@ void BS_ItemRestorePP(void)
void BS_TryRevertWeatherForm(void) void BS_TryRevertWeatherForm(void)
{ {
NATIVE_ARGS(); NATIVE_ARGS();
u16 ability = gBattleMons[gBattlerTarget].ability;
if (B_WEATHER_FORM_SUPPRESS >= GEN_5 if (B_WEATHER_FORM_SUPPRESS >= GEN_5
&& (ability == ABILITY_FORECAST || ability == ABILITY_FLOWER_GIFT) && TryBattleFormChange(gBattlerTarget, FORM_CHANGE_BATTLE_WEATHER))
&& TryBattleFormChange(gBattlerTarget, FORM_CHANGE_BATTLE_SWITCH)) // revert form
{ {
gBattleScripting.battler = gBattlerTarget; gBattleScripting.battler = gBattlerTarget;
BattleScriptPushCursorAndCallback(BattleScript_TargetFormChangeWithStringNoPopupEnd3); BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = BattleScript_TargetFormChangeWithStringNoPopup;
return; return;
} }
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;

View File

@ -6013,8 +6013,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
#else #else
TRY_WEATHER_FORM: TRY_WEATHER_FORM:
#endif #endif
if ((IsBattlerWeatherAffected(battler, gBattleWeather) || gBattleWeather == B_WEATHER_NONE) if ((IsBattlerWeatherAffected(battler, gBattleWeather)
&& TryBattleFormChange(battler, FORM_CHANGE_BATTLE_WEATHER)) || gBattleWeather == B_WEATHER_NONE
|| !WEATHER_HAS_EFFECT) // Air Lock active
&& TryBattleFormChange(battler, FORM_CHANGE_BATTLE_WEATHER))
{ {
BattleScriptPushCursorAndCallback(BattleScript_BattlerFormChangeWithStringEnd3); BattleScriptPushCursorAndCallback(BattleScript_BattlerFormChangeWithStringEnd3);
effect++; effect++;
@ -10101,9 +10103,26 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method)
} }
break; break;
case FORM_CHANGE_BATTLE_WEATHER: case FORM_CHANGE_BATTLE_WEATHER:
if (gBattleWeather & formChanges[i].param1 // Check if there is a required ability and if the battler's ability does not match it
|| (gBattleWeather == B_WEATHER_NONE && formChanges[i].param1 == B_WEATHER_NONE)) // or is suppressed. If so, revert to the no weather form.
if (formChanges[i].param2
&& (gBattleMons[battlerId].ability != formChanges[i].param2
|| (gStatuses3[gBattlerTarget] & STATUS3_GASTRO_ACID))
&& formChanges[i].param1 == B_WEATHER_NONE)
{
targetSpecies = formChanges[i].targetSpecies; targetSpecies = formChanges[i].targetSpecies;
}
// We need to revert the weather form if the field is under Air Lock, too.
if (!WEATHER_HAS_EFFECT && formChanges[i].param1 == B_WEATHER_NONE)
{
targetSpecies = formChanges[i].targetSpecies;
}
// Otherwise, just check for a match between the weather and the form change table.
else if (gBattleWeather & formChanges[i].param1
|| (gBattleWeather == B_WEATHER_NONE && formChanges[i].param1 == B_WEATHER_NONE))
{
targetSpecies = formChanges[i].targetSpecies;
}
break; break;
case FORM_CHANGE_BATTLE_TURN_END: case FORM_CHANGE_BATTLE_TURN_END:
if (formChanges[i].param1 == GetBattlerAbility(battlerId)) if (formChanges[i].param1 == GetBattlerAbility(battlerId))

View File

@ -156,11 +156,11 @@ static const struct FormChange sAbsolFormChangeTable[] = {
}; };
static const struct FormChange sCastformFormChangeTable[] = { static const struct FormChange sCastformFormChangeTable[] = {
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SUNNY, B_WEATHER_SUN}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SUNNY, B_WEATHER_SUN, ABILITY_FORECAST},
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_RAINY, B_WEATHER_RAIN}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_RAINY, B_WEATHER_RAIN, ABILITY_FORECAST},
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SNOWY, B_WEATHER_HAIL}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SNOWY, B_WEATHER_HAIL, ABILITY_FORECAST},
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, ~(B_WEATHER_SUN | B_WEATHER_RAIN | B_WEATHER_HAIL)}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, ~(B_WEATHER_SUN | B_WEATHER_RAIN | B_WEATHER_HAIL), ABILITY_FORECAST},
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, B_WEATHER_NONE}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, B_WEATHER_NONE, ABILITY_FORECAST},
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_CASTFORM}, {FORM_CHANGE_BATTLE_SWITCH, SPECIES_CASTFORM},
{FORM_CHANGE_FAINT, SPECIES_CASTFORM}, {FORM_CHANGE_FAINT, SPECIES_CASTFORM},
{FORM_CHANGE_END_BATTLE, SPECIES_CASTFORM}, {FORM_CHANGE_END_BATTLE, SPECIES_CASTFORM},
@ -231,9 +231,9 @@ static const struct FormChange sBurmyFormChangeTable[] = {
}; };
static const struct FormChange sCherrimFormChangeTable[] = { static const struct FormChange sCherrimFormChangeTable[] = {
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM_SUNSHINE, B_WEATHER_SUN}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM_SUNSHINE, B_WEATHER_SUN, ABILITY_FLOWER_GIFT},
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM, ~B_WEATHER_SUN}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM, ~B_WEATHER_SUN, ABILITY_FLOWER_GIFT},
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM, B_WEATHER_NONE}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM, B_WEATHER_NONE, ABILITY_FLOWER_GIFT},
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_CHERRIM}, {FORM_CHANGE_BATTLE_SWITCH, SPECIES_CHERRIM},
{FORM_CHANGE_FAINT, SPECIES_CHERRIM}, {FORM_CHANGE_FAINT, SPECIES_CHERRIM},
{FORM_CHANGE_END_BATTLE, SPECIES_CHERRIM}, {FORM_CHANGE_END_BATTLE, SPECIES_CHERRIM},

View File

@ -54,7 +54,7 @@ SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim back to normal when its abili
} }
} }
DOUBLE_BATTLE_TEST("Flower Gift increases the attack of Cherrim's ally by 1.5x", s16 damage) DOUBLE_BATTLE_TEST("Flower Gift increases the attack of Cherrim and its allies by 1.5x", s16 damageL, s16 damageR)
{ {
bool32 sunny; bool32 sunny;
PARAMETRIZE { sunny = FALSE; } PARAMETRIZE { sunny = FALSE; }
@ -67,19 +67,55 @@ DOUBLE_BATTLE_TEST("Flower Gift increases the attack of Cherrim's ally by 1.5x",
} WHEN { } WHEN {
if (sunny) if (sunny)
TURN { MOVE(playerLeft, MOVE_SUNNY_DAY); } TURN { MOVE(playerLeft, MOVE_SUNNY_DAY); }
TURN { MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); } TURN { MOVE(playerLeft, MOVE_TACKLE, target: opponentLeft);
MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); }
} SCENE { } SCENE {
// Sun activates // sun activates
if (sunny) { if (sunny) {
ABILITY_POPUP(playerLeft, ABILITY_FLOWER_GIFT); ABILITY_POPUP(playerLeft, ABILITY_FLOWER_GIFT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, playerLeft); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, playerLeft);
MESSAGE("Cherrim transformed!"); MESSAGE("Cherrim transformed!");
} }
// Partner uses Tackle // player uses Tackle
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerLeft);
HP_BAR(opponentLeft, captureDamage: &results[i].damageL);
// partner uses Tackle
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight);
HP_BAR(opponentLeft, captureDamage: &results[i].damage); HP_BAR(opponentLeft, captureDamage: &results[i].damageR);
} FINALLY { } FINALLY {
EXPECT_MUL_EQ(results[0].damage, UQ_4_12(1.5), results[1].damage); EXPECT_MUL_EQ(results[0].damageL, UQ_4_12(1.5), results[1].damageL);
EXPECT_MUL_EQ(results[0].damageR, UQ_4_12(1.5), results[1].damageR);
}
}
DOUBLE_BATTLE_TEST("Flower Gift increases the Sp. Def of Cherrim and its allies by 1.5x", s16 damageL, s16 damageR)
{
bool32 sunny;
PARAMETRIZE { sunny = FALSE; }
PARAMETRIZE { sunny = TRUE; }
GIVEN {
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); };
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
if (sunny)
TURN { MOVE(playerLeft, MOVE_SUNNY_DAY); }
TURN { MOVE(opponentLeft, MOVE_HYPER_VOICE, target: playerLeft); }
} SCENE {
// sun activates
if (sunny) {
ABILITY_POPUP(playerLeft, ABILITY_FLOWER_GIFT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, playerLeft);
MESSAGE("Cherrim transformed!");
}
// opponentLeft uses Hyper Voice
ANIMATION(ANIM_TYPE_MOVE, MOVE_HYPER_VOICE, opponentLeft);
HP_BAR(playerLeft, captureDamage: &results[i].damageL);
HP_BAR(playerRight, captureDamage: &results[i].damageR);
} FINALLY {
EXPECT_MUL_EQ(results[1].damageL, UQ_4_12(1.5), results[0].damageL);
EXPECT_MUL_EQ(results[1].damageR, UQ_4_12(1.5), results[0].damageR);
} }
} }

View File

@ -7,6 +7,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from an opponent's m
PARAMETRIZE { move = MOVE_SUNNY_DAY; } PARAMETRIZE { move = MOVE_SUNNY_DAY; }
PARAMETRIZE { move = MOVE_RAIN_DANCE; } PARAMETRIZE { move = MOVE_RAIN_DANCE; }
PARAMETRIZE { move = MOVE_HAIL; } PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN { GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }; PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
@ -25,6 +26,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from its own move")
PARAMETRIZE { move = MOVE_SUNNY_DAY; } PARAMETRIZE { move = MOVE_SUNNY_DAY; }
PARAMETRIZE { move = MOVE_RAIN_DANCE; } PARAMETRIZE { move = MOVE_RAIN_DANCE; }
PARAMETRIZE { move = MOVE_HAIL; } PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN { GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }; PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
@ -43,6 +45,7 @@ DOUBLE_BATTLE_TEST("Forecast transforms Castform in weather from a partner's mov
PARAMETRIZE { move = MOVE_SUNNY_DAY; } PARAMETRIZE { move = MOVE_SUNNY_DAY; }
PARAMETRIZE { move = MOVE_RAIN_DANCE; } PARAMETRIZE { move = MOVE_RAIN_DANCE; }
PARAMETRIZE { move = MOVE_HAIL; } PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN { GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }; PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
@ -63,6 +66,7 @@ DOUBLE_BATTLE_TEST("Forecast transforms all Castforms present in weather")
PARAMETRIZE { move = MOVE_SUNNY_DAY; } PARAMETRIZE { move = MOVE_SUNNY_DAY; }
PARAMETRIZE { move = MOVE_RAIN_DANCE; } PARAMETRIZE { move = MOVE_RAIN_DANCE; }
PARAMETRIZE { move = MOVE_HAIL; } PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN { GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }; PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }; PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
@ -88,10 +92,14 @@ DOUBLE_BATTLE_TEST("Forecast transforms all Castforms present in weather")
SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from an ability") SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from an ability")
{ {
u32 species, ability;
PARAMETRIZE { species = SPECIES_KYOGRE; ability = ABILITY_DRIZZLE; }
PARAMETRIZE { species = SPECIES_GROUDON; ability = ABILITY_DROUGHT; }
PARAMETRIZE { species = SPECIES_ABOMASNOW; ability = ABILITY_SNOW_WARNING; }
GIVEN { GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }; PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_KYOGRE) { Ability(ABILITY_DRIZZLE); }; OPPONENT(species) { Ability(ability); };
} WHEN { } WHEN {
TURN { SWITCH(opponent, 1); } TURN { SWITCH(opponent, 1); }
} SCENE { } SCENE {
@ -103,14 +111,17 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from an ability")
SINGLE_BATTLE_TEST("Forecast transforms Castform in primal weather") SINGLE_BATTLE_TEST("Forecast transforms Castform in primal weather")
{ {
u32 species, item, ability;
PARAMETRIZE { species = SPECIES_KYOGRE; ability = ABILITY_PRIMORDIAL_SEA; item = ITEM_BLUE_ORB; }
PARAMETRIZE { species = SPECIES_GROUDON; ability = ABILITY_DESOLATE_LAND; item = ITEM_RED_ORB; }
GIVEN { GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }; PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_KYOGRE) { Ability(ABILITY_DRIZZLE); Item(ITEM_BLUE_ORB); }; OPPONENT(species) { Item(item); };
} WHEN { } WHEN {
TURN { SWITCH(opponent, 1); } TURN { SWITCH(opponent, 1); }
} SCENE { } SCENE {
ABILITY_POPUP(opponent, ABILITY_PRIMORDIAL_SEA); ABILITY_POPUP(opponent, ability);
ABILITY_POPUP(player, ABILITY_FORECAST); ABILITY_POPUP(player, ABILITY_FORECAST);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Castform transformed!"); MESSAGE("Castform transformed!");
@ -161,6 +172,29 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when Sandstorm i
} }
} }
SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal under Air Lock")
{
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_RAYQUAZA);
} WHEN {
TURN { MOVE(player, MOVE_RAIN_DANCE); }
TURN { SWITCH(opponent, 1); }
TURN { MOVE(opponent, MOVE_CELEBRATE, megaEvolve: TRUE); }
} SCENE {
// transforms
ABILITY_POPUP(player, ABILITY_FORECAST);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Castform transformed!");
// back to normal
ABILITY_POPUP(opponent, ABILITY_AIR_LOCK);
ABILITY_POPUP(player, ABILITY_FORECAST);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Castform transformed!");
}
}
SINGLE_BATTLE_TEST("Forecast transforms Castform on switch-in") SINGLE_BATTLE_TEST("Forecast transforms Castform on switch-in")
{ {
GIVEN { GIVEN {
@ -199,3 +233,22 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform when weather changes")
MESSAGE("Castform transformed!"); MESSAGE("Castform transformed!");
} }
} }
SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when its ability is suppressed")
{
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); }
TURN { MOVE(opponent, MOVE_GASTRO_ACID); }
} SCENE {
// transforms in sun
ABILITY_POPUP(player, ABILITY_FORECAST);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Castform transformed!");
// back to normal
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Castform transformed!");
}
}