summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/constants/duel_constants.asm10
-rw-r--r--src/engine/bank1.asm14
-rw-r--r--src/engine/bank3.asm4
-rw-r--r--src/wram.asm3
4 files changed, 18 insertions, 13 deletions
diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm
index 7f2f4d4..5f6eeee 100644
--- a/src/constants/duel_constants.asm
+++ b/src/constants/duel_constants.asm
@@ -11,9 +11,13 @@ DUELTYPE_PRACTICE EQU $80
; for normal duels (vs AI), wDuelType is $80 + [wOpponentDeckID]
; wDuelFinished constants
-DUEL_WON EQU $1
-DUEL_LOST EQU $2
-DUEL_DRAW EQU $3
+TURN_PLAYER_WON EQU $1
+TURN_PLAYER_LOST EQU $2
+TURN_PLAYER_TIED EQU $3
+
+; wDuelResult constants
+DUEL_WIN EQU $0
+DUEL_LOSS EQU $1
; Box message id's
const_def
diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm
index cb8604a..9701656 100644
--- a/src/engine/bank1.asm
+++ b/src/engine/bank1.asm
@@ -163,7 +163,7 @@ StartDuel: ; 409f (1:409f)
ld a, [hl]
cp 15 ; the practice duel lasts 15 turns
jr c, .next_turn
- xor a
+ xor a ; DUEL_WIN
ld [wDuelResult], a
ret
@@ -185,9 +185,9 @@ StartDuel: ; 409f (1:409f)
ldh [hWhoseTurn], a
call Func_3b21
ld a, [wDuelFinished]
- cp DUEL_WON
+ cp TURN_PLAYER_WON
jr z, .active_duelist_won_battle
- cp DUEL_LOST
+ cp TURN_PLAYER_LOST
jr z, .active_duelist_lost_batte
ld a, $5f
ld c, MUSIC_DARK_DIDDLY
@@ -199,7 +199,7 @@ StartDuel: ; 409f (1:409f)
cp PLAYER_TURN
jr nz, .opponent_won_battle
.player_won_battle
- xor a
+ xor a ; DUEL_WIN
ld [wDuelResult], a
ld a, $5d
ld c, MUSIC_MATCH_VICTORY
@@ -211,7 +211,7 @@ StartDuel: ; 409f (1:409f)
cp PLAYER_TURN
jr nz, .player_won_battle
.opponent_won_battle
- ld a, 1
+ ld a, DUEL_LOSS
ld [wDuelResult], a
ld a, $5e
ld c, MUSIC_MATCH_LOSS
@@ -231,7 +231,7 @@ StartDuel: ; 409f (1:409f)
or a
jr nz, .wait_song
ld a, [wDuelFinished]
- cp DUEL_DRAW
+ cp TURN_PLAYER_TIED
jr z, .tied_battle
call Func_39fc
call WaitForWideTextBoxInput
@@ -302,7 +302,7 @@ HandleTurn: ; 4225 (1:4225)
call $4933
call DrawCardFromDeck
jr nc, .deck_not_empty
- ld a, DUEL_LOST
+ ld a, TURN_PLAYER_LOST
ld [wDuelFinished], a
ret
diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm
index f435924..343568f 100644
--- a/src/engine/bank3.asm
+++ b/src/engine/bank3.asm
@@ -3119,7 +3119,7 @@ OWSequence_Joshua:
FindEndOfBattleScript: ; e52c (3:652c)
ld c, $0
ld a, [wDuelResult]
- or a
+ or a ; cp DUEL_WIN
jr z, .player_won
ld c, $2
@@ -3187,7 +3187,7 @@ Func_f580: ; f580 (3:7580)
Func_fc2b: ; fc2b (3:7c2b)
ld a, [wDuelResult]
- cp $2
+ cp 2
jr c, .asm_fc34
ld a, $2
.asm_fc34
diff --git a/src/wram.asm b/src/wram.asm
index 345ba49..d9017ea 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -1204,7 +1204,8 @@ wd0c1:: ; d0c1
wd0c2:: ; d0c2
ds $1
-; stores the result of a duel (0: lost, 1: won, -1: transmission error (?) ) to be read by the overworld caller
+; stores the player's result in a duel (0: loss, 1: win, 2: ???, -1: transmission error? )
+; to be read by the overworld caller
wDuelResult:: ; d0c3
ds $1