Battle Tent: working! (for real this time!!)

This commit is contained in:
Thorn Avery 2023-12-21 15:11:21 +11:00
parent f126a26243
commit 163b1b060c
2 changed files with 73 additions and 77 deletions

View file

@ -2026,17 +2026,12 @@ wCelesteHillCaveCurScript:: db
wBrunswickGladeCurScript:: db wBrunswickGladeCurScript:: db
ds 2 ds 2
wSSAnneBowCurScript:: db wSSAnneBowCurScript:: db
UNION
wViridianForestCurScript:: db wViridianForestCurScript:: db
wMuseum1FCurScript:: db wMuseum1FCurScript:: db
wRoute13CurScript:: db wRoute13CurScript:: db
wRoute14CurScript:: db wRoute14CurScript:: db
wRoute17CurScript:: db wRoute17CurScript:: db
wRoute19CurScript:: db wRoute19CurScript:: db
NEXTU
wBTWinnings:: ds 3
wBTBattleReward:: ds 3
ENDU
wRoute21CurScript:: db wRoute21CurScript:: db
wSafariZoneGateCurScript:: db wSafariZoneGateCurScript:: db
wRockTunnelB1FCurScript:: db wRockTunnelB1FCurScript:: db
@ -2146,6 +2141,7 @@ wChannel7:: channel_struct wChannel7
wChannel8:: channel_struct wChannel8 wChannel8:: channel_struct wChannel8
ENDU ENDU
wBTStreakCnt:: db wBTStreakCnt:: db
wBTRewards:: db
wObtainedHiddenItemsFlags:: flag_array 112 wObtainedHiddenItemsFlags:: flag_array 112

View file

@ -342,10 +342,6 @@ BattleTent_AfterBattle:
jr z, .max ; cap out at 255 wins jr z, .max ; cap out at 255 wins
inc a inc a
ld [wBTStreakCnt], a ; increment win counter ld [wBTStreakCnt], a ; increment win counter
ld hl, wBTBattleReward + 2
ld de, wBTWinnings + 2
ld c, $3
predef AddBCDPredef ; for some reason this is maxing out the counter
.max .max
jr .skip2 jr .skip2
.skip .skip
@ -585,15 +581,6 @@ BattleTentGuy:
ld [wBTCont], a ld [wBTCont], a
xor a ; initialise counter xor a ; initialise counter
ld [wBTStreakCnt], a ld [wBTStreakCnt], a
ld [wBTWinnings], a
ld [wBTWinnings+1], a
ld [wBTWinnings+2], a
ld a, [BTBattleReward]
ld [wBTBattleReward], a
ld a, [BTBattleReward+1]
ld [wBTBattleReward+1], a
ld a, [BTBattleReward+2]
ld [wBTBattleReward+2], a
ld a, 1 ld a, 1
ld [wBattleTentCurScript], a ld [wBattleTentCurScript], a
jp TextScriptEnd jp TextScriptEnd
@ -604,55 +591,50 @@ BattleTentGuy_After:
cp 2 ; voluntarily exited cp 2 ; voluntarily exited
ld hl, BattleTentLost ld hl, BattleTentLost
jr nz, .skip jr nz, .skip
ld hl, BattleTentWon
; multiply streak by 2000
;ld a, [wBTStreakCnt]
;ldh [hMultiplier], a
;ld a, $07
;ldh [hMultiplicand], a
;ld a, $D0
;ldh [hMultiplicand+1], a
;call Multiply
;ldh a, [hProduct]
;ld [wBTWinnings], a
;ldh a, [hProduct+1]
;ld [wBTWinnings+1], a
;ldh a, [hProduct+2]
;ld [wBTWinnings+2], a
; Max out at 2000 * 255 = 510000
; 07 C8 30 = 2000 * 255
; (this shouldnt ever matter im just paranoid)
;ld a, [wBTWinnings]
;cp $07
;jr c, .done
;ld a, $07
;ld [wBTWinnings], a
;ld a, [wBTWinnings+1]
;cp $C8
;jr c, .done
;ld a, $C8
;ld [wBTWinnings+1], a
;ld a, [wBTWinnings+2]
;cp $30
;jr c, .done
;ld a, $30
;ld [wBTWinnings+2], a
;.done
ld a, [wBTWinnings]
ldh [hMoney], a
ld a, [wBTWinnings+1]
ldh [hMoney+1], a
ld a, [wBTWinnings+2]
ldh [hMoney+2], a
ld hl, hMoney + 2
ld de, wPlayerMoney + 2
ld c, $3
predef AddBCDPredef
ld hl, BattleTentWon
.skip
call PrintText call PrintText
; give reward
; every ten battles gives a bottle cap
; every five gives a rare candy
ld a, [wBTStreakCnt]
ld c, 0 ; fives count
.findFive:
cp 5
jr nc, .hasFive
jr .done
.hasFive:
sub 5
inc c
jr .findFive
.done:
ld a, c
and a
jr z, .skip ; skip if no rewards
ld [wBTRewards], a
ld hl, ReceivedRewardPreamble
call PrintText
ld a, [wBTRewards]
ld b, RARE_CANDY
call GiveItem
jr nc, .bag_full ; could use money instead here
ld hl, ReceivedRewardText
call PrintText
ld a, [wBTRewards]
srl a
and a
jr z, .skip
ld [wBTRewards], a
;ld b, POWER_FEED
ld b, BOTTLE_CAP
call GiveItem
jr nc, .bag_full
ld hl, ReceivedRewardText
call PrintText
jr .skip
.bag_full:
ld hl, RewardNoRoomText
call PrintText
.skip:
ld hl, BattleTentPleaseWait ld hl, BattleTentPleaseWait
call PrintText call PrintText
call BattleTent_RestoreTeam call BattleTent_RestoreTeam
@ -839,13 +821,10 @@ BattleTentWon:
text "Wow! You finally" text "Wow! You finally"
line "did it!" line "did it!"
para "Here is the" para "You beat"
line "reward!" line "@"
text_decimal wBTStreakCnt, 1, 3
para $52, " received" text " oppenont(s)!"
line "¥@"
text_bcd wBTWinnings, 3, 6
text "!"
prompt prompt
BattleTentLost: BattleTentLost:
@ -893,10 +872,10 @@ BattleTentGuy2_Win:
;text "Congratulations!" ;text "Congratulations!"
text "Well done!" text "Well done!"
para "You defeated" ;para "You defeated"
line "@" ;line "@"
text_decimal wBTStreakCnt, 1, 3 ;text_decimal wBTStreakCnt, 1, 3
text " opponent(s)!" ;text " opponent(s)!"
para "Please go back to" para "Please go back to"
line "the counter to" line "the counter to"
@ -909,6 +888,27 @@ BattleTentGuy2_Heal:
cont "full health." cont "full health."
done done
ReceivedRewardPreamble:
text "Take these"
line "on the house!"
prompt
text_end
ReceivedRewardText:
text "<PLAYER> received"
line "@"
text_decimal wBTRewards, 1, 2
text "x @"
text_ram wStringBuffer
text "!"
prompt
text_end
RewardNoRoomText:
text "You have no room!"
prompt
text_end
; Battle Tent ; Battle Tent
BattleTentMart:: BattleTentMart::
script_mart FULL_RESTORE, MAX_REVIVE, FULL_HEAL, BOTTLE_CAP, POKE_DOLL, X_ATTACK, X_DEFEND, X_SPEED, X_SPECIAL, GUARD_SPEC script_mart FULL_RESTORE, MAX_REVIVE, FULL_HEAL, BOTTLE_CAP, POKE_DOLL, X_ATTACK, X_DEFEND, X_SPEED, X_SPECIAL, GUARD_SPEC