diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index a882a0315..69e45ddea 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -2010,12 +2010,12 @@ .4byte \ptr .endm - .macro activateweatherabilities battler:req - various \battler, VARIOUS_ACTIVATE_WEATHER_ABILITIES + .macro activateweatherchangeabilities battler:req + various \battler, VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES .endm - .macro activateterrainabilities battler:req - various \battler, VARIOUS_ACTIVATE_TERRAIN_ABILITIES + .macro activateterrainchangeabilities battler:req + various \battler, VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES .endm @ helpful macros diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 722619c3b..9d307b8b9 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4976,20 +4976,8 @@ BattleScript_MoveWeatherChange:: printfromtable gMoveWeatherChangeStringIds waitmessage B_WAIT_TIME_LONG call BattleScript_WeatherFormChanges - call BattleScript_ActivateWeatherAbilities goto BattleScript_MoveEnd -BattleScript_ActivateWeatherAbilities: - copybyte sBATTLER, gBattlerAttacker - setbyte gBattlerAttacker, 0 -BattleScript_ActivateWeatherAbilities_Loop: - activateweatherabilities BS_ATTACKER -BattleScript_ActivateWeatherAbilities_Increment: - addbyte gBattlerAttacker, 1 - jumpifbytenotequal gBattlerAttacker, gBattlersCount, BattleScript_ActivateWeatherAbilities_Loop - copybyte gBattlerAttacker, sBATTLER - return - BattleScript_EffectSunnyDay:: attackcanceler attackstring @@ -8180,7 +8168,6 @@ BattleScript_DrizzleActivates:: waitstate playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES call BattleScript_WeatherFormChanges - call BattleScript_ActivateWeatherAbilities end3 BattleScript_AbilityRaisesDefenderStat:: @@ -8341,7 +8328,6 @@ BattleScript_SandstreamActivates:: waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES call BattleScript_WeatherFormChanges - call BattleScript_ActivateWeatherAbilities end3 BattleScript_SandSpitActivates:: @@ -8351,7 +8337,6 @@ BattleScript_SandSpitActivates:: waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES call BattleScript_WeatherFormChanges - call BattleScript_ActivateWeatherAbilities return BattleScript_ShedSkinActivates:: @@ -8365,6 +8350,7 @@ BattleScript_WeatherFormChanges:: setbyte sBATTLER, 0 BattleScript_WeatherFormChangesLoop:: tryweatherformdatachange + activateweatherchangeabilities BS_SCRIPTING addbyte sBATTLER, 1 jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_WeatherFormChangesLoop return @@ -8470,7 +8456,6 @@ BattleScript_DroughtActivates:: waitstate playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES call BattleScript_WeatherFormChanges - call BattleScript_ActivateWeatherAbilities end3 BattleScript_DesolateLandActivates:: @@ -8480,7 +8465,6 @@ BattleScript_DesolateLandActivates:: waitstate playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES call BattleScript_WeatherFormChanges - call BattleScript_ActivateWeatherAbilities end3 BattleScript_DesolateLandEvaporatesWaterTypeMoves:: @@ -8501,7 +8485,6 @@ BattleScript_PrimordialSeaActivates:: waitstate playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES call BattleScript_WeatherFormChanges - call BattleScript_ActivateWeatherAbilities end3 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves:: @@ -8572,7 +8555,6 @@ BattleScript_SnowWarningActivates:: waitstate playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES call BattleScript_WeatherFormChanges - call BattleScript_ActivateWeatherAbilities end3 BattleScript_TerrainSeedLoop: @@ -8603,7 +8585,7 @@ BattleScript_ActivateTerrainAbilities: copybyte sBATTLER, gBattlerAttacker setbyte gBattlerAttacker, 0 BattleScript_ActivateTerrainAbilities_Loop: - activateterrainabilities BS_ATTACKER + activateterrainchangeabilities BS_ATTACKER BattleScript_ActivateTerrainAbilities_Increment: addbyte gBattlerAttacker, 1 jumpifbytenotequal gBattlerAttacker, gBattlersCount, BattleScript_ActivateTerrainAbilities_Loop @@ -9756,7 +9738,6 @@ BattleScript_AnnounceAirLockCloudNine:: printstring STRINGID_AIRLOCKACTIVATES waitmessage B_WAIT_TIME_LONG call BattleScript_WeatherFormChanges - call BattleScript_ActivateWeatherAbilities end3 BattleScript_QuickClawActivation:: diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 74d7a0be2..61f69587c 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -248,8 +248,8 @@ #define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 157 #define VARIOUS_SWAP_STATS 158 #define VARIOUS_TRY_WIND_RIDER_POWER 159 -#define VARIOUS_ACTIVATE_WEATHER_ABILITIES 160 -#define VARIOUS_ACTIVATE_TERRAIN_ABILITIES 161 +#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 160 +#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 161 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e08a61c2f..a979400ab 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10116,11 +10116,11 @@ static void Cmd_various(void) } } return; - case VARIOUS_ACTIVATE_WEATHER_ABILITIES: + case VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES: gBattlescriptCurrInstr += 3; AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, gActiveBattler, 0, 0, 0); return; - case VARIOUS_ACTIVATE_TERRAIN_ABILITIES: + case VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES: gBattlescriptCurrInstr += 3; AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, gActiveBattler, 0, 0, 0); return; diff --git a/src/battle_util.c b/src/battle_util.c index c31ee5069..4eb44daa7 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4798,19 +4798,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; - case ABILITY_FORECAST: -#if B_WEATHER_FORMS >= GEN_5 - case ABILITY_FLOWER_GIFT: -#else - TRY_WEATHER_FORM: -#endif - effect = TryWeatherFormChange(battler); - if (effect != 0) - { - BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); - *(&gBattleStruct->formToChangeInto) = effect - 1; - } - break; case ABILITY_TRACE: if (!(gSpecialStatuses[battler].traced)) { @@ -6252,9 +6239,22 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITYEFFECT_ON_WEATHER: // For ability effects that activate when the battle weather changes. - gBattleScripting.battler = gBattlerAbility = battler; + battler = gBattlerAbility = gBattlerAttacker = gBattleScripting.battler; switch (GetBattlerAbility(battler)) { + case ABILITY_FORECAST: +#if B_WEATHER_FORMS >= GEN_5 + case ABILITY_FLOWER_GIFT: +#else + TRY_WEATHER_FORM: +#endif + effect = TryWeatherFormChange(battler); + if (effect != 0) + { + BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange); + *(&gBattleStruct->formToChangeInto) = effect - 1; + } + break; case ABILITY_PROTOSYNTHESIS: if (IsBattlerWeatherAffected(battler, B_WEATHER_SUN)) { @@ -6266,7 +6266,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITYEFFECT_ON_TERRAIN: // For ability effects that activate when the field terrain changes. - gBattleScripting.battler = gBattlerAbility = battler; + battler = gBattlerAbility = gBattlerAttacker = gBattleScripting.battler; switch (GetBattlerAbility(battler)) { case ABILITY_QUARK_DRIVE: