summaryrefslogtreecommitdiff
path: root/engine/battle/experience.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle/experience.asm')
-rw-r--r--engine/battle/experience.asm84
1 files changed, 42 insertions, 42 deletions
diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm
index 9bd67654..24748338 100644
--- a/engine/battle/experience.asm
+++ b/engine/battle/experience.asm
@@ -1,4 +1,4 @@
-GainExperience: ; 5524f (15:524f)
+GainExperience:
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ret z ; return if link battle
@@ -15,7 +15,7 @@ GainExperience: ; 5524f (15:524f)
ld hl, wPartyGainExpFlags
ld a, [wWhichPokemon]
ld c, a
- ld b, $2
+ ld b, FLAG_TEST
predef FlagActionPredef
ld a, c
and a ; is mon's gain exp flag set?
@@ -26,7 +26,7 @@ GainExperience: ; 5524f (15:524f)
ld d, h
ld e, l
ld hl, wEnemyMonBaseStats
- ld c, $5
+ ld c, NUM_STATS
.gainStatExpLoop
ld a, [hli]
ld b, a ; enemy mon base stat
@@ -49,11 +49,11 @@ GainExperience: ; 5524f (15:524f)
ld [de], a
.nextBaseStat
dec c
- jr z, .asm_552a1
+ jr z, .statExpDone
inc de
inc de
jr .gainStatExpLoop
-.asm_552a1
+.statExpDone
xor a
ld [H_MULTIPLICAND], a
ld [H_MULTIPLICAND + 1], a
@@ -66,7 +66,7 @@ GainExperience: ; 5524f (15:524f)
ld [H_DIVISOR], a
ld b, 4
call Divide
- ld hl, -((wPartyMon1HPExp + 1) - wPartyMon1OTID + 4 * 2)
+ ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1)
add hl, de
ld b, [hl] ; party mon OTID
inc hl
@@ -76,14 +76,14 @@ GainExperience: ; 5524f (15:524f)
ld b, [hl]
ld a, [wPlayerID + 1]
cp b
- ld a, $0
+ ld a, 0
jr z, .next
.tradedMon
call BoostExp ; traded mon exp boost
- ld a, $1
+ ld a, 1
.next
ld [wGainBoostedExp], a
- ld a, [W_ISINBATTLE]
+ ld a, [wIsInBattle]
dec a ; is it a trainer battle?
call nz, BoostExp ; if so, boost exp
inc hl
@@ -92,12 +92,12 @@ GainExperience: ; 5524f (15:524f)
; add the gained exp to the party mon's exp
ld b, [hl]
ld a, [H_QUOTIENT + 3]
- ld [wcf4c], a
+ ld [wExpAmountGained + 1], a
add b
ld [hld], a
ld b, [hl]
ld a, [H_QUOTIENT + 2]
- ld [wcf4b], a
+ ld [wExpAmountGained], a
adc b
ld [hl], a
jr nc, .noCarry
@@ -119,11 +119,11 @@ GainExperience: ; 5524f (15:524f)
ld d, MAX_LEVEL
callab CalcExperience ; get max exp
; compare max exp with current exp
- ld a, [$ff96]
+ ld a, [hExperience]
ld b, a
- ld a, [$ff97]
+ ld a, [hExperience + 1]
ld c, a
- ld a, [$ff98]
+ ld a, [hExperience + 2]
ld d, a
pop hl
ld a, [hld]
@@ -148,8 +148,8 @@ GainExperience: ; 5524f (15:524f)
call GetPartyMonName
ld hl, GainedText
call PrintText
- xor a ; party mon data
- ld [wcc49], a
+ xor a ; PLAYER_PARTY_DATA
+ ld [wMonDataLocation], a
call LoadMonData
pop hl
ld bc, wPartyMon1Level - wPartyMon1Exp
@@ -160,11 +160,11 @@ GainExperience: ; 5524f (15:524f)
ld a, [hl] ; current level
cp d
jp z, .nextMon ; if level didn't change, go to next mon
- ld a, [W_CURENEMYLVL]
+ ld a, [wCurEnemyLVL]
push af
push hl
ld a, d
- ld [W_CURENEMYLVL], a
+ ld [wCurEnemyLVL], a
ld [hl], a
ld bc, wPartyMon1Species - wPartyMon1Level
add hl, bc
@@ -220,19 +220,19 @@ GainExperience: ; 5524f (15:524f)
add hl, bc
push hl
ld de, wBattleMonLevel
- ld bc, $b ; size of stats
+ 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
ld de, wPlayerMonUnmodifiedLevel
- ld bc, $b
+ ld bc, 1 + NUM_STATS * 2
call CopyData
.recalcStatChanges
- xor a
- ld [wd11e], a
+ xor a ; battle mon
+ ld [wCalculateWhoseStats], a
callab CalculateModifiedStats
callab ApplyBurnAndParalysisPenaltiesToPlayer
callab ApplyBadgeStatBoosts
@@ -242,26 +242,26 @@ GainExperience: ; 5524f (15:524f)
.printGrewLevelText
ld hl, GrewLevelText
call PrintText
- xor a ; party mon data
- ld [wcc49], a
+ xor a ; PLAYER_PARTY_DATA
+ ld [wMonDataLocation], a
call LoadMonData
ld d, $1
callab PrintStatsBox
call WaitForTextScrollButtonPress
call LoadScreenTilesFromBuffer1
- xor a
- ld [wcc49], a
+ xor a ; PLAYER_PARTY_DATA
+ ld [wMonDataLocation], a
ld a, [wd0b5]
ld [wd11e], a
predef LearnMoveFromLevelUp
- ld hl, wccd3
+ ld hl, wCanEvolveFlags
ld a, [wWhichPokemon]
ld c, a
- ld b, $1
+ ld b, FLAG_SET
predef FlagActionPredef
pop hl
pop af
- ld [W_CURENEMYLVL], a
+ ld [wCurEnemyLVL], a
.nextMon
ld a, [wPartyCount]
@@ -281,7 +281,7 @@ GainExperience: ; 5524f (15:524f)
ld [hl], a ; clear gain exp flags
ld a, [wPlayerMonNumber]
ld c, a
- ld b, $1
+ ld b, FLAG_SET
push bc
predef FlagActionPredef ; set the gain exp flag for the mon that is currently out
ld hl, wPartyFoughtCurrentEnemyFlags
@@ -291,7 +291,7 @@ GainExperience: ; 5524f (15:524f)
predef_jump FlagActionPredef ; set the fought current enemy flag for the mon that is currently out
; divide enemy base stats, catch rate, and base exp by the number of mons gaining exp
-DivideExpDataByNumMonsGainingExp: ; 5546c (15:546c)
+DivideExpDataByNumMonsGainingExp:
ld a, [wPartyGainExpFlags]
ld b, a
xor a
@@ -308,7 +308,7 @@ DivideExpDataByNumMonsGainingExp: ; 5546c (15:546c)
ret c ; return if only one mon is gaining exp
ld [wd11e], a ; store number of mons gaining exp
ld hl, wEnemyMonBaseStats
- ld c, $7
+ ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats
.divideLoop
xor a
ld [H_DIVIDEND], a
@@ -325,7 +325,7 @@ DivideExpDataByNumMonsGainingExp: ; 5546c (15:546c)
ret
; multiplies exp by 1.5
-BoostExp: ; 5549f (15:549f)
+BoostExp:
ld a, [H_QUOTIENT + 2]
ld b, a
ld a, [H_QUOTIENT + 3]
@@ -339,9 +339,9 @@ BoostExp: ; 5549f (15:549f)
ld [H_QUOTIENT + 2], a
ret
-GainedText: ; 554b2 (15:54b2)
+GainedText:
TX_FAR _GainedText
- db $08 ; asm
+ TX_ASM
ld a, [wBoostExpByExpAll]
ld hl, WithExpAllText
and a
@@ -353,20 +353,20 @@ GainedText: ; 554b2 (15:54b2)
ld hl, BoostedText
ret
-WithExpAllText: ; 554cb (15:54cb)
+WithExpAllText:
TX_FAR _WithExpAllText
- db $08 ; asm
+ TX_ASM
ld hl, ExpPointsText
ret
-BoostedText: ; 554d4 (15:54d4)
+BoostedText:
TX_FAR _BoostedText
-ExpPointsText: ; 554d8 (15:54d8)
+ExpPointsText:
TX_FAR _ExpPointsText
db "@"
-GrewLevelText: ; 554dd (15:54dd)
+GrewLevelText:
TX_FAR _GrewLevelText
- db $0b
+ TX_SFX_LEVEL_UP
db "@"