From 0f4b59898419b4ae2167ab7a14fb7c2e92daded3 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Thu, 28 Nov 2024 23:21:42 +0100 Subject: [PATCH] Fixes Aegislash not reverting back (#5734) --- include/constants/form_change_types.h | 4 ++++ src/battle_script_commands.c | 5 ++--- src/battle_util.c | 4 ++++ src/data/pokemon/form_change_tables.h | 8 +++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/constants/form_change_types.h b/include/constants/form_change_types.h index 74bc16cf2f..79a8a4cee7 100644 --- a/include/constants/form_change_types.h +++ b/include/constants/form_change_types.h @@ -134,4 +134,8 @@ // param1: amount of days #define FORM_CHANGE_DAYS_PASSED 23 +// Form change for Aegislash +#define FORM_CHANGE_BATTLE_ATTACK 24 +#define FORM_CHANGE_BATTLE_KINGS_SHIELD 25 + #endif // GUARD_CONSTANTS_FORM_CHANGE_TYPES_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7a9409d4d4..f8619880d0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1127,7 +1127,6 @@ static bool32 NoTargetPresent(u8 battler, u32 move) return FALSE; } -// TODO: Convert this to a proper FORM_CHANGE type. static bool32 TryAegiFormChange(void) { // Only Aegislash with Stance Change can transform, transformed mons cannot. @@ -1142,12 +1141,12 @@ static bool32 TryAegiFormChange(void) case SPECIES_AEGISLASH_SHIELD: // Shield -> Blade if (IS_MOVE_STATUS(gCurrentMove)) return FALSE; - gBattleMons[gBattlerAttacker].species = SPECIES_AEGISLASH_BLADE; + TryBattleFormChange(gBattlerAttacker, FORM_CHANGE_BATTLE_ATTACK); break; case SPECIES_AEGISLASH_BLADE: // Blade -> Shield if (gCurrentMove != MOVE_KINGS_SHIELD) return FALSE; - gBattleMons[gBattlerAttacker].species = SPECIES_AEGISLASH_SHIELD; + TryBattleFormChange(gBattlerAttacker, FORM_CHANGE_BATTLE_KINGS_SHIELD); break; } diff --git a/src/battle_util.c b/src/battle_util.c index dc98c278e3..7e0970bcab 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -10848,6 +10848,10 @@ u16 GetBattleFormChangeTargetSpecies(u32 battler, u16 method) if (GetBattlerTeraType(battler) == formChanges[i].param1) targetSpecies = formChanges[i].targetSpecies; break; + case FORM_CHANGE_BATTLE_ATTACK: + case FORM_CHANGE_BATTLE_KINGS_SHIELD: + targetSpecies = formChanges[i].targetSpecies; + break; } } } diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index 52f888a55b..153dde2546 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -789,9 +789,11 @@ static const struct FormChange sFurfrouFormChangeTable[] = { #if P_FAMILY_HONEDGE static const struct FormChange sAegislashFormChangeTable[] = { - {FORM_CHANGE_BATTLE_SWITCH, SPECIES_AEGISLASH_SHIELD}, - {FORM_CHANGE_FAINT, SPECIES_AEGISLASH_SHIELD}, - {FORM_CHANGE_END_BATTLE, SPECIES_AEGISLASH_SHIELD}, + {FORM_CHANGE_BATTLE_ATTACK, SPECIES_AEGISLASH_BLADE}, + {FORM_CHANGE_BATTLE_KINGS_SHIELD, SPECIES_AEGISLASH_SHIELD}, + {FORM_CHANGE_BATTLE_SWITCH, SPECIES_AEGISLASH_SHIELD}, + {FORM_CHANGE_FAINT, SPECIES_AEGISLASH_SHIELD}, + {FORM_CHANGE_END_BATTLE, SPECIES_AEGISLASH_SHIELD}, {FORM_CHANGE_TERMINATOR}, }; #endif //P_FAMILY_HONEDGE