diff options
Diffstat (limited to 'de/engine/battle/end_of_battle.asm')
-rwxr-xr-x | de/engine/battle/end_of_battle.asm | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/de/engine/battle/end_of_battle.asm b/de/engine/battle/end_of_battle.asm new file mode 100755 index 00000000..190992dc --- /dev/null +++ b/de/engine/battle/end_of_battle.asm @@ -0,0 +1,91 @@ +EndOfBattle: + ld a, [wLinkState] + cp LINK_STATE_BATTLING + jr nz, .notLinkBattle +; link battle + ld a, [wEnemyMonPartyPos] + ld hl, wEnemyMon1Status + ld bc, wEnemyMon2 - wEnemyMon1 + call AddNTimes + ld a, [wEnemyMonStatus] + ld [hl], a + call ClearScreen + callab DisplayLinkBattleVersusTextBox + ld a, [wBattleResult] + cp 1 + ld de, YouWinText + jr c, .unk + ld de, YouLoseText + jr z, .unk + ld de, DrawText + coord hl, 4, 8 + jr .placeWinOrLoseString +.unk + coord hl, 6, 8 +.placeWinOrLoseString + call PlaceString + ld c, 200 + call DelayFrames + jr .evolution +.notLinkBattle + ld a, [wBattleResult] + and a + jr nz, .resetVariables + ld hl, wTotalPayDayMoney + ld a, [hli] + or [hl] + inc hl + or [hl] + jr z, .evolution ; if pay day money is 0, jump + ld de, wPlayerMoney + 2 + ld c, $3 + predef AddBCDPredef + ld hl, PickUpPayDayMoneyText + call PrintText +.evolution + xor a + ld [wForceEvolution], a + predef EvolutionAfterBattle +.resetVariables + xor a + ld [wLowHealthAlarm], a ;disable low health alarm + ld [wChannelSoundIDs + Ch4], a + ld [wIsInBattle], a + ld [wBattleType], a + ld [wMoveMissed], a + ld [wCurOpponent], a + ld [wForcePlayerToChooseMon], a + ld [wNumRunAttempts], a + ld [wEscapedFromBattle], a + ld hl, wPartyAndBillsPCSavedMenuItem + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ld [wListScrollOffset], a + ld hl, wPlayerStatsToDouble + ld b, $18 +.loop + ld [hli], a + dec b + jr nz, .loop + ld hl, wd72c + set 0, [hl] + call WaitForSoundToFinish + call GBPalWhiteOut + ld a, $ff + ld [wDestinationWarpID], a + ret + +YouWinText: + db "GEWONNEN@" + +YouLoseText: + db "VERLOREN@" + +DrawText: + db "UNENTSCHIEDEN@" + +PickUpPayDayMoneyText: + TX_FAR _PickUpPayDayMoneyText + db "@" |