summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/ai/move.asm14
-rw-r--r--engine/battle/ai/scoring.asm22
-rw-r--r--engine/battle/core.asm12
-rw-r--r--engine/battle/trainer_huds.asm7
4 files changed, 28 insertions, 27 deletions
diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm
index 5ee4d0b92..cf0c09bb9 100644
--- a/engine/battle/ai/move.asm
+++ b/engine/battle/ai/move.asm
@@ -1,5 +1,5 @@
AIChooseMove:
-; Score each move in wEnemyMonMoves starting from wBuffer1. Lower is better.
+; Score each move of wEnemyMonMoves in wEnemyAIMoveScores. Lower is better.
; Pick the move with the lowest score.
; Wildmons attack at random.
@@ -17,7 +17,7 @@ AIChooseMove:
; The default score is 20. Unusable moves are given a score of 80.
ld a, 20
- ld hl, wBuffer1
+ ld hl, wEnemyAIMoveScores
ld [hli], a
ld [hli], a
ld [hli], a
@@ -37,14 +37,14 @@ AIChooseMove:
inc hl
jr .CheckDisabledMove
.ScoreDisabledMove:
- ld hl, wBuffer1
+ ld hl, wEnemyAIMoveScores
ld b, 0
add hl, bc
ld [hl], 80
; Don't pick moves with 0 PP.
.CheckPP:
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonPP
ld b, 0
.CheckMovePP:
@@ -117,7 +117,7 @@ AIChooseMove:
; Decrement the scores of all moves one by one until one reaches 0.
.DecrementScores:
- ld hl, wBuffer1
+ ld hl, wEnemyAIMoveScores
ld de, wEnemyMonMoves
ld c, NUM_MOVES
@@ -152,7 +152,7 @@ AIChooseMove:
cp NUM_MOVES + 1
jr nz, .move_loop
- ld hl, wBuffer1
+ ld hl, wEnemyAIMoveScores
ld de, wEnemyMonMoves
ld c, NUM_MOVES
@@ -182,7 +182,7 @@ AIChooseMove:
; Randomly choose one of the moves with a score of 1
.ChooseMove:
- ld hl, wBuffer1
+ ld hl, wEnemyAIMoveScores
call Random
maskbits NUM_MOVES
ld c, a
diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm
index c0273753e..150b6ebe9 100644
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -6,7 +6,7 @@ AI_Basic:
; -Using status-only moves if the player can't be statused
; -Using moves that fail if they've already been used
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1
.checkmove
@@ -73,7 +73,7 @@ AI_Setup:
; 50% chance to greatly encourage stat-down moves during the first turn of player's Pokemon.
; Almost 90% chance to greatly discourage stat-modifying moves otherwise.
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1
.checkmove
@@ -147,7 +147,7 @@ AI_Types:
; Discourage not very effective moves unless
; all damaging moves are of the same type.
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1
.checkmove
@@ -234,7 +234,7 @@ AI_Types:
AI_Offensive:
; Greatly discourage non-damaging moves.
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1
.checkmove
@@ -261,7 +261,7 @@ AI_Offensive:
AI_Smart:
; Context-specific scoring.
- ld hl, wBuffer1
+ ld hl, wEnemyAIMoveScores
ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1
.checkmove
@@ -518,7 +518,7 @@ AI_Smart_LockOn:
.player_locked_on
push hl
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1
@@ -2893,7 +2893,7 @@ AI_Opportunist:
ret c
.lowhp
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1
.checkmove
@@ -2987,7 +2987,7 @@ AI_Aggressive:
jr z, .done
; Discourage moves that do less damage unless they're reckless too.
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld b, 0
.checkmove2
@@ -3060,7 +3060,7 @@ AI_Cautious:
and a
ret z
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1
.loop
@@ -3098,7 +3098,7 @@ INCLUDE "data/battle/ai/residual_moves.asm"
AI_Status:
; Dismiss status moves that don't affect the player.
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1
.checkmove
@@ -3161,7 +3161,7 @@ AI_Risky:
; Use any move that will KO the target.
; Risky moves will often be an exception (see below).
- ld hl, wBuffer1 - 1
+ ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1
.checkmove
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 39e4e165b..6997a3fba 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -5358,7 +5358,7 @@ MoveSelectionScreen:
hlcoord 6, 17 - NUM_MOVES - 4
.got_start_coord
ld a, SCREEN_WIDTH
- ld [wBuffer1], a
+ ld [wListMovesLineSpacing], a
predef ListMoves
ld b, 5
@@ -6334,8 +6334,7 @@ LoadEnemyMon:
ld [hli], a
ld [hli], a
ld [hl], a
-; Make sure the predef knows this isn't a partymon
- ld [wEvolutionOldSpecies], a
+ ld [wSkipMovesBeforeLevelUp], a
; Fill moves based on level
predef FillMoves
@@ -7616,9 +7615,10 @@ SendOutMonText:
and a
jr z, .not_linked
- ld hl, GoMonText ; If we're in a LinkBattle print just "Go <PlayerMon>"
-
- ld a, [wBattleHasJustStarted] ; unless this (unidentified) variable is set
+; If we're in a LinkBattle print just "Go <PlayerMon>"
+; unless DoBattle already set [wBattleHasJustStarted]
+ ld hl, GoMonText
+ ld a, [wBattleHasJustStarted]
and a
jr nz, .skip_to_textbox
diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm
index f701a4dfc..86d7a350a 100644
--- a/engine/battle/trainer_huds.asm
+++ b/engine/battle/trainer_huds.asm
@@ -47,7 +47,7 @@ ShowOTTrainerMonsRemaining:
StageBallTilesData:
ld a, [de]
push af
- ld de, wBuffer1
+ ld de, wBattleHUDTiles
ld c, PARTY_LENGTH
ld a, $34 ; empty slot
.loop1
@@ -56,7 +56,8 @@ StageBallTilesData:
dec c
jr nz, .loop1
pop af
- ld de, wBuffer1
+
+ ld de, wBattleHUDTiles
.loop2
push af
call .GetHUDTile
@@ -200,7 +201,7 @@ LinkBattle_TrainerHuds:
jp LoadTrainerHudOAM
LoadTrainerHudOAM:
- ld de, wBuffer1
+ ld de, wBattleHUDTiles
ld c, PARTY_LENGTH
.loop
ld a, [wPlaceBallsY]