diff options
author | yenatch <yenatch@gmail.com> | 2018-04-09 21:30:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-09 21:30:24 -0400 |
commit | 40b537d45b4b8937038126f7e5d2d21ccee460c0 (patch) | |
tree | 881a090b80b2c22985fc6d1231b03c6721a83462 /engine/battle/core.asm | |
parent | e4b41fad4fd3787ca2e61adb5377ba8f68fca7ef (diff) | |
parent | 53ff57ca663dc5bf9c3731022b0eb0dc73f2207f (diff) |
Merge pull request #503 from Rangi42/master
Factor wMisc into meaningful parts; move most code out of home.asm
Diffstat (limited to 'engine/battle/core.asm')
-rw-r--r-- | engine/battle/core.asm | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index de4830766..ce5088fc2 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -119,8 +119,8 @@ DoBattle: ; 3c000 WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5 call Call_LoadTempTileMapToTileMap ld a, [wBattleResult] - and $c0 - add $2 + and BATTLERESULT_BITMASK + add DRAW ld [wBattleResult], a ld a, [wLinkMode] and a @@ -128,8 +128,8 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5 jr z, .print_text ld a, [wBattleResult] - and $c0 - ld [wBattleResult], a + and BATTLERESULT_BITMASK + ld [wBattleResult], a ; WIN ld hl, BattleText_EnemyFled call CheckMobileBattleError jr nc, .print_text @@ -575,8 +575,8 @@ CheckContestBattleOver: ; 3c3f5 and a jr nz, .contest_not_over ld a, [wBattleResult] - and $c0 - add $2 + and BATTLERESULT_BITMASK + add DRAW ld [wBattleResult], a scf ret @@ -2199,8 +2199,8 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 call EmptyBattleTextBox call LoadTileMapToTempTileMap ld a, [wBattleResult] - and $c0 - ld [wBattleResult], a + and BATTLERESULT_BITMASK + ld [wBattleResult], a ; WIN call IsAnyMonHoldingExpShare jr z, .skip_exp ld hl, wEnemyMonBaseStats @@ -2745,8 +2745,8 @@ PlayerMonFaintHappinessMod: ; 3d1aa ld [wCurPartyMon], a callfar ChangeHappiness ld a, [wBattleResult] - and %11000000 - add $1 + and BATTLERESULT_BITMASK + add LOSE ld [wBattleResult], a ld a, [wWhichMonFaintedFirst] and a @@ -3050,8 +3050,8 @@ LostBattle: ; 3d38e jr nz, .not_tied ld hl, TiedAgainstText ld a, [wBattleResult] - and $c0 - add 2 + and BATTLERESULT_BITMASK + add DRAW ld [wBattleResult], a jr .text @@ -3928,11 +3928,11 @@ TryToRunAwayFromBattle: ; 3d8b3 cp BATTLEACTION_FORFEIT ld a, DRAW jr z, .fled - dec a + dec a ; LOSE .fled ld b, a ld a, [wBattleResult] - and $c0 + and BATTLERESULT_BITMASK add b ld [wBattleResult], a call StopDangerSound @@ -5180,8 +5180,8 @@ BattleMenu_Pack: ; 3e1c7 xor a ld [wWildMon], a ld a, [wBattleResult] - and $c0 - ld [wBattleResult], a + and BATTLERESULT_BITMASK + ld [wBattleResult], a ; WIN call ClearWindowData call SetPalettes scf @@ -8607,9 +8607,10 @@ DisplayLinkBattleResult: ; 3f77c .proceed ld a, [wBattleResult] and $f - cp $1 - jr c, .victory - jr z, .loss + cp LOSE + jr c, .victory ; WIN + jr z, .loss ; LOSE + ; DRAW farcall StubbedTrainerRankings_ColosseumDraws ld de, .Draw jr .store_result @@ -8841,7 +8842,7 @@ BattleEnd_HandleRoamMons: ; 3f998 jr nz, .not_roaming ld a, [wBattleResult] and $f - jr z, .caught_or_defeated_roam_mon + jr z, .caught_or_defeated_roam_mon ; WIN call GetRoamMonHP ld a, [wEnemyMonHP + 1] ld [hl], a @@ -9001,11 +9002,12 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 .StoreResult: ; 3faa0 ld a, [wBattleResult] and $f - cp $1 + cp LOSE ld bc, sLinkBattleWins + 1 - sLinkBattleResults - jr c, .okay + jr c, .okay ; WIN ld bc, sLinkBattleLosses + 1 - sLinkBattleResults - jr z, .okay + jr z, .okay ; LOSE + ; DRAW ld bc, sLinkBattleDraws + 1 - sLinkBattleResults .okay add hl, bc |