diff options
author | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2018-01-23 17:39:09 -0500 |
---|---|---|
committer | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2018-01-23 17:39:09 -0500 |
commit | a1951cefc09035e11077a433b28ec8c66b3b03db (patch) | |
tree | 4de98db5a6edb6d74192028d50893da2b764421f /engine/battle/effect_commands.asm | |
parent | 79bd48f85c7dd1868264e290b12dad17a6e25b95 (diff) |
Prefix wram labels with w, part 2.
Diffstat (limited to 'engine/battle/effect_commands.asm')
-rw-r--r-- | engine/battle/effect_commands.asm | 1314 |
1 files changed, 657 insertions, 657 deletions
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index b07f9df21..48efba8fa 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -56,7 +56,7 @@ DoMove: ; 3402c ld a, BANK(MoveEffectsPointers) call GetFarHalfword - ld de, BattleScriptBuffer + ld de, wBattleScriptBuffer .GetMoveEffect: ld a, BANK(MoveEffects) @@ -68,27 +68,27 @@ DoMove: ; 3402c jr nz, .GetMoveEffect ; Start at the first command. - ld hl, BattleScriptBuffer + ld hl, wBattleScriptBuffer ld a, l - ld [BattleScriptBufferAddress], a + ld [wBattleScriptBufferAddress], a ld a, h - ld [BattleScriptBufferAddress + 1], a + ld [wBattleScriptBufferAddress + 1], a .ReadMoveEffectCommand: -; ld a, [BattleScriptBufferAddress++] - ld a, [BattleScriptBufferAddress] +; ld a, [wBattleScriptBufferAddress++] + ld a, [wBattleScriptBufferAddress] ld l, a - ld a, [BattleScriptBufferAddress + 1] + ld a, [wBattleScriptBufferAddress + 1] ld h, a ld a, [hli] push af ld a, l - ld [BattleScriptBufferAddress], a + ld [wBattleScriptBufferAddress], a ld a, h - ld [BattleScriptBufferAddress + 1], a + ld [wBattleScriptBufferAddress + 1], a pop af ; endturn_command (-2) is used to terminate branches without ending the read cycle. @@ -131,15 +131,15 @@ BattleCommand_CheckTurn: ; 34084 jp z, EndTurn xor a - ld [AttackMissed], a - ld [EffectFailed], a + ld [wAttackMissed], a + ld [wEffectFailed], a ld [wKickCounter], a - ld [AlreadyDisobeyed], a - ld [AlreadyFailed], a + ld [wAlreadyDisobeyed], a + ld [wAlreadyFailed], a ld [wSomeoneIsRampaging], a ld a, EFFECTIVE - ld [TypeModifier], a + ld [wTypeModifier], a ld a, [hBattleTurn] and a @@ -148,7 +148,7 @@ BattleCommand_CheckTurn: ; 34084 CheckPlayerTurn: - ld hl, PlayerSubStatus4 + ld hl, wPlayerSubStatus4 bit SUBSTATUS_RECHARGE, [hl] jr z, .no_recharge @@ -161,13 +161,13 @@ CheckPlayerTurn: .no_recharge - ld hl, BattleMonStatus + ld hl, wBattleMonStatus ld a, [hl] and SLP jr z, .not_asleep dec a - ld [BattleMonStatus], a + ld [wBattleMonStatus], a and SLP jr z, .woke_up @@ -186,7 +186,7 @@ CheckPlayerTurn: call CallBattleCore ld a, $1 ld [hBGMapMode], a - ld hl, PlayerSubStatus1 + ld hl, wPlayerSubStatus1 res SUBSTATUS_NIGHTMARE, [hl] jr .not_asleep @@ -195,7 +195,7 @@ CheckPlayerTurn: call StdBattleTextBox ; Snore and Sleep Talk bypass sleep. - ld a, [CurPlayerMove] + ld a, [wCurPlayerMove] cp SNORE jr z, .not_asleep cp SLEEP_TALK @@ -207,12 +207,12 @@ CheckPlayerTurn: .not_asleep - ld hl, BattleMonStatus + ld hl, wBattleMonStatus bit FRZ, [hl] jr z, .not_frozen ; Flame Wheel and Sacred Fire thaw the user. - ld a, [CurPlayerMove] + ld a, [wCurPlayerMove] cp FLAME_WHEEL jr z, .not_frozen cp SACRED_FIRE @@ -227,7 +227,7 @@ CheckPlayerTurn: .not_frozen - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 bit SUBSTATUS_FLINCHED, [hl] jr z, .not_flinched @@ -241,7 +241,7 @@ CheckPlayerTurn: .not_flinched - ld hl, PlayerDisableCount + ld hl, wPlayerDisableCount ld a, [hl] and a jr z, .not_disabled @@ -252,21 +252,21 @@ CheckPlayerTurn: jr nz, .not_disabled ld [hl], a - ld [DisabledMove], a + ld [wDisabledMove], a ld hl, DisabledNoMoreText call StdBattleTextBox .not_disabled - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] add a jr nc, .not_confused - ld hl, PlayerConfuseCount + ld hl, wPlayerConfuseCount dec [hl] jr nz, .confused - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 res SUBSTATUS_CONFUSED, [hl] ld hl, ConfusedNoMoreText call StdBattleTextBox @@ -286,7 +286,7 @@ CheckPlayerTurn: jr nc, .not_confused ; clear confusion-dependent substatus - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 ld a, [hl] and 1 << SUBSTATUS_CONFUSED ld [hl], a @@ -298,7 +298,7 @@ CheckPlayerTurn: .not_confused - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] add a ; bit SUBSTATUS_ATTRACT jr nc, .not_infatuated @@ -323,12 +323,12 @@ CheckPlayerTurn: ; We can't disable a move that doesn't exist. - ld a, [DisabledMove] + ld a, [wDisabledMove] and a jr z, .no_disabled_move ; Are we using the disabled move? - ld hl, CurPlayerMove + ld hl, wCurPlayerMove cp [hl] jr nz, .no_disabled_move @@ -339,7 +339,7 @@ CheckPlayerTurn: .no_disabled_move - ld hl, BattleMonStatus + ld hl, wBattleMonStatus bit PAR, [hl] ret z @@ -397,7 +397,7 @@ OpponentCantMove: ; 34216 CheckEnemyTurn: ; 3421f - ld hl, EnemySubStatus4 + ld hl, wEnemySubStatus4 bit SUBSTATUS_RECHARGE, [hl] jr z, .no_recharge @@ -410,13 +410,13 @@ CheckEnemyTurn: ; 3421f .no_recharge - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus ld a, [hl] and SLP jr z, .not_asleep dec a - ld [EnemyMonStatus], a + ld [wEnemyMonStatus], a and a jr z, .woke_up @@ -437,13 +437,13 @@ CheckEnemyTurn: ; 3421f call CallBattleCore ld a, $1 ld [hBGMapMode], a - ld hl, EnemySubStatus1 + ld hl, wEnemySubStatus1 res SUBSTATUS_NIGHTMARE, [hl] jr .not_asleep .fast_asleep ; Snore and Sleep Talk bypass sleep. - ld a, [CurEnemyMove] + ld a, [wCurEnemyMove] cp SNORE jr z, .not_asleep cp SLEEP_TALK @@ -454,12 +454,12 @@ CheckEnemyTurn: ; 3421f .not_asleep - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus bit FRZ, [hl] jr z, .not_frozen ; Flame Wheel and Sacred Fire thaw the user. - ld a, [CurEnemyMove] + ld a, [wCurEnemyMove] cp FLAME_WHEEL jr z, .not_frozen cp SACRED_FIRE @@ -473,7 +473,7 @@ CheckEnemyTurn: ; 3421f .not_frozen - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 bit SUBSTATUS_FLINCHED, [hl] jr z, .not_flinched @@ -487,7 +487,7 @@ CheckEnemyTurn: ; 3421f .not_flinched - ld hl, EnemyDisableCount + ld hl, wEnemyDisableCount ld a, [hl] and a jr z, .not_disabled @@ -498,7 +498,7 @@ CheckEnemyTurn: ; 3421f jr nz, .not_disabled ld [hl], a - ld [EnemyDisabledMove], a + ld [wEnemyDisabledMove], a ld hl, DisabledNoMoreText call StdBattleTextBox @@ -506,15 +506,15 @@ CheckEnemyTurn: ; 3421f .not_disabled - ld a, [EnemySubStatus3] + ld a, [wEnemySubStatus3] add a ; bit SUBSTATUS_CONFUSED jr nc, .not_confused - ld hl, EnemyConfuseCount + ld hl, wEnemyConfuseCount dec [hl] jr nz, .confused - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 res SUBSTATUS_CONFUSED, [hl] ld hl, ConfusedNoMoreText call StdBattleTextBox @@ -536,7 +536,7 @@ CheckEnemyTurn: ; 3421f jr nc, .not_confused ; clear confusion-dependent substatus - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 ld a, [hl] and 1 << SUBSTATUS_CONFUSED ld [hl], a @@ -565,7 +565,7 @@ CheckEnemyTurn: ; 3421f .not_confused - ld a, [EnemySubStatus1] + ld a, [wEnemySubStatus1] add a ; bit SUBSTATUS_ATTRACT jr nc, .not_infatuated @@ -590,12 +590,12 @@ CheckEnemyTurn: ; 3421f ; We can't disable a move that doesn't exist. - ld a, [EnemyDisabledMove] + ld a, [wEnemyDisabledMove] and a jr z, .no_disabled_move ; Are we using the disabled move? - ld hl, CurEnemyMove + ld hl, wCurEnemyMove cp [hl] jr nz, .no_disabled_move @@ -607,7 +607,7 @@ CheckEnemyTurn: ; 3421f .no_disabled_move - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus bit PAR, [hl] ret z @@ -656,7 +656,7 @@ HitConfusion: ; 343a5 call StdBattleTextBox xor a - ld [CriticalHit], a + ld [wCriticalHit], a call HitSelfInConfusion call BattleCommand_DamageCalc @@ -695,12 +695,12 @@ BattleCommand_CheckObedience: ; 343db ret nz ; If we've already checked this turn - ld a, [AlreadyDisobeyed] + ld a, [wAlreadyDisobeyed] and a ret nz xor a - ld [AlreadyDisobeyed], a + ld [wAlreadyDisobeyed], a ; No obedience in link battles ; (since no handling exists for enemy) @@ -708,7 +708,7 @@ BattleCommand_CheckObedience: ; 343db and a ret nz - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a ret nz @@ -717,11 +717,11 @@ BattleCommand_CheckObedience: ; 343db ld a, MON_ID call BattlePartyAttr - ld a, [PlayerID] + ld a, [wPlayerID] cp [hl] jr nz, .obeylevel inc hl - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] cp [hl] ret z @@ -762,7 +762,7 @@ BattleCommand_CheckObedience: ; 343db ld b, a ld c, a - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld d, a add b @@ -839,7 +839,7 @@ BattleCommand_CheckObedience: ; 343db and SLP jr z, .Nap - ld [BattleMonStatus], a + ld [wBattleMonStatus], a ld hl, BeganToNapText jr .Print @@ -872,18 +872,18 @@ BattleCommand_CheckObedience: ; 343db .UseInstead: ; Can't use another move if the monster only has one! - ld a, [BattleMonMoves + 1] + ld a, [wBattleMonMoves + 1] and a jr z, .DoNothing ; Don't bother trying to handle Disable. - ld a, [DisabledMove] + ld a, [wDisabledMove] and a jr nz, .DoNothing - ld hl, BattleMonPP - ld de, BattleMonMoves + ld hl, wBattleMonPP + ld de, wBattleMonMoves ld b, 0 ld c, NUM_MOVES @@ -904,8 +904,8 @@ BattleCommand_CheckObedience: ; 343db .CheckMovePP: - ld hl, BattleMonPP - ld a, [CurMoveNum] + ld hl, wBattleMonPP + ld a, [wCurMoveNum] ld e, a ld d, 0 add hl, de @@ -919,13 +919,13 @@ BattleCommand_CheckObedience: ; 343db ; Make sure we can actually use the move once we get there. ld a, 1 - ld [AlreadyDisobeyed], a + ld [wAlreadyDisobeyed], a ld a, [w2DMenuNumRows] ld b, a ; Save the move we originally picked for afterward. - ld a, [CurMoveNum] + ld a, [wCurMoveNum] ld c, a push af @@ -942,8 +942,8 @@ BattleCommand_CheckObedience: ; 343db jr z, .RandomMove ; Make sure it has PP. - ld [CurMoveNum], a - ld hl, BattleMonPP + ld [wCurMoveNum], a + ld hl, wBattleMonPP ld e, a ld d, 0 add hl, de @@ -953,13 +953,13 @@ BattleCommand_CheckObedience: ; 343db ; Use it. - ld a, [CurMoveNum] + ld a, [wCurMoveNum] ld c, a ld b, 0 - ld hl, BattleMonMoves + ld hl, wBattleMonMoves add hl, bc ld a, [hl] - ld [CurPlayerMove], a + ld [wCurPlayerMove], a call SetPlayerTurn call UpdateMoveData @@ -968,19 +968,19 @@ BattleCommand_CheckObedience: ; 343db ; Restore original move choice. pop af - ld [CurMoveNum], a + ld [wCurMoveNum], a .EndDisobedience: xor a - ld [LastPlayerMove], a - ld [LastPlayerCounterMove], a + ld [wLastPlayerMove], a + ld [wLastPlayerCounterMove], a ; Break Encore too. - ld hl, PlayerSubStatus5 + ld hl, wPlayerSubStatus5 res SUBSTATUS_ENCORED, [hl] xor a - ld [PlayerEncoreCount], a + ld [wPlayerEncoreCount], a jp EndMoveEffect @@ -1044,17 +1044,17 @@ BattleCommand_DoTurn: ; 34555 call CheckUserIsCharging ret nz - ld hl, BattleMonPP - ld de, PlayerSubStatus3 - ld bc, PlayerTurnsTaken + ld hl, wBattleMonPP + ld de, wPlayerSubStatus3 + ld bc, wPlayerTurnsTaken ld a, [hBattleTurn] and a jr z, .proceed - ld hl, EnemyMonPP - ld de, EnemySubStatus3 - ld bc, EnemyTurnsTaken + ld hl, wEnemyMonPP + ld de, wEnemySubStatus3 + ld bc, wEnemyTurnsTaken .proceed @@ -1088,8 +1088,8 @@ BattleCommand_DoTurn: ; 34555 ld a, [hBattleTurn] and a - ld hl, PartyMon1PP - ld a, [CurBattleMon] + ld hl, wPartyMon1PP + ld a, [wCurBattleMon] jr z, .player ; mimic this part entirely if wildbattle @@ -1097,8 +1097,8 @@ BattleCommand_DoTurn: ; 34555 dec a jr z, .wild - ld hl, OTPartyMon1PP - ld a, [CurOTMon] + ld hl, wOTPartyMon1PP + ld a, [wCurOTMon] .player call GetPartyLocation @@ -1110,9 +1110,9 @@ BattleCommand_DoTurn: ; 34555 .consume_pp ld a, [hBattleTurn] and a - ld a, [CurMoveNum] + ld a, [wCurMoveNum] jr z, .okay - ld a, [CurEnemyMoveNum] + ld a, [wCurEnemyMoveNum] .okay ld c, a @@ -1126,8 +1126,8 @@ BattleCommand_DoTurn: ; 34555 ret .wild - ld hl, EnemyMonMoves - ld a, [CurEnemyMoveNum] + ld hl, wEnemyMonMoves + ld a, [wCurEnemyMoveNum] ld c, a ld b, 0 add hl, bc @@ -1182,9 +1182,9 @@ BattleCommand_DoTurn: ; 34555 CheckMimicUsed: ; 3460b ld a, [hBattleTurn] and a - ld a, [CurMoveNum] + ld a, [wCurMoveNum] jr z, .player - ld a, [CurEnemyMoveNum] + ld a, [wCurEnemyMoveNum] .player ld c, a @@ -1218,7 +1218,7 @@ BattleCommand_Critical: ; 34631 ; Determine whether this attack's hit will be critical. xor a - ld [CriticalHit], a + ld [wCriticalHit], a ld a, BATTLE_VARS_MOVE_POWER call GetBattleVar @@ -1227,11 +1227,11 @@ BattleCommand_Critical: ; 34631 ld a, [hBattleTurn] and a - ld hl, EnemyMonItem - ld a, [EnemyMonSpecies] + ld hl, wEnemyMonItem + ld a, [wEnemyMonSpecies] jr nz, .Item - ld hl, BattleMonItem - ld a, [BattleMonSpecies] + ld hl, wBattleMonItem + ld a, [wBattleMonSpecies] .Item: ld c, 0 @@ -1299,7 +1299,7 @@ BattleCommand_Critical: ; 34631 cp [hl] ret nc ld a, 1 - ld [CriticalHit], a + ld [wCriticalHit], a ret INCLUDE "data/battle/critical_hits.asm" @@ -1312,7 +1312,7 @@ BattleCommand_TripleKick: ; 346b2 ld a, [wKickCounter] ld b, a inc b - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 ld a, [hld] ld e, a ld a, [hli] @@ -1354,11 +1354,11 @@ BattleCommand_Stab: ; 346d2 cp STRUGGLE ret z - ld hl, BattleMonType1 + ld hl, wBattleMonType1 ld a, [hli] ld b, a ld c, [hl] - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 ld a, [hli] ld d, a ld e, [hl] @@ -1367,11 +1367,11 @@ BattleCommand_Stab: ; 346d2 and a jr z, .go ; Who Attacks and who Defends - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 ld a, [hli] ld b, a ld c, [hl] - ld hl, BattleMonType1 + ld hl, wBattleMonType1 ld a, [hli] ld d, a ld e, [hl] @@ -1404,7 +1404,7 @@ BattleCommand_Stab: ; 346d2 jr .SkipStab .stab - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 ld a, [hld] ld h, [hl] ld l, a @@ -1416,11 +1416,11 @@ BattleCommand_Stab: ; 346d2 add hl, bc ld a, h - ld [CurDamage], a + ld [wCurDamage], a ld a, l - ld [CurDamage + 1], a + ld [wCurDamage + 1], a - ld hl, TypeModifier + ld hl, wTypeModifier set 7, [hl] .SkipStab: @@ -1459,7 +1459,7 @@ BattleCommand_Stab: ; 346d2 push hl push bc inc hl - ld a, [TypeModifier] + ld a, [wTypeModifier] and %10000000 ld b, a ; If the target is immune to the move, treat it as a miss and calculate the damage as 0 @@ -1467,17 +1467,17 @@ BattleCommand_Stab: ; 346d2 and a jr nz, .NotImmune inc a - ld [AttackMissed], a + ld [wAttackMissed], a xor a .NotImmune: ld [hMultiplier], a add b - ld [TypeModifier], a + ld [wTypeModifier], a xor a ld [hMultiplicand + 0], a - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] ld [hMultiplicand + 1], a ld a, [hld] @@ -1525,21 +1525,21 @@ BattleCommand_Stab: ; 346d2 call BattleCheckTypeMatchup ld a, [wTypeMatchup] ld b, a - ld a, [TypeModifier] + ld a, [wTypeModifier] and %10000000 or b - ld [TypeModifier], a + ld [wTypeModifier], a ret ; 347c8 BattleCheckTypeMatchup: ; 347c8 - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 ld a, [hBattleTurn] and a jr z, CheckTypeMatchup - ld hl, BattleMonType1 + ld hl, wBattleMonType1 CheckTypeMatchup: ; 347d3 ; There is an incorrect assumption about this function made in the AI related code: when ; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing @@ -1626,9 +1626,9 @@ BattleCommand_ResetTypeMatchup: ; 34833 jr nz, .reset call ResetDamage xor a - ld [TypeModifier], a + ld [wTypeModifier], a inc a - ld [AttackMissed], a + ld [wAttackMissed], a ret .reset @@ -1652,7 +1652,7 @@ BattleCommand_DamageVariation: ; 34cfd ; No point in reducing 1 or 0 damage. - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] and a jr nz, .go @@ -1688,7 +1688,7 @@ BattleCommand_DamageVariation: ; 34cfd ; ...to get .85-1.00x damage. ld a, [hQuotient + 1] - ld hl, CurDamage + ld hl, wCurDamage ld [hli], a ld a, [hQuotient + 2] ld [hl], a @@ -1776,7 +1776,7 @@ BattleCommand_CheckHit: ; 34d32 .Missed: ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ret @@ -1927,17 +1927,17 @@ BattleCommand_CheckHit: ; 34d32 ; load the user's accuracy into b and the opponent's evasion into c. ld hl, wPlayerMoveStruct + MOVE_ACC - ld a, [PlayerAccLevel] + ld a, [wPlayerAccLevel] ld b, a - ld a, [EnemyEvaLevel] + ld a, [wEnemyEvaLevel] ld c, a jr z, .got_acc_eva ld hl, wEnemyMoveStruct + MOVE_ACC - ld a, [EnemyAccLevel] + ld a, [wEnemyAccLevel] ld b, a - ld a, [PlayerEvaLevel] + ld a, [wPlayerEvaLevel] ld c, a .got_acc_eva @@ -2020,7 +2020,7 @@ BattleCommand_EffectChance: ; 34ecc ; effectchance xor a - ld [EffectFailed], a + ld [wEffectFailed], a call CheckSubstituteOpp jr nz, .failed @@ -2039,7 +2039,7 @@ BattleCommand_EffectChance: ; 34ecc .failed ld a, 1 - ld [EffectFailed], a + ld [wEffectFailed], a and a ret @@ -2085,7 +2085,7 @@ BattleCommand_LowerSub: ; 34eee xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a inc a ld [wKickCounter], a ld a, SUBSTITUTE @@ -2127,16 +2127,16 @@ BattleCommand_HitTarget: ; 34f57 BattleCommand_HitTargetNoSub: ; 34f60 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay ld a, [hBattleTurn] and a - ld de, PlayerRolloutCount + ld de, wPlayerRolloutCount ld a, BATTLEANIM_ENEMY_DAMAGE jr z, .got_rollout_count - ld de, EnemyRolloutCount + ld de, wEnemyRolloutCount ld a, BATTLEANIM_PLAYER_DAMAGE .got_rollout_count @@ -2200,7 +2200,7 @@ BattleCommand_HitTargetNoSub: ; 34f60 BattleCommand_StatUpAnim: ; 34fd1 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay @@ -2211,7 +2211,7 @@ BattleCommand_StatUpAnim: ; 34fd1 BattleCommand_StatDownAnim: ; 34fdb - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay @@ -2262,7 +2262,7 @@ BattleCommand_RaiseSub: ; 35004 xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld a, $2 ld [wKickCounter], a ld a, SUBSTITUTE @@ -2276,7 +2276,7 @@ BattleCommand_FailureText: ; 35023 ; If the move missed or failed, load the appropriate ; text, and end the effects of multi-turn or multi- ; hit moves. - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret z @@ -2380,20 +2380,20 @@ BattleCommand_CheckFaint: ; 3505e bit SUBSTATUS_SUBSTITUTE, a ret nz - ld de, PlayerDamageTaken + 1 + ld de, wPlayerDamageTaken + 1 ld a, [hBattleTurn] and a jr nz, .damage_taken - ld de, EnemyDamageTaken + 1 + ld de, wEnemyDamageTaken + 1 .damage_taken - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld b, a ld a, [de] add b ld [de], a dec de - ld a, [CurDamage] + ld a, [wCurDamage] ld b, a ld a, [de] adc b @@ -2411,7 +2411,7 @@ BattleCommand_CheckFaint: ; 3505e GetFailureResultText: ; 350e4 ld hl, DoesntAffectText ld de, DoesntAffectText - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jr z, .got_text ld a, BATTLE_VARS_MOVE_EFFECT @@ -2422,25 +2422,25 @@ GetFailureResultText: ; 350e4 jr z, .got_text ld hl, AttackMissedText ld de, AttackMissed2Text - ld a, [CriticalHit] + ld a, [wCriticalHit] cp -1 jr nz, .got_text ld hl, UnaffectedText .got_text call FailText_CheckOpponentProtect xor a - ld [CriticalHit], a + ld [wCriticalHit], a ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_JUMP_KICK ret nz - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] ld b, [hl] rept 3 @@ -2480,11 +2480,11 @@ FailText_CheckOpponentProtect: ; 35157 BattleCommanda5: ; 35165 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret z - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jp z, PrintDoesntAffect jp PrintButItFailed @@ -2497,7 +2497,7 @@ BattleCommand_CriticalText: ; 35175 ; Prints the message for critical hits or one-hit KOs. ; If there is no message to be printed, wait 20 frames. - ld a, [CriticalHit] + ld a, [wCriticalHit] and a jr z, .wait @@ -2513,7 +2513,7 @@ BattleCommand_CriticalText: ; 35175 call StdBattleTextBox xor a - ld [CriticalHit], a + ld [wCriticalHit], a .wait ld c, 20 @@ -2528,11 +2528,11 @@ BattleCommand_CriticalText: ; 35175 BattleCommand_StartLoop: ; 35197 ; startloop - ld hl, PlayerRolloutCount + ld hl, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyRolloutCount + ld hl, wEnemyRolloutCount .ok xor a ld [hl], a @@ -2556,7 +2556,7 @@ BattleCommand_SuperEffectiveLoopText: ; 351a5 BattleCommand_SuperEffectiveText: ; 351ad ; supereffectivetext - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f cp 10 ; 1.0 ret z @@ -2574,11 +2574,11 @@ BattleCommand_CheckDestinyBond: ; 351c0 ; Faint the user if it fainted an opponent using Destiny Bond. - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, BattleMonHP + ld hl, wBattleMonHP .got_hp ld a, [hli] @@ -2595,30 +2595,30 @@ BattleCommand_CheckDestinyBond: ; 351c0 ld a, [hBattleTurn] and a - ld hl, EnemyMonMaxHP + 1 + ld hl, wEnemyMonMaxHP + 1 bccoord 2, 2 ; hp bar ld a, 0 jr nz, .got_max_hp - ld hl, BattleMonMaxHP + 1 + ld hl, wBattleMonMaxHP + 1 bccoord 10, 9 ; hp bar ld a, 1 .got_max_hp ld [wWhichHPBar], a ld a, [hld] - ld [Buffer1], a + ld [wBuffer1], a ld a, [hld] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer3], a + ld [wBuffer3], a xor a ld [hld], a ld a, [hl] - ld [Buffer4], a + ld [wBuffer4], a xor a ld [hl], a - ld [Buffer5], a - ld [Buffer6], a + ld [wBuffer5], a + ld [wBuffer6], a ld h, b ld l, c predef AnimateHPBar @@ -2627,7 +2627,7 @@ BattleCommand_CheckDestinyBond: ; 351c0 call BattleCommand_SwitchTurn xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a inc a ld [wKickCounter], a ld a, DESTINY_BOND @@ -2665,7 +2665,7 @@ BattleCommand_BuildOpponentRage: ; 35250 jp .start .start - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz @@ -2696,10 +2696,10 @@ BattleCommand_BuildOpponentRage: ; 35250 BattleCommand_RageDamage: ; 3527b ; ragedamage - ld a, [CurDamage] + ld a, [wCurDamage] ld h, a ld b, a - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld l, a ld c, a ld a, [hBattleTurn] @@ -2716,18 +2716,18 @@ BattleCommand_RageDamage: ; 3527b ld hl, -1 .done ld a, h - ld [CurDamage], a + ld [wCurDamage], a ld a, l - ld [CurDamage + 1], a + ld [wCurDamage + 1], a ret ; 352a3 EndMoveEffect: ; 352a3 - ld a, [BattleScriptBufferAddress] + ld a, [wBattleScriptBufferAddress] ld l, a - ld a, [BattleScriptBufferAddress + 1] + ld a, [wBattleScriptBufferAddress + 1] ld h, a ld a, $ff ld [hli], a @@ -2745,7 +2745,7 @@ DittoMetalPowder: ; 352b1 and a ld a, [hl] jr nz, .Ditto - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] .Ditto: cp DITTO @@ -2804,51 +2804,51 @@ PlayerAttackDamage: ; 352e2 jr nc, .special .physical - ld hl, EnemyMonDefense + ld hl, wEnemyMonDefense ld a, [hli] ld b, a ld c, [hl] - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit SCREENS_REFLECT, a jr z, .physicalcrit sla c rl b .physicalcrit - ld hl, BattleMonAttack + ld hl, wBattleMonAttack call GetDamageStatsCritical jr c, .thickclub - ld hl, EnemyDefense + ld hl, wEnemyDefense ld a, [hli] ld b, a ld c, [hl] - ld hl, PlayerAttack + ld hl, wPlayerAttack jr .thickclub .special - ld hl, EnemyMonSpclDef + ld hl, wEnemyMonSpclDef ld a, [hli] ld b, a ld c, [hl] - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit SCREENS_LIGHT_SCREEN, a jr z, .specialcrit sla c rl b .specialcrit - ld hl, BattleMonSpclAtk + ld hl, wBattleMonSpclAtk call GetDamageStatsCritical jr c, .lightball - ld hl, EnemySpDef + ld hl, wEnemySpDef ld a, [hli] ld b, a ld c, [hl] - ld hl, PlayerSpAtk + ld hl, wPlayerSpAtk .lightball ; Note: Returns player special attack at hl in hl. @@ -2862,7 +2862,7 @@ PlayerAttackDamage: ; 352e2 .done call TruncateHL_BC - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld e, a call DittoMetalPowder @@ -2924,7 +2924,7 @@ TruncateHL_BC: ; 3534d GetDamageStatsCritical: ; 35378 ; Return carry if non-critical. - ld a, [CriticalHit] + ld a, [wCriticalHit] and a scf ret z @@ -2945,28 +2945,28 @@ GetDamageStats: ; 3537e ld a, [wPlayerMoveStructType] cp SPECIAL ; special - ld a, [PlayerSAtkLevel] + ld a, [wPlayerSAtkLevel] ld b, a - ld a, [EnemySDefLevel] + ld a, [wEnemySDefLevel] jr nc, .end ; physical - ld a, [PlayerAtkLevel] + ld a, [wPlayerAtkLevel] ld b, a - ld a, [EnemyDefLevel] + ld a, [wEnemyDefLevel] jr .end .enemy ld a, [wEnemyMoveStructType] cp SPECIAL ; special - ld a, [EnemySAtkLevel] + ld a, [wEnemySAtkLevel] ld b, a - ld a, [PlayerSDefLevel] + ld a, [wPlayerSDefLevel] jr nc, .end ; physical - ld a, [EnemyAtkLevel] + ld a, [wEnemyAtkLevel] ld b, a - ld a, [PlayerDefLevel] + ld a, [wPlayerDefLevel] .end cp b pop bc @@ -3030,7 +3030,7 @@ SpeciesItemBoost: ; 353d1 and a ld a, [hl] jr z, .CompareSpecies - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] .CompareSpecies: pop hl @@ -3070,50 +3070,50 @@ EnemyAttackDamage: ; 353f6 jr nc, .Special .physical - ld hl, BattleMonDefense + ld hl, wBattleMonDefense ld a, [hli] ld b, a ld c, [hl] - ld a, [PlayerScreens] + ld a, [wPlayerScreens] bit SCREENS_REFLECT, a jr z, .physicalcrit sla c rl b .physicalcrit - ld hl, EnemyMonAttack + ld hl, wEnemyMonAttack call GetDamageStatsCritical jr c, .thickclub - ld hl, PlayerDefense + ld hl, wPlayerDefense ld a, [hli] ld b, a ld c, [hl] - ld hl, EnemyAttack + ld hl, wEnemyAttack jr .thickclub .Special: - ld hl, BattleMonSpclDef + ld hl, wBattleMonSpclDef ld a, [hli] ld b, a ld c, [hl] - ld a, [PlayerScreens] + ld a, [wPlayerScreens] bit SCREENS_LIGHT_SCREEN, a jr z, .specialcrit sla c rl b .specialcrit - ld hl, EnemyMonSpclAtk + ld hl, wEnemyMonSpclAtk call GetDamageStatsCritical jr c, .lightball - ld hl, PlayerSpDef + ld hl, wPlayerSpDef ld a, [hli] ld b, a ld c, [hl] - ld hl, EnemySpAtk + ld hl, wEnemySpAtk .lightball call LightBallBoost @@ -3125,7 +3125,7 @@ EnemyAttackDamage: ; 353f6 .done call TruncateHL_BC - ld a, [EnemyMonLevel] + ld a, [wEnemyMonLevel] ld e, a call DittoMetalPowder @@ -3143,27 +3143,27 @@ BattleCommand_BeatUp: ; 35461 ld a, [hBattleTurn] and a jp nz, .enemy_beats_up - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] bit SUBSTATUS_IN_LOOP, a jr nz, .next_mon ld c, 20 call DelayFrames xor a - ld [PlayerRolloutCount], a + ld [wPlayerRolloutCount], a ld [wd002], a ld [wBeatUpHitAtLeastOnce], a jr .got_mon .next_mon - ld a, [PlayerRolloutCount] + ld a, [wPlayerRolloutCount] ld b, a - ld a, [PartyCount] + ld a, [wPartyCount] sub b ld [wd002], a .got_mon ld a, [wd002] - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames call GetNick ld a, MON_HP call GetBeatupMonLocation @@ -3172,11 +3172,11 @@ BattleCommand_BeatUp: ; 35461 jp z, .beatup_fail ; fainted ld a, [wd002] ld c, a - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ; BUG: this can desynchronize link battles ; Change "cp [hl]" to "cp c" to fix cp [hl] - ld hl, BattleMonStatus + ld hl, wBattleMonStatus jr z, .active_mon ld a, MON_STATUS call GetBeatupMonLocation @@ -3189,18 +3189,18 @@ BattleCommand_BeatUp: ; 35461 ld [wBeatUpHitAtLeastOnce], a ld hl, BeatUpAttackText call StdBattleTextBox - ld a, [EnemyMonSpecies] - ld [CurSpecies], a + ld a, [wEnemyMonSpecies] + ld [wCurSpecies], a call GetBaseData - ld a, [BaseDefense] + ld a, [wBaseDefense] ld c, a push bc ld a, MON_SPECIES call GetBeatupMonLocation ld a, [hl] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData - ld a, [BaseAttack] + ld a, [wBaseAttack] pop bc ld b, a push bc @@ -3214,20 +3214,20 @@ BattleCommand_BeatUp: ; 35461 ret .enemy_beats_up - ld a, [EnemySubStatus3] + ld a, [wEnemySubStatus3] bit SUBSTATUS_IN_LOOP, a jr nz, .not_first_enemy_beatup xor a - ld [EnemyRolloutCount], a + ld [wEnemyRolloutCount], a ld [wd002], a ld [wBeatUpHitAtLeastOnce], a jr .enemy_continue .not_first_enemy_beatup - ld a, [EnemyRolloutCount] + ld a, [wEnemyRolloutCount] ld b, a - ld a, [OTPartyCount] + ld a, [wOTPartyCount] sub b ld [wd002], a .enemy_continue @@ -3239,14 +3239,14 @@ BattleCommand_BeatUp: ; 35461 and a jr nz, .link_or_tower - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .link_or_tower ld a, [wd002] ld c, a ld b, 0 - ld hl, OTPartySpecies + ld hl, wOTPartySpecies add hl, bc ld a, [hl] ld [wNamedObjectIndexBuffer], a @@ -3255,10 +3255,10 @@ BattleCommand_BeatUp: ; 35461 .link_or_tower ld a, [wd002] - ld hl, OTPartyMonNicknames + ld hl, wOTPartyMonNicknames ld bc, NAME_LENGTH call AddNTimes - ld de, StringBuffer1 + ld de, wStringBuffer1 call CopyBytes .got_enemy_nick ld a, MON_HP @@ -3268,9 +3268,9 @@ BattleCommand_BeatUp: ; 35461 jp z, .beatup_fail ld a, [wd002] ld b, a - ld a, [CurOTMon] + ld a, [wCurOTMon] cp b - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus jr z, .active_enemy ld a, MON_STATUS @@ -3285,7 +3285,7 @@ BattleCommand_BeatUp: ; 35461 jr .finish_beatup .wild - ld a, [EnemyMonSpecies] + ld a, [wEnemyMonSpecies] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, BeatUpAttackText @@ -3295,18 +3295,18 @@ BattleCommand_BeatUp: ; 35461 .finish_beatup ld hl, BeatUpAttackText call StdBattleTextBox - ld a, [BattleMonSpecies] - ld [CurSpecies], a + ld a, [wBattleMonSpecies] + ld [wCurSpecies], a call GetBaseData - ld a, [BaseDefense] + ld a, [wBaseDefense] ld c, a push bc ld a, MON_SPECIES call GetBeatupMonLocation ld a, [hl] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData - ld a, [BaseAttack] + ld a, [wBaseAttack] pop bc ld b, a push bc @@ -3345,9 +3345,9 @@ GetBeatupMonLocation: ; 355bd ld b, 0 ld a, [hBattleTurn] and a - ld hl, PartyMon1Species + ld hl, wPartyMon1Species jr z, .got_species - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species .got_species ld a, [wd002] @@ -3359,7 +3359,7 @@ GetBeatupMonLocation: ; 355bd BattleCommand_ClearMissDamage: ; 355d5 ; clearmissdamage - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret z @@ -3372,14 +3372,14 @@ HitSelfInConfusion: ; 355dd call ResetDamage ld a, [hBattleTurn] and a - ld hl, BattleMonDefense - ld de, PlayerScreens - ld a, [BattleMonLevel] + ld hl, wBattleMonDefense + ld de, wPlayerScreens + ld a, [wBattleMonLevel] jr z, .got_it - ld hl, EnemyMonDefense - ld de, EnemyScreens - ld a, [EnemyMonLevel] + ld hl, wEnemyMonDefense + ld de, wEnemyScreens + ld a, [wEnemyMonLevel] .got_it push af ld a, [hli] @@ -3536,8 +3536,8 @@ BattleCommand_DamageCalc: ; 35612 call .CriticalMultiplier -; Update CurDamage (capped at 997). - ld hl, CurDamage +; Update wCurDamage (capped at 997). + ld hl, wCurDamage ld b, [hl] ld a, [hProduct + 3] add b @@ -3617,7 +3617,7 @@ BattleCommand_DamageCalc: ; 35612 .CriticalMultiplier: - ld a, [CriticalHit] + ld a, [wCriticalHit] and a ret z @@ -3648,11 +3648,11 @@ INCLUDE "data/battle/type_boost_items.asm" BattleCommand_ConstantDamage: ; 35726 ; constantdamage - ld hl, BattleMonLevel + ld hl, wBattleMonLevel ld a, [hBattleTurn] and a jr z, .got_turn - ld hl, EnemyMonLevel + ld hl, wEnemyMonLevel .got_turn ld a, BATTLE_VARS_MOVE_EFFECT @@ -3695,11 +3695,11 @@ BattleCommand_ConstantDamage: ; 35726 jr .got_power .super_fang - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, BattleMonHP + ld hl, wBattleMonHP .got_hp ld a, [hli] srl a @@ -3718,17 +3718,17 @@ BattleCommand_ConstantDamage: ; 35726 jr .got_power .got_power - ld hl, CurDamage + ld hl, wCurDamage ld [hli], a ld [hl], b ret .reversal - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hBattleTurn] and a jr z, .reversal_got_hp - ld hl, EnemyMonHP + ld hl, wEnemyMonHP .reversal_got_hp xor a ld [hDividend], a @@ -3818,7 +3818,7 @@ BattleCommand_Counter: ; 35813 ; counter ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar and a @@ -3841,18 +3841,18 @@ BattleCommand_Counter: ; 35813 ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar dec a - ld de, StringBuffer1 + ld de, wStringBuffer1 call GetMoveData - ld a, [StringBuffer1 + MOVE_POWER] + ld a, [wStringBuffer1 + MOVE_POWER] and a ret z - ld a, [StringBuffer1 + MOVE_TYPE] + ld a, [wStringBuffer1 + MOVE_TYPE] cp SPECIAL ret nc - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] or [hl] ret z @@ -3870,7 +3870,7 @@ BattleCommand_Counter: ; 35813 .capped xor a - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 35864 @@ -3879,13 +3879,13 @@ BattleCommand_Counter: ; 35813 BattleCommand_Encore: ; 35864 ; encore - ld hl, EnemyMonMoves - ld de, EnemyEncoreCount + ld hl, wEnemyMonMoves + ld de, wEnemyEncoreCount ld a, [hBattleTurn] and a jr z, .ok - ld hl, BattleMonMoves - ld de, PlayerEncoreCount + ld hl, wBattleMonMoves + ld de, wPlayerEncoreCount .ok ld a, BATTLE_VARS_LAST_MOVE_OPP call GetBattleVar @@ -3904,12 +3904,12 @@ BattleCommand_Encore: ; 35864 cp b jr nz, .got_move - ld bc, BattleMonPP - BattleMonMoves - 1 + ld bc, wBattleMonPP - wBattleMonMoves - 1 add hl, bc ld a, [hl] and PP_MASK jp z, .failed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, .failed ld a, BATTLE_VARS_SUBSTATUS5_OPP @@ -3930,10 +3930,10 @@ BattleCommand_Encore: ; 35864 jr z, .force_last_enemy_move push hl - ld a, [LastPlayerMove] + ld a, [wLastPlayerMove] ld b, a ld c, 0 - ld hl, BattleMonMoves + ld hl, wBattleMonMoves .find_player_move ld a, [hli] cp b @@ -3951,9 +3951,9 @@ BattleCommand_Encore: ; 35864 .got_player_move pop hl ld a, c - ld [CurMoveNum], a + ld [wCurMoveNum], a ld a, b - ld [CurPlayerMove], a + ld [wCurPlayerMove], a dec a ld de, wPlayerMoveStruct call GetMoveData @@ -3961,10 +3961,10 @@ BattleCommand_Encore: ; 35864 .force_last_enemy_move push hl - ld a, [LastEnemyMove] + ld a, [wLastEnemyMove] ld b, a ld c, 0 - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves .find_enemy_move ld a, [hli] cp b @@ -3982,9 +3982,9 @@ BattleCommand_Encore: ; 35864 .got_enemy_move pop hl ld a, c - ld [CurEnemyMoveNum], a + ld [wCurEnemyMoveNum], a ld a, b - ld [CurEnemyMove], a + ld [wCurEnemyMove], a dec a ld de, wEnemyMoveStruct call GetMoveData @@ -4003,28 +4003,28 @@ BattleCommand_Encore: ; 35864 BattleCommand_PainSplit: ; 35926 ; painsplit - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, .ButItFailed call CheckSubstituteOpp jp nz, .ButItFailed call AnimateCurrentMove - ld hl, BattleMonMaxHP + 1 - ld de, EnemyMonMaxHP + 1 + ld hl, wBattleMonMaxHP + 1 + ld de, wEnemyMonMaxHP + 1 call .PlayerShareHP ld a, $1 ld [wWhichHPBar], a hlcoord 10, 9 predef AnimateHPBar - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] - ld [Buffer4], a + ld [wBuffer4], a ld a, [hli] - ld [Buffer3], a + ld [wBuffer3], a ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a call .EnemyShareHP xor a ld [wWhichHPBar], a @@ -4038,28 +4038,28 @@ BattleCommand_PainSplit: ; 35926 .PlayerShareHP: ld a, [hld] - ld [Buffer1], a + ld [wBuffer1], a ld a, [hld] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hld] ld b, a - ld [Buffer3], a + ld [wBuffer3], a ld a, [hl] - ld [Buffer4], a + ld [wBuffer4], a dec de dec de ld a, [de] dec de add b - ld [CurDamage + 1], a + ld [wCurDamage + 1], a ld b, [hl] ld a, [de] adc b srl a - ld [CurDamage], a - ld a, [CurDamage + 1] + ld [wCurDamage], a + ld a, [wCurDamage + 1] rr a - ld [CurDamage + 1], a + ld [wCurDamage + 1], a inc hl inc hl inc hl @@ -4070,25 +4070,25 @@ BattleCommand_PainSplit: ; 35926 .EnemyShareHP: ; 359ac ld c, [hl] dec hl - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] sub c ld b, [hl] dec hl - ld a, [CurDamage] + ld a, [wCurDamage] sbc b jr nc, .skip - ld a, [CurDamage] + ld a, [wCurDamage] ld b, a - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld c, a .skip ld a, c ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a ld a, b ld [hli], a - ld [Buffer6], a + ld [wBuffer6], a ret ; 359cd @@ -4107,7 +4107,7 @@ BattleCommand_Snore: ; 359d0 ret nz call ResetDamage ld a, $1 - ld [AttackMissed], a + ld [wAttackMissed], a call FailSnore jp EndMoveEffect @@ -4117,14 +4117,14 @@ BattleCommand_Snore: ; 359d0 BattleCommand_Conversion2: ; 359e6 ; conversion2 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed - ld hl, BattleMonType1 + ld hl, wBattleMonType1 ld a, [hBattleTurn] and a jr z, .got_type - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 .got_type ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar @@ -4188,7 +4188,7 @@ BattleCommand_LockOn: ; 35a53 call CheckSubstituteOpp jr nz, .fail - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .fail @@ -4235,11 +4235,11 @@ BattleCommand_Sketch: ; 35a74 ld d, h ld e, l ; Get the battle move structs. - ld hl, BattleMonMoves + ld hl, wBattleMonMoves ld a, [hBattleTurn] and a jr z, .get_last_move - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves .get_last_move ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar @@ -4278,7 +4278,7 @@ BattleCommand_Sketch: ; 35a74 ld hl, Moves + MOVE_PP call GetMoveAttr pop hl - ld bc, BattleMonPP - BattleMonMoves + ld bc, wBattleMonPP - wBattleMonMoves add hl, bc ld [hl], a pop bc @@ -4361,17 +4361,17 @@ BattleCommand_SleepTalk: ; 35b33 ; sleeptalk call ClearLastMove - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .fail ld a, [hBattleTurn] and a - ld hl, BattleMonMoves + 1 - ld a, [DisabledMove] + ld hl, wBattleMonMoves + 1 + ld a, [wDisabledMove] ld d, a jr z, .got_moves - ld hl, EnemyMonMoves + 1 - ld a, [EnemyDisabledMove] + ld hl, wEnemyMonMoves + 1 + ld a, [wEnemyDisabledMove] ld d, a .got_moves ld a, BATTLE_VARS_STATUS @@ -4438,10 +4438,10 @@ BattleCommand_SleepTalk: ; 35b33 .check_has_usable_move ld a, [hBattleTurn] and a - ld a, [DisabledMove] + ld a, [wDisabledMove] jr z, .got_move_2 - ld a, [EnemyDisabledMove] + ld a, [wEnemyDisabledMove] .got_move_2 ld b, a ld a, BATTLE_VARS_MOVE @@ -4520,15 +4520,15 @@ BattleCommand_DestinyBond: ; 35bff BattleCommand_Spite: ; 35c0f ; spite - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, .failed ld bc, PARTYMON_STRUCT_LENGTH ; ???? - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves ld a, [hBattleTurn] and a jr z, .got_moves - ld hl, BattleMonMoves + ld hl, wBattleMonMoves .got_moves ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar @@ -4547,7 +4547,7 @@ BattleCommand_Spite: ; 35c0f dec hl ld b, 0 push bc - ld c, BattleMonPP - BattleMonMoves + ld c, wBattleMonPP - wBattleMonMoves add hl, bc pop bc ld a, [hl] @@ -4610,13 +4610,13 @@ BattleCommand_Spite: ; 35c0f BattleCommand_FalseSwipe: ; 35c94 ; falseswipe - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, BattleMonHP + ld hl, wBattleMonHP .got_hp - ld de, CurDamage + ld de, wCurDamage ld c, 2 push hl push de @@ -4637,11 +4637,11 @@ BattleCommand_FalseSwipe: ; 35c94 dec a ld [de], a .okay - ld a, [CriticalHit] + ld a, [wCriticalHit] cp 2 jr nz, .carry xor a - ld [CriticalHit], a + ld [wCriticalHit], a .carry scf ret @@ -4659,11 +4659,11 @@ BattleCommand_HealBell: ; 35cc9 ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarAddr res SUBSTATUS_NIGHTMARE, [hl] - ld de, PartyMon1Status + ld de, wPartyMon1Status ld a, [hBattleTurn] and a jr z, .got_status - ld de, OTPartyMon1Status + ld de, wOTPartyMon1Status .got_status ld a, BATTLE_VARS_STATUS call GetBattleVarAddr @@ -4704,9 +4704,9 @@ FarPlayBattleAnimation: ; 35d00 PlayFXAnimID: ; 35d08 ld a, e - ld [FXAnimID], a + ld [wFXAnimID], a ld a, d - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld c, 3 call DelayFrames @@ -4719,7 +4719,7 @@ PlayFXAnimID: ; 35d08 EnemyHurtItself: ; 35d1c - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] ld b, a ld a, [hl] @@ -4730,46 +4730,46 @@ EnemyHurtItself: ; 35d1c and a jr nz, .mimic_sub_check - ld a, [EnemySubStatus4] + ld a, [wEnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a jp nz, SelfInflictDamageToSubstitute .mimic_sub_check ld a, [hld] ld b, a - ld a, [EnemyMonHP + 1] - ld [Buffer3], a + ld a, [wEnemyMonHP + 1] + ld [wBuffer3], a sub b - ld [EnemyMonHP + 1], a + ld [wEnemyMonHP + 1], a ld a, [hl] ld b, a - ld a, [EnemyMonHP] - ld [Buffer4], a + ld a, [wEnemyMonHP] + ld [wBuffer4], a sbc b - ld [EnemyMonHP], a + ld [wEnemyMonHP], a jr nc, .mimic_faint - ld a, [Buffer4] + ld a, [wBuffer4] ld [hli], a - ld a, [Buffer3] + ld a, [wBuffer3] ld [hl], a xor a - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld [hli], a ld [hl], a .mimic_faint - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a - ld hl, EnemyMonHP + ld [wBuffer1], a + ld hl, wEnemyMonHP ld a, [hli] - ld [Buffer6], a + ld [wBuffer6], a ld a, [hl] - ld [Buffer5], a + ld [wBuffer5], a hlcoord 2, 2 xor a ld [wWhichHPBar], a @@ -4781,7 +4781,7 @@ EnemyHurtItself: ; 35d1c PlayerHurtItself: ; 35d7e - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] ld b, a ld a, [hl] @@ -4792,44 +4792,44 @@ PlayerHurtItself: ; 35d7e and a jr nz, .mimic_sub_check - ld a, [PlayerSubStatus4] + ld a, [wPlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a jp nz, SelfInflictDamageToSubstitute .mimic_sub_check ld a, [hld] ld b, a - ld a, [BattleMonHP + 1] - ld [Buffer3], a + ld a, [wBattleMonHP + 1] + ld [wBuffer3], a sub b - ld [BattleMonHP + 1], a - ld [Buffer5], a + ld [wBattleMonHP + 1], a + ld [wBuffer5], a ld b, [hl] - ld a, [BattleMonHP] - ld [Buffer4], a + ld a, [wBattleMonHP] + ld [wBuffer4], a sbc b - ld [BattleMonHP], a - ld [Buffer6], a + ld [wBattleMonHP], a + ld [wBuffer6], a jr nc, .mimic_faint - ld a, [Buffer4] + ld a, [wBuffer4] ld [hli], a - ld a, [Buffer3] + ld a, [wBuffer3] ld [hl], a xor a - ld hl, BattleMonHP + ld hl, wBattleMonHP ld [hli], a ld [hl], a - ld hl, Buffer5 + ld hl, wBuffer5 ld [hli], a ld [hl], a .mimic_faint - ld hl, BattleMonMaxHP + ld hl, wBattleMonMaxHP ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a hlcoord 10, 9 ld a, $1 ld [wWhichHPBar], a @@ -4845,14 +4845,14 @@ SelfInflictDamageToSubstitute: ; 35de0 ld hl, SubTookDamageText call StdBattleTextBox - ld de, EnemySubstituteHP + ld de, wEnemySubstituteHP ld a, [hBattleTurn] and a jr z, .got_hp - ld de, PlayerSubstituteHP + ld de, wPlayerSubstituteHP .got_hp - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] and a jr nz, .broke @@ -4910,7 +4910,7 @@ UpdateMoveData: ; 35e40 ld a, BATTLE_VARS_MOVE call GetBattleVar - ld [CurMove], a + ld [wCurMove], a ld [wNamedObjectIndexBuffer], a dec a @@ -4945,7 +4945,7 @@ BattleCommand_SleepTarget: ; 35e5c ld hl, AlreadyAsleepText jr nz, .fail - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, PrintDidntAffect2 @@ -4962,7 +4962,7 @@ BattleCommand_SleepTarget: ; 35e5c call AnimateCurrentMove ld b, $7 - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr z, .random_loop ld b, $3 @@ -5006,12 +5006,12 @@ BattleCommand_SleepTarget: ; 35e5c and a jr nz, .dont_fail - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .dont_fail ; Not locked-on by the enemy - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .dont_fail @@ -5035,7 +5035,7 @@ BattleCommand_PoisonTarget: ; 35eee call GetBattleVarAddr and a ret nz - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z call CheckIfTargetIsPoisonType @@ -5044,7 +5044,7 @@ BattleCommand_PoisonTarget: ; 35eee ld a, b cp HELD_PREVENT_POISON ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -5068,7 +5068,7 @@ BattleCommand_Poison: ; 35f2c ; poison ld hl, DoesntAffectText - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jp z, .failed @@ -5107,11 +5107,11 @@ BattleCommand_Poison: ; 35f2c and a jr nz, .mimic_random - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .mimic_random - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .mimic_random @@ -5122,7 +5122,7 @@ BattleCommand_Poison: ; 35f2c .mimic_random call CheckSubstituteOpp jr nz, .failed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed call .check_toxic @@ -5168,9 +5168,9 @@ BattleCommand_Poison: ; 35f2c call GetBattleVarAddr ld a, [hBattleTurn] and a - ld de, EnemyToxicCount + ld de, wEnemyToxicCount jr z, .ok - ld de, PlayerToxicCount + ld de, wPlayerToxicCount .ok ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar @@ -5181,11 +5181,11 @@ BattleCommand_Poison: ; 35f2c CheckIfTargetIsPoisonType: ; 35fe1 - ld de, EnemyMonType1 + ld de, wEnemyMonType1 ld a, [hBattleTurn] and a jr z, .ok - ld de, BattleMonType1 + ld de, wBattleMonType1 .ok ld a, [de] inc de @@ -5226,7 +5226,7 @@ BattleCommand_EatDream: ; 36008 SapHealth: ; 36011 - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] srl a ld [hDividend], a @@ -5239,15 +5239,15 @@ SapHealth: ; 36011 ld a, $1 ld [hDividend + 1], a .ok1 - ld hl, BattleMonHP - ld de, BattleMonMaxHP + ld hl, wBattleMonHP + ld de, wBattleMonMaxHP ld a, [hBattleTurn] and a jr z, .battlemonhp - ld hl, EnemyMonHP - ld de, EnemyMonMaxHP + ld hl, wEnemyMonHP + ld de, wEnemyMonMaxHP .battlemonhp - ld bc, Buffer4 + ld bc, wBuffer4 ld a, [hli] ld [bc], a ld a, [hl] @@ -5264,12 +5264,12 @@ SapHealth: ; 36011 ld b, [hl] add b ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a ld a, [hDividend] ld b, [hl] adc b ld [hli], a - ld [Buffer6], a + ld [wBuffer6], a jr c, .okay2 ld a, [hld] ld b, a @@ -5285,11 +5285,11 @@ SapHealth: ; 36011 .okay2 ld a, [de] ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a dec de ld a, [de] ld [hli], a - ld [Buffer6], a + ld [wBuffer6], a inc de .okay3 ld a, [hBattleTurn] @@ -5319,7 +5319,7 @@ BattleCommand_BurnTarget: ; 3608c call GetBattleVarAddr and a jp nz, Defrost - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z call CheckMoveTypeMatchesTarget ; Don't burn a Fire-type @@ -5328,7 +5328,7 @@ BattleCommand_BurnTarget: ; 3608c ld a, b cp HELD_PREVENT_BURN ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -5362,11 +5362,11 @@ Defrost: ; 360dd ld a, [hBattleTurn] and a - ld a, [CurOTMon] - ld hl, OTPartyMon1Status + ld a, [wCurOTMon] + ld hl, wOTPartyMon1Status jr z, .ok - ld hl, PartyMon1Status - ld a, [CurBattleMon] + ld hl, wPartyMon1Status + ld a, [wCurBattleMon] .ok call GetPartyLocation @@ -5391,7 +5391,7 @@ BattleCommand_FreezeTarget: ; 36102 call GetBattleVarAddr and a ret nz - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z ld a, [wBattleWeather] @@ -5403,7 +5403,7 @@ BattleCommand_FreezeTarget: ; 36102 ld a, b cp HELD_PREVENT_FREEZE ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -5447,14 +5447,14 @@ BattleCommand_ParalyzeTarget: ; 36165 call GetBattleVarAddr and a ret nz - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z call GetOpponentItem ld a, b cp HELD_PREVENT_PARALYZE ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -5548,7 +5548,7 @@ BattleCommand_EvasionUp2: ; 361e0 BattleCommand_StatUp: ; 361e4 ; statup call CheckIfStatCanBeRaised - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret nz jp StatUpAnimation @@ -5558,20 +5558,20 @@ BattleCommand_StatUp: ; 361e4 CheckIfStatCanBeRaised: ; 361ef ld a, b - ld [LoweredStat], a - ld hl, PlayerStatLevels + ld [wLoweredStat], a + ld hl, wPlayerStatLevels ld a, [hBattleTurn] and a jr z, .got_stat_levels - ld hl, EnemyStatLevels + ld hl, wEnemyStatLevels .got_stat_levels - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, .stat_raise_failed - ld a, [EffectFailed] + ld a, [wEffectFailed] and a jp nz, .stat_raise_failed - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld c, a ld b, 0 @@ -5581,7 +5581,7 @@ CheckIfStatCanBeRaised: ; 361ef ld a, $d cp b jp c, .cant_raise_stat - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 jr z, .got_num_stages inc b @@ -5595,13 +5595,13 @@ CheckIfStatCanBeRaised: ; 361ef ld a, c cp $5 jr nc, .done_calcing_stats - ld hl, BattleMonStats + 1 - ld de, PlayerStats + ld hl, wBattleMonStats + 1 + ld de, wPlayerStats ld a, [hBattleTurn] and a jr z, .got_stats_pointer - ld hl, EnemyMonStats + 1 - ld de, EnemyStats + ld hl, wEnemyMonStats + 1 + ld de, wEnemyStats .got_stats_pointer push bc sla c @@ -5632,7 +5632,7 @@ CheckIfStatCanBeRaised: ; 361ef .done_calcing_stats pop hl xor a - ld [FailedMessage], a + ld [wFailedMessage], a ret ; 3626e @@ -5647,9 +5647,9 @@ CheckIfStatCanBeRaised: ; 361ef .cant_raise_stat ; 36270 ld a, $2 - ld [FailedMessage], a + ld [wFailedMessage], a ld a, $1 - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 3627b @@ -5657,7 +5657,7 @@ CheckIfStatCanBeRaised: ; 361ef .stat_raise_failed ; 3627b ld a, $1 - ld [FailedMessage], a + ld [wFailedMessage], a ret ; 36281 @@ -5763,20 +5763,20 @@ BattleCommand_EvasionDown2: ; 362e1 BattleCommand_StatDown: ; 362e3 ; statdown - ld [LoweredStat], a + ld [wLoweredStat], a call CheckMist jp nz, .Mist - ld hl, EnemyStatLevels + ld hl, wEnemyStatLevels ld a, [hBattleTurn] and a jr z, .GetStatLevel - ld hl, PlayerStatLevels + ld hl, wPlayerStatLevels .GetStatLevel: ; Attempt to lower the stat. - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld c, a ld b, 0 @@ -5786,7 +5786,7 @@ BattleCommand_StatDown: ; 362e3 jp z, .CantLower ; Sharply lower the stat if applicable. - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 jr z, .ComputerMiss dec b @@ -5803,12 +5803,12 @@ BattleCommand_StatDown: ; 362e3 and a jr nz, .DidntMiss - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .DidntMiss ; Lock-On still always works. - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .DidntMiss @@ -5826,11 +5826,11 @@ BattleCommand_StatDown: ; 362e3 call CheckSubstituteOpp jr nz, .Failed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .Failed - ld a, [EffectFailed] + ld a, [wEffectFailed] and a jr nz, .Failed @@ -5844,13 +5844,13 @@ BattleCommand_StatDown: ; 362e3 jr nc, .Hit push hl - ld hl, EnemyMonAttack + 1 - ld de, EnemyStats + ld hl, wEnemyMonAttack + 1 + ld de, wEnemyStats ld a, [hBattleTurn] and a jr z, .do_enemy - ld hl, BattleMonAttack + 1 - ld de, PlayerStats + ld hl, wBattleMonAttack + 1 + ld de, wPlayerStats .do_enemy call TryLowerStat pop hl @@ -5858,29 +5858,29 @@ BattleCommand_StatDown: ; 362e3 .Hit: xor a - ld [FailedMessage], a + ld [wFailedMessage], a ret .CouldntLower: inc [hl] .CantLower: ld a, 3 - ld [FailedMessage], a + ld [wFailedMessage], a ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ret .Failed: ld a, 1 - ld [FailedMessage], a - ld [AttackMissed], a + ld [wFailedMessage], a + ld [wAttackMissed], a ret .Mist: ld a, 2 - ld [FailedMessage], a + ld [wFailedMessage], a ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 36391 @@ -5915,10 +5915,10 @@ CheckMist: ; 36391 BattleCommand_StatUpMessage: ; 363b8 - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret nz - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld b, a inc b @@ -5930,7 +5930,7 @@ BattleCommand_StatUpMessage: ; 363b8 text_jump UnknownText_0x1c0cc6 start_asm ld hl, .up - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 ret z ld hl, .wayup @@ -5948,10 +5948,10 @@ BattleCommand_StatUpMessage: ; 363b8 BattleCommand_StatDownMessage: ; 363e9 - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret nz - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld b, a inc b @@ -5963,7 +5963,7 @@ BattleCommand_StatDownMessage: ; 363e9 text_jump UnknownText_0x1c0ceb start_asm ld hl, .fell - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 ret z ld hl, .sharplyfell @@ -6027,7 +6027,7 @@ TryLowerStat: ; 3641a BattleCommand_StatUpFailText: ; 3644c ; statupfailtext - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret z push af @@ -6035,7 +6035,7 @@ BattleCommand_StatUpFailText: ; 3644c pop af dec a jp z, TryPrintButItFailed - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld b, a inc b @@ -6048,7 +6048,7 @@ BattleCommand_StatUpFailText: ; 3644c BattleCommand_StatDownFailText: ; 3646a ; statdownfailtext - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret z push af @@ -6059,7 +6059,7 @@ BattleCommand_StatDownFailText: ; 3646a dec a ld hl, ProtectedByMistText jp z, StdBattleTextBox - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld b, a inc b @@ -6083,8 +6083,8 @@ GetStatName: ; 3648f jr .GetName .Copy: - ld de, StringBuffer2 - ld bc, StringBuffer3 - StringBuffer2 + ld de, wStringBuffer2 + ld bc, wStringBuffer3 - wStringBuffer2 jp CopyBytes INCLUDE "data/battle/stat_names.asm" @@ -6125,23 +6125,23 @@ BattleCommand_AllStatsUp: ; 36500 ResetMiss: ; 3652d xor a - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 36532 LowerStat: ; 36532 - ld [LoweredStat], a + ld [wLoweredStat], a - ld hl, PlayerStatLevels + ld hl, wPlayerStatLevels ld a, [hBattleTurn] and a jr z, .got_target - ld hl, EnemyStatLevels + ld hl, wEnemyStatLevels .got_target - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld c, a ld b, 0 @@ -6150,7 +6150,7 @@ LowerStat: ; 36532 dec b jr z, .cant_lower_anymore - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 jr z, .got_num_stages dec b @@ -6164,13 +6164,13 @@ LowerStat: ; 36532 jr nc, .accuracy_evasion push hl - ld hl, BattleMonStats + 1 - ld de, PlayerStats + ld hl, wBattleMonStats + 1 + ld de, wPlayerStats ld a, [hBattleTurn] and a jr z, .got_target_2 - ld hl, EnemyMonStats + 1 - ld de, EnemyStats + ld hl, wEnemyMonStats + 1 + ld de, wEnemyStats .got_target_2 call TryLowerStat @@ -6191,7 +6191,7 @@ LowerStat: ; 36532 .finish xor a - ld [FailedMessage], a + ld [wFailedMessage], a ret .failed @@ -6199,7 +6199,7 @@ LowerStat: ; 36532 .cant_lower_anymore ld a, 2 - ld [FailedMessage], a + ld [wFailedMessage], a ret ; 3658f @@ -6269,9 +6269,9 @@ BattleCommand_LowerSubNoAnim: ; 365c3 CalcPlayerStats: ; 365d7 - ld hl, PlayerAtkLevel - ld de, PlayerStats - ld bc, BattleMonAttack + ld hl, wPlayerAtkLevel + ld de, wPlayerStats + ld bc, wBattleMonAttack ld a, 5 call CalcStats @@ -6293,9 +6293,9 @@ CalcPlayerStats: ; 365d7 CalcEnemyStats: ; 365fd - ld hl, EnemyAtkLevel - ld de, EnemyStats - ld bc, EnemyMonAttack + ld hl, wEnemyAtkLevel + ld de, wEnemyStats + ld bc, wEnemyMonAttack ld a, 5 call CalcStats @@ -6393,11 +6393,11 @@ BattleCommand_StoreEnergy: ; 36671 bit SUBSTATUS_BIDE, a ret z - ld hl, PlayerRolloutCount + ld hl, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .check_still_storing_energy - ld hl, EnemyRolloutCount + ld hl, wEnemyRolloutCount .check_still_storing_energy dec [hl] jr nz, .still_storing @@ -6413,30 +6413,30 @@ BattleCommand_StoreEnergy: ; 36671 call GetBattleVarAddr ld a, 1 ld [hl], a - ld hl, PlayerDamageTaken + 1 + ld hl, wPlayerDamageTaken + 1 ld de, wPlayerCharging ; player ld a, [hBattleTurn] and a jr z, .player - ld hl, EnemyDamageTaken + 1 + ld hl, wEnemyDamageTaken + 1 ld de, wEnemyCharging ; enemy .player ld a, [hld] add a ld b, a - ld [CurDamage + 1], a + ld [wCurDamage + 1], a ld a, [hl] rl a - ld [CurDamage], a + ld [wCurDamage], a jr nc, .not_maxed ld a, $ff - ld [CurDamage], a - ld [CurDamage + 1], a + ld [wCurDamage], a + ld [wCurDamage + 1], a .not_maxed or b jr nz, .built_up_something ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a .built_up_something xor a ld [hli], a @@ -6462,13 +6462,13 @@ BattleCommand_StoreEnergy: ; 36671 BattleCommand_UnleashEnergy: ; 366e5 ; unleashenergy - ld de, PlayerDamageTaken - ld bc, PlayerRolloutCount + ld de, wPlayerDamageTaken + ld bc, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .got_damage - ld de, EnemyDamageTaken - ld bc, EnemyRolloutCount + ld de, wEnemyDamageTaken + ld bc, wEnemyRolloutCount .got_damage ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr @@ -6495,11 +6495,11 @@ BattleCommand_UnleashEnergy: ; 366e5 BattleCommand_CheckRampage: ; 3671a ; checkrampage - ld de, PlayerRolloutCount + ld de, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .player - ld de, EnemyRolloutCount + ld de, wEnemyRolloutCount .player ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr @@ -6541,11 +6541,11 @@ BattleCommand_Rampage: ; 36751 and SLP ret nz - ld de, PlayerRolloutCount + ld de, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .ok - ld de, EnemyRolloutCount + ld de, wEnemyRolloutCount .ok ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr @@ -6565,7 +6565,7 @@ BattleCommand_Rampage: ; 36751 BattleCommand_Teleport: ; 36778 ; teleport - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_SHINY jr z, .failed cp BATTLETYPE_TRAP @@ -6588,9 +6588,9 @@ BattleCommand_Teleport: ; 36778 dec a jr nz, .failed ; If your level is greater than the opponent's, you run without fail. - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld b, a - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] cp b jr nc, .run_away ; Generate a number between 0 and (YourLevel + TheirLevel). @@ -6615,9 +6615,9 @@ BattleCommand_Teleport: ; 36778 ld a, [wBattleMode] dec a jr nz, .failed - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld b, a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] cp b jr nc, .run_away add b @@ -6668,7 +6668,7 @@ SetBattleDraw: ; 36804 BattleCommand_ForceSwitch: ; 3680f ; forceswitch - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_SHINY jp z, .fail cp BATTLETYPE_TRAP @@ -6680,15 +6680,15 @@ BattleCommand_ForceSwitch: ; 3680f ld a, [hBattleTurn] and a jp nz, .force_player_switch - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .missed ld a, [wBattleMode] dec a jr nz, .trainer - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld b, a - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] cp b jr nc, .wild_force_flee add b @@ -6732,9 +6732,9 @@ BattleCommand_ForceSwitch: ; 3680f call ClearBox ld c, 20 call DelayFrames - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld b, a - ld a, [CurOTMon] + ld a, [wCurOTMon] ld c, a ; select a random enemy mon to switch to .random_loop_trainer @@ -6746,7 +6746,7 @@ BattleCommand_ForceSwitch: ; 3680f jr z, .random_loop_trainer push af push bc - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP call GetPartyLocation ld a, [hli] or [hl] @@ -6768,7 +6768,7 @@ BattleCommand_ForceSwitch: ; 3680f jp .fail .force_player_switch - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .player_miss @@ -6776,9 +6776,9 @@ BattleCommand_ForceSwitch: ; 3680f dec a jr nz, .vs_trainer - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld b, a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] cp b jr nc, .wild_succeed_playeristarget @@ -6827,9 +6827,9 @@ BattleCommand_ForceSwitch: ; 3680f call ClearBox ld c, 20 call DelayFrames - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ld c, a .random_loop_trainer_playeristarget call BattleRandom @@ -6842,7 +6842,7 @@ BattleCommand_ForceSwitch: ; 3680f push af push bc - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call GetPartyLocation ld a, [hli] or [hl] @@ -6851,7 +6851,7 @@ BattleCommand_ForceSwitch: ; 3680f jr z, .random_loop_trainer_playeristarget ld a, d - ld [CurPartyMon], a + ld [wCurPartyMon], a ld hl, SwitchPlayerMon call CallBattleCore @@ -6888,17 +6888,17 @@ BattleCommand_ForceSwitch: ; 3680f CheckPlayerHasMonToSwitchTo: ; 36994 - ld a, [PartyCount] + ld a, [wPartyCount] ld d, a ld e, 0 ld bc, PARTYMON_STRUCT_LENGTH .loop - ld a, [CurBattleMon] + ld a, [wCurBattleMon] cp e jr z, .next ld a, e - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call AddNTimes ld a, [hli] or [hl] @@ -6924,13 +6924,13 @@ BattleCommand_EndLoop: ; 369b6 ; Loop back to the command before 'critical'. - ld de, PlayerRolloutCount - ld bc, PlayerDamageTaken + ld de, wPlayerRolloutCount + ld bc, wPlayerDamageTaken ld a, [hBattleTurn] and a jr z, .got_addrs - ld de, EnemyRolloutCount - ld bc, EnemyDamageTaken + ld de, wEnemyRolloutCount + ld bc, wEnemyDamageTaken .got_addrs ld a, BATTLE_VARS_SUBSTATUS3 @@ -6965,7 +6965,7 @@ BattleCommand_EndLoop: ; 369b6 ld a, [hBattleTurn] and a jr nz, .check_ot_beat_up - ld a, [PartyCount] + ld a, [wPartyCount] cp 1 jp z, .only_one_beatup dec a @@ -6975,7 +6975,7 @@ BattleCommand_EndLoop: ; 369b6 ld a, [wBattleMode] cp WILD_BATTLE jp z, .only_one_beatup - ld a, [OTPartyCount] + ld a, [wOTPartyCount] cp 1 jp z, .only_one_beatup dec a @@ -7039,9 +7039,9 @@ BattleCommand_EndLoop: ; 369b6 ; Loop back to the command before 'critical'. .loop_back_to_critical - ld a, [BattleScriptBufferAddress + 1] + ld a, [wBattleScriptBufferAddress + 1] ld h, a - ld a, [BattleScriptBufferAddress] + ld a, [wBattleScriptBufferAddress] ld l, a .not_critical ld a, [hld] @@ -7049,16 +7049,16 @@ BattleCommand_EndLoop: ; 369b6 jr nz, .not_critical inc hl ld a, h - ld [BattleScriptBufferAddress + 1], a + ld [wBattleScriptBufferAddress + 1], a ld a, l - ld [BattleScriptBufferAddress], a + ld [wBattleScriptBufferAddress], a ret ; 36a82 BattleCommand_FakeOut: ; 36a82 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz @@ -7075,7 +7075,7 @@ BattleCommand_FakeOut: ; 36a82 .fail ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 36aa0 @@ -7093,7 +7093,7 @@ BattleCommand_FlinchTarget: ; 36aa0 call CheckOpponentWentFirst ret nz - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz @@ -7127,7 +7127,7 @@ CheckOpponentWentFirst: ; 36abf BattleCommand_HeldFlinch: ; 36ac9 ; kingsrock - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz @@ -7159,11 +7159,11 @@ BattleCommand_OHKO: ; 36af3 ; ohko call ResetDamage - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jr z, .no_effect - ld hl, EnemyMonLevel - ld de, BattleMonLevel + ld hl, wEnemyMonLevel + ld de, wBattleMonLevel ld bc, wPlayerMoveStruct + MOVE_ACC ld a, [hBattleTurn] and a @@ -7186,19 +7186,19 @@ BattleCommand_OHKO: ; 36af3 .finish_ohko ld [bc], a call BattleCommand_CheckHit - ld hl, CurDamage + ld hl, wCurDamage ld a, $ff ld [hli], a ld [hl], a ld a, $2 - ld [CriticalHit], a + ld [wCriticalHit], a ret .no_effect ld a, $ff - ld [CriticalHit], a + ld [wCriticalHit], a ld a, $1 - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 36b3a @@ -7240,7 +7240,7 @@ BattleCommand_Charge: ; 36b4d set SUBSTATUS_CHARGED, [hl] ld hl, IgnoredOrders2Text - ld a, [AlreadyDisobeyed] + ld a, [wAlreadyDisobeyed] and a call nz, StdBattleTextBox @@ -7373,7 +7373,7 @@ BattleCommand3c: ; 36c2c BattleCommand_TrapTarget: ; 36c2d ; traptarget - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz ld hl, wEnemyWrapCount @@ -7469,19 +7469,19 @@ BattleCommand_FocusEnergy: ; 36c98 BattleCommand_Recoil: ; 36cb2 ; recoil - ld hl, BattleMonMaxHP + ld hl, wBattleMonMaxHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP .got_hp ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld d, a ; get 1/4 damage or 1 HP, whichever is higher - ld a, [CurDamage] + ld a, [wCurDamage] ld b, a - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld c, a srl b rr c @@ -7493,26 +7493,26 @@ BattleCommand_Recoil: ; 36cb2 inc c .min_damage ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a dec hl dec hl ld a, [hl] - ld [Buffer3], a + ld [wBuffer3], a sub c ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a ld a, [hl] - ld [Buffer4], a + ld [wBuffer4], a sbc b ld [hl], a - ld [Buffer6], a + ld [wBuffer6], a jr nc, .dont_ko xor a ld [hli], a ld [hl], a - ld hl, Buffer5 + ld hl, wBuffer5 ld [hli], a ld [hl], a .dont_ko @@ -7540,7 +7540,7 @@ BattleCommand_ConfuseTarget: ; 36d1d ld a, b cp HELD_PREVENT_CONFUSE ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -7580,15 +7580,15 @@ BattleCommand_Confuse: ; 36d3b .not_already_confused call CheckSubstituteOpp jr nz, BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit BattleCommand_FinishConfusingTarget: ; 36d70 - ld bc, EnemyConfuseCount + ld bc, wEnemyConfuseCount ld a, [hBattleTurn] and a jr z, .got_confuse_count - ld bc, PlayerConfuseCount + ld bc, wPlayerConfuseCount .got_confuse_count set SUBSTATUS_CONFUSED, [hl] @@ -7649,7 +7649,7 @@ BattleCommand_Paralyze: ; 36dc7 call GetBattleVar bit PAR, a jr nz, .paralyzed - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jr z, .didnt_affect call GetOpponentItem @@ -7672,11 +7672,11 @@ BattleCommand_Paralyze: ; 36dc7 and a jr nz, .dont_sample_failure - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .dont_sample_failure - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .dont_sample_failure @@ -7689,7 +7689,7 @@ BattleCommand_Paralyze: ; 36dc7 call GetBattleVarAddr and a jr nz, .failed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed call CheckSubstituteOpp @@ -7732,11 +7732,11 @@ CheckMoveTypeMatchesTarget: ; 36e5b push hl - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 ld a, [hBattleTurn] and a jr z, .ok - ld hl, BattleMonType1 + ld hl, wBattleMonType1 .ok ld a, BATTLE_VARS_MOVE_TYPE @@ -7767,13 +7767,13 @@ BattleCommand_Substitute: ; 36e7c ; substitute call BattleCommand_MoveDelay - ld hl, BattleMonMaxHP - ld de, PlayerSubstituteHP + ld hl, wBattleMonMaxHP + ld de, wPlayerSubstituteHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, EnemyMonMaxHP - ld de, EnemySubstituteHP + ld hl, wEnemyMonMaxHP + ld de, wEnemySubstituteHP .got_hp ld a, BATTLE_VARS_SUBSTATUS4 @@ -7826,7 +7826,7 @@ BattleCommand_Substitute: ; 36e7c xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld [wKickCounter], a ld a, SUBSTITUTE call LoadAnim @@ -7908,7 +7908,7 @@ BattleCommand_DoubleUndergroundDamage: ; 36f2f DoubleDamage: ; 36f37 - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] @@ -7928,14 +7928,14 @@ BattleCommand_Mimic: ; 36f46 call ClearLastMove call BattleCommand_MoveDelay - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .fail - ld hl, BattleMonMoves + ld hl, wBattleMonMoves ld a, [hBattleTurn] and a jr z, .player_turn - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves .player_turn call CheckHiddenOpponent jr nz, .fail @@ -7963,7 +7963,7 @@ BattleCommand_Mimic: ; 36f46 call GetBattleVar ld [hl], a ld [wNamedObjectIndexBuffer], a - ld bc, BattleMonPP - BattleMonMoves + ld bc, wBattleMonPP - wBattleMonMoves add hl, bc ld [hl], 5 call GetMoveName @@ -7979,17 +7979,17 @@ BattleCommand_Mimic: ; 36f46 BattleCommand_LeechSeed: ; 36f9d ; leechseed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .evaded call CheckSubstituteOpp jr nz, .evaded - ld de, EnemyMonType1 + ld de, wEnemyMonType1 ld a, [hBattleTurn] and a jr z, .ok - ld de, BattleMonType1 + ld de, wBattleMonType1 .ok ld a, [de] @@ -8032,17 +8032,17 @@ BattleCommand_Splash: ; 36fe1 BattleCommand_Disable: ; 36fed ; disable - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed - ld de, EnemyDisableCount - ld hl, EnemyMonMoves + ld de, wEnemyDisableCount + ld hl, wEnemyMonMoves ld a, [hBattleTurn] and a jr z, .got_moves - ld de, PlayerDisableCount - ld hl, BattleMonMoves + ld de, wPlayerDisableCount + ld hl, wBattleMonMoves .got_moves ld a, [de] @@ -8066,9 +8066,9 @@ BattleCommand_Disable: ; 36fed ld a, [hBattleTurn] and a - ld hl, EnemyMonPP + ld hl, wEnemyMonPP jr z, .got_pp - ld hl, BattleMonPP + ld hl, wBattleMonPP .got_pp ld b, 0 add hl, bc @@ -8085,7 +8085,7 @@ BattleCommand_Disable: ; 36fed add c ld [de], a call AnimateCurrentMove - ld hl, DisabledMove + ld hl, wDisabledMove ld a, [hBattleTurn] and a jr nz, .got_disabled_move_pointer @@ -8109,14 +8109,14 @@ BattleCommand_PayDay: ; 3705c ; payday xor a - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld [hli], a ld a, [hBattleTurn] and a - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] jr z, .ok - ld a, [EnemyMonLevel] + ld a, [wEnemyMonLevel] .ok add a @@ -8138,17 +8138,17 @@ BattleCommand_PayDay: ; 3705c BattleCommand_Conversion: ; 3707f ; conversion - ld hl, BattleMonMoves - ld de, BattleMonType1 + ld hl, wBattleMonMoves + ld de, wBattleMonType1 ld a, [hBattleTurn] and a jr z, .got_moves - ld hl, EnemyMonMoves - ld de, EnemyMonType1 + ld hl, wEnemyMonMoves + ld de, wEnemyMonType1 .got_moves push de ld c, 0 - ld de, StringBuffer1 + ld de, wStringBuffer1 .loop push hl ld b, 0 @@ -8178,7 +8178,7 @@ BattleCommand_Conversion: ; 3707f inc de ld [de], a pop de - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .loop2 ld a, [hl] cp -1 @@ -8207,7 +8207,7 @@ BattleCommand_Conversion: ; 3707f maskbits NUM_MOVES ld c, a ld b, 0 - ld hl, StringBuffer1 + ld hl, wStringBuffer1 add hl, bc ld a, [hl] cp -1 @@ -8239,9 +8239,9 @@ BattleCommand_ResetStats: ; 3710e ; resetstats ld a, 7 ; neutral - ld hl, PlayerStatLevels + ld hl, wPlayerStatLevels call .Fill - ld hl, EnemyStatLevels + ld hl, wEnemyStatLevels call .Fill ld a, [hBattleTurn] @@ -8261,7 +8261,7 @@ BattleCommand_ResetStats: ; 3710e jp StdBattleTextBox .Fill: - ld b, PlayerStatLevelsEnd - PlayerStatLevels + ld b, wPlayerStatLevelsEnd - wPlayerStatLevels .next ld [hli], a dec b @@ -8274,13 +8274,13 @@ BattleCommand_ResetStats: ; 3710e BattleCommand_Heal: ; 3713e ; heal - ld de, BattleMonHP - ld hl, BattleMonMaxHP + ld de, wBattleMonHP + ld hl, wBattleMonMaxHP ld a, [hBattleTurn] and a jr z, .got_hp - ld de, EnemyMonHP - ld hl, EnemyMonMaxHP + ld de, wEnemyMonHP + ld hl, wEnemyMonMaxHP .got_hp ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -8403,14 +8403,14 @@ ResetActorDisable: ; 372e7 jr z, .player xor a - ld [EnemyDisableCount], a - ld [EnemyDisabledMove], a + ld [wEnemyDisableCount], a + ld [wEnemyDisabledMove], a ret .player xor a - ld [PlayerDisableCount], a - ld [DisabledMove], a + ld [wPlayerDisableCount], a + ld [wDisabledMove], a ret ; 372fc @@ -8419,13 +8419,13 @@ ResetActorDisable: ; 372e7 BattleCommand_Screen: ; 372fc ; screen - ld hl, PlayerScreens - ld bc, PlayerLightScreenCount + ld hl, wPlayerScreens + ld bc, wPlayerLightScreenCount ld a, [hBattleTurn] and a jr z, .got_screens_pointer - ld hl, EnemyScreens - ld bc, EnemyLightScreenCount + ld hl, wEnemyScreens + ld bc, wEnemyLightScreenCount .got_screens_pointer ld a, BATTLE_VARS_MOVE_EFFECT @@ -8481,7 +8481,7 @@ PrintNothingHappened: ; 37343 TryPrintButItFailed: ; 37349 - ld a, [AlreadyFailed] + ld a, [wAlreadyFailed] and a ret nz @@ -8590,11 +8590,11 @@ INCLUDE "engine/battle/effect_commands/metronome.asm" CheckUserMove: ; 37462 ; Return z if the user has move a. ld b, a - ld de, BattleMonMoves + ld de, wBattleMonMoves ld a, [hBattleTurn] and a jr z, .ok - ld de, EnemyMonMoves + ld de, wEnemyMonMoves .ok ld c, NUM_MOVES @@ -8624,7 +8624,7 @@ ResetTurn: ; 3747b .player ld [hl], 1 xor a - ld [AlreadyDisobeyed], a + ld [wAlreadyDisobeyed], a call DoMove jp EndMoveEffect @@ -8727,14 +8727,14 @@ BattleCommand5d: ; 37791 BattleCommand_FuryCutter: ; 37792 ; furycutter - ld hl, PlayerFuryCutterCount + ld hl, wPlayerFuryCutterCount ld a, [hBattleTurn] and a jr z, .go - ld hl, EnemyFuryCutterCount + ld hl, wEnemyFuryCutterCount .go - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, ResetFuryCutterCount @@ -8752,7 +8752,7 @@ BattleCommand_FuryCutter: ; 37792 ret z ; Double the damage - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] @@ -8771,11 +8771,11 @@ ResetFuryCutterCount: ; 377be push hl - ld hl, PlayerFuryCutterCount + ld hl, wPlayerFuryCutterCount ld a, [hBattleTurn] and a jr z, .reset - ld hl, EnemyFuryCutterCount + ld hl, wEnemyFuryCutterCount .reset xor a @@ -8792,11 +8792,11 @@ INCLUDE "engine/battle/effect_commands/attract.asm" BattleCommand_HappinessPower: ; 3784b ; happinesspower push bc - ld hl, BattleMonHappiness + ld hl, wBattleMonHappiness ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyMonHappiness + ld hl, wEnemyMonHappiness .ok xor a ld [hMultiplicand + 0], a @@ -8824,11 +8824,11 @@ BattleCommand_FrustrationPower: ; 3790e ; frustrationpower push bc - ld hl, BattleMonHappiness + ld hl, wBattleMonHappiness ld a, [hBattleTurn] and a jr z, .got_happiness - ld hl, EnemyMonHappiness + ld hl, wEnemyMonHappiness .got_happiness ld a, $ff sub [hl] @@ -8854,13 +8854,13 @@ BattleCommand_FrustrationPower: ; 3790e BattleCommand_Safeguard: ; 37939 ; safeguard - ld hl, PlayerScreens - ld de, PlayerSafeguardCount + ld hl, wPlayerScreens + ld de, wPlayerSafeguardCount ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyScreens - ld de, EnemySafeguardCount + ld hl, wEnemyScreens + ld de, wEnemySafeguardCount .ok bit SCREENS_SAFEGUARD, [hl] jr nz, .failed @@ -8880,11 +8880,11 @@ BattleCommand_Safeguard: ; 37939 SafeCheckSafeguard: ; 37962 push hl - ld hl, EnemyScreens + ld hl, wEnemyScreens ld a, [hBattleTurn] and a jr z, .got_turn - ld hl, PlayerScreens + ld hl, wPlayerScreens .got_turn bit SCREENS_SAFEGUARD, [hl] @@ -8896,16 +8896,16 @@ SafeCheckSafeguard: ; 37962 BattleCommand_CheckSafeguard: ; 37972 ; checksafeguard - ld hl, EnemyScreens + ld hl, wEnemyScreens ld a, [hBattleTurn] and a jr z, .got_turn - ld hl, PlayerScreens + ld hl, wPlayerScreens .got_turn bit SCREENS_SAFEGUARD, [hl] ret z ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a call BattleCommand_MoveDelay ld hl, SafeguardProtectText call StdBattleTextBox @@ -9069,7 +9069,7 @@ BatonPass_LinkEnemySwitch: ; 37a82 ld hl, LinkBattleSendReceiveAction call CallBattleCore - ld a, [OTPartyCount] + ld a, [wOTPartyCount] add BATTLEACTION_SWITCH1 ld b, a ld a, [wBattleAction] @@ -9079,7 +9079,7 @@ BatonPass_LinkEnemySwitch: ; 37a82 jr c, .switch .baton_pass - ld a, [CurOTMon] + ld a, [wCurOTMon] add BATTLEACTION_SWITCH1 ld [wBattleAction], a .switch @@ -9113,11 +9113,11 @@ ResetBatonPassStatus: ; 37ab1 call ResetActorDisable ; Attraction isn't passed. - ld hl, PlayerSubStatus1 + ld hl, wPlayerSubStatus1 res SUBSTATUS_IN_LOVE, [hl] - ld hl, EnemySubStatus1 + ld hl, wEnemySubStatus1 res SUBSTATUS_IN_LOVE, [hl] - ld hl, PlayerSubStatus5 + ld hl, wPlayerSubStatus5 ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarAddr @@ -9138,10 +9138,10 @@ ResetBatonPassStatus: ; 37ab1 CheckAnyOtherAlivePartyMons: ; 37ae9 - ld hl, PartyMon1HP - ld a, [PartyCount] + ld hl, wPartyMon1HP + ld a, [wPartyCount] ld d, a - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ld e, a jr CheckAnyOtherAliveMons @@ -9149,10 +9149,10 @@ CheckAnyOtherAlivePartyMons: ; 37ae9 CheckAnyOtherAliveEnemyMons: ; 37af6 - ld hl, OTPartyMon1HP - ld a, [OTPartyCount] + ld hl, wOTPartyMon1HP + ld a, [wOTPartyCount] ld d, a - ld a, [CurOTMon] + ld a, [wCurOTMon] ld e, a ; fallthrough @@ -9211,7 +9211,7 @@ BattleCommand_Pursuit: ; 37b1d and a ret z - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] @@ -9237,12 +9237,12 @@ BattleCommand_ClearHazards: ; 37b39 call StdBattleTextBox .not_leeched - ld hl, PlayerScreens + ld hl, wPlayerScreens ld de, wPlayerWrapCount ld a, [hBattleTurn] and a jr z, .got_screens_wrap - ld hl, EnemyScreens + ld hl, wEnemyScreens ld de, wEnemyWrapCount .got_screens_wrap bit SCREENS_SPIKES, [hl] @@ -9288,13 +9288,13 @@ BattleCommand_HealNite: ; 37b7c BattleCommand_TimeBasedHealContinue: ; 37b7e ; Time- and weather-sensitive heal. - ld hl, BattleMonMaxHP - ld de, BattleMonHP + ld hl, wBattleMonMaxHP + ld de, wBattleMonHP ld a, [hBattleTurn] and a jr z, .start - ld hl, EnemyMonMaxHP - ld de, EnemyMonHP + ld hl, wEnemyMonMaxHP + ld de, wEnemyMonHP .start ; Index for .Multipliers @@ -9312,7 +9312,7 @@ BattleCommand_TimeBasedHealContinue: ; 37b7e and a jr nz, .checkWeather - ld a, [TimeOfDay] + ld a, [wTimeOfDay] cp b jr z, .checkWeather dec c ; double @@ -9372,7 +9372,7 @@ BattleCommand_TimeBasedHealContinue: ; 37b7e BattleCommand_HiddenPower: ; 37be8 ; hiddenpower - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz farcall HiddenPowerDamage @@ -9386,7 +9386,7 @@ BattleCommand_StartRain: ; 37bf4 ld a, WEATHER_RAIN ld [wBattleWeather], a ld a, 5 - ld [WeatherCount], a + ld [wWeatherCount], a call AnimateCurrentMove ld hl, DownpourText jp StdBattleTextBox @@ -9399,7 +9399,7 @@ BattleCommand_StartSun: ; 37c07 ld a, WEATHER_SUN ld [wBattleWeather], a ld a, 5 - ld [WeatherCount], a + ld [wWeatherCount], a call AnimateCurrentMove ld hl, SunGotBrightText jp StdBattleTextBox @@ -9413,7 +9413,7 @@ BattleCommand_BellyDrum: ; 37c1a ; before checking that it has enough HP to use the move. ; Swap the order of these two blocks to fix. call BattleCommand_AttackUp2 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed @@ -9448,8 +9448,8 @@ BattleCommand_BellyDrum: ; 37c1a BattleCommand_PsychUp: ; 37c55 ; psychup - ld hl, EnemyStatLevels - ld de, PlayerStatLevels + ld hl, wEnemyStatLevels + ld de, wPlayerStatLevels ld a, [hBattleTurn] and a jr z, .pointers_correct @@ -9502,7 +9502,7 @@ BattleCommand_MirrorCoat: ; 37c95 ; mirrorcoat ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar @@ -9526,18 +9526,18 @@ BattleCommand_MirrorCoat: ; 37c95 ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar dec a - ld de, StringBuffer1 + ld de, wStringBuffer1 call GetMoveData - ld a, [StringBuffer1 + 2] + ld a, [wStringBuffer1 + 2] and a ret z - ld a, [StringBuffer1 + 3] + ld a, [wStringBuffer1 + 3] cp SPECIAL ret c - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] or [hl] ret z @@ -9555,7 +9555,7 @@ BattleCommand_MirrorCoat: ; 37c95 .capped xor a - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 37ce6 @@ -9573,7 +9573,7 @@ BattleCommand_DoubleMinimizeDamage: ; 37ce6 ld a, [hl] and a ret z - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] @@ -9618,9 +9618,9 @@ BattleCommand_CheckFutureSight: ; 37d0d ld [hl], 0 ld a, [de] inc de - ld [CurDamage], a + ld [wCurDamage], a ld a, [de] - ld [CurDamage + 1], a + ld [wCurDamage + 1], a ld b, futuresight_command jp SkipToBattleCommand @@ -9663,7 +9663,7 @@ BattleCommand_FutureSight: ; 37d34 jr z, .StoreDamage ld de, wEnemyFutureSightDamage .StoreDamage: - ld hl, CurDamage + ld hl, wCurDamage ld a, [hl] ld [de], a ld [hl], 0 @@ -9718,11 +9718,11 @@ CheckHiddenOpponent: ; 37daa GetUserItem: ; 37db2 ; Return the effect of the user's item in bc, and its id at hl. - ld hl, BattleMonItem + ld hl, wBattleMonItem ld a, [hBattleTurn] and a jr z, .go - ld hl, EnemyMonItem + ld hl, wEnemyMonItem .go ld b, [hl] jp GetItemHeldEffect @@ -9732,11 +9732,11 @@ GetUserItem: ; 37db2 GetOpponentItem: ; 37dc1 ; Return the effect of the opponent's item in bc, and its id at hl. - ld hl, EnemyMonItem + ld hl, wEnemyMonItem ld a, [hBattleTurn] and a jr z, .go - ld hl, BattleMonItem + ld hl, wBattleMonItem .go ld b, [hl] jp GetItemHeldEffect @@ -9807,14 +9807,14 @@ AnimateCurrentMove: ; 37e01 PlayDamageAnim: ; 37e19 xor a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar and a ret z - ld [FXAnimID], a + ld [wFXAnimID], a ld a, [hBattleTurn] and a @@ -9833,7 +9833,7 @@ PlayDamageAnim: ; 37e19 LoadMoveAnim: ; 37e36 xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -9846,7 +9846,7 @@ LoadMoveAnim: ; 37e36 LoadAnim: ; 37e44 - ld [FXAnimID], a + ld [wFXAnimID], a ; fallthrough ; 37e47 @@ -9867,9 +9867,9 @@ PlayUserBattleAnim: ; 37e47 PlayOpponentBattleAnim: ; 37e54 ld a, e - ld [FXAnimID], a + ld [wFXAnimID], a ld a, d - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a xor a ld [wNumHits], a @@ -9928,9 +9928,9 @@ BattleCommand_ClearText: ; 37e85 SkipToBattleCommand: ; 37e8c ; Skip over commands until reaching command b. - ld a, [BattleScriptBufferAddress + 1] + ld a, [wBattleScriptBufferAddress + 1] ld h, a - ld a, [BattleScriptBufferAddress] + ld a, [wBattleScriptBufferAddress] ld l, a .loop ld a, [hli] @@ -9938,9 +9938,9 @@ SkipToBattleCommand: ; 37e8c jr nz, .loop ld a, h - ld [BattleScriptBufferAddress + 1], a + ld [wBattleScriptBufferAddress + 1], a ld a, l - ld [BattleScriptBufferAddress], a + ld [wBattleScriptBufferAddress], a ret ; 37ea1 |