mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
commit
43de80f43c
|
@ -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,8 @@ NEXTU
|
||||||
wChannel7:: channel_struct wChannel7
|
wChannel7:: channel_struct wChannel7
|
||||||
wChannel8:: channel_struct wChannel8
|
wChannel8:: channel_struct wChannel8
|
||||||
ENDU
|
ENDU
|
||||||
|
wBTStreakCnt:: db
|
||||||
|
wBTRewards:: db
|
||||||
|
|
||||||
wObtainedHiddenItemsFlags:: flag_array 112
|
wObtainedHiddenItemsFlags:: flag_array 112
|
||||||
|
|
||||||
|
@ -2448,4 +2450,4 @@ SECTION "Stack", WRAM0
|
||||||
|
|
||||||
; the stack grows downward
|
; the stack grows downward
|
||||||
ds $99 - 1
|
ds $99 - 1
|
||||||
wStack:: db
|
wStack:: db
|
||||||
|
|
|
@ -249,12 +249,17 @@ BattleTent_InitPhase:
|
||||||
call DisplayTextID
|
call DisplayTextID
|
||||||
ld a, $ff
|
ld a, $ff
|
||||||
ld [wJoyIgnore], a
|
ld [wJoyIgnore], a
|
||||||
ld a, [wBTStreakCnt]
|
ld a, [wBTCont] ; 0 = continue, 1 = lost, 2 = exit, FF = initial
|
||||||
cp 11
|
cp 0 ; continue
|
||||||
|
jr z, .cont
|
||||||
|
cp $FF ; initial
|
||||||
|
jr z, .cont
|
||||||
|
ld a, 8
|
||||||
|
jr .done
|
||||||
|
.cont
|
||||||
ld a, 4
|
ld a, 4
|
||||||
jr nz, .skip
|
jr .done
|
||||||
ld a, 8 ; TEH URN!
|
.done
|
||||||
.skip
|
|
||||||
ld [wBattleTentCurScript], a
|
ld [wBattleTentCurScript], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -316,6 +321,9 @@ BattleTent_InitBattle:
|
||||||
ld a, 6
|
ld a, 6
|
||||||
ld [wBattleTentCurScript], a
|
ld [wBattleTentCurScript], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
BTBattleReward:
|
||||||
|
db $00, $20, $00
|
||||||
|
|
||||||
BattleTent_AfterBattle:
|
BattleTent_AfterBattle:
|
||||||
ld a, $ff
|
ld a, $ff
|
||||||
|
@ -324,6 +332,25 @@ BattleTent_AfterBattle:
|
||||||
ld [$ff8c], a
|
ld [$ff8c], a
|
||||||
ld de, BattleTentMovement_3
|
ld de, BattleTentMovement_3
|
||||||
call MoveSprite
|
call MoveSprite
|
||||||
|
ld a, [wBattleResult]
|
||||||
|
and a
|
||||||
|
jp nz, .skip ; if not zero, we lost / drew
|
||||||
|
xor a ; continue battle tent
|
||||||
|
ld [wBTCont], a
|
||||||
|
ld a, [wBTStreakCnt]
|
||||||
|
cp $FF
|
||||||
|
jr z, .max ; cap out at 255 wins
|
||||||
|
inc a
|
||||||
|
ld [wBTStreakCnt], a ; increment win counter
|
||||||
|
.max
|
||||||
|
jr .skip2
|
||||||
|
.skip
|
||||||
|
ld a, 1 ; lost last match
|
||||||
|
ld [wBTCont], a
|
||||||
|
ld a, 8
|
||||||
|
ld [wBattleTentCurScript], a
|
||||||
|
ret
|
||||||
|
.skip2
|
||||||
ld a, 7
|
ld a, 7
|
||||||
ld [wBattleTentCurScript], a
|
ld [wBattleTentCurScript], a
|
||||||
ret
|
ret
|
||||||
|
@ -332,22 +359,12 @@ BattleTent_Heal:
|
||||||
ld a, [wNPCNumScriptedSteps]
|
ld a, [wNPCNumScriptedSteps]
|
||||||
and a
|
and a
|
||||||
ret nz
|
ret nz
|
||||||
ld a, [wBattleResult]
|
ld a, [wBTCont]
|
||||||
cp 1
|
cp 1 ; lost, dont show healing dialogue
|
||||||
jr nz, .stillTehUrn
|
jr z, .skip
|
||||||
; rip
|
|
||||||
ld a, 8
|
|
||||||
ld [wBattleTentCurScript], a
|
|
||||||
ret
|
|
||||||
.stillTehUrn
|
|
||||||
ld hl, wBTStreakCnt
|
|
||||||
inc [hl]
|
|
||||||
ld a, 2
|
ld a, 2
|
||||||
ld [wPlayerMovingDirection], a
|
ld [wPlayerMovingDirection], a
|
||||||
call Delay3
|
call Delay3
|
||||||
ld a, [hl]
|
|
||||||
cp 11
|
|
||||||
jr z, .skip ; No need to heal the party, let's just say that the player wins
|
|
||||||
predef HealParty
|
predef HealParty
|
||||||
ld a, $fc
|
ld a, $fc
|
||||||
ld [wJoyIgnore], a
|
ld [wJoyIgnore], a
|
||||||
|
@ -560,32 +577,64 @@ BattleTentGuy:
|
||||||
call BattleTent_LoadTeam
|
call BattleTent_LoadTeam
|
||||||
ld hl, BattleTentLetsGo
|
ld hl, BattleTentLetsGo
|
||||||
call PrintText
|
call PrintText
|
||||||
|
ld a, $FF ; first battle
|
||||||
|
ld [wBTCont], a
|
||||||
|
xor a ; initialise counter
|
||||||
|
ld [wBTStreakCnt], a
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ld [wBattleTentCurScript], a
|
ld [wBattleTentCurScript], a
|
||||||
jp TextScriptEnd
|
jp TextScriptEnd
|
||||||
|
|
||||||
BTReward:
|
|
||||||
db $03,$00,$00
|
|
||||||
|
|
||||||
BattleTentGuy_After:
|
BattleTentGuy_After:
|
||||||
db $8
|
db $8
|
||||||
ld a, [wBTStreakCnt]
|
ld a, [wBTCont]
|
||||||
cp 11
|
cp 2 ; voluntarily exited
|
||||||
ld hl, BattleTentLost
|
ld hl, BattleTentLost
|
||||||
jr nz, .skip ; Not Teh Urn BibleThump
|
jr nz, .skip
|
||||||
ld a, $03 ; NO REVERTING THIS CODE PIGU IM SICK OF YOU BREAKING IT!
|
ld hl, BattleTentWon
|
||||||
ldh [$9f], a
|
|
||||||
ld a, $00
|
|
||||||
ldh [$a1], a
|
|
||||||
ld a, $00
|
|
||||||
ldh [$a0], a
|
|
||||||
ld hl, $ffa1
|
|
||||||
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
|
||||||
|
@ -605,23 +654,9 @@ 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.
|
||||||
and a
|
cp $FF ; very first initial battle
|
||||||
|
jr z, .init
|
||||||
; Old System
|
|
||||||
; ld hl, BattleTentGuy2_Streak
|
|
||||||
; jr nz, .skip
|
|
||||||
; inc a
|
|
||||||
; ld [wBTStreakCnt], a
|
|
||||||
; ld hl, BattleTentGuy2_Init
|
|
||||||
; jr .skip2
|
|
||||||
;.skip
|
|
||||||
; cp 11
|
|
||||||
; jr nz, .skip2
|
|
||||||
|
|
||||||
; New System
|
|
||||||
ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below.
|
|
||||||
jr z, .skip2
|
|
||||||
xor a ; The D-Pad is locked at this point, so blank out wJoyIgnore to allow manual option selection.
|
xor a ; The D-Pad is locked at this point, so blank out wJoyIgnore to allow manual option selection.
|
||||||
ld [wJoyIgnore], a
|
ld [wJoyIgnore], a
|
||||||
ld hl, BattleTentGuy2_Continue ; Continue prompt.
|
ld hl, BattleTentGuy2_Continue ; Continue prompt.
|
||||||
|
@ -630,18 +665,18 @@ BattleTentGuy2:
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
and a
|
and a
|
||||||
jr nz, .refused ; If 0, move to refused.
|
jr nz, .refused ; If 0, move to refused.
|
||||||
.cont
|
ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below.
|
||||||
|
call PrintText
|
||||||
|
jr .done
|
||||||
|
.init
|
||||||
ld hl, BattleTentGuy2_Init ; Load the next battle.
|
ld hl, BattleTentGuy2_Init ; Load the next battle.
|
||||||
; fallthrough
|
|
||||||
.skip2 ; This handles BattleTentGuy2_Streak and BattleTentGuy2_Init at once.
|
|
||||||
call PrintText
|
call PrintText
|
||||||
jr .done
|
jr .done
|
||||||
.refused
|
.refused
|
||||||
ld hl, BattleTentGuy2_Win
|
ld hl, BattleTentGuy2_Win
|
||||||
call PrintText
|
call PrintText
|
||||||
ld a, 9 ; Load BattleTent_PlayerWalkBack, which takes it from here.
|
ld a, 2 ; 2 = quit
|
||||||
ld [wBattleTentCurScript], a ; For some reason, this isn't working properly, even if jp'd.
|
ld [wBTCont], a
|
||||||
; fallthrough
|
|
||||||
.done
|
.done
|
||||||
jp TextScriptEnd
|
jp TextScriptEnd
|
||||||
|
|
||||||
|
@ -786,11 +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 "¥30000!"
|
|
||||||
prompt
|
prompt
|
||||||
|
|
||||||
BattleTentLost:
|
BattleTentLost:
|
||||||
|
@ -813,7 +847,7 @@ BattleTentGuy2_Init:
|
||||||
; Cut in favour of a different system.
|
; Cut in favour of a different system.
|
||||||
BattleTentGuy2_Streak:
|
BattleTentGuy2_Streak:
|
||||||
; text "Opponent No.@" ; could be a №?
|
; text "Opponent No.@" ; could be a №?
|
||||||
; text_decimal wBTStreakCnt, 1, 2
|
; text_decimal wBTStreakCnt, 1, 3
|
||||||
; text_start
|
; text_start
|
||||||
; line "is up next."
|
; line "is up next."
|
||||||
; para "Good luck!"
|
; para "Good luck!"
|
||||||
|
@ -824,6 +858,11 @@ BattleTentGuy2_Streak:
|
||||||
|
|
||||||
BattleTentGuy2_Continue:
|
BattleTentGuy2_Continue:
|
||||||
text "Congratulations!"
|
text "Congratulations!"
|
||||||
|
|
||||||
|
para "You're at"
|
||||||
|
line "@"
|
||||||
|
text_decimal wBTStreakCnt, 1, 3
|
||||||
|
text " win(s)!"
|
||||||
|
|
||||||
para "Do you want to"
|
para "Do you want to"
|
||||||
line "continue?"
|
line "continue?"
|
||||||
|
@ -833,8 +872,10 @@ BattleTentGuy2_Win:
|
||||||
;text "Congratulations!"
|
;text "Congratulations!"
|
||||||
text "Well done!"
|
text "Well done!"
|
||||||
|
|
||||||
;para "You have defeated"
|
;para "You defeated"
|
||||||
;line "all 10 opponents!"
|
;line "@"
|
||||||
|
;text_decimal wBTStreakCnt, 1, 3
|
||||||
|
;text " opponent(s)!"
|
||||||
|
|
||||||
para "Please go back to"
|
para "Please go back to"
|
||||||
line "the counter to"
|
line "the counter to"
|
||||||
|
@ -847,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
|
||||||
|
|
Loading…
Reference in a new issue