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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -274,7 +274,7 @@ ParkBall: ; e8a2
ld a, b ld a, b
ld [$ffb6], a ld [$ffb6], a
ld hl, EnemyMonHPHi ld hl, EnemyMonHP
ld b, [hl] ld b, [hl]
inc hl inc hl
ld c, [hl] ld c, [hl]
@ -449,9 +449,9 @@ ParkBall: ; e8a2
.asm_ea1a .asm_ea1a
set 3, [hl] set 3, [hl]
ld hl, $c6f2 ld hl, $c6f2
ld a, [EnemyMonAtkDefDV] ld a, [EnemyMonDVs]
ld [hli], a ld [hli], a
ld a, [EnemyMonSpdSpclDV] ld a, [EnemyMonDVs + 1]
ld [hl], a ld [hl], a
.asm_ea27 .asm_ea27
@ -579,7 +579,7 @@ ParkBall: ; e8a2
ld a, [PartyCount] ld a, [PartyCount]
dec a dec a
ld [CurPartyMon], a ld [CurPartyMon], a
ld hl, PartyMon1Nickname ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH ld bc, PKMN_NAME_LENGTH
call AddNTimes call AddNTimes
@ -1316,11 +1316,11 @@ Functioneed9: ; eed9
; eeeb ; eeeb
Table_eeeb: ; eeeb Table_eeeb: ; eeeb
db HP_UP, PartyMon1HPExp - PartyMon1StatExp db HP_UP, PartyMon1HPExp - PartyMon1StatExp
db PROTEIN, PartyMon1AtkExp - PartyMon1StatExp db PROTEIN, PartyMon1AtkExp - PartyMon1StatExp
db IRON, PartyMon1DefExp - PartyMon1StatExp db IRON, PartyMon1DefExp - PartyMon1StatExp
db CARBOS, PartyMon1SpdExp - PartyMon1StatExp db CARBOS, PartyMon1SpdExp - PartyMon1StatExp
db CALCIUM, PartyMon1SpclExp - PartyMon1StatExp db CALCIUM, PartyMon1SpcExp - PartyMon1StatExp
; eef5 ; eef5
@ -1334,7 +1334,7 @@ Functioneef5: ; eef5
ld [CurPartyLevel], a ld [CurPartyLevel], a
call GetBaseData call GetBaseData
ld a, [CurPartyMon] ld a, [CurPartyMon]
ld hl, PartyMon1Nickname ld hl, PartyMonNicknames
call GetNick call GetNick
ret ret
; 0xef14 ; 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" INCLUDE "includes.asm"
flag_array: MACRO
ds ((\1) + 7) / 8
ENDM
party_struct: MACRO box_struct_length EQU 32
box_struct: MACRO
\1Species:: db \1Species:: db
\1Item:: db \1Item:: db
\1Moves:: ds NUM_MOVES
\1Moves:: ds NUM_MOVES \1ID:: dw
\1Exp:: ds 3
\1ID:: dw
\1Exp:: ds 3 ; Big endian
\1StatExp:: \1StatExp::
\1HPExp:: dw \1HPExp:: dw
\1AtkExp:: dw \1AtkExp:: dw
\1DefExp:: dw \1DefExp:: dw
\1SpdExp:: dw \1SpdExp:: dw
\1SpclExp:: dw \1SpcExp:: dw
\1DVs:: ds 2
\1DVs:: \1PP:: ds NUM_MOVES
\1AtkDefDV:: db \1Happiness:: db
\1SpdSpcDV:: db \1PokerusStatus:: db
\1PP:: ds NUM_MOVES
\1Happiness:: db
\1PokerusStatus:: db
\1CaughtData:: \1CaughtData::
\1CaughtTime:: \1CaughtTime::
\1CaughtLevel:: db \1CaughtLevel:: db
\1CaughtGender:: \1CaughtGender::
\1CaughtLocation:: db \1CaughtLocation:: db
\1Level:: db
\1End::
ENDM
\1Level:: db party_struct: MACRO
box_struct \1
\1Status:: db \1Status:: db
\1Unused:: db \1Unused:: db
\1HP:: dw
; Stats are big endian. \1MaxHP:: dw
\1HP:: dw \1Stats:: ; big endian
\1MaxHP:: dw \1Attack:: dw
\1Attack:: dw \1Defense:: dw
\1Defense:: dw \1Speed:: dw
\1Speed:: dw \1SpclAtk:: dw
\1SpclAtk:: dw \1SpclDef:: 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 ENDM
@ -422,100 +443,24 @@ Sprites:: ; c400
; bit 4: pal # (non-cgb) ; bit 4: pal # (non-cgb)
; bit 3: vram bank (cgb only) ; bit 3: vram bank (cgb only)
; bit 2-0: pal # (cgb only) ; bit 2-0: pal # (cgb only)
ds 160 ds 4 * 40
SpritesEnd:: SpritesEnd::
TileMap:: ; c4a0 TileMap:: ; c4a0
; 20x18 grid of 8x8 tiles ; 20x18 grid of 8x8 tiles
ds 360 ds SCREEN_WIDTH * SCREEN_HEIGHT
TileMapEnd:: TileMapEnd::
SECTION "BattleMons",WRAM0[$c608]
EnemyMoveStruct:: wBattle::
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
PlayerMoveStruct:: wEnemyMoveStruct:: ds MOVE_LENGTH ; c608
PlayerMoveAnimation:: ; c60f wPlayerMoveStruct:: ds MOVE_LENGTH ; 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
EnemyMonNick:: ; c616 EnemyMonNick:: ds 11 ; c616
ds 11 BattleMonNick:: ds 11 ; c621
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
BattleMon:: battle_struct BattleMon ; c62c
ds 10 ds 10
OTName:: ; c656 OTName:: ; c656
@ -812,7 +757,10 @@ EffectFailed:: ; c70d
FailedMessage:: ; c70e FailedMessage:: ; c70e
ds 1 ds 1
ds 3 ds 1
wPlayerIsSwitching:: ds 1 ; c710
wEnemyIsSwitching:: ds 1 ; c711
PlayerUsedMoves:: ; c712 PlayerUsedMoves:: ; c712
; add a move that has been used once by the player ; add a move that has been used once by the player
@ -826,11 +774,14 @@ LastPlayerMove:: ; c71b
LastEnemyMove:: ; c71c LastEnemyMove:: ; c71c
ds 1 ds 1
ds 23
SECTION "battle",WRAM0[$c734]
BattleEnded:: ; c734 BattleEnded:: ; c734
ds 1 ds 1
ds 12
wBattleEnd::
; c741
SECTION "overworldmap",WRAM0[$c800] SECTION "overworldmap",WRAM0[$c800]
OverworldMap:: ; c800 OverworldMap:: ; c800
@ -868,7 +819,7 @@ AttrMap:: ; cdd9
; read horizontally from the top row ; read horizontally from the top row
; bit 3: vram bank ; bit 3: vram bank
; bit 0-2: palette id ; bit 0-2: palette id
ds 360 ds SCREEN_WIDTH * SCREEN_HEIGHT
ds 30 ds 30
@ -1071,7 +1022,6 @@ CurPartyMon:: ; d109
TempMon:: TempMon::
party_struct TempMon party_struct TempMon
TempMonEnd:: ; d13e
ds 3 ds 3
@ -1214,7 +1164,7 @@ TilesetPalettes:: ; d1e6
ds 2 ds 2
EvolvableFlags:: ; d1e8 EvolvableFlags:: ; d1e8
ds 1 flag_array PARTY_LENGTH
ds 1 ds 1
@ -1229,76 +1179,13 @@ SECTION "BattleMons2",WRAMX[$d1fa],BANK[1]
LinkBattleRNs:: ; d1fa LinkBattleRNs:: ; d1fa
ds 10 ds 10
TempEnemyMonSpecies:: ; d204 TempEnemyMonSpecies:: ds 1 ; d204
ds 1 TempBattleMonSpecies:: ds 1 ; d205
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
EnemyMon:: battle_struct EnemyMon ; d206
EnemyMonBaseStats:: ds 5 ; d226
EnemyMonCatchRate:: db ; d22b
EnemyMonBaseExp:: db ; d22c
EnemyMonEnd:: EnemyMonEnd::
@ -1402,57 +1289,23 @@ SECTION "TimeOfDay",WRAMX[$d269],BANK[1]
TimeOfDay:: ; d269 TimeOfDay:: ; d269
ds 1 ds 1
SECTION "OTParty",WRAMX[$d280],BANK[1] SECTION "OTParty",WRAMX[$d280],BANK[1]
OTPartyCount:: ; d280 OTPartyCount:: ds 1 ; d280
ds 1 ; number of Pokémon in party OTPartySpecies:: ds 6 ; d281
OTPartySpecies:: ; d281 OTPartyEnd:: ds 1
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
OTPartyMon1:: ; d288 OTPartyMon1:: party_struct OTPartyMon1 ; d288
party_struct OTPartyMon1 OTPartyMon2:: party_struct OTPartyMon2 ; d2b8
OTPartyMon2:: ; d2b8 OTPartyMon3:: party_struct OTPartyMon3 ; d2e8
party_struct OTPartyMon2 OTPartyMon4:: party_struct OTPartyMon4 ; d318
OTPartyMon3:: ; d2e8 OTPartyMon5:: party_struct OTPartyMon5 ; d348
party_struct OTPartyMon3 OTPartyMon6:: party_struct OTPartyMon6 ; d378
OTPartyMon4:: ; d318
party_struct OTPartyMon4
OTPartyMon5:: ; d348
party_struct OTPartyMon5
OTPartyMon6:: ; d378
party_struct OTPartyMon6
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] SECTION "Map Events", WRAMX[$d432], BANK[1]
MapStatus:: ; d432 MapStatus:: ; d432
@ -1789,7 +1642,7 @@ EventFlags:: ; da72
;PoliceAtElmsLabEvent:: ; db52 ;PoliceAtElmsLabEvent:: ; db52
;SalesmanMahoganyTownEvent:: ; db5c ;SalesmanMahoganyTownEvent:: ; db5c
;RedGyaradosEvent:: ; db5c ;RedGyaradosEvent:: ; db5c
ds 250 flag_array 2000
; db6c ; db6c
SECTION "Boxes",WRAMX[$db72],BANK[1] SECTION "Boxes",WRAMX[$db72],BANK[1]
@ -1800,35 +1653,7 @@ wCurBox:: ; db72
ds 2 ds 2
; 8 chars + $50 ; 8 chars + $50
wBoxNames:: wBoxNames:: ds 9 * NUM_BOXES ; db75
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
SECTION "bike", WRAMX[$dbf5],BANK[1] SECTION "bike", WRAMX[$dbf5],BANK[1]
BikeFlags:: ; dbf5 BikeFlags:: ; dbf5
@ -1867,7 +1692,7 @@ PoisonStepCount:: ; dc74
SECTION "Visited Spawn Points", WRAMX[$dca5],BANK[1] SECTION "Visited Spawn Points", WRAMX[$dca5],BANK[1]
VisitedSpawns:: ; dca5 VisitedSpawns:: ; dca5
ds 4 flag_array 27
SECTION "BackupMapInfo", WRAMX[$dcad],BANK[1] SECTION "BackupMapInfo", WRAMX[$dcad],BANK[1]
@ -1901,155 +1726,87 @@ PartyEnd:: ; dcde
ds 1 ; legacy functions don't check PartyCount ds 1 ; legacy functions don't check PartyCount
PartyMons:: PartyMons::
PartyMon1:: ; dcdf PartyMon1:: party_struct PartyMon1 ; dcdf
party_struct PartyMon1 PartyMon2:: party_struct PartyMon2 ; dd0f
PartyMon2:: ; dd0f PartyMon3:: party_struct PartyMon3 ; dd3f
party_struct PartyMon2 PartyMon4:: party_struct PartyMon4 ; dd6f
PartyMon3:: ; dd3f PartyMon5:: party_struct PartyMon5 ; dd9f
party_struct PartyMon3 PartyMon6:: party_struct PartyMon6 ; ddcf
PartyMon4:: ; dd6f
party_struct PartyMon4
PartyMon5:: ; dd9f
party_struct PartyMon5
PartyMon6:: ; ddcf
party_struct PartyMon6
PartyMonOT:: PartyMonOT:: ds 11 * 6 ; ddff
PartyMon1OT:: ; ddff
ds 11
PartyMon2OT:: ; de0a
ds 11
PartyMon3OT:: ; de15
ds 11
PartyMon4OT:: ; de20
ds 11
PartyMon5OT:: ; de2b
ds 11
PartyMon6OT:: ; de36
ds 11
PartyMonNicknames:: PartyMonNicknames:: ds 11 * 6 ; de41
PartyMon1Nickname:: ; de41
ds 11
PartyMon2Nickname:: ; de4c
ds 11
PartyMon3Nickname:: ; de57
ds 11
PartyMon4Nickname:: ; de62
ds 11
PartyMon5Nickname:: ; de6d
ds 11
PartyMon6Nickname:: ; de78
ds 11
PartyMonNicknamesEnd:: PartyMonNicknamesEnd::
SECTION "Pokedex",WRAMX[$de99],BANK[1]
SECTION "Pokedex", WRAMX[$de99], BANK[1]
PokedexCaught:: ; de99 PokedexCaught:: ; de99
ds 32 flag_array 251
EndPokedexCaught:: EndPokedexCaught::
PokedexSeen:: ; deb9 PokedexSeen:: ; deb9
ds 32 flag_array 251
EndPokedexSeen:: EndPokedexSeen::
UnownDex:: ; ded9 UnownDex:: ; ded9
ds 26 ds 26
UnlockedUnowns:: ; def3 UnlockedUnowns:: ; def3
ds 1 ds 1
SECTION "Breeding",WRAMX[$def5],BANK[1] ds 1
DaycareMan:: ; def5
wDaycareMan:: ; def5
; bit 7: active ; bit 7: active
; bit 6: monsters are compatible ; bit 6: monsters are compatible
; bit 5: egg ready ; bit 5: egg ready
; bit 0: monster 1 in daycare ; bit 0: monster 1 in daycare
ds 1 ds 1
BreedMon1:: wBreedMon1::
BreedMon1Nick:: ; def6 wBreedMon1Nick:: ds PKMN_NAME_LENGTH ; def6
ds 11 wBreedMon1OT:: ds NAME_LENGTH ; df01
BreedMon1OT:: ; df01 wBreedMon1Stats:: box_struct wBreedMon1 ; df0c
ds 11
BreedMon1Stats::
BreedMon1Species:: ; df0c
ds 1
ds 31
DaycareLady:: ; df2c wDaycareLady:: ; df2c
; bit 7: active ; bit 7: active
; bit 0: monster 2 in daycare ; bit 0: monster 2 in daycare
ds 1 ds 1
StepsToEgg:: ; df2d wStepsToEgg:: ; df2d
ds 1 ds 1
DittoInDaycare:: ; df2e wDittoInDaycare:: ; df2e
; z: yes ; z: yes
; nz: no ; nz: no
ds 1 ds 1
BreedMon2:: wBreedMon2::
BreedMon2Nick:: ; df2f wBreedMon2Nick:: ds PKMN_NAME_LENGTH ; df2f
ds 11 wBreedMon2OT:: ds NAME_LENGTH ; df3a
BreedMon2OT:: ; df3a wBreedMon2Stats:: box_struct wBreedMon2 ; df45
ds 11
BreedMon2Stats::
BreedMon2Species:: ; df45
ds 1
ds 31
EggNick:: ; df65 wEggNick:: ds PKMN_NAME_LENGTH ; df65
; EGG@ wEggOT:: ds NAME_LENGTH ; df70
ds 11 wEggMon:: box_struct wEggMon ; df7b
EggOT:: ; df70
ds 11
EggMon::
EggSpecies:: ; df7b
ds 1
ds 31
ds 1 ds 1
wContestMon:: ; df9c wContestMon:: party_struct wContestMon ; df9c
party_struct wContestMon
ds 3 ds 3
RoamMon1Species:: ; dfcf roam_struct: MACRO
ds 1 \1Species:: db
RoamMon1Level:: ; dfd0 \1Level:: db
ds 1 \1MapGroup:: db
RoamMon1MapGroup:: ; dfd1 \1MapNumber:: db
ds 1 \1HP:: ds 1
RoamMon1MapNumber:: ; dfd2 \1DVs:: ds 2
ds 1 ENDM
RoamMon1HP:: ; dfd3
ds 1
RoamMon1DVs:: ; dfd4
ds 2
RoamMon2Species:: ; dfd6 wRoamMon1:: roam_struct wRoamMon1 ; dfcf
ds 1 wRoamMon2:: roam_struct wRoamMon2 ; dfd6
RoamMon2Level:: ; dfd7 wRoamMon3:: roam_struct wRoamMon3 ; dfdd
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
@ -2107,175 +1864,24 @@ BattleAnimTemps:: ; d419
ds 8 ds 8
SECTION "SRAMBank1",SRAM,BANK[1] SECTION "Scratch", SRAM, BANK[0]
SECTION "BoxMons",SRAM[$ad10],BANK[1]
BoxCount:: ; ad10 SECTION "SRAM Bank 1", SRAM, BANK[1]
ds 1
BoxSpecies:: ; ad11 SECTION "BoxMons", SRAM[$ad10], BANK[1]
ds 20
ds 1 sBoxCount:: ds 1 ; ad10
BoxMons:: sBoxSpecies:: ds MONS_PER_BOX ; ad11
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
ds 1 ds 1
BoxMon2:: ; ad46 sBoxMons:: ; ad26
ds 32 sBoxMon1:: box_struct sBoxMon1
BoxMon3:: ; ad66 sBoxMon2::
ds 32 ds box_struct_length * (MONS_PER_BOX +- 1)
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
BoxMonOT:: sBoxMonOT:: ds 11 * 20 ; afa6
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::
sBoxMonNicknames:: ds 11 * 20 ; b082
sBoxMonNicknamesEnd::
; b15e