diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 65721975..c8ac2687 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1167,7 +1167,27 @@ HandlePlayerBlackOut: ld [wIsTrainerBattle], a ld a, [wLinkState] cp LINK_STATE_BATTLING - jr z, .notRival1Battle + jp z, .notRival1Battle + + ; This is a scripted loss mechanic from a pret tutorial, adapted to the Battle Tent. + ; This is necessary so you don't get booted out of the tent and have your Pokemon de-levelled. + + ld a, [wCurMap] + cp BATTLE_TENT + jr nz, .notThatTrainer + hlcoord 0, 0 + lb bc, 8, 21 + call ClearScreenArea + call ScrollTrainerPicAfterBattle + ld c, 40 + call DelayFrames + ld hl, StupidBattleTentFix + call PrintText + ld a, [wCurMap] + cp BATTLE_TENT ; MAP ID can be found in constants\map_constants.asm + ret + +.notThatTrainer ld a, [wCurOpponent] cp OPP_RIVAL1 jr nz, .notRival1Battle @@ -7124,3 +7144,10 @@ LoadMonBackPic: ldh a, [hLoadedROMBank] ld b, a jp CopyVideoData + +; I struggled a lot in making this generate the text. +; This is the best compromise I can come up with right now. +StupidBattleTentFix: + text "Oops! Better" + line "luck next time!" + prompt diff --git a/engine/battletentdata.asm b/engine/battletentdata.asm index cf46fde4..642ac2ff 100644 --- a/engine/battletentdata.asm +++ b/engine/battletentdata.asm @@ -1,4 +1,5 @@ ;btlibs +; afters are farcallable for core.asm BTLib1: db "ready@@@@" db "prepared@" @@ -11,13 +12,13 @@ BTLib2: db "battle@" db "rock@@@" -BTLib3: +BTLib3:: db "Oh no@@@@@" db "Argh no@@@" db "Oh well@@@" db "My streak@" -BTLib4: +BTLib4:: db "game@@@" db "battle@" db "play@@@" @@ -33,7 +34,7 @@ BTBeforeBattlePtrTable: dw BTBeforeBattleTemplate7 dw BTBeforeBattleTemplate8 -BTAfterBattlePtrTable: +BTAfterBattlePtrTable:: dw BTAfterBattleTemplate1 dw BTAfterBattleTemplate2 dw BTAfterBattleTemplate3 @@ -107,7 +108,7 @@ BTBeforeBattleTemplate8: text "." done -BTAfterBattleTemplate1: +BTAfterBattleTemplate1:: text "@" text_ram wStringBuffer1 text "!" @@ -115,13 +116,13 @@ BTAfterBattleTemplate1: para "Oh man.." prompt -BTAfterBattleTemplate2: +BTAfterBattleTemplate2:: text "@" text_ram wStringBuffer1 text "!" prompt -BTAfterBattleTemplate3: +BTAfterBattleTemplate3:: text "@" text_ram wStringBuffer1 text "!" @@ -131,14 +132,14 @@ BTAfterBattleTemplate3: text "!" prompt -BTAfterBattleTemplate4: +BTAfterBattleTemplate4:: text "That was a nice" line "@" text_ram wStringBuffer2 text "!" prompt -BTAfterBattleTemplate5: +BTAfterBattleTemplate5:: text "I did the best" line "I could." @@ -146,7 +147,7 @@ BTAfterBattleTemplate5: line "regrets!" prompt -BTAfterBattleTemplate6: +BTAfterBattleTemplate6:: text "@" text_ram wStringBuffer1 text "!" @@ -156,7 +157,7 @@ BTAfterBattleTemplate6: text "!" prompt -BTAfterBattleTemplate7: +BTAfterBattleTemplate7:: text "That was a nice" line "@" text_ram wStringBuffer2 @@ -164,7 +165,7 @@ BTAfterBattleTemplate7: cont "don't you think?" prompt -BTAfterBattleTemplate8: +BTAfterBattleTemplate8:: text "Awesome" line "@" text_ram wStringBuffer2 diff --git a/home/overworld.asm b/home/overworld.asm index 0fcadf75..cd80a59b 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -366,6 +366,8 @@ OverworldLoopLessDelay:: ld a, [wCurMap] cp OAKS_LAB jp z, .noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab + cp BATTLE_TENT + jp z, .noFaintCheck callfar AnyPartyAlive ld a, d and a diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index c4eaf5b4..5d1b826c 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -647,7 +647,6 @@ BattleTentTrainer: ld hl, wd72d set 6, [hl] set 7, [hl] - ld [wBTClass], a ld a, 1 ld [wIsTrainerBattle], a