mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Streamlined ability-on-weather changes
Also renamed activateweatherabilities and activateterrainabilities.
This commit is contained in:
parent
e8dfb66c30
commit
ca32d43433
@ -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
|
||||
|
@ -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::
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user