summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2015-11-28 17:09:19 -0500
committerluckytyphlosion <alan.rj.huang@gmail.com>2015-11-28 17:09:19 -0500
commit90c7b976dca2467f47c4916b3835414bb07cc4d1 (patch)
treef2acf7019573d3b708339c704c51b8ecca77b6ea
parent4cb785e0db4adb727ac1b92115ad3f74e414867f (diff)
engine/battle/moveEffects/substitute_effect.asm and ActivatePC
Also no more W_PLAYER/ENEMYBATTSTATUS
-rwxr-xr-xengine/battle/animations.asm4
-rwxr-xr-xengine/battle/core.asm238
-rw-r--r--engine/battle/decrement_pp.asm8
-rw-r--r--engine/battle/experience.asm2
-rw-r--r--engine/battle/moveEffects/conversion_effect.asm4
-rw-r--r--engine/battle/moveEffects/focus_energy_effect.asm4
-rw-r--r--engine/battle/moveEffects/haze_effect.asm4
-rw-r--r--engine/battle/moveEffects/leech_seed_effect.asm4
-rw-r--r--engine/battle/moveEffects/mist_effect.asm4
-rw-r--r--engine/battle/moveEffects/reflect_light_screen_effect.asm4
-rw-r--r--engine/battle/moveEffects/substitute_effect.asm12
-rw-r--r--engine/battle/moveEffects/transform_effect.asm12
-rw-r--r--engine/battle/trainer_ai.asm8
-rwxr-xr-xengine/give_pokemon.asm2
-rwxr-xr-xengine/items/items.asm12
-rwxr-xr-xengine/menu/pc.asm36
-rwxr-xr-xengine/palettes.asm4
-rwxr-xr-xwram.asm12
-rwxr-xr-xyellow/main.asm17
19 files changed, 198 insertions, 193 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index ab518c77..c0d0e000 100755
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -2088,10 +2088,10 @@ HideSubstituteShowMonAnim: ; 79747 (1e:5747)
ld a, [H_WHOSETURN]
and a
ld hl, wPlayerMonMinimized
- ld a, [W_PLAYERBATTSTATUS2]
+ ld a, [wPlayerBattleStatus2]
jr z, .next1
ld hl, wEnemyMonMinimized
- ld a, [W_ENEMYBATTSTATUS2]
+ ld a, [wEnemyBattleStatus2]
.next1
push hl
; if the substitute broke, slide it down, else slide it offscreen horizontally
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index ac7ddcdc..f54e7000 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -380,13 +380,13 @@ MainInBattleLoop: ; 3c233 (f:4233)
call SaveScreenTilesToBuffer1
xor a
ld [wFirstMonsNotOutYet], a
- ld a, [W_PLAYERBATTSTATUS2]
+ ld a, [wPlayerBattleStatus2]
and (1 << NeedsToRecharge) | (1 << UsingRage) ; check if the player is using Rage or needs to recharge
jr nz, .selectEnemyMove
; the player is not using Rage and doesn't need to recharge
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
res Flinched, [hl] ; reset flinch bit
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
res Flinched, [hl] ; reset flinch bit
ld a, [hl]
and (1 << ThrashingAbout) | (1 << ChargingUp) ; check if the player is thrashing about or charging for an attack
@@ -400,10 +400,10 @@ MainInBattleLoop: ; 3c233 (f:4233)
ld a, [wBattleMonStatus]
and (1 << FRZ) | SLP ; is mon frozen or asleep?
jr nz, .selectEnemyMove ; if so, jump
- ld a, [W_PLAYERBATTSTATUS1]
+ ld a, [wPlayerBattleStatus1]
and (1 << StoringEnergy) | (1 << UsingTrappingMove) ; check player is using Bide or using a multi-turn attack like wrap
jr nz, .selectEnemyMove ; if so, jump
- ld a, [W_ENEMYBATTSTATUS1]
+ ld a, [wEnemyBattleStatus1]
bit UsingTrappingMove, a ; check if enemy is using a multi-turn attack like wrap
jr z, .selectPlayerMove ; if not, jump
; enemy is using a mult-turn attack like wrap, so player is trapped and cannot execute a move
@@ -441,7 +441,7 @@ MainInBattleLoop: ; 3c233 (f:4233)
sub $4
jr c, .noLinkBattle
; the link battle enemy has switched mons
- ld a, [W_PLAYERBATTSTATUS1]
+ ld a, [wPlayerBattleStatus1]
bit UsingTrappingMove, a ; check if using multi-turn move like Wrap
jr z, .asm_3c2dd
ld a, [wPlayerMoveListIndex]
@@ -584,11 +584,11 @@ HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd)
pop hl
call HandlePoisonBurnLeechSeed_DecreaseOwnHP
.notBurnedOrPoisoned
- ld de, W_PLAYERBATTSTATUS2
+ ld de, wPlayerBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .playersTurn2
- ld de, W_ENEMYBATTSTATUS2
+ ld de, wEnemyBattleStatus2
.playersTurn2
ld a, [de]
add a
@@ -659,12 +659,12 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: ; 3c43d (f:443d)
jr nz, .nonZeroDamage
inc c ; damage is at least 1
.nonZeroDamage
- ld hl, W_PLAYERBATTSTATUS3
+ ld hl, wPlayerBattleStatus3
ld de, W_PLAYERTOXICCOUNTER
ld a, [H_WHOSETURN]
and a
jr z, .playersTurn
- ld hl, W_ENEMYBATTSTATUS3
+ ld hl, wEnemyBattleStatus3
ld de, W_ENEMYTOXICCOUNTER
.playersTurn
bit BadlyPoisoned, [hl]
@@ -775,14 +775,14 @@ CheckNumAttacksLeft: ; 3c50f (f:450f)
and a
jr nz, .checkEnemy
; player has 0 attacks left
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
res UsingTrappingMove, [hl] ; player not using multi-turn attack like wrap any more
.checkEnemy
ld a, [wEnemyNumAttacksLeft]
and a
ret nz
; enemy has 0 attacks left
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
res UsingTrappingMove, [hl] ; enemy not using multi-turn attack like wrap any more
ret
@@ -832,7 +832,7 @@ FaintEnemyPokemon: ; 0x3c567
ld [hli], a
ld [hl], a
.wild
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
res AttackingMultipleTimes, [hl]
; Bug. This only zeroes the high byte of the player's accumulated damage,
; setting the accumulated damage to itself mod 256 instead of 0 as was probably
@@ -1094,7 +1094,7 @@ RemoveFaintedPlayerMon: ; 3c741 (f:4741)
ld hl, wPartyGainExpFlags
ld b, FLAG_RESET
predef FlagActionPredef ; clear gain exp flag for fainted mon
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
res 2, [hl] ; reset "attacking multiple times" flag
ld a, [wLowHealthAlarm]
bit 7, a ; skip sound flag (red bar (?))
@@ -1392,7 +1392,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
ld [hl],a
dec a
ld [wAICount],a
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
res 5,[hl]
coord hl, 18, 0
ld a,8
@@ -1839,7 +1839,7 @@ SendOutMon: ; 3cc91 (f:4c91)
ld [wPlayerMonMinimized], a
ld b, SET_PAL_BATTLE
call RunPaletteCommand
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
res UsingTrappingMove, [hl]
ld a, $1
ld [H_WHOSETURN], a
@@ -2340,13 +2340,13 @@ UseBagItem:
and a ; was the item used successfully?
jp z, BagWasSelected ; if not, go back to the bag menu
- ld a, [W_PLAYERBATTSTATUS1]
+ ld a, [wPlayerBattleStatus1]
bit UsingTrappingMove, a ; is the player using a multi-turn move like wrap?
jr z, .checkIfMonCaptured
ld hl, wPlayerNumAttacksLeft
dec [hl]
jr nz, .checkIfMonCaptured
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
res UsingTrappingMove, [hl] ; not using multi-turn move any more
.checkIfMonCaptured
@@ -2453,7 +2453,7 @@ PartyMenuOrRockOrRun:
predef StatusScreen
predef StatusScreen2
; now we need to reload the enemy mon pic
- ld a, [W_ENEMYBATTSTATUS2]
+ ld a, [wEnemyBattleStatus2]
bit HasSubstituteUp, a ; does the enemy mon have a substitute?
ld hl, AnimationSubstitute
jr nz, .doEnemyMonAnimation
@@ -2730,7 +2730,7 @@ SelectMenuItem: ; 3d2fe (f:52fe)
dec a
cp c
jr z, .disabled
- ld a, [W_PLAYERBATTSTATUS3]
+ ld a, [wPlayerBattleStatus3]
bit 3, a ; transformed
jr nz, .dummy ; game freak derp
.dummy
@@ -3010,20 +3010,20 @@ SelectEnemyMove: ; 3d564 (f:5564)
ld a, [hl]
jr .done
.noLinkBattle
- ld a, [W_ENEMYBATTSTATUS2]
+ ld a, [wEnemyBattleStatus2]
and (1 << NeedsToRecharge) | (1 << UsingRage) ; need to recharge or using rage
ret nz
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld a, [hl]
and (1 << ChargingUp) | (1 << ThrashingAbout) ; using a charging move or thrash/petal dance
ret nz
ld a, [wEnemyMonStatus]
and SLP | 1 << FRZ ; sleeping or frozen
ret nz
- ld a, [W_ENEMYBATTSTATUS1]
+ ld a, [wEnemyBattleStatus1]
and (1 << UsingTrappingMove) | (1 << StoringEnergy) ; using a trapping move like wrap or bide
ret nz
- ld a, [W_PLAYERBATTSTATUS1]
+ ld a, [wPlayerBattleStatus1]
bit UsingTrappingMove, a ; caught in player's trapping move (e.g. wrap)
jr z, .canSelectMove
.unableToSelectMove
@@ -3150,7 +3150,7 @@ ExecutePlayerMove: ; 3d65e (f:565e)
jp [hl]
.playerHasNoSpecialCondition
call GetCurrentMove
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
bit ChargingUp, [hl] ; charging up for attack
jr nz, PlayerCanExecuteChargingMove
call CheckForDisobedience
@@ -3166,7 +3166,7 @@ CheckIfPlayerNeedsToChargeUp: ; 3d69a (f:569a)
; in-battle stuff
PlayerCanExecuteChargingMove: ; 3d6a9 (f:56a9)
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
res ChargingUp,[hl] ; reset charging up and invulnerability statuses if mon was charging up for an attack
; being fully paralyzed or hurting oneself in confusion removes charging up status
; resulting in the Pokemon being invulnerable for the whole battle
@@ -3221,7 +3221,7 @@ getPlayerAnimationType
ld a,5 ; move has effect
playPlayerMoveAnimation
push af
- ld a,[W_PLAYERBATTSTATUS2]
+ ld a,[wPlayerBattleStatus2]
bit HasSubstituteUp,a
ld hl,HideSubstituteShowMonAnim
ld b,BANK(HideSubstituteShowMonAnim)
@@ -3232,7 +3232,7 @@ playPlayerMoveAnimation
call PlayMoveAnimation
call HandleExplodingAnimation
call DrawPlayerHUDAndHPBar
- ld a,[W_PLAYERBATTSTATUS2]
+ ld a,[wPlayerBattleStatus2]
bit HasSubstituteUp,a
ld hl,ReshowSubstituteAnim
ld b,BANK(ReshowSubstituteAnim)
@@ -3299,7 +3299,7 @@ MirrorMoveCheck
ret z ; don't do anything else if the enemy fainted
call HandleBuildingRage
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
bit AttackingMultipleTimes,[hl]
jr z,.executeOtherEffects
ld a,[wPlayerNumAttacksLeft]
@@ -3420,7 +3420,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
jp .returnToHL
.HeldInPlaceCheck
- ld a,[W_ENEMYBATTSTATUS1]
+ ld a,[wEnemyBattleStatus1]
bit UsingTrappingMove,a ; is enemy using a mult-turn move like wrap?
jp z,.FlinchedCheck
ld hl,CantMoveText
@@ -3429,7 +3429,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
jp .returnToHL
.FlinchedCheck
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
bit Flinched,[hl]
jp z,.HyperBeamCheck
res Flinched,[hl] ; reset player's flinch status
@@ -3439,7 +3439,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
jp .returnToHL
.HyperBeamCheck
- ld hl,W_PLAYERBATTSTATUS2
+ ld hl,wPlayerBattleStatus2
bit NeedsToRecharge,[hl]
jr z,.AnyMoveDisabledCheck
res NeedsToRecharge,[hl] ; reset player's recharge status
@@ -3463,13 +3463,13 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
call PrintText
.ConfusedCheck
- ld a,[W_PLAYERBATTSTATUS1]
+ ld a,[wPlayerBattleStatus1]
add a ; is player confused?
jr nc,.TriedToUseDisabledMoveCheck
ld hl,W_PLAYERCONFUSEDCOUNTER
dec [hl]
jr nz,.IsConfused
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
res Confused,[hl] ; if confused counter hit 0, reset confusion status
ld hl,ConfusedNoMoreText
call PrintText
@@ -3484,9 +3484,9 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
call BattleRandom
cp a,$80 ; 50% chance to hurt itself
jr c,.TriedToUseDisabledMoveCheck
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
ld a,[hl]
- and a, 1 << Confused ; if mon hurts itself, clear every other status from W_PLAYERBATTSTATUS1
+ and a, 1 << Confused ; if mon hurts itself, clear every other status from wPlayerBattleStatus1
ld [hl],a
call HandleSelfConfusionDamage
jr .MonHurtItselfOrFullyParalysed
@@ -3514,7 +3514,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
call PrintText
.MonHurtItselfOrFullyParalysed
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
ld a,[hl]
; clear bide, thrashing, charging up, and trapping moves such as warp (already cleared for confusion damage)
and $ff ^ ((1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << ChargingUp) | (1 << UsingTrappingMove))
@@ -3536,7 +3536,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
jp .returnToHL ; if using a two-turn move, we need to recharge the first turn
.BideCheck
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
bit StoringEnergy,[hl] ; is mon using bide?
jr z,.ThrashingAboutCheck
xor a
@@ -3558,7 +3558,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
ld hl,ExecutePlayerMoveDone
jp .returnToHL ; unless mon unleashes energy, can't move this turn
.UnleashEnergy
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
res StoringEnergy,[hl] ; not using bide any more
ld hl,UnleashedEnergyText
call PrintText
@@ -3597,7 +3597,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
ld hl,PlayerCalcMoveDamage ; skip DecrementPP
jp nz,.returnToHL
push hl
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
res ThrashingAbout,[hl] ; no longer thrashing about
set Confused,[hl] ; confused
call BattleRandom
@@ -3622,7 +3622,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
jp .returnToHL
.RageCheck
- ld a, [W_PLAYERBATTSTATUS2]
+ ld a, [wPlayerBattleStatus2]
bit UsingRage, a ; is mon using rage?
jp z, .checkPlayerStatusConditionsDone ; if we made it this far, mon can move normally this turn
ld a, RAGE
@@ -3705,12 +3705,12 @@ CantMoveText: ; 3da83 (f:5a83)
PrintMoveIsDisabledText: ; 3da88 (f:5a88)
ld hl, wPlayerSelectedMove
- ld de, W_PLAYERBATTSTATUS1
+ ld de, wPlayerBattleStatus1
ld a, [H_WHOSETURN]
and a
jr z, .removeChargingUp
inc hl
- ld de, W_ENEMYBATTSTATUS1
+ ld de, wEnemyBattleStatus1
.removeChargingUp
ld a, [de]
res ChargingUp, a ; end the pokemon's
@@ -4246,7 +4246,7 @@ GetDamageVarsForPlayerAttack: ; 3ddcf (f:5dcf)
ld a, [hli]
ld b, a
ld c, [hl] ; bc = enemy defense
- ld a, [W_ENEMYBATTSTATUS3]
+ ld a, [wEnemyBattleStatus3]
bit HasReflectUp, a ; check for Reflect
jr z, .physicalAttackCritCheck
; if the enemy has used Reflect, double the enemy's defense
@@ -4276,7 +4276,7 @@ GetDamageVarsForPlayerAttack: ; 3ddcf (f:5dcf)
ld a, [hli]
ld b, a
ld c, [hl] ; bc = enemy special
- ld a, [W_ENEMYBATTSTATUS3]
+ ld a, [wEnemyBattleStatus3]
bit HasLightScreenUp, a ; check for Light Screen
jr z, .specialAttackCritCheck
; if the enemy has used Light Screen, double the enemy's special
@@ -4359,7 +4359,7 @@ GetDamageVarsForEnemyAttack: ; 3de75 (f:5e75)
ld a, [hli]
ld b, a
ld c, [hl] ; bc = player defense
- ld a, [W_PLAYERBATTSTATUS3]
+ ld a, [wPlayerBattleStatus3]
bit HasReflectUp, a ; check for Reflect
jr z, .physicalAttackCritCheck
; if the player has used Reflect, double the player's defense
@@ -4389,7 +4389,7 @@ GetDamageVarsForEnemyAttack: ; 3de75 (f:5e75)
ld a, [hli]
ld b, a
ld c, [hl]
- ld a, [W_PLAYERBATTSTATUS3]
+ ld a, [wPlayerBattleStatus3]
bit HasLightScreenUp, a ; check for Light Screen
jr z, .specialAttackCritCheck
; if the player has used Light Screen, double the player's special
@@ -4694,10 +4694,10 @@ CriticalHitTest: ; 3e023 (f:6023)
ld a, [H_WHOSETURN]
and a
ld hl, W_PLAYERMOVEPOWER
- ld de, W_PLAYERBATTSTATUS2
+ ld de, wPlayerBattleStatus2
jr z, .calcCriticalHitProbability
ld hl, W_ENEMYMOVEPOWER
- ld de, W_ENEMYBATTSTATUS2
+ ld de, wEnemyBattleStatus2
.calcCriticalHitProbability
ld a, [hld] ; read base power from RAM
and a
@@ -4891,7 +4891,7 @@ ApplyDamageToEnemyPokemon: ; 3e142 (f:6142)
ld a,[hl]
or b
jr z,ApplyAttackToEnemyPokemonDone ; we're done if damage is 0
- ld a,[W_ENEMYBATTSTATUS2]
+ ld a,[wEnemyBattleStatus2]
bit HasSubstituteUp,a ; does the enemy have a substitute?
jp nz,AttackSubstitute
; subtract the damage from the pokemon's current HP
@@ -5010,7 +5010,7 @@ ApplyDamageToPlayerPokemon: ; 3e200 (f:6200)
ld a,[hl]
or b
jr z,ApplyAttackToPlayerPokemonDone ; we're done if damage is 0
- ld a,[W_PLAYERBATTSTATUS2]
+ ld a,[wPlayerBattleStatus2]
bit HasSubstituteUp,a ; does the player have a substitute?
jp nz,AttackSubstitute
; subtract the damage from the pokemon's current HP
@@ -5067,13 +5067,13 @@ AttackSubstitute: ; 3e25e (f:625e)
call PrintText
; values for player turn
ld de,wEnemySubstituteHP
- ld bc,W_ENEMYBATTSTATUS2
+ ld bc,wEnemyBattleStatus2
ld a,[H_WHOSETURN]
and a
jr z,.applyDamageToSubstitute
; values for enemy turn
ld de,wPlayerSubstituteHP
- ld bc,W_PLAYERBATTSTATUS2
+ ld bc,wPlayerBattleStatus2
.applyDamageToSubstitute
ld hl,wDamage
ld a,[hli]
@@ -5121,14 +5121,14 @@ SubstituteBrokeText: ; 3e2b1 (f:62b1)
; this function raises the attack modifier of a pokemon using Rage when that pokemon is attacked
HandleBuildingRage: ; 3e2b6 (f:62b6)
; values for the player turn
- ld hl,W_ENEMYBATTSTATUS2
+ ld hl,wEnemyBattleStatus2
ld de,wEnemyMonStatMods
ld bc,W_ENEMYMOVENUM
ld a,[H_WHOSETURN]
and a
jr z,.next
; values for the enemy turn
- ld hl,W_PLAYERBATTSTATUS2
+ ld hl,wPlayerBattleStatus2
ld de,wPlayerMonStatMods
ld bc,W_PLAYERMOVENUM
.next
@@ -5436,14 +5436,14 @@ INCLUDE "data/type_effects.asm"
; some tests that need to pass for a move to hit
MoveHitTest: ; 3e56b (f:656b)
; player's turn
- ld hl,W_ENEMYBATTSTATUS1
+ ld hl,wEnemyBattleStatus1
ld de,W_PLAYERMOVEEFFECT
ld bc,wEnemyMonStatus
ld a,[H_WHOSETURN]
and a
jr z,.dreamEaterCheck
; enemy's turn
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
ld de,W_ENEMYMOVEEFFECT
ld bc,wBattleMonStatus
.dreamEaterCheck
@@ -5490,11 +5490,11 @@ MoveHitTest: ; 3e56b (f:656b)
; FLASH, CONVERSION*, HAZE*, SCREECH, LIGHT SCREEN*, REFLECT*
; the moves that are marked with an asterisk are not affected since this
; function is not called when those moves are used
- ld a,[W_ENEMYBATTSTATUS2]
+ ld a,[wEnemyBattleStatus2]
bit ProtectedByMist,a ; is mon protected by mist?
jp nz,.moveMissed
.skipEnemyMistCheck
- ld a,[W_PLAYERBATTSTATUS2]
+ ld a,[wPlayerBattleStatus2]
bit UsingXAccuracy,a ; is the player using X Accuracy?
ret nz ; if so, always hit regardless of accuracy/evasion
jr .calcHitChance
@@ -5511,11 +5511,11 @@ MoveHitTest: ; 3e56b (f:656b)
jr .skipPlayerMistCheck
.playerMistCheck
; similar to enemy mist check
- ld a,[W_PLAYERBATTSTATUS2]
+ ld a,[wPlayerBattleStatus2]
bit ProtectedByMist,a ; is mon protected by mist?
jp nz,.moveMissed
.skipPlayerMistCheck
- ld a,[W_ENEMYBATTSTATUS2]
+ ld a,[wEnemyBattleStatus2]
bit UsingXAccuracy,a ; is the enemy using X Accuracy?
ret nz ; if so, always hit regardless of accuracy/evasion
.calcHitChance
@@ -5545,11 +5545,11 @@ MoveHitTest: ; 3e56b (f:656b)
and a
jr z,.playerTurn2
.enemyTurn2
- ld hl,W_ENEMYBATTSTATUS1
+ ld hl,wEnemyBattleStatus1
res UsingTrappingMove,[hl] ; end multi-turn attack e.g. wrap
ret
.playerTurn2
- ld hl,W_PLAYERBATTSTATUS1
+ ld hl,wPlayerBattleStatus1
res UsingTrappingMove,[hl] ; end multi-turn attack e.g. wrap
ret
@@ -5690,7 +5690,7 @@ ExecuteEnemyMove: ; 3e6bc (f:66bc)
jr nz, .enemyHasNoSpecialConditions
jp [hl]
.enemyHasNoSpecialConditions
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
bit ChargingUp, [hl] ; is the enemy charging up for attack?
jr nz, EnemyCanExecuteChargingMove ; if so, jump
call GetCurrentMove
@@ -5703,7 +5703,7 @@ CheckIfEnemyNeedsToChargeUp: ; 3e6fc (f:66fc)
jp z, JumpMoveEffect
jr EnemyCanExecuteMove
EnemyCanExecuteChargingMove: ; 3e70b (f:670b)
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
res ChargingUp, [hl] ; no longer charging up for attack
res Invulnerable, [hl] ; no longer invulnerable to typical attacks
ld a, [W_ENEMYMOVENUM]
@@ -5772,7 +5772,7 @@ asm_3e7a0: ; 3e7a0 (f:67a0)
xor a
playEnemyMoveAnimation: ; 3e7a4 (f:67a4)
push af
- ld a, [W_ENEMYBATTSTATUS2]
+ ld a, [wEnemyBattleStatus2]
bit HasSubstituteUp, a ; does mon have a substitute?
ld hl, HideSubstituteShowMonAnim
ld b, BANK(HideSubstituteShowMonAnim)
@@ -5783,7 +5783,7 @@ playEnemyMoveAnimation: ; 3e7a4 (f:67a4)
call PlayMoveAnimation
call HandleExplodingAnimation
call DrawEnemyHUDAndHPBar
- ld a, [W_ENEMYBATTSTATUS2]
+ ld a, [wEnemyBattleStatus2]
bit HasSubstituteUp, a ; does mon have a substitute?
ld hl, ReshowSubstituteAnim
ld b, BANK(ReshowSubstituteAnim)
@@ -5849,7 +5849,7 @@ EnemyCheckIfMirrorMoveEffect: ; 3e7ef (f:67ef)
or b
ret z
call HandleBuildingRage
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
bit AttackingMultipleTimes, [hl] ; is mon hitting multiple times? (example: double kick)
jr z, .asm_3e873
push hl
@@ -5916,7 +5916,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld hl, ExecuteEnemyMoveDone ; enemy can't move this turn
jp .enemyReturnToHL
.checkIfTrapped
- ld a, [W_PLAYERBATTSTATUS1]
+ ld a, [wPlayerBattleStatus1]
bit UsingTrappingMove, a ; is the player using a multi-turn attack like warp
jp z, .checkIfFlinched
ld hl, CantMoveText
@@ -5924,7 +5924,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld hl, ExecuteEnemyMoveDone ; enemy can't move this turn
jp .enemyReturnToHL
.checkIfFlinched
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
bit Flinched, [hl] ; check if enemy mon flinched
jp z, .checkIfMustRecharge
res Flinched, [hl]
@@ -5933,7 +5933,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld hl, ExecuteEnemyMoveDone ; enemy can't move this turn
jp .enemyReturnToHL
.checkIfMustRecharge
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
bit NeedsToRecharge, [hl] ; check if enemy mon has to recharge after using a move
jr z, .checkIfAnyMoveDisabled
res NeedsToRecharge, [hl]
@@ -5955,13 +5955,13 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld hl, DisabledNoMoreText
call PrintText
.checkIfConfused
- ld a, [W_ENEMYBATTSTATUS1]
+ ld a, [wEnemyBattleStatus1]
add a ; check if enemy mon is confused
jp nc, .checkIfTriedToUseDisabledMove
ld hl, W_ENEMYCONFUSEDCOUNTER
dec [hl]
jr nz, .isConfused
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
res Confused, [hl] ; if confused counter hit 0, reset confusion status
ld hl, ConfusedNoMoreText
call PrintText
@@ -5976,9 +5976,9 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
call BattleRandom
cp $80
jr c, .checkIfTriedToUseDisabledMove
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld a, [hl]
- and 1 << Confused ; if mon hurts itself, clear every other status from W_ENEMYBATTSTATUS1
+ and 1 << Confused ; if mon hurts itself, clear every other status from wEnemyBattleStatus1
ld [hl], a
ld hl, HurtItselfText
call PrintText
@@ -6042,7 +6042,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld hl, FullyParalyzedText
call PrintText
.monHurtItselfOrFullyParalysed
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld a, [hl]
; clear bide, thrashing about, charging up, and multi-turn moves such as warp
and $ff ^ ((1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << ChargingUp) | (1 << UsingTrappingMove))
@@ -6062,7 +6062,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld hl, ExecuteEnemyMoveDone
jp .enemyReturnToHL ; if using a two-turn move, enemy needs to recharge the first turn
.checkIfUsingBide
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
bit StoringEnergy, [hl] ; is mon using bide?
jr z, .checkIfThrashingAbout
xor a
@@ -6084,7 +6084,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld hl, ExecuteEnemyMoveDone
jp .enemyReturnToHL ; unless mon unleashes energy, can't move this turn
.unleashEnergy
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
res StoringEnergy, [hl] ; not using bide any more
ld hl, UnleashedEnergyText
call PrintText
@@ -6123,7 +6123,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
ld hl, EnemyCalcMoveDamage ; skip DecrementPP
jp nz, .enemyReturnToHL
push hl
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
res ThrashingAbout, [hl] ; mon is no longer using thrash or petal dance
set Confused, [hl] ; mon is now confused
call BattleRandom
@@ -6145,7 +6145,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
jp nz, .enemyReturnToHL
jp .enemyReturnToHL
.checkIfUsingRage
- ld a, [W_ENEMYBATTSTATUS2]
+ ld a, [wEnemyBattleStatus2]
bit UsingRage, a ; is mon using rage?
jp z, .checkEnemyStatusConditionsDone ; if we made it this far, mon can move normally this turn
ld a, RAGE
@@ -6203,7 +6203,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01)
ld [wEnemyMonSpecies], a
ld [wd0b5], a
call GetMonHeader
- ld a, [W_ENEMYBATTSTATUS3]
+ ld a, [wEnemyBattleStatus3]
bit Transformed, a ; is enemy mon transformed?
ld hl, wTransformedEnemyMonOriginalDVs ; original DVs before transforming
ld a, [hli]
@@ -6235,7 +6235,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01)
ld a, [wIsInBattle]
cp $2 ; is it a trainer battle?
jr z, .copyHPAndStatusFromPartyData
- ld a, [W_ENEMYBATTSTATUS3]
+ ld a, [wEnemyBattleStatus3]
bit Transformed, a ; is enemy mon transformed?
jr nz, .copyTypes ; if transformed, jump
; if it's a wild mon and not transformed, init the current HP to max HP and the status to 0
@@ -6800,11 +6800,11 @@ HandleExplodingAnimation: ; 3eed3 (f:6ed3)
ld a, [H_WHOSETURN]
and a
ld hl, wEnemyMonType1
- ld de, W_ENEMYBATTSTATUS1
+ ld de, wEnemyBattleStatus1
ld a, [W_PLAYERMOVENUM]
jr z, .asm_3eeea
ld hl, wBattleMonType1
- ld de, W_ENEMYBATTSTATUS1
+ ld de, wEnemyBattleStatus1
ld a, [W_ENEMYMOVENUM]
.asm_3eeea
cp SELFDESTRUCT
@@ -6952,12 +6952,12 @@ MoveEffectPointerTable: ; 3f150 (f:7150)
SleepEffect: ; 3f1fc (f:71fc)
ld de, wEnemyMonStatus
- ld bc, W_ENEMYBATTSTATUS2
+ ld bc, wEnemyBattleStatus2
ld a, [H_WHOSETURN]
and a
jp z, .sleepEffect
ld de, wBattleMonStatus
- ld bc, W_PLAYERBATTSTATUS2
+ ld bc, wPlayerBattleStatus2
.sleepEffect
ld a, [bc]
@@ -7051,12 +7051,12 @@ PoisonEffect: ; 3f24f (f:724f)
ld a, [H_WHOSETURN]
and a
ld b, ANIM_C7
- ld hl, W_PLAYERBATTSTATUS3
+ ld hl, wPlayerBattleStatus3
ld a, [de]
ld de, W_PLAYERTOXICCOUNTER
jr nz, .ok
ld b, ANIM_A9
- ld hl, W_ENEMYBATTSTATUS3
+ ld hl, wEnemyBattleStatus3
ld de, W_ENEMYTOXICCOUNTER
.ok
cp TOXIC
@@ -7101,12 +7101,12 @@ DrainHPEffect: ; 3f2e9 (f:72e9)
ExplodeEffect: ; 3f2f1 (f:72f1)
ld hl, wBattleMonHP
- ld de, W_PLAYERBATTSTATUS2
+ ld de, wPlayerBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .faintUser
ld hl, wEnemyMonHP
- ld de, W_ENEMYBATTSTATUS2
+ ld de, wEnemyBattleStatus2
.faintUser
xor a
ld [hli], a ; set the mon's HP to 0
@@ -7379,13 +7379,13 @@ UpdateStatDone: ; 3f4ca (f:74ca)
ld b, c
inc b
call PrintStatText
- ld hl, W_PLAYERBATTSTATUS2
+ ld hl, wPlayerBattleStatus2
ld de, W_PLAYERMOVENUM
ld bc, wPlayerMonMinimized
ld a, [H_WHOSETURN]
and a
jr z, .asm_3f4e6
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
ld de, W_ENEMYMOVENUM
ld bc, wEnemyMonMinimized
.asm_3f4e6
@@ -7460,13 +7460,13 @@ RoseText: ; 3f547 (f:7547)
StatModifierDownEffect: ; 3f54c (f:754c)
ld hl, wEnemyMonStatMods
ld de, W_PLAYERMOVEEFFECT
- ld bc, W_ENEMYBATTSTATUS1
+ ld bc, wEnemyBattleStatus1
ld a, [H_WHOSETURN]
and a
jr z, .statModifierDownEffect
ld hl, wPlayerMonStatMods
ld de, W_ENEMYMOVEEFFECT
- ld bc, W_PLAYERBATTSTATUS1
+ ld bc, wPlayerBattleStatus1
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .statModifierDownEffect
@@ -7702,13 +7702,13 @@ StatModifierRatios: ; 3f6cb (f:76cb)
db 4, 1 ; 4.00
BideEffect: ; 3f6e5 (f:76e5)
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
ld de, wPlayerBideAccumulatedDamage
ld bc, wPlayerNumAttacksLeft
ld a, [H_WHOSETURN]
and a
jr z, .bideEffect
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld de, wEnemyBideAccumulatedDamage
ld bc, wEnemyNumAttacksLeft
.bideEffect
@@ -7729,12 +7729,12 @@ BideEffect: ; 3f6e5 (f:76e5)
jp PlayBattleAnimation2
ThrashPetalDanceEffect: ; 3f717 (f:7717)
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft
ld a, [H_WHOSETURN]
and a
jr z, .thrashPetalDanceEffect
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld de, wEnemyNumAttacksLeft
.thrashPetalDanceEffect
set ThrashingAbout, [hl] ; mon is now using thrash/petal dance
@@ -7863,13 +7863,13 @@ WasBlownAwayText: ; 3f80c (f:780c)
db "@"
TwoToFiveAttacksEffect: ; 3f811 (f:7811)
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft
ld bc, wPlayerNumHits
ld a, [H_WHOSETURN]
and a
jr z, .twoToFiveAttacksEffect
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld de, wEnemyNumAttacksLeft
ld bc, wEnemyNumHits
.twoToFiveAttacksEffect
@@ -7910,12 +7910,12 @@ TwoToFiveAttacksEffect: ; 3f811 (f:7811)
FlinchSideEffect: ; 3f85b (f:785b)
call CheckTargetSubstitute
ret nz
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld de, W_PLAYERMOVEEFFECT
ld a, [H_WHOSETURN]
and a
jr z, .flinchSideEffect
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
ld de, W_ENEMYMOVEEFFECT
.flinchSideEffect
ld a, [de]
@@ -7935,13 +7935,13 @@ OneHitKOEffect: ; 3f884 (f:7884)
jpab OneHitKOEffect_
ChargeEffect: ; 3f88c (f:788c)
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
ld de, W_PLAYERMOVEEFFECT
ld a, [H_WHOSETURN]
and a
ld b, XSTATITEM_ANIM
jr z, .chargeEffect
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld de, W_ENEMYMOVEEFFECT
ld b, ANIM_AF
.chargeEffect
@@ -8017,12 +8017,12 @@ DugAHoleText: ; 3f912 (f:7912)
db "@"
TrappingEffect: ; 3f917 (f:7917)
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft
ld a, [H_WHOSETURN]
and a
jr z, .trappingEffect
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld de, wEnemyNumAttacksLeft
.trappingEffect
bit UsingTrappingMove, [hl]
@@ -8067,11 +8067,11 @@ ConfusionEffect: ; 3f961 (f:7961)
ConfusionSideEffectSuccess: ; 3f96f (f:796f)
ld a, [H_WHOSETURN]
and a
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
ld bc, W_ENEMYCONFUSEDCOUNTER
ld a, [W_PLAYERMOVEEFFECT]
jr z, .confuseTarget
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
ld bc, W_PLAYERCONFUSEDCOUNTER
ld a, [W_ENEMYMOVEEFFECT]
.confuseTarget
@@ -8108,33 +8108,33 @@ SubstituteEffect: ; 3f9b9 (f:79b9)
jpab SubstituteEffect_
HyperBeamEffect: ; 3f9c1 (f:79c1)
- ld hl, W_PLAYERBATTSTATUS2
+ ld hl, wPlayerBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .hyperBeamEffect
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
.hyperBeamEffect
set NeedsToRecharge, [hl] ; mon now needs to recharge
ret
ClearHyperBeam: ; 3f9cf (f:79cf)
push hl
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .asm_3f9db
- ld hl, W_PLAYERBATTSTATUS2
+ ld hl, wPlayerBattleStatus2
.asm_3f9db
res NeedsToRecharge, [hl] ; mon no longer needs to recharge
pop hl
ret
RageEffect: ; 3f9df (f:79df)
- ld hl, W_PLAYERBATTSTATUS2
+ ld hl, wPlayerBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .player
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
.player
set UsingRage, [hl] ; mon is now in "rage" mode
ret
@@ -8149,13 +8149,13 @@ MimicEffect: ; 3f9ed (f:79ed)
ld a, [H_WHOSETURN]
and a
ld hl, wBattleMonMoves
- ld a, [W_PLAYERBATTSTATUS1]
+ ld a, [wPlayerBattleStatus1]
jr nz, .asm_3fa13
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .asm_3fa3a
ld hl, wEnemyMonMoves
- ld a, [W_ENEMYBATTSTATUS1]
+ ld a, [wEnemyBattleStatus1]
.asm_3fa13
bit Invulnerable, a
jr nz, .asm_3fa74
@@ -8180,7 +8180,7 @@ MimicEffect: ; 3f9ed (f:79ed)
ld a, [wEnemyMoveListIndex]
jr .asm_3fa5f
.asm_3fa3a
- ld a, [W_ENEMYBATTSTATUS1]
+ ld a, [wEnemyBattleStatus1]
bit Invulnerable, a
jr nz, .asm_3fa74
ld a, [wCurrentMenuItem]
@@ -8374,11 +8374,11 @@ ParalyzedMayNotAttackText: ; 3fb74 (f:7b74)
CheckTargetSubstitute: ; 3fb79 (f:7b79)
push hl
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .next1
- ld hl, W_PLAYERBATTSTATUS2
+ ld hl, wPlayerBattleStatus2
.next1
bit HasSubstituteUp, [hl]
pop hl
diff --git a/engine/battle/decrement_pp.asm b/engine/battle/decrement_pp.asm
index c6a9f2b5..da1910ee 100644
--- a/engine/battle/decrement_pp.asm
+++ b/engine/battle/decrement_pp.asm
@@ -4,9 +4,9 @@ DecrementPP: ; f42db (3d:42db)
cp a, STRUGGLE
ret z ; if the pokemon is using "struggle", there's nothing to do
; we don't decrement PP for "struggle"
- ld hl, W_PLAYERBATTSTATUS1
- ld a, [hli] ; load the W_PLAYERBATTSTATUS1 pokemon status flags and increment hl to load the
- ; W_PLAYERBATTSTATUS2 status flags later
+ ld hl, wPlayerBattleStatus1
+ ld a, [hli] ; load the wPlayerBattleStatus1 pokemon status flags and increment hl to load the
+ ; wPlayerBattleStatus2 status flags later
and a, (1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << AttackingMultipleTimes)
ret nz ; if any of these statuses are true, don't decrement PP
bit UsingRage, [hl]
@@ -17,7 +17,7 @@ DecrementPP: ; f42db (3d:42db)
call .DecrementPP
; decrement PP in the party struct
- ld a, [W_PLAYERBATTSTATUS3]
+ ld a, [wPlayerBattleStatus3]
bit Transformed, a
ret nz ; Return if transformed. Pokemon Red stores the "current pokemon's" PP
; separately from the "Pokemon in your party's" PP. This is
diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm
index 65e18999..0480bfcb 100644
--- a/engine/battle/experience.asm
+++ b/engine/battle/experience.asm
@@ -223,7 +223,7 @@ GainExperience: ; 5524f (15:524f)
ld bc, 1 + NUM_STATS * 2 ; size of stats
call CopyData
pop hl
- ld a, [W_PLAYERBATTSTATUS3]
+ ld a, [wPlayerBattleStatus3]
bit 3, a ; is the mon transformed?
jr nz, .recalcStatChanges
; the mon is not transformed, so update the unmodified stats
diff --git a/engine/battle/moveEffects/conversion_effect.asm b/engine/battle/moveEffects/conversion_effect.asm
index 968f27e9..5965f2a8 100644
--- a/engine/battle/moveEffects/conversion_effect.asm
+++ b/engine/battle/moveEffects/conversion_effect.asm
@@ -3,13 +3,13 @@ ConversionEffect_: ; 1396d (4:796d)
ld de, wBattleMonType1
ld a, [H_WHOSETURN]
and a
- ld a, [W_ENEMYBATTSTATUS1]
+ ld a, [wEnemyBattleStatus1]
jr z, .conversionEffect
push hl
ld h, d
ld l, e
pop de
- ld a, [W_PLAYERBATTSTATUS1]
+ ld a, [wPlayerBattleStatus1]
.conversionEffect
bit Invulnerable, a ; is mon immune to typical attacks (dig/fly)
jr nz, PrintButItFailedText
diff --git a/engine/battle/moveEffects/focus_energy_effect.asm b/engine/battle/moveEffects/focus_energy_effect.asm
index e88d065a..e7f30794 100644
--- a/engine/battle/moveEffects/focus_energy_effect.asm
+++ b/engine/battle/moveEffects/focus_energy_effect.asm
@@ -1,9 +1,9 @@
FocusEnergyEffect_: ; f628b (3d:628b)
- ld hl, W_PLAYERBATTSTATUS2
+ ld hl, wPlayerBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .notEnemy
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
.notEnemy
bit GettingPumped, [hl] ; is mon already using focus energy?
jr nz, .alreadyUsing
diff --git a/engine/battle/moveEffects/haze_effect.asm b/engine/battle/moveEffects/haze_effect.asm
index fcee5a2f..de36ac36 100644
--- a/engine/battle/moveEffects/haze_effect.asm
+++ b/engine/battle/moveEffects/haze_effect.asm
@@ -36,9 +36,9 @@ HazeEffect_: ; 139a4 (4:79a4)
ld hl, wPlayerDisabledMoveNumber
ld [hli], a
ld [hl], a
- ld hl, W_PLAYERBATTSTATUS1
+ ld hl, wPlayerBattleStatus1
call CureVolatileStatuses
- ld hl, W_ENEMYBATTSTATUS1
+ ld hl, wEnemyBattleStatus1
call CureVolatileStatuses
ld hl, PlayCurrentMoveAnimation
call CallBankF
diff --git a/engine/battle/moveEffects/leech_seed_effect.asm b/engine/battle/moveEffects/leech_seed_effect.asm
index 1b0afe4b..769e9ed9 100644
--- a/engine/battle/moveEffects/leech_seed_effect.asm
+++ b/engine/battle/moveEffects/leech_seed_effect.asm
@@ -3,12 +3,12 @@ LeechSeedEffect_: ; 2bea9 (a:7ea9)
ld a, [W_MOVEMISSED]
and a
jr nz, .moveMissed
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
ld de, wEnemyMonType1
ld a, [H_WHOSETURN]
and a
jr z, .leechSeedEffect
- ld hl, W_PLAYERBATTSTATUS2
+ ld hl, wPlayerBattleStatus2
ld de, wBattleMonType1
.leechSeedEffect
; miss if the target is grass-type or already seeded
diff --git a/engine/battle/moveEffects/mist_effect.asm b/engine/battle/moveEffects/mist_effect.asm
index 5d7669f8..022606bb 100644
--- a/engine/battle/moveEffects/mist_effect.asm
+++ b/engine/battle/moveEffects/mist_effect.asm
@@ -1,9 +1,9 @@
MistEffect_: ; f64ac (3d:64ac)
- ld hl, W_PLAYERBATTSTATUS2
+ ld hl, wPlayerBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .mistEffect
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
.mistEffect
bit ProtectedByMist, [hl] ; is mon protected by mist?
jr nz, .mistAlreadyInUse
diff --git a/engine/battle/moveEffects/reflect_light_screen_effect.asm b/engine/battle/moveEffects/reflect_light_screen_effect.asm
index ee053670..12bb3367 100644
--- a/engine/battle/moveEffects/reflect_light_screen_effect.asm
+++ b/engine/battle/moveEffects/reflect_light_screen_effect.asm
@@ -1,10 +1,10 @@
ReflectLightScreenEffect_: ; f645d (3d:645d)
- ld hl, W_PLAYERBATTSTATUS3
+ ld hl, wPlayerBattleStatus3
ld de, W_PLAYERMOVEEFFECT
ld a, [H_WHOSETURN]
and a
jr z, .reflectLightScreenEffect
- ld hl, W_ENEMYBATTSTATUS3
+ ld hl, wEnemyBattleStatus3
ld de, W_ENEMYMOVEEFFECT
.reflectLightScreenEffect
ld a, [de]
diff --git a/engine/battle/moveEffects/substitute_effect.asm b/engine/battle/moveEffects/substitute_effect.asm
index 54b752ef..a4cd0264 100644
--- a/engine/battle/moveEffects/substitute_effect.asm
+++ b/engine/battle/moveEffects/substitute_effect.asm
@@ -1,15 +1,15 @@
-SubstituteEffect_: ; 17dad (5:7dad)
+SubstituteEffect_: ; 17c31 (5:7c31)
ld c, 50
call DelayFrames
ld hl, wBattleMonMaxHP
ld de, wPlayerSubstituteHP
- ld bc, W_PLAYERBATTSTATUS2
+ ld bc, wPlayerBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .notEnemy
ld hl, wEnemyMonMaxHP
ld de, wEnemySubstituteHP
- ld bc, W_ENEMYBATTSTATUS2
+ ld bc, wEnemyBattleStatus2
.notEnemy
ld a, [bc]
bit HasSubstituteUp, a ; user already has substitute?
@@ -64,14 +64,14 @@ SubstituteEffect_: ; 17dad (5:7dad)
.printText
jp PrintText
-SubstituteText: ; 17e1d (5:7e1d)
+SubstituteText: ; 17ca1 (5:7ca1)
TX_FAR _SubstituteText
db "@"
-HasSubstituteText: ; 17e22 (5:7e22)
+HasSubstituteText: ; 17ca6 (5:7ca6)
TX_FAR _HasSubstituteText
db "@"
-TooWeakSubstituteText: ; 17e27 (5:7e27)
+TooWeakSubstituteText: ; 17cab (5:7cab)
TX_FAR _TooWeakSubstituteText
db "@"
diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm
index bf252600..d77f43a3 100644
--- a/engine/battle/moveEffects/transform_effect.asm
+++ b/engine/battle/moveEffects/transform_effect.asm
@@ -1,27 +1,27 @@
TransformEffect_: ; f637f (3d:637f)
ld hl, wBattleMonSpecies
ld de, wEnemyMonSpecies
- ld bc, W_ENEMYBATTSTATUS3
- ld a, [W_ENEMYBATTSTATUS1]
+ ld bc, wEnemyBattleStatus3
+ ld a, [wEnemyBattleStatus1]
ld a, [H_WHOSETURN]
and a
jr nz, .hitTest
ld hl, wEnemyMonSpecies
ld de, wBattleMonSpecies
- ld bc, W_PLAYERBATTSTATUS3
+ ld bc, wPlayerBattleStatus3
ld [wPlayerMoveListIndex], a
- ld a, [W_PLAYERBATTSTATUS1]
+ ld a, [wPlayerBattleStatus1]
.hitTest
bit Invulnerable, a ; is mon invulnerable to typical attacks? (fly/dig)
jp nz, .failed
push hl
push de
push bc
- ld hl, W_PLAYERBATTSTATUS2
+ ld hl, wPlayerBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .transformEffect
- ld hl, W_ENEMYBATTSTATUS2
+ ld hl, wEnemyBattleStatus2
.transformEffect
; animation(s) played are different if target has Substitute up
bit HasSubstituteUp, [hl]
diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm
index 072d3c8a..2209fb57 100644
--- a/engine/battle/trainer_ai.asm
+++ b/engine/battle/trainer_ai.asm
@@ -727,27 +727,27 @@ AICureStatus: ; 3a791 (e:6791)
xor a
ld [hl],a ; clear status in enemy team roster
ld [wEnemyMonStatus],a ; clear status of active enemy
- ld hl,W_ENEMYBATTSTATUS3
+ ld hl,wEnemyBattleStatus3
res 0,[hl]
ret
AIUseXAccuracy: ; 0x3a7a8 unused
call AIPlayRestoringSFX
- ld hl,W_ENEMYBATTSTATUS2
+ ld hl,wEnemyBattleStatus2
set 0,[hl]
ld a,X_ACCURACY
jp AIPrintItemUse
AIUseGuardSpec: ; 3a7b5 (e:67b5)
call AIPlayRestoringSFX
- ld hl,W_ENEMYBATTSTATUS2
+ ld hl,wEnemyBattleStatus2
set 1,[hl]
ld a,GUARD_SPEC_
jp AIPrintItemUse
AIUseDireHit: ; 0x3a7c2 unused
call AIPlayRestoringSFX
- ld hl,W_ENEMYBATTSTATUS2
+ ld hl,wEnemyBattleStatus2
set 2,[hl]
ld a,DIRE_HIT
jp AIPrintItemUse
diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm
index 7de90e55..31587672 100755
--- a/engine/give_pokemon.asm
+++ b/engine/give_pokemon.asm
@@ -12,7 +12,7 @@ _GivePokemon: ; f66fa (3d:66fa)
jr nc, .boxFull
; add to box
xor a
- ld [W_ENEMYBATTSTATUS3], a
+ ld [wEnemyBattleStatus3], a
ld a, [wcf91]
ld [wEnemyMonSpecies2], a
callab LoadEnemyMonData
diff --git a/engine/items/items.asm b/engine/items/items.asm
index 0e3b68ae..c2aff579 100755
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -371,7 +371,7 @@ ItemUseBall: ; d3ad (3:53ad)
ld a,[hl]
push af ;...and status ailments
push hl
- ld hl,W_ENEMYBATTSTATUS3
+ ld hl,wEnemyBattleStatus3
bit Transformed,[hl]
jr z,.next15
ld a,$4c
@@ -861,7 +861,7 @@ ItemUseMedicine: ; d8ae (3:58ae)
xor a
ld [wBattleMonStatus],a ; remove the status ailment in the in-battle pokemon data
push hl
- ld hl,W_PLAYERBATTSTATUS3
+ ld hl,wPlayerBattleStatus3
res BadlyPoisoned,[hl] ; heal Toxic status
pop hl
ld bc,30
@@ -1536,7 +1536,7 @@ ItemUseXAccuracy: ; de3e (3:5e3e)
ld a,[wIsInBattle]
and a
jp z,ItemUseNotTime
- ld hl,W_PLAYERBATTSTATUS2
+ ld hl,wPlayerBattleStatus2
set UsingXAccuracy,[hl] ; X Accuracy bit
callabd_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM
jp PrintItemUseTextAndRemoveItem
@@ -1655,7 +1655,7 @@ ItemUseGuardSpec: ; df11 (3:5f11)
pop af
ld [wWhichPokemon], a
- ld hl,W_PLAYERBATTSTATUS2
+ ld hl,wPlayerBattleStatus2
set ProtectedByMist,[hl] ; Mist bit
jp PrintItemUseTextAndRemoveItem
@@ -1680,7 +1680,7 @@ ItemUseDireHit: ; df42 (3:5f42)
pop af
ld [wWhichPokemon], a
- ld hl,W_PLAYERBATTSTATUS2
+ ld hl,wPlayerBattleStatus2
set GettingPumped,[hl] ; Focus Energy bit
jp PrintItemUseTextAndRemoveItem
@@ -2079,7 +2079,7 @@ ItemUsePPRestore: ; e1f7 (3:61f7)
ld a, [wPlayerMonNumber]
cp b
jr nz, .usePPItem
- ld a, [W_PLAYERBATTSTATUS3]
+ ld a, [wPlayerBattleStatus3]
bit Transformed, a
jr z, .usePPItem
call ItemUseNotTime
diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm
index 78b35b95..373ae580 100755
--- a/engine/menu/pc.asm
+++ b/engine/menu/pc.asm
@@ -1,4 +1,4 @@
-ActivatePC: ; 17e2c (5:7e2c)
+ActivatePC: ; 17cb0 (5:7cb0)
call SaveScreenTilesToBuffer2
ld a, SFX_TURN_ON_PC
call PlaySound
@@ -9,7 +9,7 @@ ActivatePC: ; 17e2c (5:7e2c)
set 3, [hl]
call LoadScreenTilesFromBuffer2
call Delay3
-PCMainMenu: ; 17e48 (5:7e48)
+PCMainMenu: ; 17ccc (5:7ccc)
callba DisplayPCMainMenu
ld hl, wFlags_0xcd60
set 5, [hl]
@@ -58,19 +58,19 @@ PCMainMenu: ; 17e48 (5:7e48)
call PrintText
callba PlayerPC
jr ReloadMainMenu
-OaksPC: ; 17ec0 (5:7ec0)
+OaksPC: ; 17d44 (5:7d44)
ld a, SFX_ENTER_PC
call PlaySound
call WaitForSoundToFinish
callba OpenOaksPC
jr ReloadMainMenu
-PKMNLeague: ; 17ed2 (5:7ed2)
+PKMNLeague: ; 17d56 (5:7d56)
ld a, SFX_ENTER_PC
call PlaySound
call WaitForSoundToFinish
callba PKMNLeaguePC
jr ReloadMainMenu
-BillsPC: ; 17ee4 (5:7ee4)
+BillsPC: ; 17d68 (5:7d68)
ld a, SFX_ENTER_PC
call PlaySound
call WaitForSoundToFinish
@@ -83,13 +83,13 @@ BillsPC: ; 17ee4 (5:7ee4)
.printText
call PrintText
callba BillsPC_
-ReloadMainMenu: ; 17f06 (5:7f06)
+ReloadMainMenu: ; 17d8a (5:7d8a)
xor a
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
call ReloadMapData
call UpdateSprites
jp PCMainMenu
-LogOff: ; 17f13 (5:7f13)
+LogOff: ; 17d97 (5:7d97)
ld a, SFX_TURN_OFF_PC
call PlaySound
call WaitForSoundToFinish
@@ -98,41 +98,41 @@ LogOff: ; 17f13 (5:7f13)
res 5, [hl]
ret
-TurnedOnPC1Text: ; 17f23 (5:7f23)
+TurnedOnPC1Text: ; 17da7 (5:7da7)
TX_FAR _TurnedOnPC1Text
db "@"
-AccessedBillsPCText: ; 17f28 (5:7f28)
+AccessedBillsPCText: ; 17dac (5:7dac)
TX_FAR _AccessedBillsPCText
db "@"
-AccessedSomeonesPCText: ; 17f2d (5:7f2d)
+AccessedSomeonesPCText: ; 17db1 (5:7db1)
TX_FAR _AccessedSomeonesPCText
db "@"
-AccessedMyPCText: ; 17f32 (5:7f32)
+AccessedMyPCText: ; 17db6 (5:7db6)
TX_FAR _AccessedMyPCText
db "@"
; removes one of the specified item ID [hItemToRemoveID] from bag (if existent)
-RemoveItemByID: ; 17f37 (5:7f37)
+RemoveItemByID: ; 17dbb (5:7dbb)
ld hl, wBagItems
ld a, [hItemToRemoveID]
ld b, a
xor a
ld [hItemToRemoveIndex], a
-.asm_17f40
+.loop
ld a, [hli]
- cp $ff
+ cp $ff ; have we reached the cancel button (terminator)
ret z
- cp b
- jr z, .asm_17f4f
+ cp b ; is the current item the item we want?
+ jr z, .foundItem ; if so, remove it from the inventory
inc hl
ld a, [hItemToRemoveIndex]
inc a
ld [hItemToRemoveIndex], a
- jr .asm_17f40
-.asm_17f4f
+ jr .loop
+.foundItem
ld a, $1
ld [wItemQuantity], a
ld a, [hItemToRemoveIndex]
diff --git a/engine/palettes.asm b/engine/palettes.asm
index 1b16f845..56b77411 100755
--- a/engine/palettes.asm
+++ b/engine/palettes.asm
@@ -30,7 +30,7 @@ SetPal_Battle: ; 71eda (1c:5eda)
ld de, wPalPacket
ld bc, $10
call CopyData
- ;ld a, [W_PLAYERBATTSTATUS3]
+ ;ld a, [wPlayerBattleStatus3]
ld hl, wBattleMonSpecies
ld a, [hl]
and a
@@ -42,7 +42,7 @@ SetPal_Battle: ; 71eda (1c:5eda)
.asm_71ef9
call DeterminePaletteID
ld b, a
- ;ld a, [W_ENEMYBATTSTATUS3]
+ ;ld a, [wEnemyBattleStatus3]
ld hl, wEnemyMonSpecies2
call DeterminePaletteID
ld c, a
diff --git a/wram.asm b/wram.asm
index 4de02c97..ee070fbf 100755
--- a/wram.asm
+++ b/wram.asm
@@ -1646,7 +1646,7 @@ wPlayerStatsToHalve:: ; d061
; always 0
ds 1
-W_PLAYERBATTSTATUS1:: ; d062
+wPlayerBattleStatus1:: ; d062
; bit 0 - bide
; bit 1 - thrash / petal dance
; bit 2 - attacking multiple times (e.g. double kick)
@@ -1657,7 +1657,7 @@ W_PLAYERBATTSTATUS1:: ; d062
; bit 7 - confusion
ds 1
-W_PLAYERBATTSTATUS2:: ; d063
+wPlayerBattleStatus2:: ; d063
; bit 0 - X Accuracy effect
; bit 1 - protected by "mist"
; bit 2 - focus energy effect
@@ -1667,7 +1667,7 @@ W_PLAYERBATTSTATUS2:: ; d063
; bit 7 - leech seeded
ds 1
-W_PLAYERBATTSTATUS3:: ; d064
+wPlayerBattleStatus3:: ; d064
; bit 0 - toxic
; bit 1 - light screen
; bit 2 - reflect
@@ -1682,11 +1682,11 @@ wEnemyStatsToHalve:: ; d066
; always 0
ds 1
-W_ENEMYBATTSTATUS1:: ; d067
+wEnemyBattleStatus1:: ; d067
ds 1
-W_ENEMYBATTSTATUS2:: ; d068
+wEnemyBattleStatus2:: ; d068
ds 1
-W_ENEMYBATTSTATUS3:: ; d069
+wEnemyBattleStatus3:: ; d069
ds 1
wPlayerNumAttacksLeft::
diff --git a/yellow/main.asm b/yellow/main.asm
index 6ac82a84..b4dfa440 100755
--- a/yellow/main.asm
+++ b/yellow/main.asm
@@ -3621,9 +3621,8 @@ BrunoSprite: INCBIN "gfx/sprites/bruno.2bpp"
LoreleiSprite: INCBIN "gfx/sprites/lorelei.2bpp"
SeelSprite: INCBIN "gfx/sprites/seel.2bpp"
- dr $17c31,$17cb0
-ActivatePC: ; 17cb0 (5:7cb0)
- dr $17cb0,$18000
+INCLUDE "engine/battle/moveEffects/substitute_effect.asm"
+INCLUDE "engine/menu/pc.asm"
SECTION "bank06",ROMX,BANK[$06]
dr $18000,$1a4ea
@@ -3646,7 +3645,9 @@ SECTION "bank07",ROMX,BANK[$07]
dr $1c000,$1c21e
DoClearSaveDialogue: ; 1c21e (7:421e)
- dr $1c21e,$1e321
+ dr $1c21e,$1e2ae
+OpenOaksPC: ; 1e2ae (7:62ae)
+ dr $1e2ae,$1e321
SafariZoneCheck: ; 1e321 (7:6e21)
dr $1e321,$1e330
SafariZoneCheckSteps: ; 1e330 (7:6330)
@@ -4293,13 +4294,17 @@ SECTION "bank1D",ROMX,BANK[$1D]
HiddenItemNear: ; 7405c (1d:405c)
dr $7405c,$74726
VendingMachineMenu: ; 74726 (1d:4726)
- dr $74726,$78000
+ dr $74726,$75dfe
+PKMNLeaguePC: ; 75dfe (1d:5dfe)
+ dr $75dfe,$78000
SECTION "bank1E",ROMX,BANK[$1E]
dr $78000,$78757
AnimationTileset2: ; 78757 (1e:4757)
- dr $78757,$79816
+ dr $78757,$797af
+AnimationSubstitute: ; 797af (1e:57af)
+ dr $797af,$79816
HideSubstituteShowMonAnim: ; 79816 (1e:5816)
dr $79816,$798b2
ReshowSubstituteAnim: ; 798b2 (1e:58b2)