WIP Battle Tent: win counter

This commit is contained in:
Thorn Avery 2023-12-18 19:04:33 +11:00
parent 2a6c2604bd
commit ce2d9ec06c
2 changed files with 18 additions and 9 deletions

View file

@ -2125,7 +2125,7 @@ UNION
; Surely this position will not cause any issues at all. ; Surely this position will not cause any issues at all.
;battle tent data ;battle tent data
wBTOrder:: dw wBTOrder:: dw
wBTStreakCnt:: db wBTCont:: db
wBTClass:: db wBTClass:: db
wBTDataEnd:: wBTDataEnd::
wStringBuffer1:: ; cf5f wStringBuffer1:: ; cf5f
@ -2140,6 +2140,7 @@ NEXTU
wChannel7:: channel_struct wChannel7 wChannel7:: channel_struct wChannel7
wChannel8:: channel_struct wChannel8 wChannel8:: channel_struct wChannel8
ENDU ENDU
wBTStreakCnt:: db
wObtainedHiddenItemsFlags:: flag_array 112 wObtainedHiddenItemsFlags:: flag_array 112
@ -2448,4 +2449,4 @@ SECTION "Stack", WRAM0
; the stack grows downward ; the stack grows downward
ds $99 - 1 ds $99 - 1
wStack:: db wStack:: db

View file

@ -249,7 +249,7 @@ BattleTent_InitPhase:
call DisplayTextID call DisplayTextID
ld a, $ff ld a, $ff
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, [wBTStreakCnt] ; 0 = continue, 1 = lost, 2 = exit, FF = initial ld a, [wBTCont] ; 0 = continue, 1 = lost, 2 = exit, FF = initial
cp 0 ; continue cp 0 ; continue
jr z, .cont jr z, .cont
cp $FF ; initial cp $FF ; initial
@ -333,11 +333,17 @@ BattleTent_AfterBattle:
and a and a
jp nz, .skip ; if not zero, we lost / drew jp nz, .skip ; if not zero, we lost / drew
xor a ; continue battle tent xor a ; continue battle tent
ld [wBTStreakCnt], a ld [wBTCont], a
ld a, [wBTStreakCnt]
cp $FF
jr z, .max ; cap out at 255 wins
inc a
.max
ld [wBTStreakCnt], a ; increment win counter
jr .skip2 jr .skip2
.skip .skip
ld a, 1 ; lost last match ld a, 1 ; lost last match
ld [wBTStreakCnt], a ld [wBTCont], a
ld a, 8 ld a, 8
ld [wBattleTentCurScript], a ld [wBattleTentCurScript], a
ret ret
@ -350,7 +356,7 @@ BattleTent_Heal:
ld a, [wNPCNumScriptedSteps] ld a, [wNPCNumScriptedSteps]
and a and a
ret nz ret nz
ld a, [wBTStreakCnt] ld a, [wBTCont]
cp 1 ; lost, dont show healing dialogue cp 1 ; lost, dont show healing dialogue
jr z, .skip jr z, .skip
ld a, 2 ld a, 2
@ -569,6 +575,8 @@ BattleTentGuy:
ld hl, BattleTentLetsGo ld hl, BattleTentLetsGo
call PrintText call PrintText
ld a, $FF ; first battle ld a, $FF ; first battle
ld [wBTCont], a
xor a ; initialise counter
ld [wBTStreakCnt], a ld [wBTStreakCnt], a
ld a, 1 ld a, 1
ld [wBattleTentCurScript], a ld [wBattleTentCurScript], a
@ -579,7 +587,7 @@ BTReward:
BattleTentGuy_After: BattleTentGuy_After:
db $8 db $8
ld a, [wBTStreakCnt] ld a, [wBTCont]
cp 2 ; voluntarily exited cp 2 ; voluntarily exited
ld hl, BattleTentLost ld hl, BattleTentLost
jr nz, .skip ; Not Teh Urn BibleThump jr nz, .skip ; Not Teh Urn BibleThump
@ -615,7 +623,7 @@ BattleTentGuy_After:
; Arguably a better system, but I do wish the counter incremented... ; Arguably a better system, but I do wish the counter incremented...
BattleTentGuy2: BattleTentGuy2:
db $8 db $8
ld a, [wBTStreakCnt] ; The streak counter is still used for message continuity. ld a, [wBTCont] ; The streak counter is still used for message continuity.
cp $FF ; very first initial battle cp $FF ; very first initial battle
jr z, .init jr z, .init
ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below. ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below.
@ -635,7 +643,7 @@ BattleTentGuy2:
ld hl, BattleTentGuy2_Win ld hl, BattleTentGuy2_Win
call PrintText call PrintText
ld a, 2 ; 2 = quit ld a, 2 ; 2 = quit
ld [wBTStreakCnt], a ld [wBTCont], a
.done .done
jp TextScriptEnd jp TextScriptEnd