summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/ai/scoring.asm69
-rw-r--r--engine/battle/core.asm2
-rw-r--r--engine/battle/trainer_huds.asm2
3 files changed, 37 insertions, 36 deletions
diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm
index 75efcf920..10ad045ff 100644
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -1,5 +1,6 @@
AIScoring: ; used only for BANK(AIScoring)
+
AI_Basic:
; Don't do anything redundant:
; -Using status-only moves if the player can't be statused
@@ -458,15 +459,15 @@ AI_Smart_LockOn:
.asm_38834
ld a, [wPlayerEvaLevel]
- cp $a
+ cp BASE_STAT_LEVEL + 3
jr nc, .asm_3887a
- cp $8
+ cp BASE_STAT_LEVEL + 1
jr nc, .asm_38875
ld a, [wEnemyAccLevel]
- cp $5
+ cp BASE_STAT_LEVEL - 2
jr c, .asm_3887a
- cp $7
+ cp BASE_STAT_LEVEL
jr c, .asm_38875
ld hl, wEnemyMonMoves
@@ -572,7 +573,7 @@ AI_Smart_Selfdestruct:
; If enemy's HP is between 25% and 50%,
; over 90% chance to greatly discourage this move.
call Random
- cp 9 percent - 2
+ cp 8 percent
ret c
.asm_388c6
@@ -596,7 +597,7 @@ AI_Smart_DreamEater:
AI_Smart_EvasionUp:
; Dismiss this move if enemy's evasion can't raise anymore.
ld a, [wEnemyEvaLevel]
- cp $d
+ cp MAX_STAT_LEVEL
jp nc, AIDiscourageMove
; If enemy's HP is full...
@@ -707,12 +708,12 @@ AI_Smart_AlwaysHit:
; ...enemy's accuracy level has been lowered three or more stages
ld a, [wEnemyAccLevel]
- cp $5
+ cp BASE_STAT_LEVEL - 2
jr c, .asm_38954
; ...or player's evasion level has been raised three or more stages.
ld a, [wPlayerEvaLevel]
- cp $a
+ cp BASE_STAT_LEVEL + 3
ret c
.asm_38954
@@ -872,12 +873,12 @@ AI_Smart_ResetStats:
; 85% chance to encourage this move if any of enemy's stat levels is lower than -2.
push hl
ld hl, wEnemyAtkLevel
- ld c, $8
+ ld c, NUM_LEVEL_STATS
.asm_389fb
dec c
jr z, .asm_38a05
ld a, [hli]
- cp $5
+ cp BASE_STAT_LEVEL - 2
jr c, .asm_38a12
jr .asm_389fb
@@ -889,7 +890,7 @@ AI_Smart_ResetStats:
dec c
jr z, .asm_38a1b
ld a, [hli]
- cp $a
+ cp BASE_STAT_LEVEL + 3
jr c, .asm_38a0a
.asm_38a12
@@ -1045,7 +1046,7 @@ AI_Smart_Unused2B:
.asm_38aaa
push hl
ld hl, wPlayerUsedMoves
- ld c, 4
+ ld c, NUM_MOVES
.asm_38ab0
ld a, [hli]
@@ -1108,12 +1109,12 @@ AI_Smart_SpDefenseUp2:
; Discourage this move if enemy's special defense level is higher than +3.
ld a, [wEnemySDefLevel]
- cp $b
+ cp BASE_STAT_LEVEL + 4
jr nc, .asm_38b10
; 80% chance to greatly encourage this move if
; enemy's Special Defense level is lower than +2, and the player is of a special type.
- cp $9
+ cp BASE_STAT_LEVEL + 2
ret nc
ld a, [wBattleMonType1]
@@ -1252,11 +1253,11 @@ AI_Smart_Rage:
; Encourage this move based on Rage's counter.
.asm_38b8c
ld a, [wEnemyRageCounter]
- cp $2
+ cp 2
ret c
dec [hl]
ld a, [wEnemyRageCounter]
- cp $3
+ cp 3
ret c
dec [hl]
ret
@@ -1328,7 +1329,7 @@ AI_Smart_Mimic:
AI_Smart_Counter:
push hl
ld hl, wPlayerUsedMoves
- ld c, 4
+ ld c, NUM_MOVES
ld b, 0
.asm_38bf9
@@ -1467,8 +1468,8 @@ AI_Smart_SleepTalk:
; Greatly discourage this move otherwise.
ld a, [wEnemyMonStatus]
- and $7
- cp $1
+ and SLP
+ cp 1
jr z, .asm_38cc7
dec [hl]
@@ -1510,7 +1511,7 @@ AI_Smart_Spite:
.asm_38ce7
push hl
ld b, a
- ld c, 4
+ ld c, NUM_MOVES
ld hl, wBattleMonMoves
ld de, wBattleMonPP
@@ -1529,9 +1530,9 @@ AI_Smart_Spite:
.asm_38cfb
pop hl
ld a, [de]
- cp $6
+ cp 6
jr c, .asm_38d0d
- cp $f
+ cp 15
jr nc, .asm_38d0b
call Random
@@ -1828,9 +1829,9 @@ AI_Smart_Curse:
jr nc, .asm_38e93
ld a, [wEnemyAtkLevel]
- cp $b
+ cp BASE_STAT_LEVEL + 4
jr nc, .asm_38e93
- cp $9
+ cp BASE_STAT_LEVEL + 2
ret nc
ld a, [wBattleMonType1]
@@ -1954,10 +1955,10 @@ AI_Smart_Protect:
AI_Smart_Foresight:
ld a, [wEnemyAccLevel]
- cp $5
+ cp BASE_STAT_LEVEL - 2
jr c, .asm_38f41
ld a, [wPlayerEvaLevel]
- cp $a
+ cp BASE_STAT_LEVEL + 3
jr nc, .asm_38f41
ld a, [wBattleMonType1]
@@ -2146,10 +2147,10 @@ AI_Smart_Rollout:
jr nc, .asm_39020
ld a, [wEnemyAccLevel]
- cp 7
+ cp BASE_STAT_LEVEL
jr c, .asm_39020
ld a, [wPlayerEvaLevel]
- cp 8
+ cp BASE_STAT_LEVEL + 1
jr nc, .asm_39020
; Otherwise, 80% chance to greatly encourage this move.
@@ -2417,7 +2418,7 @@ AI_Smart_BellyDrum:
; Else, discourage this move if enemy's HP is not full.
ld a, [wEnemyAtkLevel]
- cp $a
+ cp BASE_STAT_LEVEL + 3
jr nc, .asm_3914d
call AICheckEnemyMaxHP
@@ -2472,12 +2473,12 @@ AI_Smart_PsychUp:
; Else, 80% chance to encourage this move unless player's accuracy level is lower than -1...
ld a, [wPlayerAccLevel]
- cp $6
+ cp BASE_STAT_LEVEL - 1
ret c
; ...or enemy's evasion level is higher than +0.
ld a, [wEnemyEvaLevel]
- cp $8
+ cp BASE_STAT_LEVEL + 1
ret nc
call AI_80_20
@@ -2494,8 +2495,8 @@ AI_Smart_PsychUp:
AI_Smart_MirrorCoat:
push hl
ld hl, wPlayerUsedMoves
- ld c, $4
- ld b, $0
+ ld c, NUM_MOVES
+ ld b, 0
.asm_39193
ld a, [hli]
@@ -2828,7 +2829,7 @@ AIHasMoveInArray:
.next
ld a, [hli]
- cp $ff
+ cp -1
jr z, .done
ld b, a
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 4d561c7ae..d51e4cdd5 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -6200,7 +6200,7 @@ LoadEnemyMon:
jr z, .Happiness
; 40% chance of not flooring
call Random
- cp 40 percent - 2
+ cp 39 percent + 1
jr c, .Happiness
; Try again if length < 1024 mm (i.e. if HIGH(length) < 3 feet)
ld a, [wMagikarpLength]
diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm
index bc55c7423..f701a4dfc 100644
--- a/engine/battle/trainer_huds.asm
+++ b/engine/battle/trainer_huds.asm
@@ -225,7 +225,7 @@ LoadBallIconGFX:
ld de, .gfx
ld hl, vTiles0 tile $31
lb bc, BANK(LoadBallIconGFX), 4
- call Get2bpp_2
+ call Get2bppViaHDMA
ret
.gfx