mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Adding ability effect triggers for terrains and weather
A new, probably better way to handle the announcement trigger that abilities such as Protosynthesis and Quark Drive have, when the battle weather or the field terrain change.
Misc. changes:
-EFFECT_DAMAGE_SET_TERRAIN -> EFFECT_HIT_SET_REMOVE_TERRAIN
-It's more appropriate as the effect can be used to force set a terrain or simply to remove an active terrain, after all.
-The main reason for the rename was the inconsistency with the battle script's label.
-Reverted accidentally committed change to B_DOUBLE_WILD_CHANCE, performed back in c8abf00c
.
This commit is contained in:
parent
0ef148dfbb
commit
e8dfb66c30
@ -2010,6 +2010,14 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro activateweatherabilities battler:req
|
||||
various \battler, VARIOUS_ACTIVATE_WEATHER_ABILITIES
|
||||
.endm
|
||||
|
||||
.macro activateterrainabilities battler:req
|
||||
various \battler, VARIOUS_ACTIVATE_TERRAIN_ABILITIES
|
||||
.endm
|
||||
|
||||
@ helpful macros
|
||||
.macro setstatchanger stat:req, stages:req, down:req
|
||||
setbyte sSTATCHANGER, \stat | \stages << 3 | \down << 7
|
||||
|
@ -410,7 +410,7 @@ gBattleScriptsForMoveEffects::
|
||||
.4byte BattleScript_EffectCourtChange @ EFFECT_COURT_CHANGE
|
||||
.4byte BattleScript_EffectSteelBeam @ EFFECT_STEEL_BEAM
|
||||
.4byte BattleScript_EffectExtremeEvoboost @ EFFECT_EXTREME_EVOBOOST
|
||||
.4byte BattleScript_EffectTerrainHit @ EFFECT_DAMAGE_SET_TERRAIN
|
||||
.4byte BattleScript_EffectHitSetRemoveTerrain @ EFFECT_HIT_SET_REMOVE_TERRAIN
|
||||
.4byte BattleScript_EffectDarkVoid @ EFFECT_DARK_VOID
|
||||
.4byte BattleScript_EffectSleepHit @ EFFECT_SLEEP_HIT
|
||||
.4byte BattleScript_EffectDoubleShock @ EFFECT_DOUBLE_SHOCK
|
||||
@ -2456,6 +2456,7 @@ BattleScript_EffectPsychicTerrain:
|
||||
printfromtable gTerrainStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG
|
||||
call BattleScript_ActivateTerrainAbilities
|
||||
call BattleScript_TerrainSeedLoop
|
||||
jumpifabilitypresent ABILITY_MIMICRY, BattleScript_ApplyMimicry
|
||||
goto BattleScript_MoveEnd
|
||||
@ -4975,9 +4976,20 @@ BattleScript_MoveWeatherChange::
|
||||
printfromtable gMoveWeatherChangeStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateSwitchInAbilities
|
||||
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
|
||||
@ -7150,6 +7162,7 @@ BattleScript_SeedSowerActivates::
|
||||
printstring STRINGID_TERRAINBECOMESGRASSY
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG
|
||||
call BattleScript_ActivateTerrainAbilities
|
||||
call BattleScript_TerrainSeedLoop
|
||||
return
|
||||
|
||||
@ -8167,6 +8180,7 @@ BattleScript_DrizzleActivates::
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_AbilityRaisesDefenderStat::
|
||||
@ -8327,6 +8341,7 @@ BattleScript_SandstreamActivates::
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_SandSpitActivates::
|
||||
@ -8336,6 +8351,7 @@ BattleScript_SandSpitActivates::
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
return
|
||||
|
||||
BattleScript_ShedSkinActivates::
|
||||
@ -8454,6 +8470,7 @@ BattleScript_DroughtActivates::
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_DesolateLandActivates::
|
||||
@ -8463,6 +8480,7 @@ BattleScript_DesolateLandActivates::
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_DesolateLandEvaporatesWaterTypeMoves::
|
||||
@ -8483,6 +8501,7 @@ BattleScript_PrimordialSeaActivates::
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_PrimordialSeaFizzlesOutFireTypeMoves::
|
||||
@ -8553,6 +8572,7 @@ BattleScript_SnowWarningActivates::
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_TerrainSeedLoop:
|
||||
@ -8566,7 +8586,6 @@ BattleScript_TerrainSeedLoop_NextBattler:
|
||||
addbyte gBattlerTarget, 0x1
|
||||
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TerrainSeedLoopIter
|
||||
restoretarget
|
||||
call BattleScript_ActivateSwitchInAbilities
|
||||
return
|
||||
|
||||
BattleScript_ActivateSwitchInAbilities:
|
||||
@ -8580,12 +8599,24 @@ BattleScript_ActivateSwitchInAbilities_Increment:
|
||||
copybyte gBattlerAttacker, sBATTLER
|
||||
return
|
||||
|
||||
BattleScript_ActivateTerrainAbilities:
|
||||
copybyte sBATTLER, gBattlerAttacker
|
||||
setbyte gBattlerAttacker, 0
|
||||
BattleScript_ActivateTerrainAbilities_Loop:
|
||||
activateterrainabilities BS_ATTACKER
|
||||
BattleScript_ActivateTerrainAbilities_Increment:
|
||||
addbyte gBattlerAttacker, 1
|
||||
jumpifbytenotequal gBattlerAttacker, gBattlersCount, BattleScript_ActivateTerrainAbilities_Loop
|
||||
copybyte gBattlerAttacker, sBATTLER
|
||||
return
|
||||
|
||||
BattleScript_ElectricSurgeActivates::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_TERRAINBECOMESELECTRIC
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG
|
||||
call BattleScript_ActivateTerrainAbilities
|
||||
call BattleScript_TerrainSeedLoop
|
||||
end3
|
||||
|
||||
@ -8595,6 +8626,7 @@ BattleScript_MistySurgeActivates::
|
||||
printstring STRINGID_TERRAINBECOMESMISTY
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG
|
||||
call BattleScript_ActivateTerrainAbilities
|
||||
call BattleScript_TerrainSeedLoop
|
||||
end3
|
||||
|
||||
@ -8604,6 +8636,7 @@ BattleScript_GrassySurgeActivates::
|
||||
printstring STRINGID_TERRAINBECOMESGRASSY
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG
|
||||
call BattleScript_ActivateTerrainAbilities
|
||||
call BattleScript_TerrainSeedLoop
|
||||
end3
|
||||
|
||||
@ -8613,6 +8646,7 @@ BattleScript_PsychicSurgeActivates::
|
||||
printstring STRINGID_TERRAINBECOMESPSYCHIC
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG
|
||||
call BattleScript_ActivateTerrainAbilities
|
||||
call BattleScript_TerrainSeedLoop
|
||||
end3
|
||||
|
||||
@ -9722,6 +9756,7 @@ BattleScript_AnnounceAirLockCloudNine::
|
||||
printstring STRINGID_AIRLOCKACTIVATES
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_QuickClawActivation::
|
||||
@ -9881,7 +9916,7 @@ BattleScript_ExtremeEvoboostSpDef::
|
||||
BattleScript_ExtremeEvoboostEnd::
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectTerrainHit:
|
||||
BattleScript_EffectHitSetRemoveTerrain:
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
@ -9903,6 +9938,7 @@ BattleScript_EffectTerrainHit:
|
||||
setterrain BattleScript_TryFaint
|
||||
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG
|
||||
printfromtable gTerrainStringIds
|
||||
call BattleScript_ActivateTerrainAbilities
|
||||
BattleScript_TryFaint:
|
||||
tryfaintmon BS_TARGET
|
||||
goto BattleScript_MoveEnd
|
||||
|
@ -34,6 +34,8 @@
|
||||
#define ABILITYEFFECT_MOVE_END_OTHER 12
|
||||
#define ABILITYEFFECT_NEUTRALIZINGGAS 13
|
||||
#define ABILITYEFFECT_FIELD_SPORT 14 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_ON_WEATHER 15
|
||||
#define ABILITYEFFECT_ON_TERRAIN 16
|
||||
// Special cases
|
||||
#define ABILITYEFFECT_MUD_SPORT 252 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_WATER_SPORT 253 // Only used if B_SPORT_TURNS < GEN_6
|
||||
|
@ -391,7 +391,7 @@
|
||||
#define EFFECT_COURT_CHANGE 385
|
||||
#define EFFECT_STEEL_BEAM 386
|
||||
#define EFFECT_EXTREME_EVOBOOST 387
|
||||
#define EFFECT_DAMAGE_SET_TERRAIN 388 // genesis supernova
|
||||
#define EFFECT_HIT_SET_REMOVE_TERRAIN 388
|
||||
#define EFFECT_DARK_VOID 389
|
||||
#define EFFECT_SLEEP_HIT 390
|
||||
#define EFFECT_DOUBLE_SHOCK 391
|
||||
|
@ -248,6 +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
|
||||
|
||||
// Cmd_manipulatedamage
|
||||
#define DMG_CHANGE_SIGN 0
|
||||
|
@ -7941,7 +7941,7 @@ static void HandleTerrainMove(u16 move)
|
||||
statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN, timer = &gFieldTimers.terrainTimer;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 3;
|
||||
break;
|
||||
case EFFECT_DAMAGE_SET_TERRAIN:
|
||||
case EFFECT_HIT_SET_REMOVE_TERRAIN:
|
||||
switch (gBattleMoves[move].argument)
|
||||
{
|
||||
case 0: //genesis supernova
|
||||
@ -10116,6 +10116,14 @@ static void Cmd_various(void)
|
||||
}
|
||||
}
|
||||
return;
|
||||
case VARIOUS_ACTIVATE_WEATHER_ABILITIES:
|
||||
gBattlescriptCurrInstr += 3;
|
||||
AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, gActiveBattler, 0, 0, 0);
|
||||
return;
|
||||
case VARIOUS_ACTIVATE_TERRAIN_ABILITIES:
|
||||
gBattlescriptCurrInstr += 3;
|
||||
AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, gActiveBattler, 0, 0, 0);
|
||||
return;
|
||||
} // End of switch (gBattlescriptCurrInstr[2])
|
||||
|
||||
gBattlescriptCurrInstr += 3;
|
||||
|
@ -476,7 +476,7 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] =
|
||||
[EFFECT_COURT_CHANGE] = 0, // TODO: Assign points
|
||||
[EFFECT_STEEL_BEAM] = 0, // TODO: Assign points
|
||||
[EFFECT_EXTREME_EVOBOOST] = 0, // TODO: Assign points
|
||||
[EFFECT_DAMAGE_SET_TERRAIN] = 0, // TODO: Assign points
|
||||
[EFFECT_HIT_SET_REMOVE_TERRAIN] = 0, // TODO: Assign points
|
||||
[EFFECT_DARK_VOID] = 0, // TODO: Assign points
|
||||
[EFFECT_SLEEP_HIT] = 1,
|
||||
[EFFECT_DOUBLE_SHOCK] = 0, // TODO: Assign points
|
||||
|
@ -6251,6 +6251,34 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_ON_WEATHER: // For ability effects that activate when the battle weather changes.
|
||||
gBattleScripting.battler = gBattlerAbility = battler;
|
||||
switch (GetBattlerAbility(battler))
|
||||
{
|
||||
case ABILITY_PROTOSYNTHESIS:
|
||||
if (IsBattlerWeatherAffected(battler, B_WEATHER_SUN))
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler));
|
||||
BattleScriptPushCursorAndCallback(BattleScript_ProtosynthesisActivates);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_ON_TERRAIN: // For ability effects that activate when the field terrain changes.
|
||||
gBattleScripting.battler = gBattlerAbility = battler;
|
||||
switch (GetBattlerAbility(battler))
|
||||
{
|
||||
case ABILITY_QUARK_DRIVE:
|
||||
if (IsBattlerTerrainAffected(battler, STATUS_FIELD_ELECTRIC_TERRAIN))
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler));
|
||||
BattleScriptPushCursorAndCallback(BattleScript_QuarkDriveActivates);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (effect && gLastUsedAbility != 0xFF)
|
||||
|
@ -13872,7 +13872,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
||||
|
||||
[MOVE_ICE_SPINNER] =
|
||||
{
|
||||
.effect = EFFECT_DAMAGE_SET_TERRAIN,
|
||||
.effect = EFFECT_HIT_SET_REMOVE_TERRAIN,
|
||||
.power = 80,
|
||||
.type = TYPE_ICE,
|
||||
.accuracy = 100,
|
||||
@ -13884,7 +13884,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
||||
.split = SPLIT_PHYSICAL,
|
||||
.zMovePower = 160,
|
||||
.zMoveEffect = Z_EFFECT_NONE,
|
||||
.argument = 1, //remove terrain
|
||||
.argument = 1, // Remove the active field terrain if there is one.
|
||||
},
|
||||
|
||||
[MOVE_GLAIVE_RUSH] =
|
||||
@ -14839,7 +14839,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
||||
},
|
||||
[MOVE_GENESIS_SUPERNOVA] =
|
||||
{
|
||||
.effect = EFFECT_DAMAGE_SET_TERRAIN,
|
||||
.effect = EFFECT_HIT_SET_REMOVE_TERRAIN,
|
||||
.power = 185,
|
||||
.type = TYPE_PSYCHIC,
|
||||
.accuracy = 0,
|
||||
@ -14850,7 +14850,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
||||
.flags = 0,
|
||||
.zMovePower = 0,
|
||||
.split = SPLIT_SPECIAL,
|
||||
.argument = 0, //psychic terrain
|
||||
.argument = 0, // Set Psychic Terrain. If there's a different field terrain active, overwrite it.
|
||||
.zMoveEffect = 0
|
||||
},
|
||||
[MOVE_SINISTER_ARROW_RAID] =
|
||||
@ -14900,7 +14900,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
||||
},
|
||||
[MOVE_SPLINTERED_STORMSHARDS] =
|
||||
{
|
||||
.effect = EFFECT_DAMAGE_SET_TERRAIN,
|
||||
.effect = EFFECT_HIT_SET_REMOVE_TERRAIN,
|
||||
.power = 190,
|
||||
.type = TYPE_ROCK,
|
||||
.accuracy = 0,
|
||||
@ -14911,7 +14911,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
||||
.flags = 0,
|
||||
.zMovePower = 0,
|
||||
.split = SPLIT_PHYSICAL,
|
||||
.argument = 1, //remove terrain
|
||||
.argument = 1, // Remove the active field terrain if there is one.
|
||||
.zMoveEffect = 0
|
||||
},
|
||||
[MOVE_LETS_SNUGGLE_FOREVER] =
|
||||
|
Loading…
Reference in New Issue
Block a user