summaryrefslogtreecommitdiff
path: root/engine/battle/ai
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle/ai')
-rw-r--r--engine/battle/ai/items.asm4
-rw-r--r--engine/battle/ai/scoring.asm36
-rw-r--r--engine/battle/ai/switch.asm16
3 files changed, 28 insertions, 28 deletions
diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm
index 29bc23b20..28dfb1010 100644
--- a/engine/battle/ai/items.asm
+++ b/engine/battle/ai/items.asm
@@ -806,7 +806,7 @@ EnemyUsedXItem:
push bc
call PrintText_UsedItemOn
pop bc
- farcall CheckIfStatCanBeRaised
+ farcall RaiseStat
jp AIUpdateHUD
; Parameter
@@ -818,7 +818,7 @@ PrintText_UsedItemOn_AND_AIUpdateHUD:
PrintText_UsedItemOn:
ld a, [wCurEnemyItem]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, wStringBuffer1
ld de, wMonOrItemNameBuffer
diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm
index 6928a3a83..752796892 100644
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -171,10 +171,10 @@ AI_Types:
pop bc
pop hl
- ld a, [wd265]
+ ld a, [wTypeMatchup]
and a
jr z, .immune
- cp 10 ; 1.0
+ cp EFFECTIVE
jr z, .checkmove
jr c, .noteffective
@@ -415,8 +415,8 @@ AI_Smart_LeechHit:
pop hl
; 60% chance to discourage this move if not very effective.
- ld a, [wd265]
- cp 10 ; 1.0
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
jr c, .asm_38815
; Do nothing if effectiveness is neutral.
@@ -491,8 +491,8 @@ AI_Smart_LockOn:
push hl
push bc
farcall BattleCheckTypeMatchup
- ld a, [wd265]
- cp $a
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
pop bc
pop hl
jr c, .asm_3884f
@@ -1292,8 +1292,8 @@ AI_Smart_Mimic:
ld [hBattleTurn], a
callfar BattleCheckTypeMatchup
- ld a, [wd265]
- cp $a
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
pop hl
jr c, .asm_38bef
jr z, .asm_38bd4
@@ -1408,8 +1408,8 @@ AI_Smart_Encore:
predef CheckTypeMatchup
pop hl
- ld a, [wd265]
- cp $a
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
jr nc, .asm_38c68
and a
@@ -1550,7 +1550,7 @@ AI_Smart_Spite:
dec [hl]
ret
-Function_0x38d16
+Function_0x38d16:
jp AIDiscourageMove
AI_Smart_DestinyBond:
@@ -1679,8 +1679,8 @@ AI_Smart_Conversion2:
callfar BattleCheckTypeMatchup
- ld a, [wd265]
- cp $a
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
pop hl
jr c, .asm_38dc9
ret z
@@ -2293,8 +2293,8 @@ AI_Smart_HiddenPower:
pop hl
; Discourage Hidden Power if not very effective.
- ld a, [wd265]
- cp 10
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
jr c, .bad
; Discourage Hidden Power if its base power is lower than 50.
@@ -2303,8 +2303,8 @@ AI_Smart_HiddenPower:
jr c, .bad
; Encourage Hidden Power if super-effective.
- ld a, [wd265]
- cp 11
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE + 1
jr nc, .good
; Encourage Hidden Power if its base power is 70.
@@ -3125,7 +3125,7 @@ AI_Status:
pop bc
pop hl
- ld a, [wd265]
+ ld a, [wTypeMatchup]
and a
jr nz, .checkmove
diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm
index b9bd2ea60..b12087e23 100644
--- a/engine/battle/ai/switch.asm
+++ b/engine/battle/ai/switch.asm
@@ -30,11 +30,11 @@ CheckPlayerMoveTypeMatchups:
ld hl, wEnemyMonType
call CheckTypeMatchup
ld a, [wTypeMatchup]
- cp 10 + 1 ; 1.0 + 0.1
+ cp EFFECTIVE + 1 ; 1.0 + 0.1
jr nc, .super_effective
and a
jr z, .next
- cp 10 ; 1.0
+ cp EFFECTIVE ; 1.0
jr nc, .neutral
.not_very_effective
@@ -75,7 +75,7 @@ CheckPlayerMoveTypeMatchups:
ld hl, wEnemyMonType1
call CheckTypeMatchup
ld a, [wTypeMatchup]
- cp 10 + 1 ; 1.0 + 0.1
+ cp EFFECTIVE + 1 ; 1.0 + 0.1
jr c, .ok
call .DecreaseScore
.ok
@@ -84,7 +84,7 @@ CheckPlayerMoveTypeMatchups:
jr z, .ok2
call CheckTypeMatchup
ld a, [wTypeMatchup]
- cp 10 + 1 ; 1.0 + 0.1
+ cp EFFECTIVE + 1 ; 1.0 + 0.1
jr c, .ok2
call .DecreaseScore
.ok2
@@ -130,7 +130,7 @@ CheckPlayerMoveTypeMatchups:
; not very effective
inc c
- cp 10
+ cp EFFECTIVE
jr c, .loop2
; neutral
@@ -139,7 +139,7 @@ CheckPlayerMoveTypeMatchups:
inc c
inc c
inc c
- cp 10
+ cp EFFECTIVE
jr z, .loop2
; super effective
@@ -481,7 +481,7 @@ FindEnemyMonsWithASuperEffectiveMove:
; if neutral: load 1 and continue
ld e, 1
- cp 10 + 1
+ cp EFFECTIVE + 1
jr c, .nope
; if super-effective: load 2 and break
@@ -584,7 +584,7 @@ FindEnemyMonsThatResistPlayer:
ld hl, wBaseType
call CheckTypeMatchup
ld a, [wTypeMatchup]
- cp 10 + 1
+ cp EFFECTIVE + 1
jr nc, .dont_choose_mon
ld a, b