aboutsummaryrefslogtreecommitdiffstats
path: root/engine/battle/experience.asm
diff options
context:
space:
mode:
authorNarishma-gb <194818981+Narishma-gb@users.noreply.github.com>2025-11-27 19:39:25 +0100
committerGitHub <noreply@github.com>2025-11-27 13:39:25 -0500
commit3a4382c6055e21da72357dd18638947a2acbbda9 (patch)
treecb383fbd6a0dc57e3b0f9e9483c2a3f898f42f96 /engine/battle/experience.asm
parentAvoid magic numbers for most `CopyData` calls (#542) (diff)
downloadpokeyellow-3a4382c6055e21da72357dd18638947a2acbbda9.tar.gz
pokeyellow-3a4382c6055e21da72357dd18638947a2acbbda9.tar.xz
pokeyellow-3a4382c6055e21da72357dd18638947a2acbbda9.zip
Use more Pokemon data constants, create MOVE_NAME_LENGTH (#543)
Diffstat (limited to 'engine/battle/experience.asm')
-rw-r--r--engine/battle/experience.asm26
1 files changed, 13 insertions, 13 deletions
diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm
index a8ee6747..4e44643c 100644
--- a/engine/battle/experience.asm
+++ b/engine/battle/experience.asm
@@ -21,7 +21,7 @@ GainExperience:
and a ; is mon's gain exp flag set?
pop hl
jp z, .nextMon ; if mon's gain exp flag not set, go to next mon
- ld de, (wPartyMon1HPExp + 1) - (wPartyMon1HP + 1)
+ ld de, (MON_HP_EXP + 1) - (MON_HP + 1)
add hl, de
ld d, h
ld e, l
@@ -66,9 +66,9 @@ GainExperience:
ldh [hDivisor], a
ld b, 4
call Divide
- ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1)
+ ld hl, MON_OTID - (MON_DVS - 1)
add hl, de
- ld b, [hl] ; party mon OTID
+ ld b, [hl] ; wPartyMon*OTID
inc hl
ld a, [wPlayerID]
cp b
@@ -152,7 +152,7 @@ GainExperience:
ld [wMonDataLocation], a
call LoadMonData
pop hl
- ld bc, wPartyMon1Level - wPartyMon1Exp
+ ld bc, MON_LEVEL - MON_EXP
add hl, bc
push hl
farcall CalcLevelFromExperience
@@ -166,13 +166,13 @@ GainExperience:
ld a, d
ld [wCurEnemyLevel], a
ld [hl], a
- ld bc, wPartyMon1Species - wPartyMon1Level
+ ld bc, MON_SPECIES - MON_LEVEL
add hl, bc
ld a, [hl]
ld [wCurSpecies], a
ld [wPokedexNum], a
call GetMonHeader
- ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species
+ ld bc, (MON_MAXHP + 1) - MON_SPECIES
add hl, bc
push hl
ld a, [hld]
@@ -181,7 +181,7 @@ GainExperience:
push bc ; push max HP (from before levelling up)
ld d, h
ld e, l
- ld bc, (wPartyMon1HPExp - 1) - wPartyMon1MaxHP
+ ld bc, (MON_HP_EXP - 1) - MON_MAXHP
add hl, bc
ld b, $1 ; consider stat exp when calculating stats
call CalcStats
@@ -193,15 +193,15 @@ GainExperience:
ld a, [hl]
sbc b
ld b, a ; bc = difference between old max HP and new max HP after levelling
- ld de, (wPartyMon1HP + 1) - wPartyMon1MaxHP
+ ld de, (MON_HP + 1) - MON_MAXHP
add hl, de
; add to the current HP the amount of max HP gained when levelling
- ld a, [hl] ; wPartyMon1HP + 1
+ ld a, [hl] ; wPartyMon*HP + 1
add c
ld [hld], a
- ld a, [hl] ; wPartyMon1HP + 1
+ ld a, [hl] ; wPartyMon*HP + 1
adc b
- ld [hl], a ; wPartyMon1HP
+ ld [hl], a ; wPartyMon*HP
ld a, [wPlayerMonNumber]
ld b, a
ld a, [wWhichPokemon]
@@ -216,7 +216,7 @@ GainExperience:
ld a, [hl]
ld [de], a
; copy other stats from party mon to battle mon
- ld bc, wPartyMon1Level - (wPartyMon1HP + 1)
+ ld bc, MON_LEVEL - (MON_HP + 1)
add hl, bc
push hl
ld de, wBattleMonLevel
@@ -271,7 +271,7 @@ GainExperience:
cp b
jr z, .done
ld [wWhichPokemon], a
- ld bc, wPartyMon2 - wPartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
ld hl, wPartyMon1
call AddNTimes
jp .partyMonLoop