diff options
Diffstat (limited to 'engine/battle/core.asm')
-rw-r--r-- | engine/battle/core.asm | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index af102990..3814348d 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -5964,7 +5964,7 @@ LoadEnemyMon: ; Fill stats ld de, wEnemyMonMaxHP ld b, FALSE - ld hl, wEnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; wLinkBattleRNs + 7 ; ? + ld hl, wEnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) predef CalcMonStats ; If we're in a trainer battle, @@ -8036,7 +8036,7 @@ ShowLinkBattleParticipantsAfterEnd: ld a, BANK(sLinkBattleStats) call OpenSRAM - call AddLastBattleToLinkRecord + call AddLastLinkBattleToLinkRecord call ReadAndPrintLinkBattleRecord call CloseSRAM @@ -8052,6 +8052,9 @@ ShowLinkBattleParticipantsAfterEnd: .Draw: db " DRAW@" +LINK_BATTLE_RECORD_LENGTH EQUS "(sLinkBattleRecord1End - sLinkBattleRecord1)" ; 18 +NUM_LINK_BATTLE_RECORDS EQUS "((sLinkBattleStatsEnd - sLinkBattleRecord) / LINK_BATTLE_RECORD_LENGTH)" ; 5 + _DisplayLinkRecord: ld a, BANK(sLinkBattleStats) call OpenSRAM @@ -8077,7 +8080,7 @@ ReadAndPrintLinkBattleRecord: call ClearSprites call .PrintBattleRecord hlcoord 0, 8 - ld b, 5 + ld b, NUM_LINK_BATTLE_RECORDS ld de, sLinkBattleRecord + 2 .loop push bc @@ -8094,7 +8097,7 @@ ReadAndPrintLinkBattleRecord: ld h, d ld l, e ld de, wceed - ld bc, 10 + ld bc, NAME_LENGTH - 1 call CopyBytes ld a, "@" ld [de], a @@ -8131,7 +8134,7 @@ ReadAndPrintLinkBattleRecord: call PlaceString .next pop hl - ld bc, 18 + ld bc, LINK_BATTLE_RECORD_LENGTH add hl, bc ld d, h ld e, l @@ -8300,7 +8303,7 @@ GetRoamMonSpecies: ld hl, wRoamMon3Species ret -AddLastBattleToLinkRecord: +AddLastLinkBattleToLinkRecord: ld hl, wOTPlayerID ld de, wStringBuffer1 ld bc, 2 @@ -8308,10 +8311,10 @@ AddLastBattleToLinkRecord: ld hl, wOTPlayerName ld bc, NAME_LENGTH - 1 call CopyBytes - ld hl, sLinkBattleStats - 12 + ld hl, sLinkBattleStats - (LINK_BATTLE_RECORD_LENGTH - 6) call .StoreResult ld hl, sLinkBattleRecord - ld d, 5 + ld d, NUM_LINK_BATTLE_RECORDS .loop push hl inc hl @@ -8322,17 +8325,17 @@ AddLastBattleToLinkRecord: and a jr z, .copy push de - ld bc, 12 + ld bc, LINK_BATTLE_RECORD_LENGTH - 6 ld de, wStringBuffer1 call CompareBytesLong pop de pop hl jr c, .done - ld bc, 18 + ld bc, LINK_BATTLE_RECORD_LENGTH add hl, bc dec d jr nz, .loop - ld bc, -18 + ld bc, -LINK_BATTLE_RECORD_LENGTH add hl, bc push hl @@ -8340,7 +8343,7 @@ AddLastBattleToLinkRecord: ld d, h ld e, l ld hl, wStringBuffer1 - ld bc, 12 + ld bc, LINK_BATTLE_RECORD_LENGTH - 6 call CopyBytes ld b, 6 xor a @@ -8359,12 +8362,12 @@ AddLastBattleToLinkRecord: ld a, [wBattleResult] and $f cp LOSE - ld bc, sLinkBattleWins + 1 - (sLinkBattleStats - 12) + ld bc, (sLinkBattleRecord1Wins - sLinkBattleRecord1) + 1 jr c, .okay ; WIN - ld bc, sLinkBattleLosses + 1 - (sLinkBattleStats - 12) + ld bc, (sLinkBattleRecord1Losses - sLinkBattleRecord1) + 1 jr z, .okay ; LOSE ; DRAW - ld bc, sLinkBattleDraws + 1 - (sLinkBattleStats - 12) + ld bc, (sLinkBattleRecord1Draws - sLinkBattleRecord1) + 1 .okay add hl, bc call .CheckOverflow @@ -8386,8 +8389,8 @@ AddLastBattleToLinkRecord: ret .FindOpponentAndAppendRecord: - ld b, 5 - ld hl, sLinkBattleRecord + 17 + ld b, NUM_LINK_BATTLE_RECORDS + ld hl, sLinkBattleRecord1End - 1 ld de, wceed .loop3 push bc @@ -8405,7 +8408,7 @@ AddLastBattleToLinkRecord: ld a, c ld [de], a inc de - ld bc, 18 + ld bc, LINK_BATTLE_RECORD_LENGTH add hl, bc pop bc dec b @@ -8454,26 +8457,26 @@ AddLastBattleToLinkRecord: .done2 push bc ld a, b - ld bc, 18 + ld bc, LINK_BATTLE_RECORD_LENGTH ld hl, sLinkBattleRecord call AddNTimes push hl ld de, wceed - ld bc, 18 + ld bc, LINK_BATTLE_RECORD_LENGTH call CopyBytes pop hl pop bc push hl ld a, c - ld bc, 18 + ld bc, LINK_BATTLE_RECORD_LENGTH ld hl, sLinkBattleRecord call AddNTimes pop de push hl - ld bc, 18 + ld bc, LINK_BATTLE_RECORD_LENGTH call CopyBytes ld hl, wceed - ld bc, 18 + ld bc, LINK_BATTLE_RECORD_LENGTH pop de call CopyBytes ret |