Consolidate monster structs in wram and sram.

The PartyMon struct is really the box struct with volatile variables like status added.

Some other labels have been reworked.
Move structs no longer have explicit labels since their location is arbitrary and usually shared.
This commit is contained in:
yenatch 2014-06-12 18:32:42 -07:00
parent 23f9b5d21e
commit 023cfdbb05
14 changed files with 1128 additions and 1538 deletions

View File

@ -16,7 +16,7 @@ AIScoring_RedStatus: ; 38591
inc de
call AIGetEnemyMove
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
ld c, a
push hl
@ -28,7 +28,7 @@ AIScoring_RedStatus: ; 38591
pop hl
jr nz, .discourage
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
push hl
push de
push bc
@ -82,7 +82,7 @@ AIScoring_RedStatMods: ; 385e0
inc de
call AIGetEnemyMove
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
cp EFFECT_ATTACK_UP
jr c, .checkmove
@ -119,7 +119,7 @@ AIScoring_RedStatMods: ; 385e0
jr nz, .discourage
.encourage
call Function_0x39527
call Function39527
jr c, .checkmove
dec [hl]
@ -173,7 +173,7 @@ AIScoring_RedSuperEffective: ; 38635
jr c, .noteffective
; effective
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr z, .checkmove
dec [hl]
@ -185,7 +185,7 @@ AIScoring_RedSuperEffective: ; 38635
push hl
push de
push bc
ld a, [EnemyMoveType]
ld a, [wEnemyMoveStruct + MOVE_TYPE]
ld d, a
ld hl, EnemyMonMoves
ld b, EnemyMonMovesEnd - EnemyMonMoves + 1
@ -199,10 +199,10 @@ AIScoring_RedSuperEffective: ; 38635
jr z, .asm_38693
call AIGetEnemyMove
ld a, [EnemyMoveType]
ld a, [wEnemyMoveStruct + MOVE_TYPE]
cp d
jr z, .checkmove2
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr nz, .asm_38692
jr .checkmove2
@ -244,7 +244,7 @@ AIScoring_Offensive: ; 386a2
inc de
call AIGetEnemyMove
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr nz, .checkmove
@ -275,7 +275,7 @@ AIScoring_Smart: ; 386be
push hl
call AIGetEnemyMove
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
ld hl, .table_386f2
ld de, 3
call IsInArray
@ -398,7 +398,7 @@ AIScoring_Sleep: ; 387e3
ret nc
.asm_387f0
call Function_0x39527
call Function39527
ret c
dec [hl]
dec [hl]
@ -421,7 +421,7 @@ AIScoring_LeechHit: ; 387f7
call AICheckEnemyMaxHP
ret c
call Function_0x39521
call Function39521
ret c
dec [hl]
@ -484,8 +484,8 @@ AIScoring_LockOn: ; 3881d
call AIGetEnemyMove
ld a, [EnemyMoveAccuracy]
cp $b4
ld a, [wEnemyMoveStruct + MOVE_ACC]
cp 180
jr nc, .asm_3884f
ld a, $1
@ -513,7 +513,7 @@ AIScoring_LockOn: ; 3881d
.asm_3887a
pop hl
call Function_0x39527
call Function39527
ret c
dec [hl]
@ -538,8 +538,8 @@ AIScoring_LockOn: ; 3881d
inc de
call AIGetEnemyMove
ld a, [EnemyMoveAccuracy]
cp $b4
ld a, [wEnemyMoveStruct + MOVE_ACC]
cp 180
jr nc, .asm_3888b
dec [hl]
@ -602,19 +602,16 @@ AIScoring_EvasionUp: ; 388d4
jp nc, AIDiscourageMove
call AICheckEnemyMaxHP
jr nc, .asm_388f2
ld a, [PlayerSubStatus5]
bit 0, a
bit SUBSTATUS_TOXIC, a
jr nz, .asm_388ef
call Random
cp $b2
jr nc, .asm_38911
.asm_388ef
dec [hl]
dec [hl]
@ -622,42 +619,35 @@ AIScoring_EvasionUp: ; 388d4
.asm_388f2
call AICheckEnemyQuarterHP
jr nc, .asm_3890f
call Random
cp $a
jr c, .asm_388ef
call AICheckEnemyHalfHP
jr nc, .asm_3890a
call Function_0x39521
call Function39521
jr c, .asm_388ef
jr .asm_38911
.asm_3890a
call Function_0x39527
call Function39527
jr c, .asm_38911
.asm_3890f
inc [hl]
inc [hl]
.asm_38911
ld a, [PlayerSubStatus5]
bit 0, a
bit SUBSTATUS_TOXIC, a
jr nz, .asm_38938
ld a, [PlayerSubStatus4]
bit 7, a
bit SUBSTATUS_LEECH_SEED, a
jr nz, .asm_38941
ld a, [EnemyEvaLevel]
@ -671,7 +661,7 @@ AIScoring_EvasionUp: ; 388d4
jr nz, .asm_388ef
ld a, [PlayerSubStatus1]
bit 6, a
bit SUBSTATUS_ENCORED, a
jr nz, .asm_388ef
@ -688,7 +678,7 @@ AIScoring_EvasionUp: ; 388d4
ret
.asm_38941
call Function_0x39527
call Function39527
ret c
dec [hl]
@ -706,7 +696,7 @@ AIScoring_AlwaysHit: ; 38947
ret c
.asm_38954
call Function_0x39521
call Function39521
ret c
dec [hl]
@ -721,30 +711,29 @@ AIScoring_MirrorMove: ; 3895b
jr nz, .asm_38968
call AICompareSpeed
ret nc
jp AIDiscourageMove
jp AIDiscourageMove
.asm_38968
push hl
ld hl, Table_0x39301
ld de, 1
call IsInArray
pop hl
ret nc
call Function_0x39527
call Function39527
ret c
dec [hl]
call AICompareSpeed
ret nc
call Random
call Random
cp $19
ret c
dec [hl]
ret
; 38985
@ -752,23 +741,19 @@ AIScoring_MirrorMove: ; 3895b
AIScoring_AccuracyDown: ; 38985
call AICheckPlayerMaxHP
jr nc, .asm_389a0
call AICheckEnemyHalfHP
jr nc, .asm_389a0
ld a, [PlayerSubStatus5]
bit 0, a
bit SUBSTATUS_TOXIC, a
jr nz, .asm_3899d
call Random
cp $b2
jr nc, .asm_389bf
.asm_3899d
dec [hl]
dec [hl]
@ -776,42 +761,34 @@ AIScoring_AccuracyDown: ; 38985
.asm_389a0
call AICheckPlayerQuarterHP
jr nc, .asm_389bd
call Random
cp $a
jr c, .asm_3899d
call AICheckPlayerHalfHP
jr nc, .asm_389b8
call Function_0x39521
call Function39521
jr c, .asm_3899d
jr .asm_389bf
.asm_389b8
call Function_0x39527
call Function39527
jr c, .asm_389bf
.asm_389bd
inc [hl]
inc [hl]
.asm_389bf
ld a, [PlayerSubStatus5]
bit 0, a
bit SUBSTATUS_TOXIC, a
jr nz, .asm_389e6
ld a, [PlayerSubStatus4]
bit 7, a
bit SUBSTATUS_LEECH_SEED, a
jr nz, .asm_389ef
ld a, [EnemyEvaLevel]
@ -825,10 +802,9 @@ AIScoring_AccuracyDown: ; 38985
jr nz, .asm_3899d
ld a, [PlayerSubStatus1]
bit 6, a
bit SUBSTATUS_ENCORED, a
jr nz, .asm_3899d
.asm_389e4
inc [hl]
ret
@ -842,9 +818,9 @@ AIScoring_AccuracyDown: ; 38985
ret
.asm_389ef
call Function_0x39527
call Function39527
ret c
dec [hl]
ret
; 389f5
@ -862,7 +838,6 @@ AIScoring_Haze: ; 389f5
jr c, .asm_38a12
jr .asm_389fb
.asm_38a05
ld hl, PlayerAtkLevel
ld c, $8
@ -984,7 +959,7 @@ AIScoring_Bind: ; 38a71
jr z, .asm_38a91
.asm_38a8b
call Function_0x39527
call Function39527
ret c
inc [hl]
ret
@ -992,7 +967,7 @@ AIScoring_Bind: ; 38a71
.asm_38a91
call AICheckEnemyQuarterHP
ret nc
call Function_0x39527
call Function39527
ret c
dec [hl]
dec [hl]
@ -1022,7 +997,7 @@ AIScoring_Unused2B: ; 38a9c
call AIGetEnemyMove
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
cp EFFECT_PROTECT
jr z, .asm_38ad5
dec c
@ -1081,14 +1056,14 @@ AIScoring_SpDefenseUp2: ; 38aed
ret nc
ld a, [BattleMonType1]
cp FIRE
cp SPECIAL
jr nc, .asm_38b09
ld a, [BattleMonType2]
cp FIRE
cp SPECIAL
ret c
.asm_38b09
call Function_0x39521
call Function39521
ret c
dec [hl]
dec [hl]
@ -1128,14 +1103,14 @@ AIScoring_Paralyze: ; 38b26
ret c
call AICheckEnemyQuarterHP
ret nc
call Function_0x39521
call Function39521
ret c
dec [hl]
dec [hl]
ret
.asm_38b3a
call Function_0x39527
call Function39527
ret c
inc [hl]
ret
@ -1143,7 +1118,7 @@ AIScoring_Paralyze: ; 38b26
AIScoring_SpeedDownHit: ; 38b40
ld a, [EnemyMoveAnimation]
ld a, [wEnemyMoveStruct + MOVE_ANIM]
cp ICY_WIND
ret nz
call AICheckEnemyQuarterHP
@ -1174,7 +1149,7 @@ AIScoring_HyperBeam: ; 38b63
jr c, .asm_38b72
call AICheckEnemyQuarterHP
ret c
call Function_0x39527
call Function39527
ret c
dec [hl]
ret
@ -1184,7 +1159,7 @@ AIScoring_HyperBeam: ; 38b63
cp 40
ret c
inc [hl]
call Function_0x39527
call Function39527
ret c
inc [hl]
ret
@ -1196,7 +1171,7 @@ AIScoring_Rage: ; 38b7f
bit 6, a
jr z, .asm_38b9b
call Function_0x39527
call Function39527
jr c, .asm_38b8c
dec [hl]
@ -1216,7 +1191,7 @@ AIScoring_Rage: ; 38b7f
call AICheckEnemyHalfHP
jr nc, .asm_38ba6
call Function_0x39521
call Function39521
ret nc
dec [hl]
ret
@ -1249,7 +1224,7 @@ AIScoring_Mimic: ; 38ba8
jr c, .asm_38bef
jr z, .asm_38bd4
call Function_0x39527
call Function39527
jr c, .asm_38bd4
dec [hl]
@ -1263,7 +1238,7 @@ AIScoring_Mimic: ; 38ba8
pop hl
ret nc
call Function_0x39527
call Function39527
ret c
dec [hl]
ret
@ -1291,12 +1266,12 @@ AIScoring_Counter: ; 38bf1
call AIGetEnemyMove
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr z, .asm_38c0e
ld a, [EnemyMoveType]
cp $14
ld a, [wEnemyMoveStruct + MOVE_TYPE]
cp SPECIAL
jr nc, .asm_38c0e
inc b
@ -1319,12 +1294,12 @@ AIScoring_Counter: ; 38bf1
call AIGetEnemyMove
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr z, .asm_38c38
ld a, [EnemyMoveType]
cp $14
ld a, [wEnemyMoveStruct + MOVE_TYPE]
cp SPECIAL
jr nc, .asm_38c38
@ -1354,12 +1329,12 @@ AIScoring_Encore: ; 38c3b
call AIGetEnemyMove
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr z, .asm_38c68
push hl
ld a, [EnemyMoveType]
ld a, [wEnemyMoveStruct + MOVE_TYPE]
ld hl, EnemyMonType1
ld a, $41
call Predef
@ -1433,7 +1408,7 @@ AIScoring_Encore: ; 38c3b
AIScoring_PainSplit: ; 38ca4
push hl
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld b, [hl]
inc hl
ld c, [hl]
@ -1490,7 +1465,7 @@ AIScoring_Spite: ; 38cd5
call AICompareSpeed
jp c, AIDiscourageMove
call Function_0x39527
call Function39527
ret c
inc [hl]
ret
@ -1596,7 +1571,7 @@ AIScoring_HealBell: ; 38d1f
.asm_38d48
and $27
ret z
call Function_0x39527
call Function39527
ret c
dec [hl]
@ -1664,7 +1639,7 @@ AIScoring_Conversion2: ; 38d98
ld a, BANK(Moves)
call GetFarByte
ld [PlayerMoveType], a
ld [wPlayerMoveStruct + MOVE_TYPE], a
xor a
ld [hBattleTurn], a
@ -1677,7 +1652,7 @@ AIScoring_Conversion2: ; 38d98
jr c, .asm_38dc9
ret z
call Function_0x39527
call Function39527
ret c
dec [hl]
@ -1713,7 +1688,7 @@ AIScoring_Disable: ; 38dd1
ret
.asm_38dee
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
ret nz
@ -1755,7 +1730,7 @@ AIScoring_MeanLook: ; 38dfb
ret
.asm_38e26
call Function_0x39521
call Function39521
ret c
dec [hl]
dec [hl]
@ -1792,7 +1767,7 @@ AICheckLastPlayerMon: ; 38e2e
AIScoring_Nightmare: ; 38e4a
call Function_0x39527
call Function39527
ret c
dec [hl]
ret
@ -1832,12 +1807,12 @@ AIScoring_Curse: ; 38e5c
ld a, [BattleMonType1]
cp GHOST
jr z, .asm_38e92
cp FIRE
cp SPECIAL
ret nc
ld a, [BattleMonType2]
cp FIRE
cp SPECIAL
ret nc
call Function_0x39521
call Function39521
ret c
dec [hl]
dec [hl]
@ -1892,7 +1867,7 @@ AIScoring_Curse: ; 38e5c
ret nz
.asm_38ecb
call Function_0x39527
call Function39527
ret c
dec [hl]
@ -1936,7 +1911,7 @@ AIScoring_Protect: ; 38ed2
jr c, .asm_38f14
.asm_38f0d
call Function_0x39521
call Function39521
ret c
dec [hl]
ret
@ -2002,14 +1977,14 @@ AIScoring_PerishSong: ; 38f4a
pop hl
ret c
call Function_0x39527
call Function39527
ret c
inc [hl]
ret
.asm_38f6f
call Function_0x39527
call Function39527
ret c
dec [hl]
@ -2043,7 +2018,7 @@ AIScoring_Sandstorm: ; 38f7a
call AICheckPlayerHalfHP
jr nc, .asm_38fa6
call Function_0x39527
call Function39527
ret c
dec [hl]
@ -2079,7 +2054,7 @@ AIScoring_Endure: ; 38fac
call AIHasMove
jr nc, .asm_38fcb
call Function_0x39521
call Function39521
ret c
dec [hl]
@ -2091,7 +2066,7 @@ AIScoring_Endure: ; 38fac
ld a, [EnemySubStatus5]
bit SUBSTATUS_LOCK_ON, a
ret z
call Function_0x39527
call Function39527
ret c
dec [hl]
@ -2161,7 +2136,7 @@ AIScoring_Rollout: ; 38fef
ret
.asm_39020
call Function_0x39521
call Function39521
ret c
inc [hl]
ret
@ -2174,7 +2149,7 @@ AIScoring_Attract: ; 39026
and a
jr z, .asm_39032
call Function_0x39521
call Function39521
ret c
inc [hl]
ret
@ -2191,7 +2166,7 @@ AIScoring_Attract: ; 39026
AIScoring_Safeguard: ; 3903a
call AICheckPlayerHalfHP
ret c
call Function_0x39521
call Function39521
ret c
inc [hl]
ret
@ -2217,7 +2192,7 @@ AIScoring_Earthquake: ; 39044
.asm_39058
call AICompareSpeed
ret c
call Function_0x39527
call Function39527
ret c
dec [hl]
ret
@ -2239,13 +2214,13 @@ AIScoring_BatonPass: ; 39062
AIScoring_Pursuit: ; 39072
call AICheckPlayerQuarterHP
jr nc, .asm_3907d
call Function_0x39521
call Function39521
ret c
inc [hl]
ret
.asm_3907d
call Function_0x39527
call Function39527
ret c
dec [hl]
dec [hl]
@ -2267,7 +2242,7 @@ AIScoring_RapidSpin: ; 39084
ret z
.asm_39097
call Function_0x39521
call Function39521
ret c
dec [hl]
@ -2372,7 +2347,7 @@ AIScoring_WeatherMove: ; 3910d
call AICheckPlayerHalfHP
jr nc, AIBadWeatherType
call Function_0x39527
call Function39527
ret c
dec [hl]
@ -2476,7 +2451,7 @@ AIScoring_PsychUp: ; 39152
ld a, [EnemyEvaLevel]
cp $8
ret nc
call Function_0x39521
call Function39521
ret c
dec [hl]
@ -2502,12 +2477,12 @@ AIScoring_MirrorCoat: ; 3918b
call AIGetEnemyMove
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr z, .asm_391a8
ld a, [EnemyMoveType]
cp FIRE
ld a, [wEnemyMoveStruct + MOVE_TYPE]
cp SPECIAL
jr c, .asm_391a8
inc b
@ -2530,12 +2505,12 @@ AIScoring_MirrorCoat: ; 3918b
call AIGetEnemyMove
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr z, .asm_391d2
ld a, [EnemyMoveType]
cp FIRE
ld a, [wEnemyMoveStruct + MOVE_TYPE]
cp SPECIAL
jr c, .asm_391d2
@ -2574,7 +2549,7 @@ AIScoring_Gust: ; 391d5
.asm_391e9
call AICompareSpeed
ret c
call Function_0x39527
call Function39527
ret c
dec [hl]
ret
@ -2600,7 +2575,7 @@ AIScoring_Stomp: ; 39200
and a
ret z
call Function_0x39521
call Function39521
ret c
dec [hl]
@ -2625,7 +2600,7 @@ AIScoring_Solarbeam: ; 3920b
ret
.asm_3921e
call Function_0x39521
call Function39521
ret c
dec [hl]
@ -2650,13 +2625,13 @@ AIScoring_Thunder: ; 39225
AICompareSpeed: ; 39233
push bc
ld a, [EnemyMonSpd + 1]
ld a, [EnemyMonSpeed + 1]
ld b, a
ld a, [BattleMonSpd + 1]
ld a, [BattleMonSpeed + 1]
cp b
ld a, [EnemyMonSpd]
ld a, [EnemyMonSpeed]
ld b, a
ld a, [BattleMonSpd]
ld a, [BattleMonSpeed]
sbc b
pop bc
ret
@ -2677,8 +2652,8 @@ AICheckEnemyMaxHP: ; 39251
push hl
push de
push bc
ld de, EnemyMonHPHi
ld hl, EnemyMonMaxHPHi
ld de, EnemyMonHP
ld hl, EnemyMonMaxHP
; fallthrough
; 3925a
@ -2733,7 +2708,7 @@ AICheckEnemyHalfHP: ; 39281
push hl
push de
push bc
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld b, [hl]
inc hl
ld c, [hl]
@ -2756,7 +2731,7 @@ AICheckEnemyQuarterHP: ; 39298
push hl
push de
push bc
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld b, [hl]
inc hl
ld c, [hl]
@ -2811,7 +2786,7 @@ AIHasMove: ; 392ca
call AIGetEnemyMove
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
cp b
jr z, .asm_392e3
@ -2898,7 +2873,7 @@ AIScoring_Opportunist: ; 39315
call AICheckEnemyQuarterHP
jr nc, .asm_39322
call Function_0x39527
call Function39527
ret c
.asm_39322
@ -2992,7 +2967,7 @@ AIScoring_Aggressive: ; 39369
push de
push bc
call AIGetEnemyMove
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr z, .nodamage
call AIDamageCalc
@ -3043,14 +3018,14 @@ AIScoring_Aggressive: ; 39369
call AIGetEnemyMove
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
cp 2
jr c, .checkmove2
push hl
push de
push bc
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
ld hl, .aggressivemoves
ld de, 1
call IsInArray
@ -3077,7 +3052,7 @@ AIScoring_Aggressive: ; 39369
AIDamageCalc: ; 393e7
ld a, 1
ld [hBattleTurn], a
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
ld de, 1
ld hl, .ConstantDamageEffects
call IsInArray
@ -3175,7 +3150,7 @@ AIScoring_StatusImmunity: ; 39453
inc de
call AIGetEnemyMove
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
cp EFFECT_TOXIC
jr z, .poisonimmunity
cp EFFECT_POISON
@ -3185,7 +3160,7 @@ AIScoring_StatusImmunity: ; 39453
cp EFFECT_PARALYZE
jr z, .typeimmunity
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr z, .checkmove
@ -3242,12 +3217,12 @@ AIScoring_Risky: ; 394a9
push hl
call AIGetEnemyMove
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
and a
jr z, .nextmove
; Don't use risky moves at max hp.
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
ld de, 1
ld hl, .riskymoves
call IsInArray
@ -3317,7 +3292,7 @@ AIGetEnemyMove: ; 39508
ld bc, MOVE_LENGTH
call AddNTimes
ld de, EnemyMoveStruct
ld de, wEnemyMoveStruct
ld a, BANK(Moves)
call FarCopyBytes
@ -3328,14 +3303,14 @@ AIGetEnemyMove: ; 39508
; 39521
Function_0x39521: ; 39521
Function39521: ; 39521
call Random
cp 50 ; 1/5
ret
; 39527
Function_0x39527: ; 39527
Function39527: ; 39527
call Random
cp $80 ; 1/2
ret

View File

@ -12,8 +12,8 @@ Function3c000: ; 3c000
inc a
ld [$d264], a
ld hl, OTPartyMon1HP
ld bc, $002f
ld d, $3
ld bc, OTPartyMon2 - (OTPartyMon1 + 1)
ld d, NUM_MOVES - 1
.asm_3c019
inc d
ld a, [hli]
@ -166,8 +166,8 @@ Function3c12f: ; 3c12f
call Function3c3f5
jp c, .asm_3c1be
xor a
ld [$c710], a
ld [$c711], a
ld [wPlayerIsSwitching], a
ld [wEnemyIsSwitching], a
ld [$d264], a
ld [$c73f], a
ld [$c740], a
@ -455,7 +455,7 @@ Function3c314: ; 3c314
jr z, .asm_3c35b
cp $d
jr z, .asm_3c35b
sub $4
sub NUM_MOVES
jr c, .asm_3c35b
ld a, [$d0ec]
cp $2
@ -537,8 +537,8 @@ Function3c314: ; 3c314
jr .asm_3c3c5
.asm_3c3c5
ld de, BattleMonSpd
ld hl, EnemyMonSpd
ld de, BattleMonSpeed
ld hl, EnemyMonSpeed
ld c, $2
call StringCmp
jr z, .asm_3c3d8
@ -653,26 +653,26 @@ Function3c434: ; 3c434
callab UpdateMoveData
xor a
ld [$c732], a
ld a, [PlayerMoveEffect]
cp $77
ld a, [wPlayerMoveStruct + MOVE_EFFECT]
cp EFFECT_FURY_CUTTER
jr z, .asm_3c494
xor a
ld [PlayerFuryCutterCount], a
.asm_3c494
ld a, [PlayerMoveEffect]
cp $51
ld a, [wPlayerMoveStruct + MOVE_EFFECT]
cp EFFECT_RAGE
jr z, .asm_3c4a4
ld hl, PlayerSubStatus4
res 6, [hl]
res SUBSTATUS_RAGE, [hl]
xor a
ld [$c72b], a
.asm_3c4a4
ld a, [PlayerMoveEffect]
cp $6f
ld a, [wPlayerMoveStruct + MOVE_EFFECT]
cp EFFECT_PROTECT
jr z, .asm_3c4c9
cp $74
cp EFFECT_ENDURE
jr z, .asm_3c4c9
xor a
ld [PlayerProtectCount], a
@ -1055,7 +1055,7 @@ Function3c706: ; 3c706
and a
jr z, Function3c710
Function3c70b: ; 3c70b
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
jr Function3c713
Function3c710: ; 3c710
@ -1176,7 +1176,7 @@ Function3c716: ; 3c716
ld a, [hBattleTurn]
and a
jr z, .asm_3c7f4
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
.asm_3c7f4
ld a, [hli]
@ -1243,7 +1243,7 @@ Function3c801: ; 3c801
ret
.asm_3c85c
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
xor a
ld [hli], a
ld [hl], a
@ -1352,7 +1352,7 @@ Function3c8eb: ; 3c8eb
ld a, [hBattleTurn]
and a
jr z, .asm_3c922
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
.asm_3c922
ld a, [hli]
@ -2423,7 +2423,7 @@ EnemyPartyMonEntrance: ; 3cf78
call SetEnemyTurn
call SpikesDamage
xor a
ld [EnemyMoveAnimation], a
ld [wEnemyMoveStruct + MOVE_ANIM], a
ld [$d0ec], a
inc a
ret
@ -2732,7 +2732,7 @@ KantoGymLeaders:
Function3d14e: ; 3d14e
call Function3cef1
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
or [hl]
call z, Function3cf14
@ -2743,7 +2743,7 @@ Function3d14e: ; 3d14e
ld a, d
and a
jp z, LostBattle
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
or [hl]
jr nz, .asm_3d185
@ -2841,7 +2841,7 @@ Function3d1f8: ; 3d1f8
cp $1
jr z, .asm_3d20a
ld hl, PartyMon1Speed
ld de, EnemyMonSpd
ld de, EnemyMonSpeed
jp Function3d8b3
; 3d227
@ -2862,7 +2862,7 @@ Function3d227: ; 3d227
ld [$d0ec], a
call Function3d2e0
jr c, .asm_3d251
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
or [hl]
jr nz, .asm_3d26c
@ -3296,7 +3296,7 @@ Function3d4e1: ; 3d4e1
ld [$c6fc], a
ld [$d0ec], a
inc a
ld [$c711], a
ld [wEnemyIsSwitching], a
call Function309d
jp Function3e3ad
; 3d517
@ -3309,8 +3309,8 @@ Function3d517: ; 3d517
.asm_3d522
call Function3d6ca
ld a, $1
ld [$c711], a
ld a, 1
ld [wEnemyIsSwitching], a
call Function3d7a0
call Function3d7b8
jp Function3d7c7
@ -3321,7 +3321,7 @@ Function3d533: ; 3d533
and a
jr z, .asm_3d541
ld a, [$d430]
sub $4
sub NUM_MOVES
ld b, a
jr .asm_3d555
@ -3435,10 +3435,10 @@ Function3d5d7: ; 3d5d7
push de
push bc
dec a
ld hl, Moves + MOVE_ANIM
ld hl, Moves
ld bc, MOVE_LENGTH
call AddNTimes
ld de, EnemyMoveAnimation
ld de, wEnemyMoveStruct
ld a, BANK(Moves)
call FarCopyBytes
call SetEnemyTurn
@ -3475,14 +3475,14 @@ Function3d618: ; 3d618
ld a, BANK(BaseData)
call FarCopyBytes
ld a, [BattleMonType1]
ld [PlayerMoveType], a
ld [wPlayerMoveStruct + MOVE_TYPE], a
call SetPlayerTurn
callab Function347c8
ld a, [$d265]
cp $b
jr nc, .asm_3d663
ld a, [BattleMonType2]
ld [PlayerMoveType], a
ld [wPlayerMoveStruct + MOVE_TYPE], a
callab Function347c8
ld a, [$d265]
cp $b
@ -3592,14 +3592,14 @@ Function3d6ca: ; 3d6ca
ld a, [$def4]
and a
jr nz, .asm_3d708
ld hl, EnemyMonAtkDefDV
ld a, $2d
ld hl, EnemyMonDVs
ld a, PREDEF_GET_UNOWN_LETTER
call Predef
ld a, [UnownLetter]
ld [$def4], a
.asm_3d708
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
ld [$c6ea], a
ld a, [hl]
@ -3759,7 +3759,7 @@ NewEnemyMonStatus: ; 3d834
ld [hl], a
ld [EnemyDisableCount], a
ld [EnemyFuryCutterCount], a
ld [$c681], a
ld [EnemyProtectCount], a
ld [$c72c], a
ld [EnemyDisabledMove], a
ld [$c6fa], a
@ -4019,21 +4019,21 @@ Function3d8b3: ; 3d8b3
Function3da0d: ; 3da0d
ld a, $0
ld a, PartyMon1Species - PartyMon1
call GetPartyParamLocation
ld de, BattleMonSpecies
ld bc, $0006
ld bc, 1 + 1 + NUM_MOVES ; species, item, moves ; BattleMonDVs - BattleMonSpecies
call CopyBytes
ld bc, $000f
ld bc, PartyMon1DVs - (PartyMon1Species + 1 + 1 + NUM_MOVES)
add hl, bc
ld de, BattleMonAtkDefDV
ld bc, $0007
ld de, BattleMonDVs
ld bc, 2 + NUM_MOVES + 1 ; DVs, PP, happiness ; BattleMonLevel - BattleMonDVs
call CopyBytes
inc hl
inc hl
inc hl
ld de, BattleMonLevel
ld bc, $0011
ld bc, 1 + 1 + 1 + 2 + 2 * 6 ; level, status, unused, stats
call CopyBytes
ld a, [BattleMonSpecies]
ld [TempBattleMonSpecies], a
@ -4044,15 +4044,15 @@ Function3da0d: ; 3da0d
ld [BattleMonType1], a
ld a, [BaseType2]
ld [BattleMonType2], a
ld hl, PartyMon1Nickname
ld hl, PartyMonNicknames
ld a, [CurBattleMon]
call SkipNames
ld de, BattleMonNick
ld bc, $000b
ld bc, PKMN_NAME_LENGTH
call CopyBytes
ld hl, BattleMonAtk
ld hl, BattleMonAttack
ld de, PlayerStats
ld bc, $000a
ld bc, 2 * 5
call CopyBytes
call Function3ec2c
call BadgeStatBoosts
@ -4074,7 +4074,7 @@ Function3da7c: ; 3da7c
; 3da85
Function3da85: ; 3da85
ld hl, BattleMonAtkDefDV
ld hl, BattleMonDVs
ld a, [PlayerSubStatus5]
bit 3, a
ret z
@ -4084,7 +4084,7 @@ Function3da85: ; 3da85
; 3da97
Function3da97: ; 3da97
ld hl, EnemyMonAtkDefDV
ld hl, EnemyMonDVs
ld a, [EnemySubStatus5]
bit 3, a
ret z
@ -4092,7 +4092,7 @@ Function3da97: ; 3da97
ld a, [IsInBattle]
dec a
ret z
ld hl, OTPartyMon1AtkDefDV
ld hl, OTPartyMon1DVs
ld a, [CurOTMon]
jp GetPartyLocation
; 3dab1
@ -4114,31 +4114,31 @@ Function3dabd: ; 3dabd
ld hl, OTPartyMon1Species
call GetPartyLocation
ld de, EnemyMonSpecies
ld bc, $0006
ld bc, 1 + 1 + NUM_MOVES
call CopyBytes
ld bc, $000f
ld bc, OTPartyMon1DVs - (OTPartyMon1Species + 1 + 1 + NUM_MOVES)
add hl, bc
ld de, EnemyMonAtkDefDV
ld bc, $0007
ld de, EnemyMonDVs
ld bc, 2 + NUM_MOVES + 1
call CopyBytes
inc hl
inc hl
inc hl
ld de, EnemyMonLevel
ld bc, $0011
ld bc, 1 + 1 + 1 + 2 + 2 * 6
call CopyBytes
ld a, [EnemyMonSpecies]
ld [CurSpecies], a
call GetBaseData
ld hl, OTPartyMon1Nickname
ld hl, OTPartyMonNicknames
ld a, [CurPartyMon]
call SkipNames
ld de, EnemyMonNick
ld bc, $000b
ld bc, PKMN_NAME_LENGTH
call CopyBytes
ld hl, EnemyMonAtk
ld hl, EnemyMonAttack
ld de, EnemyStats
ld bc, $000a
ld bc, 2 * 5
call CopyBytes
call Function3ec30
ld hl, BaseType1
@ -4148,9 +4148,9 @@ Function3dabd: ; 3dabd
inc de
ld a, [hl]
ld [de], a
ld hl, BaseHP
ld hl, BaseStats
ld de, EnemyMonBaseStats
ld b, $5
ld b, 5
.asm_3db25
ld a, [hli]
ld [de], a
@ -4177,7 +4177,7 @@ Function3db32: ; 3db32
call Function3db5f
call EmptyBattleTextBox
call Function309d
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
or [hl]
ret
@ -4185,12 +4185,12 @@ Function3db32: ; 3db32
Function3db5f: ; 3db5f
ld hl, BattleMonAtkDefDV
ld a, $2d
ld hl, BattleMonDVs
ld a, PREDEF_GET_UNOWN_LETTER
call Predef
hlcoord 1, 5
ld b, $7
ld c, $8
ld b, 7
ld c, 8
call ClearBox
call WaitBGMap
xor a
@ -4201,7 +4201,7 @@ Function3db5f: ; 3db5f
ld [$d0d2], a
ld [CurMoveNum], a
ld [TypeModifier], a
ld [PlayerMoveAnimation], a
ld [wPlayerMoveStruct + MOVE_ANIM], a
ld [LastEnemyCounterMove], a
ld [LastPlayerCounterMove], a
ld [LastPlayerMove], a
@ -4223,7 +4223,7 @@ Function3db5f: ; 3db5f
call Function3ee17
.asm_3dbbc
ld a, $0
ld a, PartyMon1Species - PartyMon1
call GetPartyParamLocation
ld b, h
ld c, l
@ -4281,20 +4281,20 @@ BreakAttraction: ; 3dc18
SpikesDamage: ; 3dc23
ld hl, PlayerScreens
ld de, BattleMonType1
ld de, BattleMonType
ld bc, Function3df48
ld a, [hBattleTurn]
and a
jr z, .ok
ld hl, EnemyScreens
ld de, EnemyMonType1
ld de, EnemyMonType
ld bc, Function3e036
.ok
bit SCREENS_SPIKES, [hl]
ret z
; Flying-types aren't affected by Spikes.
; Flying-types aren't affected by Spikes.
ld a, [de]
cp FLYING
ret z
@ -4321,15 +4321,17 @@ SpikesDamage: ; 3dc23
; 3dc5b
Function3dc5b: ; 3dc5b
ld a, $10
ld a, BATTLE_VARS_MOVE
call GetBattleVar
ld b, a
call GetMoveEffect
ld a, b
cp $80
cp EFFECT_PURSUIT
jr nz, .asm_3dce4
ld a, [CurBattleMon]
push af
ld hl, DoPlayerTurn
ld a, [hBattleTurn]
and a
@ -4337,25 +4339,29 @@ Function3dc5b: ; 3dc5b
ld hl, DoEnemyTurn
ld a, [$c71a]
ld [CurBattleMon], a
.asm_3dc7e
ld a, BANK(DoPlayerTurn)
rst FarCall
ld a, $10
ld a, BATTLE_VARS_MOVE
call _GetBattleVar
ld a, $ff
ld [hl], a
pop af
ld [CurBattleMon], a
ld a, [hBattleTurn]
and a
jr z, .asm_3dcc0
ld a, [$c71a]
call Function399f
ld hl, BattleMonHP
ld a, [hli]
or [hl]
jr nz, .asm_3dce4
ld a, $f0
ld [CryTracks], a
ld a, [BattleMonSpecies]
@ -4371,10 +4377,11 @@ Function3dc5b: ; 3dc5b
jr .asm_3dcdf
.asm_3dcc0
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
or [hl]
jr nz, .asm_3dce4
ld de, SFX_KINESIS
call PlaySFX
call WaitSFX
@ -4436,8 +4443,8 @@ Function3dd2f: ; 3dd2f
ld a, b
cp $1
ret nz
ld de, EnemyMonHPLo
ld hl, EnemyMonMaxHPHi
ld de, EnemyMonHP + 1
ld hl, EnemyMonMaxHP
ld a, [hBattleTurn]
and a
jr z, .asm_3dd4a
@ -4945,7 +4952,7 @@ Function3e043: ; 3e043
ld h, b
ld l, c
dec hl
ld hl, EnemyMonAtkDefDV
ld hl, EnemyMonDVs
ld de, TempMonDVs
ld a, [EnemySubStatus5]
bit 3, a
@ -4990,7 +4997,7 @@ Function3e043: ; 3e043
call PrintLevel
.asm_3e0be
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
ld [$ffb5], a
ld a, [hld]
@ -5008,7 +5015,7 @@ Function3e043: ; 3e043
ld a, $30
ld [hMultiplier], a
call Multiply
ld hl, EnemyMonMaxHPHi
ld hl, EnemyMonMaxHP
ld a, [hli]
ld b, a
ld a, [hl]
@ -5386,8 +5393,8 @@ Function3e358: ; 3e358
; 3e3ad
Function3e3ad: ; 3e3ad
ld a, $1
ld [$c710], a
ld a, 1
ld [wPlayerIsSwitching], a
ld a, [InLinkBattle]
and a
jr z, .asm_3e3c1
@ -5412,7 +5419,7 @@ Function3e3ad: ; 3e3ad
jp z, .asm_3e3ca
cp $d
jp z, .asm_3e3ca
cp $4
cp NUM_MOVES
jp c, .asm_3e3ca
cp $f
jr nz, .asm_3e3e9
@ -5452,9 +5459,9 @@ BattleMonEntrance: ; 3e40b
call SetEnemyTurn
call Function3dc5b
jr c, .asm_3e423
jr c, .ok
call Function3dce6
.asm_3e423
.ok
hlcoord 9, 7
lb bc, 5, 11
@ -5506,8 +5513,8 @@ Function3e489: ; 3e489
call Function30b4
ld a, $3
ld [$cfa9], a
ld hl, BattleMonSpd
ld de, EnemyMonSpd
ld hl, BattleMonSpeed
ld de, EnemyMonSpeed
call Function3d8b3
ld a, $0
ld [$d266], a
@ -5906,7 +5913,7 @@ MoveInfoBox: ; 3e6c8
ld [hl], "/"
callab UpdateMoveData
ld a, [PlayerMoveAnimation]
ld a, [wPlayerMoveStruct + MOVE_ANIM]
ld b, a
hlcoord 2, 10
ld a, PREDEF_PRINT_MOVE_TYPE
@ -5996,7 +6003,7 @@ Function3e786: ; 3e786
Function3e7c1: ; 3e7c1
ld a, [$c711]
ld a, [wEnemyIsSwitching]
and a
ret nz
ld a, [InLinkBattle]
@ -6013,16 +6020,17 @@ Function3e7c1: ; 3e7c1
jp z, .asm_3e8bd
cp $d
jp z, .asm_3e82c
cp $4
cp NUM_MOVES
jp nc, Function3e8c1
ld [CurEnemyMoveNum], a
ld c, a
ld a, [EnemySubStatus1]
bit 6, a
bit SUBSTATUS_ENCORED, a
jp nz, .asm_3e882
ld a, [EnemySubStatus3]
and $13
and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_ROLLOUT | 1 << SUBSTATUS_BIDE
jp nz, .asm_3e882
ld hl, EnemySubStatus5
bit 4, [hl]
ld a, [LastEnemyMove]
@ -6113,14 +6121,14 @@ Function3e7c1: ; 3e7c1
ld [$c733], a
.asm_3e894
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
cp EFFECT_FURY_CUTTER
jr z, .asm_3e89f
xor a
ld [EnemyFuryCutterCount], a
.asm_3e89f
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
cp EFFECT_RAGE
jr z, .asm_3e8af
ld hl, EnemySubStatus4
@ -6129,13 +6137,13 @@ Function3e7c1: ; 3e7c1
ld [$c72c], a
.asm_3e8af
ld a, [EnemyMoveEffect]
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
cp EFFECT_PROTECT
ret z
cp EFFECT_ENDURE
ret z
xor a
ld [$c681], a
ld [EnemyProtectCount], a
ret
.asm_3e8bd
@ -6146,7 +6154,7 @@ Function3e7c1: ; 3e7c1
Function3e8c1: ; 3e8c1
xor a
ld [EnemyFuryCutterCount], a
ld [$c681], a
ld [EnemyProtectCount], a
ld [$c72c], a
ld hl, EnemySubStatus4
res SUBSTATUS_RAGE, [hl]
@ -6492,9 +6500,9 @@ LoadEnemyMon: ; 3e8eb
ld [hli], a
; Full HP...
ld a, [EnemyMonMaxHPHi]
ld a, [EnemyMonMaxHP]
ld [hli], a
ld a, [EnemyMonMaxHPLo]
ld a, [EnemyMonMaxHP + 1]
ld [hl], a
; ...unless it's a RoamMon
@ -6510,13 +6518,13 @@ LoadEnemyMon: ; 3e8eb
jr z, .InitRoamHP
; Update from the struct if it has
ld a, [hl]
ld [EnemyMonHPLo], a
ld [EnemyMonHP + 1], a
jr .Moves
.InitRoamHP
; HP only uses the lo byte in the RoamMon struct since
; Raikou/Entei/Suicune will have < 256 hp at level 40
ld a, [EnemyMonHPLo]
ld a, [EnemyMonHP + 1]
ld [hl], a
jr .Moves
@ -6527,9 +6535,9 @@ LoadEnemyMon: ; 3e8eb
ld a, [CurPartyMon]
call GetPartyLocation
ld a, [hld]
ld [EnemyMonHPLo], a
ld [EnemyMonHP + 1], a
ld a, [hld]
ld [EnemyMonHPHi], a
ld [EnemyMonHP], a
; Make sure everything knows which monster the opponent is using
ld a, [CurPartyMon]
@ -6975,11 +6983,11 @@ Function3ecb7: ; 3ecb7
ld a, [$d265]
and a
ld a, c
ld hl, BattleMonAtk
ld hl, BattleMonAttack
ld de, PlayerStats
ld bc, PlayerAtkLevel
jr z, .asm_3ecd2
ld hl, EnemyMonAtk
ld hl, EnemyMonAttack
ld de, EnemyStats
ld bc, EnemyAtkLevel
@ -7113,7 +7121,7 @@ BadgeStatBoosts: ; 3ed45
or c
ld b, a
ld hl, BattleMonAtk
ld hl, BattleMonAttack
ld c, 4
.CheckBadge
ld a, b
@ -7432,7 +7440,7 @@ Function3ee3b: ; 3ee3b
ld a, [$ffb5]
ld [StringBuffer2], a
ld a, [CurPartyMon]
ld hl, PartyMon1Nickname
ld hl, PartyMonNicknames
call GetNick
ld hl, UnknownText_0x3f11b
call BattleTextBox
@ -7960,14 +7968,14 @@ Function3f26d: ; 3f26d
jr nz, .asm_3f2ce
.asm_3f27c
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
or [hl]
ld hl, UnknownText_0x3f2d1
jr z, .asm_3f2ce
xor a
ld [hMultiplicand], a
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
ld [$c6ea], a
ld [$ffb5], a
@ -7977,7 +7985,7 @@ Function3f26d: ; 3f26d
ld a, $19
ld [hMultiplier], a
call Multiply
ld hl, EnemyMonMaxHPHi
ld hl, EnemyMonMaxHP
ld a, [hli]
ld b, [hl]
srl a
@ -8052,7 +8060,7 @@ UnknownText_0x3f2fa: ; 3f2fa
Function3f2ff: ; 3f2ff
push de
push bc
ld hl, EnemyMonHPLo
ld hl, EnemyMonHP + 1
ld de, $c6eb
ld b, [hl]
dec hl
@ -8067,7 +8075,7 @@ Function3f2ff: ; 3f2ff
ld a, $19
ld [hMultiplier], a
call Multiply
ld hl, EnemyMonMaxHPHi
ld hl, EnemyMonMaxHP
ld a, [hli]
ld b, [hl]
srl a
@ -8300,8 +8308,8 @@ Function3f447: ; 3f447
push af
ld a, [BattleMonSpecies]
ld [CurPartySpecies], a
ld hl, BattleMonAtkDefDV
ld a, $2d
ld hl, BattleMonDVs
ld a, PREDEF_GET_UNOWN_LETTER
call Predef
ld de, $9310
ld a, $3d
@ -8339,8 +8347,8 @@ Function3f486: ; 3f486
ld [CurSpecies], a
ld [CurPartySpecies], a
call GetBaseData
ld hl, EnemyMonAtkDefDV
ld a, $2d
ld hl, EnemyMonDVs
ld a, PREDEF_GET_UNOWN_LETTER
call Predef
ld de, VTiles2
ld a, $3e
@ -8537,8 +8545,8 @@ Function3f607: ; 3f607
ld de, $c739
ld bc, NUM_MOVES
call CopyBytes
ld hl, EnemyMonAtkDefDV
ld a, $2d
ld hl, EnemyMonDVs
ld a, PREDEF_GET_UNOWN_LETTER
call Predef
ld a, [CurPartySpecies]
cp UNOWN
@ -8975,7 +8983,7 @@ Function3f998: ; 3f998
and $f
jr z, .asm_3f9af
call GetRoamMonHP
ld a, [EnemyMonHPLo]
ld a, [EnemyMonHP + 1]
ld [hl], a
jr .asm_3f9ca
@ -9003,74 +9011,74 @@ Function3f998: ; 3f998
GetRoamMonMapGroup: ; 3f9d1
ld a, [TempEnemyMonSpecies]
ld b, a
ld a, [RoamMon1Species]
ld a, [wRoamMon1Species]
cp b
ld hl, RoamMon1MapGroup
ld hl, wRoamMon1MapGroup
ret z
ld a, [RoamMon2Species]
ld a, [wRoamMon2Species]
cp b
ld hl, RoamMon2MapGroup
ld hl, wRoamMon2MapGroup
ret z
ld hl, RoamMon3MapGroup
ld hl, wRoamMon3MapGroup
ret
; 3f9e9
GetRoamMonMapNumber: ; 3f9e9
ld a, [TempEnemyMonSpecies]
ld b, a
ld a, [RoamMon1Species]
ld a, [wRoamMon1Species]
cp b
ld hl, RoamMon1MapNumber
ld hl, wRoamMon1MapNumber
ret z
ld a, [RoamMon2Species]
ld a, [wRoamMon2Species]
cp b
ld hl, RoamMon2MapNumber
ld hl, wRoamMon2MapNumber
ret z
ld hl, RoamMon3MapNumber
ld hl, wRoamMon3MapNumber
ret
; 3fa01
GetRoamMonHP: ; 3fa01
; output: hl = RoamMonHP
; output: hl = wRoamMonHP
ld a, [TempEnemyMonSpecies]
ld b, a
ld a, [RoamMon1Species]
ld a, [wRoamMon1Species]
cp b
ld hl, RoamMon1HP
ld hl, wRoamMon1HP
ret z
ld a, [RoamMon2Species]
ld a, [wRoamMon2Species]
cp b
ld hl, RoamMon2HP
ld hl, wRoamMon2HP
ret z
ld hl, RoamMon3HP
ld hl, wRoamMon3HP
ret
; 3fa19
GetRoamMonDVs: ; 3fa19
; output: hl = RoamMonDVs
; output: hl = wRoamMonDVs
ld a, [TempEnemyMonSpecies]
ld b, a
ld a, [RoamMon1Species]
ld a, [wRoamMon1Species]
cp b
ld hl, RoamMon1DVs
ld hl, wRoamMon1DVs
ret z
ld a, [RoamMon2Species]
ld a, [wRoamMon2Species]
cp b
ld hl, RoamMon2DVs
ld hl, wRoamMon2DVs
ret z
ld hl, RoamMon3DVs
ld hl, wRoamMon3DVs
ret
; 3fa31
GetRoamMonSpecies: ; 3fa31
ld a, [TempEnemyMonSpecies]
ld hl, RoamMon1Species
ld hl, wRoamMon1Species
cp [hl]
ret z
ld hl, RoamMon2Species
ld hl, wRoamMon2Species
cp [hl]
ret z
ld hl, RoamMon3Species
ld hl, wRoamMon3Species
ret
; 3fa42

View File

@ -2395,12 +2395,12 @@ BattleCommand09: ; 34d32
call .StatModifiers
ld a, [PlayerMoveAccuracy]
ld a, [wPlayerMoveStruct + MOVE_ACC]
ld b, a
ld a, [hBattleTurn]
and a
jr z, .BrightPowder
ld a, [EnemyMoveAccuracy]
ld a, [wEnemyMoveStruct + MOVE_ACC]
ld b, a
.BrightPowder
@ -2592,7 +2592,7 @@ BattleCommand09: ; 34d32
ld a, [hBattleTurn]
and a
ld hl, PlayerMoveAccuracy
ld hl, wPlayerMoveStruct + MOVE_ACC
ld a, [PlayerAccLevel]
ld b, a
ld a, [EnemyEvaLevel]
@ -2600,7 +2600,7 @@ BattleCommand09: ; 34d32
jr z, .asm_34e60
ld hl, EnemyMoveAccuracy
ld hl, wEnemyMoveStruct + MOVE_ACC
ld a, [EnemyAccLevel]
ld b, a
ld a, [PlayerEvaLevel]
@ -2695,11 +2695,11 @@ BattleCommand90: ; 34ecc
jr nz, .failed
push hl
ld hl, PlayerMoveEffectChance
ld hl, wPlayerMoveStruct + MOVE_CHANCE
ld a, [hBattleTurn]
and a
jr z, .asm_34ee1
ld hl, EnemyMoveEffectChance
ld hl, wEnemyMoveStruct + MOVE_CHANCE
.asm_34ee1
call BattleRandom
@ -3224,7 +3224,7 @@ BattleCommand11: ; 351c0
; Faint the user if it fainted an opponent using Destiny Bond.
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hBattleTurn]
and a
jr z, .asm_351cb
@ -3438,7 +3438,7 @@ PlayerAttackDamage: ; 352e2
call ResetDamage
ld hl, PlayerMovePower
ld hl, wPlayerMoveStruct + MOVE_POWER
ld a, [hli]
and a
ld d, a
@ -3450,7 +3450,7 @@ PlayerAttackDamage: ; 352e2
; Physical
ld hl, EnemyMonDef
ld hl, EnemyMonDefense
ld a, [hli]
ld b, a
ld c, [hl]
@ -3463,7 +3463,7 @@ PlayerAttackDamage: ; 352e2
rl b
.physicalcrit
ld hl, BattleMonAtk
ld hl, BattleMonAttack
call GetDamageStatsCritical
jr c, .thickclub
@ -3586,7 +3586,7 @@ GetDamageStats: ; 3537e
ld a, [hBattleTurn]
and a
jr nz, .enemy
ld a, [PlayerMoveType]
ld a, [wPlayerMoveStruct + MOVE_TYPE]
cp SPECIAL
; special
ld a, [PlayerSAtkLevel]
@ -3600,7 +3600,7 @@ GetDamageStats: ; 3537e
jr .end
.enemy
ld a, [EnemyMoveType]
ld a, [wEnemyMoveStruct + MOVE_TYPE]
cp SPECIAL
; special
ld a, [EnemySAtkLevel]
@ -3699,8 +3699,8 @@ EnemyAttackDamage: ; 353f6
call ResetDamage
; No damage dealt with 0 power.
ld hl, EnemyMovePower
ld a, [hli] ; hl = EnemyMoveType
ld hl, wEnemyMoveStruct + MOVE_POWER
ld a, [hli] ; hl = wEnemyMoveStruct + MOVE_TYPE
ld d, a
and a
ret z
@ -3711,7 +3711,7 @@ EnemyAttackDamage: ; 353f6
; Physical
ld hl, BattleMonDef
ld hl, BattleMonDefense
ld a, [hli]
ld b, a
ld c, [hl]
@ -3724,7 +3724,7 @@ EnemyAttackDamage: ; 353f6
rl b
.physicalcrit
ld hl, EnemyMonAtk
ld hl, EnemyMonAttack
call GetDamageStatsCritical
jr c, .thickclub
@ -3804,7 +3804,7 @@ BattleCommanda1: ; 35461
ld [DefaultFlypoint], a
.asm_3548d
ld a, [DefaultFlypoint]
ld hl, PartyMon1Nickname
ld hl, PartyMonNicknames
call GetNick
ld a, $22
call Function355bd
@ -3847,7 +3847,7 @@ BattleCommanda1: ; 35461
ld a, [hl]
ld e, a
pop bc
ld a, [PlayerMovePower]
ld a, [wPlayerMoveStruct + MOVE_POWER]
ld d, a
ret
@ -3893,7 +3893,7 @@ BattleCommanda1: ; 35461
.asm_35532
ld a, [DefaultFlypoint]
ld hl, OTPartyMon1Nickname
ld hl, OTPartyMonNicknames
ld bc, $000b
call AddNTimes
ld de, StringBuffer1
@ -3952,7 +3952,7 @@ BattleCommanda1: ; 35461
ld a, [hl]
ld e, a
pop bc
ld a, [EnemyMovePower]
ld a, [wEnemyMoveStruct + MOVE_POWER]
ld d, a
ret
; 355b0
@ -4004,12 +4004,12 @@ Function355dd: ; 355dd
call ResetDamage
ld a, [hBattleTurn]
and a
ld hl, BattleMonDef
ld hl, BattleMonDefense
ld de, PlayerScreens
ld a, [BattleMonLevel]
jr z, .asm_355f7
ld hl, EnemyMonDef
ld hl, EnemyMonDefense
ld de, EnemyScreens
ld a, [EnemyMonLevel]
.asm_355f7
@ -4345,7 +4345,7 @@ BattleCommand3f: ; 35726
ld a, $0
jr .asm_3578c ; 35769 $21
.asm_3576b
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hBattleTurn]
and a
jr z, .asm_35776 ; 35771 $3
@ -4376,7 +4376,7 @@ BattleCommand3f: ; 35726
ld a, [hBattleTurn]
and a
jr z, .asm_3579d ; 35798 $3
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
.asm_3579d
xor a
ld [$ffb3], a
@ -4433,14 +4433,14 @@ BattleCommand3f: ; 35726
ld a, [hl]
jr nz, .asm_357f8
ld hl, PlayerMovePower
ld hl, wPlayerMoveStruct + MOVE_POWER
ld [hl], a
push hl
call PlayerAttackDamage
jr .asm_35800
.asm_357f8
ld hl, EnemyMovePower
ld hl, wEnemyMoveStruct + MOVE_POWER
ld [hl], a
push hl
call EnemyAttackDamage
@ -4600,7 +4600,7 @@ BattleCommand41: ; 35864
ld a, b
ld [CurPlayerMove], a
dec a
ld de, PlayerMoveStruct
ld de, wPlayerMoveStruct
call GetMoveData
jr .asm_3591a
.asm_358ef
@ -4629,7 +4629,7 @@ BattleCommand41: ; 35864
ld a, b
ld [CurEnemyMove], a
dec a
ld de, EnemyMoveStruct
ld de, wEnemyMoveStruct
call GetMoveData
.asm_3591a
call AnimateCurrentMove
@ -4654,14 +4654,14 @@ BattleCommand42: ; 35926
jp nz, Function359cd
call AnimateCurrentMove
ld hl, $c63f
ld de, EnemyMonMaxHPLo
ld de, EnemyMonMaxHP + 1
call .asm_3597d
ld a, $1
ld [$d10a], a
hlcoord 10, 9
ld a, $b
call Predef
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hli]
ld [$d1ed], a
ld a, [hli]
@ -5230,7 +5230,7 @@ BattleCommand4a: ; 35c0f
BattleCommand4b: ; 35c94
; falseswipe
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld a, [hBattleTurn]
and a
jr z, .asm_35c9f ; 35c9a $3
@ -5362,7 +5362,7 @@ Function35d1c: ; 35d1c
ld a, [EnemyMonHP]
ld [$d1ec + 1], a
sbc b
ld [EnemyMonHPHi], a
ld [EnemyMonHP], a
jr nc, .asm_35d59
ld a, [$d1ed]
@ -5837,8 +5837,8 @@ Function36011: ; 36011
ld a, [hBattleTurn]
and a
jr z, .asm_36037 ; 0x3602f $6
ld hl, EnemyMonHPHi
ld de, EnemyMonMaxHPHi
ld hl, EnemyMonHP
ld de, EnemyMonMaxHP
.asm_36037
ld bc, $d1ed
ld a, [hli]
@ -6396,12 +6396,12 @@ BattleCommand1d: ; 362e3
jr nc, .Hit
push hl
ld hl, EnemyMonAtk + 1
ld hl, EnemyMonAttack + 1
ld de, EnemyStats
ld a, [hBattleTurn]
and a
jr z, .asm_36366
ld hl, BattleMonAtk + 1
ld hl, BattleMonAttack + 1
ld de, PlayerStats
.asm_36366
call Function3641a
@ -6840,7 +6840,7 @@ BattleCommanda7: ; 365c3
Function365d7: ; 365d7
ld hl, PlayerAtkLevel
ld de, PlayerStats
ld bc, BattleMonAtk
ld bc, BattleMonAttack
ld a, $5
call Function3661d
@ -6863,7 +6863,7 @@ Function365d7: ; 365d7
Function365fd: ; 365fd
ld hl, EnemyAtkLevel
ld de, EnemyStats
ld bc, EnemyMonAtk
ld bc, EnemyMonAttack
ld a, $5
call Function3661d
@ -7040,8 +7040,8 @@ BattleCommand22: ; 366e5
ld [de], a
inc de
ld [de], a
ld [PlayerMoveEffect], a
ld [EnemyMoveEffect], a
ld [wPlayerMoveStruct + MOVE_EFFECT], a
ld [wEnemyMoveStruct + MOVE_EFFECT], a
call BattleRandom
and $1
inc a
@ -7257,7 +7257,7 @@ BattleCommand23: ; 3680f
inc a
ld [$d232], a
call Function36804
ld a, [PlayerMoveAnimation]
ld a, [wPlayerMoveStruct + MOVE_ANIM]
jp .asm_36975
.asm_36869
call Function349f4
@ -7348,7 +7348,7 @@ BattleCommand23: ; 3680f
inc a
ld [$d232], a
call Function36804
ld a, [EnemyMoveAnimation]
ld a, [wEnemyMoveStruct + MOVE_ANIM]
jr .asm_36975
.asm_36908
@ -7687,7 +7687,7 @@ BattleCommand26: ; 36af3
jr z, .asm_36b2f ; 36afb $32
ld hl, EnemyMonLevel
ld de, BattleMonLevel
ld bc, PlayerMoveAccuracy
ld bc, wPlayerMoveStruct + MOVE_ACC
ld a, [hBattleTurn]
and a
jr z, .asm_36b12 ; 36b09 $7
@ -7695,7 +7695,7 @@ BattleCommand26: ; 36af3
ld h, d
ld l, e
pop de
ld bc, EnemyMoveAccuracy
ld bc, wEnemyMoveStruct + MOVE_ACC
.asm_36b12
ld a, [de]
sub [hl]
@ -7990,7 +7990,7 @@ BattleCommand27: ; 36cb2
ld a, [hBattleTurn]
and a
jr z, .asm_36cbd ; 36cb8 $3
ld hl, EnemyMonMaxHPHi
ld hl, EnemyMonMaxHP
.asm_36cbd
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
@ -9951,20 +9951,25 @@ CheckAnyOtherAliveMons: ; 37b01
BattleCommand68: ; 37b1d
ld hl, $c711
; pursuit
; Double damage if the opponent is switching.
ld hl, wEnemyIsSwitching
ld a, [hBattleTurn]
and a
jr z, .asm_37b28 ; 37b23 $3
ld hl, $c710
.asm_37b28
jr z, .ok
ld hl, wPlayerIsSwitching
.ok
ld a, [hl]
and a
ret z
ld hl, CurDamage + 1
sla [hl]
dec hl
rl [hl]
ret nc
ld a, $ff
ld [hli], a
ld [hl], a

View File

@ -1,3 +1,4 @@
PARTY_LENGTH EQU 6
; strings
PLAYER_NAME_LENGTH EQU 8
@ -16,7 +17,8 @@ TRAINER_NAME EQU 7
; boxes
NUM_BOXES EQU 14
MONS_PER_BOX EQU 20
NUM_BOXES EQU 14
; predefs

View File

@ -35,7 +35,7 @@ GiveOddEgg: ; 1fb4b6
ld hl, OddEggs
ld a, OddEgg2 - OddEgg1
call AddNTimes
ld de, EnemyMoveAnimation
ld de, $c608
ld bc, $0046
call CopyBytes
ld a, EGG_TICKET

View File

@ -9,13 +9,13 @@
dwb $d957, %00001000 ; expn card
dwb $d957, %10000000 ; on/off
; DaycareMan, %10000000 ; daycare 1 on
dwb DaycareMan, %01000000 ; monster 1 and 2 are compatible
; DaycareMan, %00100000 ; egg is ready
dwb DaycareMan, %00000001 ; monster 1 in daycare
; wDaycareMan, %10000000 ; daycare 1 on
dwb wDaycareMan, %01000000 ; monster 1 and 2 are compatible
; wDaycareMan, %00100000 ; egg is ready
dwb wDaycareMan, %00000001 ; monster 1 in daycare
; DaycareLady, %10000000 = daycare 2 on
dwb DaycareLady, %00000001 ; monster 2 in daycare
; wDaycareLady, %10000000 = daycare 2 on
dwb wDaycareLady, %00000001 ; monster 2 in daycare
dwb $d854, %00000001 ; mom saving money ; $8
dwb $d854, %10000000 ; dst

View File

@ -2659,7 +2659,7 @@ Script_giveegg: ; 0x97968
ld [CurPartySpecies], a
call GetScriptByte
ld [CurPartyLevel], a
callba Functiondf8c
callba GiveEgg
ret nc
ld a, $2
ld [ScriptVar], a

View File

@ -34,7 +34,7 @@ NameRater: ; fb6ed
call Functionfb7d3
ld hl, UnknownText_0xfb837
jr c, .asm_fb76c
ld hl, PartyMon1Nickname
ld hl, PartyMonNicknames
ld bc, $000b
ld a, [CurPartyMon]
call AddNTimes
@ -70,12 +70,12 @@ NameRater: ; fb6ed
; fb78a
Functionfb78a: ; fb78a
ld hl, PartyMon1OT
ld bc, $000b
ld hl, PartyMonOT
ld bc, NAME_LENGTH
ld a, [CurPartyMon]
call AddNTimes
ld de, PlayerName
ld c, $b
ld c, NAME_LENGTH
call .asm_fb7b1
jr c, .asm_fb7bc
ld hl, PartyMon1ID
@ -122,7 +122,7 @@ Functionfb7be: ; fb7be
; fb7d3
Functionfb7d3: ; fb7d3
ld hl, PartyMon1Nickname
ld hl, PartyMonNicknames
ld bc, $000b
ld a, [CurPartyMon]
call AddNTimes

View File

@ -139,7 +139,7 @@ ReadCaughtData: ; 4f134
GetCaughtName: ; 4f176
ld a, [CurPartyMon]
ld hl, PartyMon1Nickname
ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH
call AddNTimes
ld de, $d003
@ -258,8 +258,8 @@ GetCaughtLocation: ; 4f20a
GetCaughtOT: ; 4f242
ld a, [CurPartyMon]
ld hl, PartyMon1OT
ld bc, $000b
ld hl, PartyMonOT
ld bc, NAME_LENGTH
call AddNTimes
ld de, $d02a
ld bc, $000b

View File

@ -250,10 +250,10 @@ _GetBattleVar:: ; 39e7
dw PlayerSubStatus4, EnemySubStatus4
dw PlayerSubStatus5, EnemySubStatus5
dw BattleMonStatus, EnemyMonStatus
dw PlayerMoveAnimation, EnemyMoveAnimation
dw PlayerMoveEffect, EnemyMoveEffect
dw PlayerMovePower, EnemyMovePower
dw PlayerMoveType, EnemyMoveType
dw wPlayerMoveStruct + MOVE_ANIM, wEnemyMoveStruct + MOVE_ANIM
dw wPlayerMoveStruct + MOVE_EFFECT, wEnemyMoveStruct + MOVE_EFFECT
dw wPlayerMoveStruct + MOVE_POWER, wEnemyMoveStruct + MOVE_POWER
dw wPlayerMoveStruct + MOVE_TYPE, wEnemyMoveStruct + MOVE_TYPE
dw CurPlayerMove, CurEnemyMove
dw LastEnemyCounterMove, LastPlayerCounterMove
dw LastPlayerMove, LastEnemyMove

View File

@ -120,7 +120,7 @@ Function2198:: ; 2198
ld e, a
ld a, [$d195]
ld d, a
ld hl, EnemyMoveAnimation
ld hl, $c608
ld b, $5
.asm_21a5

View File

@ -274,7 +274,7 @@ ParkBall: ; e8a2
ld a, b
ld [$ffb6], a
ld hl, EnemyMonHPHi
ld hl, EnemyMonHP
ld b, [hl]
inc hl
ld c, [hl]
@ -449,9 +449,9 @@ ParkBall: ; e8a2
.asm_ea1a
set 3, [hl]
ld hl, $c6f2
ld a, [EnemyMonAtkDefDV]
ld a, [EnemyMonDVs]
ld [hli], a
ld a, [EnemyMonSpdSpclDV]
ld a, [EnemyMonDVs + 1]
ld [hl], a
.asm_ea27
@ -579,7 +579,7 @@ ParkBall: ; e8a2
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
ld hl, PartyMon1Nickname
ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH
call AddNTimes
@ -1316,11 +1316,11 @@ Functioneed9: ; eed9
; eeeb
Table_eeeb: ; eeeb
db HP_UP, PartyMon1HPExp - PartyMon1StatExp
db PROTEIN, PartyMon1AtkExp - PartyMon1StatExp
db IRON, PartyMon1DefExp - PartyMon1StatExp
db CARBOS, PartyMon1SpdExp - PartyMon1StatExp
db CALCIUM, PartyMon1SpclExp - PartyMon1StatExp
db HP_UP, PartyMon1HPExp - PartyMon1StatExp
db PROTEIN, PartyMon1AtkExp - PartyMon1StatExp
db IRON, PartyMon1DefExp - PartyMon1StatExp
db CARBOS, PartyMon1SpdExp - PartyMon1StatExp
db CALCIUM, PartyMon1SpcExp - PartyMon1StatExp
; eef5
@ -1334,7 +1334,7 @@ Functioneef5: ; eef5
ld [CurPartyLevel], a
call GetBaseData
ld a, [CurPartyMon]
ld hl, PartyMon1Nickname
ld hl, PartyMonNicknames
call GetNick
ret
; 0xef14

1232
main.asm

File diff suppressed because it is too large Load Diff

708
wram.asm
View File

@ -1,51 +1,72 @@
INCLUDE "includes.asm"
flag_array: MACRO
ds ((\1) + 7) / 8
ENDM
party_struct: MACRO
\1Species:: db
\1Item:: db
\1Moves:: ds NUM_MOVES
\1ID:: dw
\1Exp:: ds 3 ; Big endian
box_struct_length EQU 32
box_struct: MACRO
\1Species:: db
\1Item:: db
\1Moves:: ds NUM_MOVES
\1ID:: dw
\1Exp:: ds 3
\1StatExp::
\1HPExp:: dw
\1AtkExp:: dw
\1DefExp:: dw
\1SpdExp:: dw
\1SpclExp:: dw
\1DVs::
\1AtkDefDV:: db
\1SpdSpcDV:: db
\1PP:: ds NUM_MOVES
\1Happiness:: db
\1PokerusStatus:: db
\1HPExp:: dw
\1AtkExp:: dw
\1DefExp:: dw
\1SpdExp:: dw
\1SpcExp:: dw
\1DVs:: ds 2
\1PP:: ds NUM_MOVES
\1Happiness:: db
\1PokerusStatus:: db
\1CaughtData::
\1CaughtTime::
\1CaughtLevel:: db
\1CaughtGender::
\1CaughtLocation:: db
\1Level:: db
\1End::
ENDM
\1Level:: db
\1Status:: db
\1Unused:: db
; Stats are big endian.
\1HP:: dw
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1SpclAtk:: dw
\1SpclDef:: dw
party_struct: MACRO
box_struct \1
\1Status:: db
\1Unused:: db
\1HP:: dw
\1MaxHP:: dw
\1Stats:: ; big endian
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1SpclAtk:: dw
\1SpclDef:: dw
\1StatsEnd::
ENDM
battle_struct: MACRO
\1Species:: db
\1Item:: db
\1Moves:: ds NUM_MOVES
\1MovesEnd::
\1DVs:: ds 2
\1PP:: ds NUM_MOVES
\1Happiness:: db
\1Level:: db
\1Status:: ds 2
\1HP:: dw
\1MaxHP:: dw
\1Stats:: ; big endian
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1SpclAtk:: dw
\1SpclDef:: dw
\1StatsEnd::
\1Type::
\1Type1:: db
\1Type2:: db
ENDM
@ -422,100 +443,24 @@ Sprites:: ; c400
; bit 4: pal # (non-cgb)
; bit 3: vram bank (cgb only)
; bit 2-0: pal # (cgb only)
ds 160
ds 4 * 40
SpritesEnd::
TileMap:: ; c4a0
; 20x18 grid of 8x8 tiles
ds 360
ds SCREEN_WIDTH * SCREEN_HEIGHT
TileMapEnd::
SECTION "BattleMons",WRAM0[$c608]
EnemyMoveStruct::
EnemyMoveAnimation:: ; c608
ds 1
EnemyMoveEffect:: ; c609
ds 1
EnemyMovePower:: ; c60a
ds 1
EnemyMoveType:: ; c60b
ds 1
EnemyMoveAccuracy:: ; c60c
ds 1
EnemyMovePP:: ; c60d
ds 1
EnemyMoveEffectChance:: ; c60e
ds 1
wBattle::
PlayerMoveStruct::
PlayerMoveAnimation:: ; c60f
ds 1
PlayerMoveEffect:: ; c610
ds 1
PlayerMovePower:: ; c611
ds 1
PlayerMoveType:: ; c612
ds 1
PlayerMoveAccuracy:: ; c613
ds 1
PlayerMovePP:: ; c614
ds 1
PlayerMoveEffectChance:: ; c615
ds 1
wEnemyMoveStruct:: ds MOVE_LENGTH ; c608
wPlayerMoveStruct:: ds MOVE_LENGTH ; c60f
EnemyMonNick:: ; c616
ds 11
BattleMonNick:: ; c621
ds 11
BattleMonSpecies:: ; c62c
ds 1
BattleMonItem:: ; c62d
ds 1
BattleMonMoves:: ; c62e
ds NUM_MOVES
BattleMonDVs::
BattleMonAtkDefDV:: ; c632
ds 1
BattleMonSpdSpclDV:: ; c633
ds 1
BattleMonPP:: ; c634
ds NUM_MOVES
BattleMonHappiness:: ; c638
ds 1
BattleMonLevel:: ; c639
ds 1
BattleMonStatus:: ; c63a
ds 2
BattleMonHP:: ; c63c
ds 2
BattleMonMaxHP:: ; c63e
ds 2
BattleMonAtk:: ; c640
ds 2
BattleMonDef:: ; c642
ds 2
BattleMonSpd:: ; c644
ds 2
BattleMonSpclAtk:: ; c646
ds 2
BattleMonSpclDef:: ; c648
ds 2
BattleMonType1:: ; c64a
ds 1
BattleMonType2:: ; c64b
ds 1
EnemyMonNick:: ds 11 ; c616
BattleMonNick:: ds 11 ; c621
BattleMon:: battle_struct BattleMon ; c62c
ds 10
OTName:: ; c656
@ -812,7 +757,10 @@ EffectFailed:: ; c70d
FailedMessage:: ; c70e
ds 1
ds 3
ds 1
wPlayerIsSwitching:: ds 1 ; c710
wEnemyIsSwitching:: ds 1 ; c711
PlayerUsedMoves:: ; c712
; add a move that has been used once by the player
@ -826,11 +774,14 @@ LastPlayerMove:: ; c71b
LastEnemyMove:: ; c71c
ds 1
ds 23
SECTION "battle",WRAM0[$c734]
BattleEnded:: ; c734
ds 1
ds 12
wBattleEnd::
; c741
SECTION "overworldmap",WRAM0[$c800]
OverworldMap:: ; c800
@ -868,7 +819,7 @@ AttrMap:: ; cdd9
; read horizontally from the top row
; bit 3: vram bank
; bit 0-2: palette id
ds 360
ds SCREEN_WIDTH * SCREEN_HEIGHT
ds 30
@ -1071,7 +1022,6 @@ CurPartyMon:: ; d109
TempMon::
party_struct TempMon
TempMonEnd:: ; d13e
ds 3
@ -1214,7 +1164,7 @@ TilesetPalettes:: ; d1e6
ds 2
EvolvableFlags:: ; d1e8
ds 1
flag_array PARTY_LENGTH
ds 1
@ -1229,76 +1179,13 @@ SECTION "BattleMons2",WRAMX[$d1fa],BANK[1]
LinkBattleRNs:: ; d1fa
ds 10
TempEnemyMonSpecies:: ; d204
ds 1
TempBattleMonSpecies:: ; d205
ds 1
EnemyMon::
EnemyMonSpecies:: ; d206
ds 1
EnemyMonItem:: ; d207
ds 1
EnemyMonMoves:: ; d208
ds NUM_MOVES
EnemyMonMovesEnd::
EnemyMonDVs::
EnemyMonAtkDefDV:: ; d20c
ds 1
EnemyMonSpdSpclDV:: ; d20d
ds 1
EnemyMonPP:: ; d20e
ds NUM_MOVES
EnemyMonHappiness:: ; d212
ds 1
EnemyMonLevel:: ; d213
ds 1
EnemyMonStatus:: ; d214
ds 2
EnemyMonHP::
EnemyMonHPHi:: ; d216
ds 1
EnemyMonHPLo:: ; d217
ds 1
EnemyMonMaxHP::
EnemyMonMaxHPHi:: ; d218
ds 1
EnemyMonMaxHPLo:: ; d219
ds 1
EnemyMonStats::
EnemyMonAtk:: ; d21a
ds 2
EnemyMonDef:: ; d21c
ds 2
EnemyMonSpd:: ; d21e
ds 2
EnemyMonSpclAtk:: ; d220
ds 2
EnemyMonSpclDef:: ; d222
ds 2
EnemyMonStatsEnd::
EnemyMonType1:: ; d224
ds 1
EnemyMonType2:: ; d225
ds 1
EnemyMonBaseStats:: ; d226
ds 5
EnemyMonCatchRate:: ; d22b
ds 1
EnemyMonBaseExp:: ; d22c
ds 1
TempEnemyMonSpecies:: ds 1 ; d204
TempBattleMonSpecies:: ds 1 ; d205
EnemyMon:: battle_struct EnemyMon ; d206
EnemyMonBaseStats:: ds 5 ; d226
EnemyMonCatchRate:: db ; d22b
EnemyMonBaseExp:: db ; d22c
EnemyMonEnd::
@ -1402,57 +1289,23 @@ SECTION "TimeOfDay",WRAMX[$d269],BANK[1]
TimeOfDay:: ; d269
ds 1
SECTION "OTParty",WRAMX[$d280],BANK[1]
OTPartyCount:: ; d280
ds 1 ; number of Pokémon in party
OTPartySpecies:: ; d281
ds 6 ; species of each Pokémon in party
; d287
ds 1 ; any empty slots including the 7th must be FF
; or the routine will keep going
OTPartyCount:: ds 1 ; d280
OTPartySpecies:: ds 6 ; d281
OTPartyEnd:: ds 1
OTPartyMon1:: ; d288
party_struct OTPartyMon1
OTPartyMon2:: ; d2b8
party_struct OTPartyMon2
OTPartyMon3:: ; d2e8
party_struct OTPartyMon3
OTPartyMon4:: ; d318
party_struct OTPartyMon4
OTPartyMon5:: ; d348
party_struct OTPartyMon5
OTPartyMon6:: ; d378
party_struct OTPartyMon6
OTPartyMon1:: party_struct OTPartyMon1 ; d288
OTPartyMon2:: party_struct OTPartyMon2 ; d2b8
OTPartyMon3:: party_struct OTPartyMon3 ; d2e8
OTPartyMon4:: party_struct OTPartyMon4 ; d318
OTPartyMon5:: party_struct OTPartyMon5 ; d348
OTPartyMon6:: party_struct OTPartyMon6 ; d378
OTPartyMonOT:: ds 11 * 6 ; d3a8
OTPartyMonNicknames:: ds 11 * 6 ; d3ea
OTPartyMonOT::
OTPartyMon1OT:: ; d3a8
ds 11
OTPartyMon2OT:: ; d3b3
ds 11
OTPartyMon3OT:: ; d3be
ds 11
OTPartyMon4OT:: ; d3c9
ds 11
OTPartyMon5OT:: ; d3d4
ds 11
OTPartyMon6OT:: ; d3df
ds 11
OTPartyMonNicknames::
OTPartyMon1Nickname:: ; d3ea
ds 11
OTPartyMon2Nickname:: ; d3f5
ds 11
OTPartyMon3Nickname:: ; d400
ds 11
OTPartyMon4Nickname:: ; d40b
ds 11
OTPartyMon5Nickname:: ; d416
ds 11
OTPartyMon6Nickname:: ; d421
ds 11
SECTION "Map Events", WRAMX[$d432], BANK[1]
MapStatus:: ; d432
@ -1789,7 +1642,7 @@ EventFlags:: ; da72
;PoliceAtElmsLabEvent:: ; db52
;SalesmanMahoganyTownEvent:: ; db5c
;RedGyaradosEvent:: ; db5c
ds 250
flag_array 2000
; db6c
SECTION "Boxes",WRAMX[$db72],BANK[1]
@ -1800,35 +1653,7 @@ wCurBox:: ; db72
ds 2
; 8 chars + $50
wBoxNames::
Box1Name:: ; db75
ds 9
Box2Name:: ; db7e
ds 9
Box3Name:: ; db87
ds 9
Box4Name:: ; db90
ds 9
Box5Name:: ; db99
ds 9
Box6Name:: ; dba2
ds 9
Box7Name:: ; dbab
ds 9
Box8Name:: ; dbb4
ds 9
Box9Name:: ; dbbd
ds 9
Box10Name:: ; dbc6
ds 9
Box11Name:: ; dbcf
ds 9
Box12Name:: ; dbd8
ds 9
Box13Name:: ; dbe1
ds 9
Box14Name:: ; dbea
ds 9
wBoxNames:: ds 9 * NUM_BOXES ; db75
SECTION "bike", WRAMX[$dbf5],BANK[1]
BikeFlags:: ; dbf5
@ -1867,7 +1692,7 @@ PoisonStepCount:: ; dc74
SECTION "Visited Spawn Points", WRAMX[$dca5],BANK[1]
VisitedSpawns:: ; dca5
ds 4
flag_array 27
SECTION "BackupMapInfo", WRAMX[$dcad],BANK[1]
@ -1901,155 +1726,87 @@ PartyEnd:: ; dcde
ds 1 ; legacy functions don't check PartyCount
PartyMons::
PartyMon1:: ; dcdf
party_struct PartyMon1
PartyMon2:: ; dd0f
party_struct PartyMon2
PartyMon3:: ; dd3f
party_struct PartyMon3
PartyMon4:: ; dd6f
party_struct PartyMon4
PartyMon5:: ; dd9f
party_struct PartyMon5
PartyMon6:: ; ddcf
party_struct PartyMon6
PartyMon1:: party_struct PartyMon1 ; dcdf
PartyMon2:: party_struct PartyMon2 ; dd0f
PartyMon3:: party_struct PartyMon3 ; dd3f
PartyMon4:: party_struct PartyMon4 ; dd6f
PartyMon5:: party_struct PartyMon5 ; dd9f
PartyMon6:: party_struct PartyMon6 ; ddcf
PartyMonOT::
PartyMon1OT:: ; ddff
ds 11
PartyMon2OT:: ; de0a
ds 11
PartyMon3OT:: ; de15
ds 11
PartyMon4OT:: ; de20
ds 11
PartyMon5OT:: ; de2b
ds 11
PartyMon6OT:: ; de36
ds 11
PartyMonOT:: ds 11 * 6 ; ddff
PartyMonNicknames::
PartyMon1Nickname:: ; de41
ds 11
PartyMon2Nickname:: ; de4c
ds 11
PartyMon3Nickname:: ; de57
ds 11
PartyMon4Nickname:: ; de62
ds 11
PartyMon5Nickname:: ; de6d
ds 11
PartyMon6Nickname:: ; de78
ds 11
PartyMonNicknames:: ds 11 * 6 ; de41
PartyMonNicknamesEnd::
SECTION "Pokedex",WRAMX[$de99],BANK[1]
SECTION "Pokedex", WRAMX[$de99], BANK[1]
PokedexCaught:: ; de99
ds 32
flag_array 251
EndPokedexCaught::
PokedexSeen:: ; deb9
ds 32
flag_array 251
EndPokedexSeen::
UnownDex:: ; ded9
ds 26
UnlockedUnowns:: ; def3
ds 1
SECTION "Breeding",WRAMX[$def5],BANK[1]
DaycareMan:: ; def5
ds 1
wDaycareMan:: ; def5
; bit 7: active
; bit 6: monsters are compatible
; bit 5: egg ready
; bit 0: monster 1 in daycare
ds 1
BreedMon1::
BreedMon1Nick:: ; def6
ds 11
BreedMon1OT:: ; df01
ds 11
BreedMon1Stats::
BreedMon1Species:: ; df0c
ds 1
ds 31
wBreedMon1::
wBreedMon1Nick:: ds PKMN_NAME_LENGTH ; def6
wBreedMon1OT:: ds NAME_LENGTH ; df01
wBreedMon1Stats:: box_struct wBreedMon1 ; df0c
DaycareLady:: ; df2c
wDaycareLady:: ; df2c
; bit 7: active
; bit 0: monster 2 in daycare
ds 1
StepsToEgg:: ; df2d
wStepsToEgg:: ; df2d
ds 1
DittoInDaycare:: ; df2e
wDittoInDaycare:: ; df2e
; z: yes
; nz: no
ds 1
BreedMon2::
BreedMon2Nick:: ; df2f
ds 11
BreedMon2OT:: ; df3a
ds 11
BreedMon2Stats::
BreedMon2Species:: ; df45
ds 1
ds 31
wBreedMon2::
wBreedMon2Nick:: ds PKMN_NAME_LENGTH ; df2f
wBreedMon2OT:: ds NAME_LENGTH ; df3a
wBreedMon2Stats:: box_struct wBreedMon2 ; df45
EggNick:: ; df65
; EGG@
ds 11
EggOT:: ; df70
ds 11
EggMon::
EggSpecies:: ; df7b
ds 1
ds 31
wEggNick:: ds PKMN_NAME_LENGTH ; df65
wEggOT:: ds NAME_LENGTH ; df70
wEggMon:: box_struct wEggMon ; df7b
ds 1
wContestMon:: ; df9c
party_struct wContestMon
wContestMon:: party_struct wContestMon ; df9c
ds 3
RoamMon1Species:: ; dfcf
ds 1
RoamMon1Level:: ; dfd0
ds 1
RoamMon1MapGroup:: ; dfd1
ds 1
RoamMon1MapNumber:: ; dfd2
ds 1
RoamMon1HP:: ; dfd3
ds 1
RoamMon1DVs:: ; dfd4
ds 2
roam_struct: MACRO
\1Species:: db
\1Level:: db
\1MapGroup:: db
\1MapNumber:: db
\1HP:: ds 1
\1DVs:: ds 2
ENDM
RoamMon2Species:: ; dfd6
ds 1
RoamMon2Level:: ; dfd7
ds 1
RoamMon2MapGroup:: ; dfd8
ds 1
RoamMon2MapNumber:: ; dfd9
ds 1
RoamMon2HP:: ; dfda
ds 1
RoamMon2DVs:: ; dfdb
ds 2
RoamMon3Species:: ; dfdd
ds 1
RoamMon3Level:: ; dfde
ds 1
RoamMon3MapGroup:: ; dfdf
ds 1
RoamMon3MapNumber:: ; dfe0
ds 1
RoamMon3HP:: ; dfe1
ds 1
RoamMon3DVs:: ; dfe2
ds 2
wRoamMon1:: roam_struct wRoamMon1 ; dfcf
wRoamMon2:: roam_struct wRoamMon2 ; dfd6
wRoamMon3:: roam_struct wRoamMon3 ; dfdd
@ -2107,175 +1864,24 @@ BattleAnimTemps:: ; d419
ds 8
SECTION "SRAMBank1",SRAM,BANK[1]
SECTION "Scratch", SRAM, BANK[0]
SECTION "BoxMons",SRAM[$ad10],BANK[1]
BoxCount:: ; ad10
ds 1
BoxSpecies:: ; ad11
ds 20
ds 1
BoxMons::
BoxMon1::
BoxMon1Species:: ; ad26
ds 1
BoxMon1Item:: ; ad27
ds 1
BoxMon1Moves:: ; ad28
ds 4
BoxMon1ID:: ; ad2c
ds 2
BoxMon1Exp:: ; ad2e
ds 3
BoxMon1HPExp:: ; ad31
ds 2
BoxMon1AtkExp:: ; ad33
ds 2
BoxMon1DefExp:: ; ad35
ds 2
BoxMon1SpdExp:: ; ad37
ds 2
BoxMon1SpcExp:: ; ad39
ds 2
BoxMon1DVs:: ; ad3b
ds 2
BoxMon1PP:: ; ad3d
ds 4
BoxMon1Happiness:: ; ad41
ds 1
BoxMon1PokerusStatus:: ; ad42
ds 1
BoxMon1CaughtData::
BoxMon1CaughtTime::
BoxMon1CaughtLevel:: ; ad43
ds 1
BoxMon1CaughtGender::
BoxMon1CaughtLocation:: ; ad44
ds 1
BoxMon1Level:: ; ad45
SECTION "SRAM Bank 1", SRAM, BANK[1]
SECTION "BoxMons", SRAM[$ad10], BANK[1]
sBoxCount:: ds 1 ; ad10
sBoxSpecies:: ds MONS_PER_BOX ; ad11
ds 1
BoxMon2:: ; ad46
ds 32
BoxMon3:: ; ad66
ds 32
BoxMon4:: ; ad86
ds 32
BoxMon5:: ; ada6
ds 32
BoxMon6:: ; adc6
ds 32
BoxMon7:: ; ade6
ds 32
BoxMon8:: ; ae06
ds 32
BoxMon9:: ; ae26
ds 32
BoxMon10:: ; ae46
ds 32
BoxMon11:: ; ae66
ds 32
BoxMon12:: ; ae86
ds 32
BoxMon13:: ; aea6
ds 32
BoxMon14:: ; aec6
ds 32
BoxMon15:: ; aee6
ds 32
BoxMon16:: ; af06
ds 32
BoxMon17:: ; af26
ds 32
BoxMon18:: ; af46
ds 32
BoxMon19:: ; af66
ds 32
BoxMon20:: ; af86
ds 32
sBoxMons:: ; ad26
sBoxMon1:: box_struct sBoxMon1
sBoxMon2::
ds box_struct_length * (MONS_PER_BOX +- 1)
BoxMonOT::
BoxMon1OT:: ; afa6
ds 11
BoxMon2OT:: ; afb1
ds 11
BoxMon3OT:: ; afbc
ds 11
BoxMon4OT:: ; afc7
ds 11
BoxMon5OT:: ; afd2
ds 11
BoxMon6OT:: ; afdd
ds 11
BoxMon7OT:: ; afe8
ds 11
BoxMon8OT:: ; aff3
ds 11
BoxMon9OT:: ; affe
ds 11
BoxMon10OT:: ; b009
ds 11
BoxMon11OT:: ; b014
ds 11
BoxMon12OT:: ; b01f
ds 11
BoxMon13OT:: ; b02a
ds 11
BoxMon14OT:: ; b035
ds 11
BoxMon15OT:: ; b040
ds 11
BoxMon16OT:: ; b04b
ds 11
BoxMon17OT:: ; b056
ds 11
BoxMon18OT:: ; b061
ds 11
BoxMon19OT:: ; b06c
ds 11
BoxMon20OT:: ; b077
ds 11
BoxMonNicknames::
BoxMon1Nickname:: ; b082
ds 11
BoxMon2Nickname:: ; b08d
ds 11
BoxMon3Nickname:: ; b098
ds 11
BoxMon4Nickname:: ; b0a3
ds 11
BoxMon5Nickname:: ; b0ae
ds 11
BoxMon6Nickname:: ; b0b9
ds 11
BoxMon7Nickname:: ; b0c4
ds 11
BoxMon8Nickname:: ; b0cf
ds 11
BoxMon9Nickname:: ; b0da
ds 11
BoxMon10Nickname:: ; b0e5
ds 11
BoxMon11Nickname:: ; b0f0
ds 11
BoxMon12Nickname:: ; b0fb
ds 11
BoxMon13Nickname:: ; b106
ds 11
BoxMon14Nickname:: ; b111
ds 11
BoxMon15Nickname:: ; b11c
ds 11
BoxMon16Nickname:: ; b127
ds 11
BoxMon17Nickname:: ; b132
ds 11
BoxMon18Nickname:: ; b13d
ds 11
BoxMon19Nickname:: ; b148
ds 11
BoxMon20Nickname:: ; b153
ds 11
BoxMonNicknamesEnd::
sBoxMonOT:: ds 11 * 20 ; afa6
sBoxMonNicknames:: ds 11 * 20 ; b082
sBoxMonNicknamesEnd::
; b15e