From d4c7e5e5595d85f25f4ab078d64dd3a02dce49e1 Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Tue, 23 May 2023 14:03:38 -0700 Subject: [PATCH] changed B_WEATHER_FORM preproc to affect tables instead of function --- include/config/battle.h | 1 - src/battle_script_commands.c | 2 -- src/battle_util.c | 2 +- src/data/pokemon/form_change_tables.h | 8 ++++++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/config/battle.h b/include/config/battle.h index d0b5366ecd..4a1bbdc2f9 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -101,7 +101,6 @@ #define B_STOCKPILE_RAISES_DEFS GEN_LATEST // In Gen4+, Stockpile also raises Defense and Sp. Defense stats. Once Spit Up / Swallow is used, these stat changes are lost. #define B_TRANSFORM_SHINY GEN_LATEST // In Gen4+, Transform will copy the shiny state of the opponent instead of maintaining its own shiny state. #define B_TRANSFORM_FORM_CHANGES GEN_LATEST // In Gen5+, Transformed Pokemon cannot change forms. -#define B_WEATHER_FORM_SUPPRESS GEN_LATEST // In Gen5+, Cherrim and Castform revert to their normal forms upon losing their ability. // Ability settings #define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c85446a343..47a98ac9e3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -16605,7 +16605,6 @@ void BS_ItemRestorePP(void) void BS_TryRevertWeatherForm(void) { NATIVE_ARGS(); -#if B_WEATHER_FORM_SUPPRESS >= GEN_5 if (TryBattleFormChange(gBattlerTarget, FORM_CHANGE_BATTLE_WEATHER)) { gBattleScripting.battler = gBattlerTarget; @@ -16613,7 +16612,6 @@ void BS_TryRevertWeatherForm(void) gBattlescriptCurrInstr = BattleScript_TargetFormChangeWithStringNoPopup; return; } -#endif gBattlescriptCurrInstr = cmd->nextInstr; } diff --git a/src/battle_util.c b/src/battle_util.c index 3f0e101f08..7c0d3f8cc8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -10167,7 +10167,7 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method) 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) + else if (!WEATHER_HAS_EFFECT && formChanges[i].param1 == B_WEATHER_NONE) { targetSpecies = formChanges[i].targetSpecies; } diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index 6919ca05db..ca20061578 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -156,11 +156,19 @@ static const struct FormChange sAbsolFormChangeTable[] = { }; static const struct FormChange sCastformFormChangeTable[] = { +#ifdef B_WEATHER_FORMS >= GEN_5 {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SUNNY, B_WEATHER_SUN, ABILITY_FORECAST}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_RAINY, B_WEATHER_RAIN, ABILITY_FORECAST}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SNOWY, B_WEATHER_HAIL | B_WEATHER_SNOW, ABILITY_FORECAST}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, ~(B_WEATHER_SUN | B_WEATHER_RAIN | B_WEATHER_HAIL | B_WEATHER_SNOW), ABILITY_FORECAST}, {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, B_WEATHER_NONE, ABILITY_FORECAST}, +#else + {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SUNNY, B_WEATHER_SUN}, + {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_RAINY, B_WEATHER_RAIN}, + {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SNOWY, B_WEATHER_HAIL | B_WEATHER_SNOW}, + {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, ~(B_WEATHER_SUN | B_WEATHER_RAIN | B_WEATHER_HAIL | B_WEATHER_SNOW)}, + {FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, B_WEATHER_NONE}, +#endif {FORM_CHANGE_BATTLE_SWITCH, SPECIES_CASTFORM}, {FORM_CHANGE_FAINT, SPECIES_CASTFORM}, {FORM_CHANGE_END_BATTLE, SPECIES_CASTFORM},