From 629a5969fe263f2e4605df54a9ba2dfae11530e9 Mon Sep 17 00:00:00 2001 From: TheJamesLJ Date: Mon, 13 May 2024 00:11:03 +0100 Subject: [PATCH 1/4] Fixed Shaymin form change with incorrect status condition --- src/data/pokemon/form_change_tables.h | 2 +- src/pokemon.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index 8eb96e04b067..0b8eb485a9d4 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -627,7 +627,7 @@ static const struct FormChange sShayminFormChangeTable[] = { {FORM_CHANGE_ITEM_USE, SPECIES_SHAYMIN_SKY, ITEM_GRACIDEA, DAY}, {FORM_CHANGE_WITHDRAW, SPECIES_SHAYMIN_LAND}, {FORM_CHANGE_TIME_OF_DAY, SPECIES_SHAYMIN_LAND, NIGHT}, - {FORM_CHANGE_STATUS, SPECIES_SHAYMIN_LAND, (STATUS1_FREEZE | STATUS1_FROSTBITE)}, + {FORM_CHANGE_STATUS, SPECIES_SHAYMIN_LAND, STATUS1_FREEZE | STATUS1_FROSTBITE}, {FORM_CHANGE_TERMINATOR}, }; #endif //P_FAMILY_SHAYMIN diff --git a/src/pokemon.c b/src/pokemon.c index e7db64cd9a37..c271fec73bd1 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6230,9 +6230,12 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 break; case FORM_CHANGE_WITHDRAW: case FORM_CHANGE_FAINT: - case FORM_CHANGE_STATUS: targetSpecies = formChanges[i].targetSpecies; break; + case FORM_CHANGE_STATUS: + if(GetBoxMonData(boxMon, MON_DATA_STATUS, NULL) & formChanges[i].param1) + targetSpecies = formChanges[i].targetSpecies; + break; case FORM_CHANGE_TIME_OF_DAY: switch (formChanges[i].param1) { From c929704e83c9af7f5a26ab81c0814c0c522c030e Mon Sep 17 00:00:00 2001 From: TheJamesLJ Date: Mon, 13 May 2024 00:12:25 +0100 Subject: [PATCH 2/4] Fixed Shaymin receiving damage again after changing form --- data/battle_scripts_1.s | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5fa5bf342d81..15c0d109a04f 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6993,6 +6993,13 @@ BattleScript_CudChewActivates:: setbyte sBERRY_OVERRIDE, 0 end3 +BattleScript_ApplyDisguiseFormChangeHPLoss:: +.if B_DISGUISE_HP_LOSS >= GEN_8 + healthbarupdate BS_SCRIPTING + datahpupdate BS_SCRIPTING +.endif + return + BattleScript_TargetFormChangeNoPopup: flushtextbox handleformchange BS_SCRIPTING, 0 @@ -7000,10 +7007,7 @@ BattleScript_TargetFormChangeNoPopup: playanimation BS_TARGET, B_ANIM_FORM_CHANGE waitanimation handleformchange BS_SCRIPTING, 2 -.if B_DISGUISE_HP_LOSS >= GEN_8 - healthbarupdate BS_SCRIPTING - datahpupdate BS_SCRIPTING -.endif + jumpifability BS_TARGET ABILITY_DISGUISE BattleScript_ApplyDisguiseFormChangeHPLoss return BattleScript_TargetFormChange:: From 1f73be19ac35c423a816c39b8023a0eb1dd778d7 Mon Sep 17 00:00:00 2001 From: TheJamesLJ Date: Mon, 13 May 2024 12:35:28 +0100 Subject: [PATCH 3/4] PR feedback updates - fixed missing commas in battle script --- data/battle_scripts_1.s | 2 +- src/pokemon.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 15c0d109a04f..abf8287ea1be 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7007,7 +7007,7 @@ BattleScript_TargetFormChangeNoPopup: playanimation BS_TARGET, B_ANIM_FORM_CHANGE waitanimation handleformchange BS_SCRIPTING, 2 - jumpifability BS_TARGET ABILITY_DISGUISE BattleScript_ApplyDisguiseFormChangeHPLoss + jumpifability BS_TARGET, ABILITY_DISGUISE, BattleScript_ApplyDisguiseFormChangeHPLoss return BattleScript_TargetFormChange:: diff --git a/src/pokemon.c b/src/pokemon.c index c271fec73bd1..dd7093989a21 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6233,7 +6233,7 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 targetSpecies = formChanges[i].targetSpecies; break; case FORM_CHANGE_STATUS: - if(GetBoxMonData(boxMon, MON_DATA_STATUS, NULL) & formChanges[i].param1) + if (GetBoxMonData(boxMon, MON_DATA_STATUS, NULL) & formChanges[i].param1) targetSpecies = formChanges[i].targetSpecies; break; case FORM_CHANGE_TIME_OF_DAY: From 2946053d05d0dc6df30f97fda5b55fdd5be8fa2f Mon Sep 17 00:00:00 2001 From: TheJamesLJ Date: Mon, 13 May 2024 17:19:36 +0100 Subject: [PATCH 4/4] Added Shaymin form change test by @AlexOn1ine --- test/battle/form_change/status.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/test/battle/form_change/status.c b/test/battle/form_change/status.c index b264ba3dd57e..f0d5a9f3f026 100644 --- a/test/battle/form_change/status.c +++ b/test/battle/form_change/status.c @@ -3,13 +3,38 @@ SINGLE_BATTLE_TEST("Shaymin-Sky reverts to Shaymin-Land when frozen or frostbitten") { + u32 move; + + PARAMETRIZE { move = MOVE_POWDER_SNOW; } + PARAMETRIZE { move = MOVE_EMBER; } + PARAMETRIZE { move = MOVE_THUNDERSHOCK; } + PARAMETRIZE { move = MOVE_POISON_STING; } + PARAMETRIZE { move = MOVE_POISON_FANG; } + ASSUME(MoveHasAdditionalEffect(MOVE_POWDER_SNOW, MOVE_EFFECT_FREEZE_OR_FROSTBITE)); + ASSUME(MoveHasAdditionalEffect(MOVE_EMBER, MOVE_EFFECT_BURN)); + ASSUME(MoveHasAdditionalEffect(MOVE_THUNDERSHOCK, MOVE_EFFECT_PARALYSIS)); + ASSUME(MoveHasAdditionalEffect(MOVE_POISON_STING, MOVE_EFFECT_POISON)); + ASSUME(MoveHasAdditionalEffect(MOVE_POISON_FANG, MOVE_EFFECT_TOXIC)); GIVEN { PLAYER(SPECIES_SHAYMIN_SKY); OPPONENT(SPECIES_WOBBUFFET); } WHEN { - TURN { MOVE(opponent, MOVE_POWDER_SNOW); } + TURN { MOVE(opponent, move); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, move, opponent); + if (move == MOVE_POWDER_SNOW) { + STATUS_ICON(player, freeze: TRUE); + NOT HP_BAR(player); // Regression caused by Mimikyu form change + MESSAGE("Shaymin transformed!"); + } else { + NOT MESSAGE("Shaymin transformed!"); + } } THEN { - EXPECT_EQ(player->species, SPECIES_SHAYMIN_LAND); + if (move == MOVE_POWDER_SNOW) + EXPECT_EQ(player->species, SPECIES_SHAYMIN_LAND); + else + EXPECT_EQ(player->species, SPECIES_SHAYMIN_SKY); + } }