From 86c1e0feea0ba487b020b801835aa19b221edb4d Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 10 Jun 2014 23:08:07 -0700 Subject: [PATCH] Consolidate NUM_MOVES usage and monster struct labels. There turned out to be a lot of instances of NUM_MOVES. --- battle/core.asm | 223 ++++++++-------- battle/effect_commands.asm | 475 +++++++++++++++++++---------------- constants/misc_constants.asm | 10 + items/item_effects.asm | 87 ++++--- main.asm | 402 ++++++++++++++--------------- wram.asm | 145 +++-------- 6 files changed, 655 insertions(+), 687 deletions(-) diff --git a/battle/core.asm b/battle/core.asm index 6cb19b7d6..b4678e8f9 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -172,7 +172,7 @@ Function3c12f: ; 3c12f ld [$c73f], a ld [$c740], a ld [CurDamage], a - ld [$d257], a + ld [CurDamage + 1], a call Function3c27c call UpdateBattleMonInParty callba AIChooseMove @@ -723,7 +723,7 @@ Function3c4df: ; 3c4df dec a ld [PlayerEncoreCount], a jr z, .asm_3c50a - ld hl, BattleMonPPMove1 + ld hl, BattleMonPP ld a, [CurMoveNum] ld c, a ld b, $0 @@ -747,7 +747,7 @@ Function3c4df: ; 3c4df dec a ld [EnemyEncoreCount], a jr z, .asm_3c535 - ld hl, EnemyMonPPMove1 + ld hl, EnemyMonPP ld a, [CurEnemyMoveNum] ld c, a ld b, $0 @@ -1390,14 +1390,14 @@ Function3c93c: ; 3c93c .asm_3c957 callab GetUserItem ld a, b - cp $6 + cp HELD_RESTORE_PP jr nz, .asm_3c9ae ld hl, PartyMon1PP ld a, [CurBattleMon] call GetPartyLocation ld d, h ld e, l - ld hl, PartyMon1Move1 + ld hl, PartyMon1Moves ld a, [CurBattleMon] call GetPartyLocation ld a, [hBattleTurn] @@ -1408,12 +1408,12 @@ Function3c93c: ; 3c93c ld a, [IsInBattle] dec a jr z, .asm_3c99b - ld hl, OTPartyMon1PPMove1 + ld hl, OTPartyMon1PP ld a, [CurOTMon] call GetPartyLocation ld d, h ld e, l - ld hl, OTPartyMon1Move1 + ld hl, OTPartyMon1Moves ld a, [CurOTMon] call GetPartyLocation @@ -1430,18 +1430,19 @@ Function3c93c: ; 3c93c inc de inc c ld a, c - cp $4 + cp NUM_MOVES jr nz, .asm_3c99d .asm_3c9ae ret .asm_3c9af + ; lousy hack ld a, [hl] - cp $a6 - ld b, $1 + cp SKETCH + ld b, 1 jr z, .asm_3c9b8 - ld b, $5 + ld b, 5 .asm_3c9b8 ld a, [de] @@ -1451,18 +1452,18 @@ Function3c93c: ; 3c93c push bc ld a, [hl] ld [$d265], a - ld de, BattleMonItem - ld hl, BattleMonPPMove1 + ld de, BattleMonMoves - 1 + ld hl, BattleMonPP ld a, [hBattleTurn] and a jr z, .asm_3c9d2 - ld de, EnemyMonItem - ld hl, EnemyMonPPMove1 + ld de, EnemyMonMoves - 1 + ld hl, EnemyMonPP .asm_3c9d2 inc de pop bc - ld b, $0 + ld b, 0 add hl, bc push hl ld h, d @@ -1542,27 +1543,32 @@ Function3ca26: ; 3ca26 ld [hl], a cp $1 ret nz + ld hl, BattleText_0x808b6 call StdBattleTextBox - ld a, $10 + + ld a, BATTLE_VARS_MOVE call _GetBattleVar push af - ld a, $f8 + ld a, FUTURE_SIGHT ld [hl], a + callab UpdateMoveData xor a ld [AttackMissed], a ld [AlreadyDisobeyed], a - ld a, $a + ld a, 10 ld [TypeModifier], a callab DoMove xor a ld [CurDamage], a - ld [$d257], a - ld a, $10 + ld [CurDamage + 1], a + + ld a, BATTLE_VARS_MOVE call _GetBattleVar pop af ld [hl], a + call UpdateBattleMonInParty jp UpdateEnemyMonInParty ; 3ca8f @@ -1635,24 +1641,24 @@ Function3cafb: ; 3cafb call .asm_3cb1c .asm_3cb09 ld a, [PlayerScreens] - bit 2, a + bit SCREENS_SAFEGUARD, a ret z ld hl, $c701 dec [hl] ret nz - res 2, a + res SCREENS_SAFEGUARD, a ld [PlayerScreens], a xor a jr .asm_3cb2e .asm_3cb1c ld a, [EnemyScreens] - bit 2, a + bit SCREENS_SAFEGUARD, a ret z ld hl, $c705 dec [hl] ret nz - res 2, a + res SCREENS_SAFEGUARD, a ld [EnemyScreens], a ld a, $1 @@ -1676,7 +1682,7 @@ Function3cb36: ; 3cb36 .CheckPlayer call SetPlayerTurn ld de, .Your - call .asm_3cb6f + call .Copy ld hl, PlayerScreens ld de, PlayerLightScreenCount jr .FadeScreens @@ -1684,7 +1690,7 @@ Function3cb36: ; 3cb36 .CheckEnemy call SetEnemyTurn ld de, .Enemy - call .asm_3cb6f + call .Copy ld hl, EnemyScreens ld de, EnemyLightScreenCount @@ -1695,7 +1701,7 @@ Function3cb36: ; 3cb36 call nz, FadeReflect ret -.asm_3cb6f +.Copy ld hl, StringBuffer1 jp CopyName2 ; 3cb75 @@ -1852,7 +1858,7 @@ Function3cc45: ; 3cc45 ld a, [hBattleTurn] and a jr z, .asm_3cc50 - ld hl, EnemyMonHPHi + ld hl, EnemyMonHP .asm_3cc50 inc hl @@ -2099,7 +2105,7 @@ Function3cd55: ; 3cd55 call nz, Function3df48 ld a, $1 ld [hBGMapMode], a - ld c, $3c + ld c, 60 call DelayFrames ld a, [IsInBattle] dec a @@ -2147,7 +2153,7 @@ Function3cdca: ; 3cdca jr z, .asm_3cde6 call ClearSprites hlcoord 1, 0 - ld bc, $040a + lb bc, 4, 10 call ClearBox call Function3d2b3 ld a, $1 @@ -2264,27 +2270,29 @@ Function3ce01: ; 3ce01 Function3ceaa: ; 3ceaa ld a, [PartyCount] ld b, a - ld hl, PartyMon1Species + ld hl, PartyMon1 ld c, $1 ld d, $0 .asm_3ceb5 push hl push bc - ld bc, $0022 + ld bc, PartyMon1HP - PartyMon1 add hl, bc ld a, [hli] or [hl] pop bc pop hl jr z, .asm_3ced1 + push hl push bc - ld bc, $0001 + ld bc, PartyMon1Item - PartyMon1 add hl, bc pop bc ld a, [hl] pop hl - cp $39 + + cp EXP_SHARE jr nz, .asm_3ced1 ld a, d or c @@ -2293,7 +2301,7 @@ Function3ceaa: ; 3ceaa .asm_3ced1 sla c push de - ld de, $0030 + ld de, PartyMon2 - PartyMon1 add hl, de pop de dec b @@ -2331,7 +2339,7 @@ Function3cef1: ; 3cef1 call Function37b6 call Function3d43b hlcoord 9, 7 - ld bc, $050b + lb bc, 5, 11 call ClearBox ld hl, BattleText_0x80a75 jp StdBattleTextBox @@ -2345,7 +2353,7 @@ Function3cf14: ; 3cf14 ld de, SFX_UNKNOWN_2A call PlaySFX hlcoord 1, 0 - ld bc, $040a + lb bc, 4, 10 call ClearBox ld hl, BattleText_0x809a8 jp StdBattleTextBox @@ -2356,7 +2364,7 @@ Function3cf35: ; 3cf35 ld b, a xor a ld hl, OTPartyMon1HP - ld de, $0030 + ld de, PartyMon2 - PartyMon1 .asm_3cf40 or [hl] inc hl @@ -2494,7 +2502,7 @@ Function3d02b: ; 3d02b push af ld a, $0 jr nc, .asm_3d044 - ld a, [$d854] + ld a, [wMomSavingMoney] and $7 cp $3 jr nz, .asm_3d044 @@ -2525,7 +2533,7 @@ Function3d02b: ; 3d02b call Function3d099 pop af jr nc, .asm_3d07b - ld a, [$d854] + ld a, [wMomSavingMoney] and $7 jr z, .asm_3d07b ld hl, SentToMomTexts @@ -2547,7 +2555,7 @@ Function3d02b: ; 3d02b Function3d081: ; 3d081 push bc ld hl, $c688 - ld de, $d853 + ld de, wMomsMoney + 2 call Function3d0be pop bc ret @@ -2556,7 +2564,7 @@ Function3d081: ; 3d081 Function3d08d: ; 3d08d push bc ld hl, $c688 - ld de, $d850 + ld de, Money + 2 call Function3d0be pop bc ret @@ -2585,13 +2593,13 @@ SentToMomTexts: ; 3d0ab Function3d0b1: ; 3d0b1 - ld hl, $d853 + ld hl, wMomsMoney + 2 ld a, [hld] - cp $3f + cp 999999 % $100 ld a, [hld] - sbc $42 + sbc 999999 / $100 % $100 ld a, [hl] - sbc $f + sbc 999999 / $10000 % $100 ret ; 3d0be @@ -2616,17 +2624,17 @@ Function3d0be: ; 3d0be jr nz, .asm_3d0ce pop hl ld a, [hld] - cp $3f + cp 999999 % $100 ld a, [hld] - sbc $42 + sbc 999999 / $100 % $100 ld a, [hl] - sbc $f + sbc 999999 / $10000 % $100 ret c - ld [hl], $f + ld [hl], 999999 / $10000 % $100 inc hl - ld [hl], $42 + ld [hl], 999999 / $100 % $100 inc hl - ld [hl], $3f + ld [hl], 999999 % $100 ret ; 3d0ea @@ -3412,7 +3420,7 @@ Function3d599: ; 3d599 Function3d5d7: ; 3d5d7 push bc - ld hl, OTPartyMon1Move1 + ld hl, OTPartyMon1Moves ld a, b call GetPartyLocation pop bc @@ -5531,7 +5539,7 @@ Function3e4bc: ; 3e4bc ret .asm_3e4c8 - ld hl, EnemyMonMove1 + ld hl, EnemyMonMoves ld a, [$d235] dec a jr z, .asm_3e4e2 @@ -5539,49 +5547,50 @@ Function3e4bc: ; 3e4bc jr z, .asm_3e4dd call Function3e786 ret z - ld hl, BattleMonMove1 + ld hl, BattleMonMoves jr .asm_3e4e2 .asm_3e4dd - ld a, $2 + ld a, PartyMon1Moves - PartyMon1 call GetPartyParamLocation .asm_3e4e2 ld de, $d25e - ld bc, $0004 + ld bc, NUM_MOVES call CopyBytes xor a ld [hBGMapMode], a - hlcoord 4, 12 - ld b, $4 - ld c, $e + + hlcoord 4, 17 - NUM_MOVES - 1 + ld b, 4 + ld c, 14 ld a, [$d235] cp $2 jr nz, .asm_3e503 - hlcoord 4, 8 - ld b, $4 - ld c, $e - + hlcoord 4, 17 - NUM_MOVES - 1 - 4 + ld b, 4 + ld c, 14 .asm_3e503 call TextBox - hlcoord 6, 13 + + hlcoord 6, 17 - NUM_MOVES ld a, [$d235] cp $2 jr nz, .asm_3e513 - hlcoord 6, 9 - + hlcoord 6, 17 - NUM_MOVES - 4 .asm_3e513 - ld a, $14 + ld a, SCREEN_WIDTH ld [Buffer1], a - ld a, $20 + ld a, PREDEF_LIST_MOVES call Predef - ld b, $5 + + ld b, 5 ld a, [$d235] cp $2 - ld a, $d + ld a, 17 - NUM_MOVES jr nz, .asm_3e52c - ld b, $5 - ld a, $9 + ld b, 5 + ld a, 17 - NUM_MOVES - 4 .asm_3e52c ld [$cfa1], a @@ -5641,10 +5650,10 @@ Function3e4bc: ; 3e4bc and a jr z, .asm_3e5a3 hlcoord 5, 13 - ld bc, $0014 + ld bc, SCREEN_WIDTH dec a call AddNTimes - ld [hl], $ec + ld [hl], "▷" .asm_3e5a3 ld a, $1 @@ -5681,10 +5690,10 @@ Function3e4bc: ; 3e4bc .asm_3e5d9 pop af ret nz - ld hl, BattleMonPPMove1 + ld hl, BattleMonPP ld a, [$cfa9] ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] and $3f @@ -5699,9 +5708,9 @@ Function3e4bc: ; 3e4bc and a jr nz, .asm_3e606 ld a, [$cfa9] - ld hl, BattleMonMove1 + ld hl, BattleMonMoves ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] @@ -6018,8 +6027,8 @@ Function3e7c1: ; 3e7c1 bit 4, [hl] ld a, [LastEnemyMove] jp nz, .asm_3e87f - ld hl, EnemyMonMove1 - ld b, $0 + ld hl, EnemyMonMoves + ld b, 0 add hl, bc ld a, [hl] jp .asm_3e87f @@ -6041,9 +6050,9 @@ Function3e7c1: ; 3e7c1 jr .asm_3e87f .asm_3e830 - ld hl, EnemyMonMove1 - ld de, EnemyMonPPMove1 - ld b, $4 + ld hl, EnemyMonMoves + ld de, EnemyMonPP + ld b, NUM_MOVES .asm_3e838 ld a, [hl] and a @@ -6067,11 +6076,11 @@ Function3e7c1: ; 3e7c1 dec a jr nz, .asm_3e882 .asm_3e855 - ld hl, EnemyMonMove1 + ld hl, EnemyMonMoves call BattleRandom - and $3 + and 3 ; TODO factor in NUM_MOVES ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [EnemyDisableCount] swap a @@ -6082,7 +6091,7 @@ Function3e7c1: ; 3e7c1 ld a, [hl] and a jr z, .asm_3e855 - ld hl, EnemyMonPPMove1 + ld hl, EnemyMonPP add hl, bc ld b, a ld a, [hl] @@ -6105,25 +6114,25 @@ Function3e7c1: ; 3e7c1 .asm_3e894 ld a, [EnemyMoveEffect] - cp $77 + cp EFFECT_FURY_CUTTER jr z, .asm_3e89f xor a ld [EnemyFuryCutterCount], a .asm_3e89f ld a, [EnemyMoveEffect] - cp $51 + cp EFFECT_RAGE jr z, .asm_3e8af ld hl, EnemySubStatus4 - res 6, [hl] + res SUBSTATUS_RAGE, [hl] xor a ld [$c72c], a .asm_3e8af ld a, [EnemyMoveEffect] - cp $6f + cp EFFECT_PROTECT ret z - cp $74 + cp EFFECT_ENDURE ret z xor a ld [$c681], a @@ -6140,20 +6149,20 @@ Function3e8c1: ; 3e8c1 ld [$c681], a ld [$c72c], a ld hl, EnemySubStatus4 - res 6, [hl] + res SUBSTATUS_RAGE, [hl] ret ; 3e8d1 Function3e8d1: ; 3e8d1 ld a, [EnemySubStatus4] - and $20 + and 1 << SUBSTATUS_RECHARGE ret nz ld hl, EnemySubStatus3 ld a, [hl] - and $13 + and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_ROLLOUT | 1 << SUBSTATUS_BIDE ret nz ld hl, EnemySubStatus1 - bit 6, [hl] + bit SUBSTATUS_ENCORED, [hl] ret ; 3e8e4 @@ -8520,19 +8529,19 @@ Function3f607: ; 3f607 ld [IsInBattle], a callba Function10605d call LoadEnemyMon - ld hl, EnemyMonMove1 + ld hl, EnemyMonMoves ld de, $c735 - ld bc, $0004 + ld bc, NUM_MOVES call CopyBytes - ld hl, EnemyMonPPMove1 + ld hl, EnemyMonPP ld de, $c739 - ld bc, $0004 + ld bc, NUM_MOVES call CopyBytes ld hl, EnemyMonAtkDefDV ld a, $2d call Predef ld a, [CurPartySpecies] - cp $c9 + cp UNOWN jr nz, .asm_3f648 ld a, [$def4] and a @@ -8555,9 +8564,9 @@ Function3f607: ; 3f607 ; 3f662 Function3f662: ; 3f662 - ld hl, EnemyMonMove1 + ld hl, EnemyMonMoves ld de, $d25e - ld b, 4 + ld b, NUM_MOVES .loop ld a, [de] inc de @@ -8618,7 +8627,7 @@ Function3f6a5: ; 3f6a5 and a jr z, .asm_3f6b7 call Function3f759 - ld c, $96 + ld c, 150 call DelayFrames call Function3f77c ret @@ -8693,7 +8702,7 @@ Function3f71d: ; 3f71d .asm_3f73d ld hl, $c6ee - ld de, $d850 + ld de, Money + 2 call Function3d0be ld hl, BattleText_0x80730 call StdBattleTextBox diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index d16528d22..ed6f0257a 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -905,7 +905,7 @@ BattleCommand02: ; 343db .UseInstead ; Can't use another move if the monster only has one! - ld a, [BattleMonMove2] + ld a, [BattleMonMoves + 1] and a jr z, .DoNothing @@ -1744,8 +1744,8 @@ Function3484e: ; 3484e Function348de: ; 348de - ld de, EnemyMonMove1 - ld b, 5 + ld de, EnemyMonMoves + ld b, NUM_MOVES + 1 ld c, 0 ld a, [$d265] @@ -1775,7 +1775,7 @@ Function348de: ; 348de jr z, .loop inc c - cp $a + cp 10 jr c, .loop inc c @@ -1784,10 +1784,10 @@ Function348de: ; 348de inc c inc c - cp $a + cp 10 jr z, .loop - ld c, $64 + ld c, 100 jr .loop .exit @@ -1797,9 +1797,9 @@ Function348de: ; 348de ld a, c and a jr z, .doubledown ; double down - cp $5 + cp 5 jr c, Function34931 ; down - cp $64 + cp 100 ret c jr Function34939 ; up @@ -1833,11 +1833,11 @@ Function34941: ; 34941 ret c ld a, [EnemySubStatus1] - bit 4, a + bit SUBSTATUS_PERISH, a jr z, .asm_34986 - ld a, [$c67f] - cp $1 + ld a, [EnemyPerishCount] + cp 1 jr nz, .asm_34986 call Function349f4 @@ -1969,10 +1969,11 @@ Function349f4: ; 349f4 ld a, c or b ld c, a + .asm_34a16 srl b push bc - ld bc, $30 + ld bc, PartyMon2 - PartyMon1 add hl, bc pop bc inc e @@ -2010,7 +2011,7 @@ Function34a2a: ; 34a2a push hl push bc - ld bc, $0022 + ld bc, PartyMon1HP - PartyMon1 add hl, bc pop bc ld a, [hli] @@ -2045,7 +2046,7 @@ Function34a2a: ; 34a2a ret z push bc - ld bc, $30 + ld bc, PartyMon2 - PartyMon1 add hl, bc pop bc @@ -2074,7 +2075,7 @@ Function34a85: ; 34a85 .asm_34a98 srl b push bc - ld bc, $2f + ld bc, PartyMon2HP - (PartyMon1HP + 1) add hl, bc pop bc dec e @@ -2093,7 +2094,7 @@ Function34aa7: ; 34aa7 ld a, $ff ld [$c716], a - ld hl, OTPartyMon1Move1 + ld hl, OTPartyMon1Moves ld b, $20 ld d, $0 ld e, $0 @@ -2104,7 +2105,7 @@ Function34aa7: ; 34aa7 push hl push bc - ld b, $4 + ld b, NUM_MOVES ld c, $0 .asm_34abf ld a, [hli] @@ -2159,7 +2160,7 @@ Function34aa7: ; 34aa7 .asm_34b00 push bc - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 add hl, bc pop bc srl b @@ -2288,7 +2289,7 @@ Function34b77: ; 34b77 srl b pop hl push bc - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 add hl, bc pop bc jr .asm_34b82 @@ -4991,17 +4992,17 @@ BattleCommand48: ; 35b33 jr nz, .asm_35ba3 ; 35b3a $67 ld a, [hBattleTurn] and a - ld hl, BattleMonMove2 + ld hl, BattleMonMoves + 1 ld a, [DisabledMove] ld d, a jr z, .asm_35b4f ; 35b46 $7 - ld hl, EnemyMonMove2 + ld hl, EnemyMonMoves + 1 ld a, [EnemyDisabledMove] ld d, a .asm_35b4f ld a, BATTLE_VARS_STATUS call GetBattleVar - and $7 + and SLP jr z, .asm_35ba3 ; 35b56 $4b ld a, [hl] and a @@ -5012,9 +5013,9 @@ BattleCommand48: ; 35b33 .asm_35b62 push hl call BattleRandom - and $3 + and 3 ; TODO factor in NUM_MOVES ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] pop hl @@ -5068,11 +5069,11 @@ BattleCommand48: ; 35b33 ld a, [EnemyDisabledMove] .asm_35bbe ld b, a - ld a, $10 + ld a, BATTLE_VARS_MOVE call GetBattleVar ld c, a dec hl - ld d, $4 + ld d, NUM_MOVES .asm_35bc8 ld a, [hl] and a @@ -5112,17 +5113,17 @@ BattleCommand48: ; 35b33 pop de pop hl - cp $91 + cp EFFECT_SKULL_BASH ret z - cp $27 + cp EFFECT_RAZOR_WIND ret z - cp $4b + cp EFFECT_SKY_ATTACK ret z - cp $97 + cp EFFECT_SOLARBEAM ret z - cp $9b + cp EFFECT_FLY ret z - cp $1a + cp EFFECT_BIDE ret ; 35bff @@ -5132,7 +5133,7 @@ BattleCommand49: ; 35bff ld a, BATTLE_VARS_SUBSTATUS5 call _GetBattleVar - set 6, [hl] + set SUBSTATUS_DESTINY_BOND, [hl] call AnimateCurrentMove ld hl, DestinyBondEffectText jp StdBattleTextBox @@ -5156,7 +5157,7 @@ BattleCommand4a: ; 35c0f call GetBattleVar and a jr z, .asm_35c91 ; 35c2a $65 - cp $a5 + cp STRUGGLE jr z, .asm_35c91 ; 35c2e $61 ld b, a ld c, $ff @@ -5178,7 +5179,7 @@ BattleCommand4a: ; 35c0f push bc call GetMoveName call BattleRandom - and $3 + and 3 inc a inc a ld b, a @@ -5192,7 +5193,7 @@ BattleCommand4a: ; 35c0f sub b ld [hl], a push af - ld a, $17 + ld a, PartyMon1PP - PartyMon1 call OpponentPartyAttr ld d, b pop af @@ -5275,7 +5276,7 @@ BattleCommand4c: ; 35cc9 ld a, BATTLE_VARS_SUBSTATUS1 call _GetBattleVar - res 0, [hl] + res SUBSTATUS_NIGHTMARE, [hl] ld de, PartyMon1Status ld a, [hBattleTurn] and a @@ -5288,8 +5289,8 @@ BattleCommand4c: ; 35cc9 ld [hl], a ld h, d ld l, e - ld bc, $30 - ld d, $6 + ld bc, PartyMon2 - PartyMon1 + ld d, PartyEnd - PartySpecies .asm_35ce9 ld [hl], a add hl, bc @@ -5313,7 +5314,7 @@ FarPlayBattleAnimation: ; 35d00 ; battle animations disabled? ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar - and $60 ; bit 6 | 5 + and 1 << 6 | 1 << 5 ret nz ; fallthrough @@ -5347,19 +5348,19 @@ Function35d1c: ; 35d1c jr nz, .asm_35d31 ld a, [EnemySubStatus4] - bit 4, a + bit SUBSTATUS_SUBSTITUTE, a jp nz, Function35de0 .asm_35d31 ld a, [hld] ld b, a - ld a, [EnemyMonHPLo] + ld a, [EnemyMonHP + 1] ld [$d1ec], a sub b - ld [EnemyMonHPLo], a + ld [EnemyMonHP + 1], a ld a, [hl] ld b, a - ld a, [EnemyMonHPHi] - ld [$d1ed], a + ld a, [EnemyMonHP] + ld [$d1ec + 1], a sbc b ld [EnemyMonHPHi], a jr nc, .asm_35d59 @@ -5368,17 +5369,19 @@ Function35d1c: ; 35d1c ld [hli], a ld a, [$d1ec] ld [hl], a + xor a - ld hl, EnemyMonHPHi + ld hl, EnemyMonHP ld [hli], a ld [hl], a + .asm_35d59 - ld hl, EnemyMonMaxHPHi + ld hl, EnemyMonMaxHP ld a, [hli] ld [$d1eb], a ld a, [hl] ld [$d1ea], a - ld hl, EnemyMonHPHi + ld hl, EnemyMonHP ld a, [hli] ld [$d1ef], a ld a, [hl] @@ -5406,35 +5409,37 @@ Function35d7e: ; 35d7e jr nz, .asm_35d93 ld a, [PlayerSubStatus4] - bit 4, a + bit SUBSTATUS_SUBSTITUTE, a jp nz, Function35de0 .asm_35d93 ld a, [hld] ld b, a - ld a, [$c63d] + ld a, [BattleMonHP + 1] ld [$d1ec], a sub b - ld [$c63d], a + ld [BattleMonHP + 1], a ld [$d1ee], a ld b, [hl] ld a, [BattleMonHP] - ld [$d1ed], a + ld [$d1ec + 1], a sbc b ld [BattleMonHP], a - ld [$d1ef], a + ld [$d1ee + 1], a jr nc, .asm_35dc5 - ld a, [$d1ed] + ld a, [$d1ec + 1] ld [hli], a ld a, [$d1ec] ld [hl], a xor a + ld hl, BattleMonHP ld [hli], a ld [hl], a ld hl, $d1ee ld [hli], a ld [hl], a + .asm_35dc5 ld hl, BattleMonMaxHP ld a, [hli] @@ -5456,29 +5461,28 @@ Function35de0: ; 35de0 ld hl, SubTookDamageText call StdBattleTextBox - ld de, $c6e0 + ld de, EnemySubstituteHP ld a, [hBattleTurn] and a - jr z, .asm_35df1 + jr z, .got_hp + ld de, PlayerSubstituteHP +.got_hp - ld de, $c6df -.asm_35df1 ld hl, CurDamage ld a, [hli] and a - jr nz, .asm_35dff + jr nz, .broke ld a, [de] sub [hl] ld [de], a - jr z, .asm_35dff + jr z, .broke + jr nc, .done - jr nc, .asm_35e3d - -.asm_35dff +.broke ld a, BATTLE_VARS_SUBSTATUS4_OPP call _GetBattleVar - res 4, [hl] + res SUBSTATUS_SUBSTITUTE, [hl] ld hl, SubFadedText call StdBattleTextBox @@ -5487,28 +5491,27 @@ Function35de0: ; 35de0 call BattleCommanda7 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar - and $60 ; fly | dig + and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND call z, Function37ec7 call SwitchTurn ld a, BATTLE_VARS_MOVE_EFFECT call _GetBattleVar cp EFFECT_MULTI_HIT - jr z, .asm_35e3a + jr z, .ok cp EFFECT_DOUBLE_HIT - jr z, .asm_35e3a + jr z, .ok cp EFFECT_TWINEEDLE - jr z, .asm_35e3a + jr z, .ok cp EFFECT_TRIPLE_KICK - jr z, .asm_35e3a + jr z, .ok cp EFFECT_BEAT_UP - jr z, .asm_35e3a - + jr z, .ok xor a ld [hl], a -.asm_35e3a +.ok call RefreshBattleHuds -.asm_35e3d +.done jp ResetDamage ; 35e40 @@ -8271,17 +8274,19 @@ BattleCommand31: ; 36e7c call BattleCommandaa ld hl, BattleMonMaxHP - ld de, $c6df + ld de, PlayerSubstituteHP ld a, [hBattleTurn] and a - jr z, .asm_36e90 ; 36e88 $6 - ld hl, EnemyMonMaxHPHi - ld de, $c6e0 -.asm_36e90 + jr z, .got_hp + ld hl, EnemyMonMaxHP + ld de, EnemySubstituteHP +.got_hp + ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar - bit 4, a + bit SUBSTATUS_SUBSTITUTE, a jr nz, .asm_36ef4 ; 36e97 $5b + ld a, [hli] ld b, [hl] srl a @@ -8296,7 +8301,7 @@ BattleCommand31: ; 36e7c sub b ld e, a ld a, [hl] - sbc $0 + sbc 0 ld d, a jr c, .asm_36eff ; 36eae $4f ld a, d @@ -8305,22 +8310,26 @@ BattleCommand31: ; 36e7c ld [hl], d inc hl ld [hl], e + ld a, BATTLE_VARS_SUBSTATUS4 call _GetBattleVar - set 4, [hl] + set SUBSTATUS_SUBSTITUTE, [hl] + ld hl, $c730 ld de, $c72e ld a, [hBattleTurn] and a - jr z, .asm_36ecf ; 36ec7 $6 + jr z, .asm_36ecf ld hl, $c731 ld de, $c72f .asm_36ecf + xor a ld [hl], a ld [de], a call Function37ed5 jr c, .asm_36ee8 ; 36ed5 $11 + xor a ld [$cfca], a ld [FXAnimIDHi], a @@ -8328,17 +8337,20 @@ BattleCommand31: ; 36e7c ld a, $a4 call Function37e44 jr .asm_36eeb ; 36ee6 $3 + .asm_36ee8 call BattleCommanda6 .asm_36eeb ld hl, MadeSubstituteText call StdBattleTextBox jp RefreshBattleHuds + .asm_36ef4 call Function34548 call nz, BattleCommand0c ld hl, HasSubstituteText - jr .asm_36f08 ; 36efd $9 + jr .asm_36f08 + .asm_36eff call Function34548 call nz, BattleCommand0c @@ -8351,7 +8363,7 @@ BattleCommand32: ; 36f0b ; rechargenextturn ld a, BATTLE_VARS_SUBSTATUS4 call _GetBattleVar - set 5, [hl] + set SUBSTATUS_RECHARGE, [hl] ret ; 36f13 @@ -8360,7 +8372,7 @@ EndRechargeOpp: ; 36f13 push hl ld a, BATTLE_VARS_SUBSTATUS4_OPP call _GetBattleVar - res 5, [hl] + res SUBSTATUS_RECHARGE, [hl] pop hl ret ; 36f1d @@ -8370,7 +8382,7 @@ BattleCommand97: ; 36f1d ; rage ld a, BATTLE_VARS_SUBSTATUS4 call _GetBattleVar - set 6, [hl] + set SUBSTATUS_RAGE, [hl] ret ; 36f25 @@ -8431,10 +8443,10 @@ BattleCommand33: ; 36f46 call GetBattleVar and a jr z, .asm_36f9a ; 36f68 $30 - cp $a5 + cp STRUGGLE jr z, .asm_36f9a ; 36f6c $2c ld b, a - ld c, $4 + ld c, NUM_MOVES .asm_36f71 ld a, [hli] cp b @@ -8444,16 +8456,16 @@ BattleCommand33: ; 36f46 dec hl .asm_36f79 ld a, [hld] - cp $66 + cp MIMIC jr nz, .asm_36f79 ; 36f7c $fb inc hl ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar ld [hl], a ld [$d265], a - ld bc, $0006 + ld bc, BattleMonPP - BattleMonMoves add hl, bc - ld [hl], $5 + ld [hl], 5 call GetMoveName call AnimateCurrentMove ld hl, LearnedMoveText @@ -8467,34 +8479,39 @@ BattleCommand35: ; 36f9d ; leechseed ld a, [AttackMissed] and a - jr nz, .asm_36fd8 ; 36fa1 $35 + jr nz, .evaded call CheckSubstituteOpp - jr nz, .asm_36fd8 ; 36fa6 $30 + jr nz, .evaded + ld de, EnemyMonType1 ld a, [hBattleTurn] and a - jr z, .asm_36fb3 ; 36fae $3 + jr z, .ok ld de, BattleMonType1 -.asm_36fb3 +.ok + ld a, [de] - cp $16 - jr z, .asm_36fd2 ; 36fb6 $1a + cp GRASS + jr z, .grass inc de ld a, [de] - cp $16 - jr z, .asm_36fd2 ; 36fbc $14 + cp GRASS + jr z, .grass + ld a, BATTLE_VARS_SUBSTATUS4_OPP call _GetBattleVar - bit 7, [hl] - jr nz, .asm_36fd8 ; 36fc5 $11 - set 7, [hl] + bit SUBSTATUS_LEECH_SEED, [hl] + jr nz, .evaded + set SUBSTATUS_LEECH_SEED, [hl] call AnimateCurrentMove ld hl, WasSeededText jp StdBattleTextBox -.asm_36fd2 + +.grass call AnimateFailedMove jp PrintDoesntAffect -.asm_36fd8 + +.evaded call AnimateFailedMove ld hl, EvadedText jp StdBattleTextBox @@ -8514,6 +8531,7 @@ BattleCommand37: ; 36fed ld a, [AttackMissed] and a jr nz, .asm_37059 ; 36ff1 $66 + ld de, EnemyDisableCount ld hl, EnemyMonMoves ld a, [hBattleTurn] @@ -8522,15 +8540,18 @@ BattleCommand37: ; 36fed ld de, PlayerDisableCount ld hl, BattleMonMoves .asm_37004 + ld a, [de] and a jr nz, .asm_37059 ; 37006 $51 + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar and a jr z, .asm_37059 ; 3700e $49 - cp $a5 + cp STRUGGLE jr z, .asm_37059 ; 37012 $45 + ld b, a ld c, $ff .asm_37017 @@ -8538,20 +8559,21 @@ BattleCommand37: ; 36fed ld a, [hli] cp b jr nz, .asm_37017 ; 3701a $fb + ld a, [hBattleTurn] and a - ld hl, EnemyMonPPMove1 + ld hl, EnemyMonPP jr z, .asm_37027 ; 37022 $3 ld hl, BattleMonPP .asm_37027 - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] and a jr z, .asm_37059 ; 3702c $2b .asm_3702e call BattleRandom - and $7 + and 7 jr z, .asm_3702e ; 37033 $f9 inc a inc c @@ -8583,22 +8605,24 @@ BattleCommand1e: ; 3705c xor a ld hl, StringBuffer1 ld [hli], a + ld a, [hBattleTurn] and a ld a, [BattleMonLevel] - jr z, .asm_3706c ; 37067 $3 + jr z, .ok ld a, [EnemyMonLevel] -.asm_3706c +.ok + add a ld hl, $c6ee add [hl] ld [hld], a - jr nc, .asm_37079 ; 37072 $5 + jr nc, .done inc [hl] dec hl - jr nz, .asm_37079 ; 37076 $1 + jr nz, .done inc [hl] -.asm_37079 +.done ld hl, CoinsScatteredText jp StdBattleTextBox ; 3707f @@ -8611,7 +8635,7 @@ BattleCommand1f: ; 3707f ld de, BattleMonType1 ld a, [hBattleTurn] and a - jr z, .asm_37090 ; 37088 $6 + jr z, .asm_37090 ld hl, EnemyMonMoves ld de, EnemyMonType1 .asm_37090 @@ -8625,7 +8649,7 @@ BattleCommand1f: ; 3707f ld a, [hl] pop hl and a - jr z, .asm_370b2 ; 3709d $13 + jr z, .asm_370b2 push hl push bc dec a @@ -8637,8 +8661,8 @@ BattleCommand1f: ; 3707f pop hl inc c ld a, c - cp $4 - jr c, .asm_37096 ; 370b0 $e4 + cp NUM_MOVES + jr c, .asm_37096 .asm_370b2 ld a, $ff ld [de], a @@ -8651,43 +8675,44 @@ BattleCommand1f: ; 3707f .asm_370bd ld a, [hl] cp $ff - jr z, .asm_370d3 ; 370c0 $11 - cp $13 - jr z, .asm_370d0 ; 370c4 $a + jr z, .asm_370d3 + cp CURSE_T + jr z, .asm_370d0 ld a, [de] cp [hl] - jr z, .asm_370d0 ; 370c8 $6 + jr z, .asm_370d0 inc de ld a, [de] dec de cp [hl] - jr nz, .asm_370d9 ; 370ce $9 + jr nz, .asm_370d9_a .asm_370d0 inc hl - jr .asm_370bd ; 370d1 $ea + jr .asm_370bd .asm_370d3 call AnimateFailedMove jp PrintButItFailed -.asm_370d9 +.asm_370d9_a +.asm_370d9_b call BattleRandom - and $3 + and 3 ; TODO factor in NUM_MOVES ld c, a - ld b, $0 + ld b, 0 ld hl, StringBuffer1 add hl, bc ld a, [hl] cp $ff - jr z, .asm_370d9 ; 370e8 $ef - cp $13 - jr z, .asm_370d9 ; 370ec $eb + jr z, .asm_370d9_b ; 370e8 $ef + cp CURSE_T + jr z, .asm_370d9_b ; 370ec $eb ld a, [de] cp [hl] - jr z, .asm_370d9 ; 370f0 $e7 + jr z, .asm_370d9_b ; 370f0 $e7 inc de ld a, [de] dec de cp [hl] - jr z, .asm_370d9 ; 370f6 $e1 + jr z, .asm_370d9_b ; 370f6 $e1 ld a, [hl] ld [de], a inc de @@ -8727,10 +8752,10 @@ BattleCommand20: ; 3710e .Fill ld b, PlayerStatLevelsEnd - PlayerStatLevels -.asm_37139 +.next ld [hli], a dec b - jr nz, .asm_37139 + jr nz, .next ret ; 3713e @@ -8743,8 +8768,8 @@ BattleCommand2c: ; 3713e ld a, [hBattleTurn] and a jr z, .asm_3714f ; 37147 $6 - ld de, EnemyMonHPHi - ld hl, EnemyMonMaxHPHi + ld de, EnemyMonHP + ld hl, EnemyMonMaxHP .asm_3714f ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -8752,14 +8777,14 @@ BattleCommand2c: ; 3713e push hl push de push bc - ld c, $2 + ld c, 2 call StringCmp pop bc pop de pop hl jp z, .asm_371c4 ld a, b - cp $9c + cp REST jr nz, .asm_37199 ; 37166 $31 push hl push de @@ -8767,12 +8792,12 @@ BattleCommand2c: ; 3713e call BattleCommandaa ld a, BATTLE_VARS_SUBSTATUS5 call _GetBattleVar - res 0, [hl] + res SUBSTATUS_TOXIC, [hl] ld a, BATTLE_VARS_STATUS call _GetBattleVar ld a, [hl] and a - ld [hl], $3 + ld [hl], 3 ld hl, WentToSleepText jr z, .asm_37186 ; 37181 $3 ld hl, RestedText @@ -8832,12 +8857,12 @@ BattleCommand2d: ; 371cd ld [$c689], a ld a, BATTLE_VARS_SUBSTATUS4 call _GetBattleVar - bit 4, [hl] + bit SUBSTATUS_SUBSTITUTE, [hl] push af jr z, .asm_37200 ; 371f4 $a call Function34548 jr nz, .asm_37200 ; 371f9 $5 - ld a, $a4 + ld a, SUBSTITUTE call Function37e44 .asm_37200 ld a, BATTLE_VARS_SUBSTATUS5 @@ -8860,7 +8885,7 @@ BattleCommand2d: ; 371cd inc hl inc de inc de - ld bc, $0004 + ld bc, NUM_MOVES call CopyBytes ld a, [hBattleTurn] and a @@ -8897,7 +8922,7 @@ BattleCommand2d: ; 371cd pop hl ld bc, $ffe8 add hl, bc - ld b, $4 + ld b, NUM_MOVES .asm_3725f ld a, [de] inc de @@ -8945,7 +8970,7 @@ BattleCommand2d: ; 371cd ld a, $2 ld [$c689], a pop af - ld a, $a4 + ld a, SUBSTITUTE call nz, Function37e44 ld hl, TransformedText jp StdBattleTextBox @@ -9024,23 +9049,23 @@ BattleCommand2e: ; 372fc cp EFFECT_LIGHT_SCREEN jr nz, .Reflect - bit 3, [hl] - jr nz, .asm_37337 - set 3, [hl] - ld a, $5 + bit SCREENS_LIGHT_SCREEN, [hl] + jr nz, .failed + set SCREENS_LIGHT_SCREEN, [hl] + ld a, 5 ld [bc], a ld hl, LightScreenEffectText jr .asm_37331 .Reflect - bit 4, [hl] - jr nz, .asm_37337 - set 4, [hl] + bit SCREENS_REFLECT, [hl] + jr nz, .failed + set SCREENS_REFLECT, [hl] ; LightScreenCount -> ReflectCount inc bc - ld a, $5 + ld a, 5 ld [bc], a ld hl, ReflectEffectText @@ -9048,7 +9073,7 @@ BattleCommand2e: ; 372fc call AnimateCurrentMove jp StdBattleTextBox -.asm_37337 +.failed call AnimateFailedMove jp PrintButItFailed ; 3733d @@ -9121,7 +9146,7 @@ PrintParalyze: ; 37372 CheckSubstituteOpp: ; 37378 ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar - bit 4, a + bit SUBSTATUS_SUBSTITUTE, a ret ; 37380 @@ -9145,10 +9170,10 @@ BattleCommand1a: ; 37380 call Function37e36 ld a, BATTLE_VARS_SUBSTATUS4 call _GetBattleVar - res 7, [hl] + res SUBSTATUS_LEECH_SEED, [hl] ld a, BATTLE_VARS_SUBSTATUS5_OPP call _GetBattleVar - res 6, [hl] + res SUBSTATUS_DESTINY_BOND, [hl] call Function37ed5 ret nc callba DrawPlayerHUD @@ -9360,30 +9385,30 @@ BattleCommand5f: ; 377ce ; attract ld a, [AttackMissed] and a - jr nz, .asm_377f2 + jr nz, .failed call Function377f5 - jr c, .asm_377f2 + jr c, .failed call CheckHiddenOpponent - jr nz, .asm_377f2 + jr nz, .failed ld a, BATTLE_VARS_SUBSTATUS1_OPP call _GetBattleVar - bit 7, [hl] - jr nz, .asm_377f2 + bit SUBSTATUS_IN_LOVE, [hl] + jr nz, .failed - set 7, [hl] + set SUBSTATUS_IN_LOVE, [hl] call AnimateCurrentMove ; 'fell in love!' ld hl, FellInLoveText jp StdBattleTextBox -.asm_377f2 +.failed jp Function37354 ; 377f5 Function377f5: ; 377f5 - ld a, 0 + ld a, PartyMon1Species - PartyMon1 call BattlePartyAttr ld a, [hl] ld [CurPartySpecies], a @@ -9404,7 +9429,7 @@ Function377f5: ; 377f5 push bc ld a, [TempEnemyMonSpecies] ld [CurPartySpecies], a - ld hl, EnemyMonAtkDefDV + ld hl, EnemyMonDVs ld a, [EnemySubStatus5] bit 3, a jr z, .asm_37829 @@ -9444,22 +9469,22 @@ BattleCommand60: ; 3784b ld hl, BattleMonHappiness ld a, [hBattleTurn] and a - jr z, .asm_37857 ; 37852 $3 + jr z, .ok ld hl, EnemyMonHappiness -.asm_37857 +.ok xor a - ld [$ffb4], a - ld [$ffb5], a + ld [hMultiplicand], a + ld [hMultiplicand + 1], a ld a, [hl] - ld [$ffb6], a - ld a, $a - ld [$ffb7], a + ld [hMultiplicand + 2], a + ld a, 10 + ld [hMultiplier], a call Multiply - ld a, $19 - ld [$ffb7], a - ld b, $4 + ld a, 25 + ld [hDivisor], a + ld b, 4 call Divide - ld a, [$ffb6] + ld a, [hQuotient + 2] ld d, a pop bc ret @@ -9471,23 +9496,27 @@ BattleCommand61: ; 37874 ld a, [InLinkBattle] cp $3 - jr z, .asm_3787d ; 37879 $2 + jr z, .asm_3787d push bc push de .asm_3787d + call BattleCommand07 + ld a, [InLinkBattle] cp $3 - jr z, .asm_37889 ; 37885 $2 + jr z, .asm_37889 pop de pop bc .asm_37889 + ld a, [$d265] and a jp z, AnimateFailedMove ld a, [AttackMissed] and a jp nz, AnimateFailedMove + push bc call BattleRandom ld b, a @@ -9502,6 +9531,7 @@ BattleCommand61: ; 37874 inc c inc hl jr .asm_378a1 ; 378ab $f4 + .asm_378ad ld a, c ld [$c689], a @@ -9509,6 +9539,7 @@ BattleCommand61: ; 37874 ld d, [hl] pop bc ret + .asm_378b7 pop bc ld a, $3 @@ -9524,6 +9555,7 @@ BattleCommand61: ; 37874 ld a, BANK(AICheckPlayerMaxHP) rst FarCall jr c, .asm_378f3 ; 378d1 $20 + ld hl, GetQuarterMaxHP call CallBattleCore call SwitchTurn @@ -9535,6 +9567,7 @@ BattleCommand61: ; 37874 call SwitchTurn call UpdateOpponentInParty jr .asm_37904 ; 378f1 $11 + .asm_378f3 call SwitchTurn call Function37ed5 @@ -9546,9 +9579,9 @@ BattleCommand61: ; 37874 jp EndMoveEffect .table_37907 - db $66, 40 - db $b3, 80 - db $cc, 120 + db 40 percent, 40 + db 70 percent + 1, 80 + db 80 percent, 120 db $ff ; 3790e @@ -9569,12 +9602,12 @@ BattleCommand63: ; 3790e xor a ld [$ffb4], a ld [$ffb5], a - ld a, $a + ld a, 10 ld [$ffb7], a call Multiply - ld a, $19 + ld a, 25 ld [$ffb7], a - ld b, $4 + ld b, 4 call Divide ld a, [$ffb6] ld d, a @@ -9587,22 +9620,22 @@ BattleCommand64: ; 37939 ; safeguard ld hl, PlayerScreens - ld de, $c701 + ld de, PlayerSafeguardCount ld a, [hBattleTurn] and a - jr z, .asm_3794a ; 37942 $6 + jr z, .ok ld hl, EnemyScreens - ld de, $c705 -.asm_3794a - bit 2, [hl] - jr nz, .asm_3795c ; 3794c $e - set 2, [hl] - ld a, $5 + ld de, EnemySafeguardCount +.ok + bit SCREENS_SAFEGUARD, [hl] + jr nz, .failed + set SCREENS_SAFEGUARD, [hl] + ld a, 5 ld [de], a call AnimateCurrentMove ld hl, CoveredByVeilText jp StdBattleTextBox -.asm_3795c +.failed call AnimateFailedMove jp PrintButItFailed ; 37962 @@ -9617,7 +9650,7 @@ Function37962: ; 37962 ld hl, PlayerScreens .asm_3796e - bit 2, [hl] + bit SCREENS_SAFEGUARD, [hl] pop hl ret ; 37972 @@ -9631,9 +9664,9 @@ BattleCommand65: ; 37972 jr z, .asm_3797d ; 37978 $3 ld hl, PlayerScreens .asm_3797d - bit 2, [hl] + bit SCREENS_SAFEGUARD, [hl] ret z - ld a, $1 + ld a, 1 ld [AttackMissed], a call BattleCommandaa ld hl, SafeguardProtectText @@ -9649,14 +9682,14 @@ BattleCommand66: ; 37991 call BattleRandom ld b, a ld hl, .Magnitudes -.asm_37999 +.loop ld a, [hli] cp b - jr nc, .asm_379a1 ; 3799b $4 + jr nc, .ok inc hl inc hl - jr .asm_37999 ; 3799f $f8 -.asm_379a1 + jr .loop +.ok ld d, [hl] push de inc hl @@ -9821,7 +9854,7 @@ FailedBatonPass: ; 37aab ResetBatonPassStatus: ; 37ab1 ; Reset status changes that aren't passed by Baton Pass. -; Nightmare isn't passed. + ; Nightmare isn't passed. ld a, BATTLE_VARS_STATUS call GetBattleVar and SLP @@ -9832,10 +9865,10 @@ ResetBatonPassStatus: ; 37ab1 res SUBSTATUS_NIGHTMARE, [hl] .ok -; Disable isn't passed. + ; Disable isn't passed. call ResetActorDisable -; Attraction isn't passed. + ; Attraction isn't passed. ld hl, PlayerSubStatus1 res SUBSTATUS_IN_LOVE, [hl] ld hl, EnemySubStatus1 @@ -9847,7 +9880,7 @@ ResetBatonPassStatus: ; 37ab1 res 3, [hl] res 4, [hl] -; New mon hasn't used a move yet. + ; New mon hasn't used a move yet. ld a, BATTLE_VARS_LAST_MOVE call _GetBattleVar ld [hl], 0 @@ -9944,12 +9977,13 @@ BattleCommand69: ; 37b39 ld a, BATTLE_VARS_SUBSTATUS4 call _GetBattleVar - bit 7, [hl] + bit SUBSTATUS_LEECH_SEED, [hl] jr z, .asm_37b4a ; 37b40 $8 - res 7, [hl] + res SUBSTATUS_LEECH_SEED, [hl] ld hl, ShedLeechSeedText call StdBattleTextBox .asm_37b4a + ld hl, PlayerScreens ld de, $c730 ld a, [hBattleTurn] @@ -9958,14 +9992,15 @@ BattleCommand69: ; 37b39 ld hl, EnemyScreens ld de, $c731 .asm_37b5b - bit 0, [hl] + bit SCREENS_SPIKES, [hl] jr z, .asm_37b69 ; 37b5d $a - res 0, [hl] + res SCREENS_SPIKES, [hl] ld hl, BlewSpikesText push de call StdBattleTextBox pop de .asm_37b69 + ld a, [de] and a ret z @@ -10130,14 +10165,14 @@ BattleCommand95: ; 37c1a pop bc callab Function3cc3f call UpdateUserInParty - ld a, $5 + ld a, 5 .asm_37c41 push af call BattleCommand77 pop af dec a - jr nz, .asm_37c41 ; 37c47 $f8 + jr nz, .asm_37c41 ld hl, BellyDrumText jp StdBattleTextBox @@ -10262,9 +10297,9 @@ BattleCommand9d: ; 37ce6 ld hl, $c6fa ld a, [hBattleTurn] and a - jr z, .asm_37cf1 ; 37cec $3 + jr z, .ok ld hl, $c6fe -.asm_37cf1 +.ok ld a, [hl] and a ret z @@ -10358,12 +10393,12 @@ BattleCommand9c: ; 37d34 ld hl, CurDamage ld a, [hl] ld [de], a - ld [hl], $0 + ld [hl], 0 inc hl inc de ld a, [hl] ld [de], a - ld [hl], $0 + ld [hl], 0 jp EndMoveEffect .asm_37d87 pop bc @@ -10382,13 +10417,13 @@ BattleCommand9f: ; 37d94 inc hl ld a, [Weather] cp WEATHER_RAIN - jr z, .asm_37da7 ; 37d9f $6 + jr z, .rain cp WEATHER_SUN ret nz - ld [hl], $80 + ld [hl], 50 percent + 1 ret -.asm_37da7 - ld [hl], $ff +.rain + ld [hl], 100 percent ret ; 37daa @@ -10396,7 +10431,7 @@ BattleCommand9f: ; 37d94 CheckHiddenOpponent: ; 37daa ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar - and $60 ; fly | dig + and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret ; 37db2 @@ -10675,5 +10710,3 @@ Function37ed5: ; 37ed5 ret ; 37ee2 - - diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 9236887a4..076684345 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -2,9 +2,18 @@ ; strings PLAYER_NAME_LENGTH EQU 8 PKMN_NAME_LENGTH EQU 11 +MOVE_NAME_LENGTH EQU 13 NAME_LENGTH EQU 11 LV_CHAR EQU $6e +; GetName types +PKMN_NAME EQU 1 +MOVE_NAME EQU 2 +ITEM_NAME EQU 4 +PARTY_OT_NAME EQU 5 +ENEMY_OT_NAME EQU 6 +TRAINER_NAME EQU 7 + ; boxes NUM_BOXES EQU 14 @@ -22,6 +31,7 @@ PREDEF_UPDATE_ENEMY_HUD EQU $15 PREDEF_START_BATTLE EQU $16 PREDEF_FILL_IN_EXP_BAR EQU $17 PREDEF_FILLMOVES EQU $1B +PREDEF_LIST_MOVES EQU $20 PREDEF_GET_GENDER EQU $24 PREDEF_STATS_SCREEN EQU $25 PREDEF_DRAW_PLAYER_HP EQU $26 diff --git a/items/item_effects.asm b/items/item_effects.asm index 51994ca1f..d294d198c 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -366,7 +366,7 @@ ParkBall: ; e8a2 .asm_e98e ld b, a - ld [MagikarpLength], a + ld [Buffer1], a call Random cp b @@ -478,13 +478,13 @@ ParkBall: ; e8a2 bit 3, [hl] jr nz, .asm_ea67 ld hl, $c735 - ld de, EnemyMonMove1 - ld bc, $0004 + ld de, EnemyMonMoves + ld bc, NUM_MOVES call CopyBytes ld hl, $c739 - ld de, EnemyMonPPMove1 - ld bc, $0004 + ld de, EnemyMonPP + ld bc, NUM_MOVES call CopyBytes .asm_ea67 @@ -2633,11 +2633,11 @@ Functionf652: ; f652 .asm_f677 ld a, [CurPartyMon] - ld hl, PartyMon1Move1 - ld bc, $0030 + ld hl, PartyMon1Moves + ld bc, PartyMon2 - PartyMon1 call AddNTimes - ld de, BattleMonMove1 - ld b, $4 + ld de, BattleMonMoves + ld b, NUM_MOVES .asm_f688 ld a, [de] and a @@ -2647,13 +2647,10 @@ Functionf652: ; f652 push hl push de push bc + rept NUM_MOVES + 2 ; BattleMonPP - BattleMonMoves inc de - inc de - inc de - inc de - inc de - inc de - ld bc, $0015 + endr + ld bc, PartyMon1PP - PartyMon1Moves add hl, bc ld a, [hl] ld [de], a @@ -2682,15 +2679,16 @@ Functionf6af: ; f6af ld hl, $cfa9 ld [hli], a ld [hl], a - ld b, $4 + ld b, NUM_MOVES .asm_f6b7 push bc - ld hl, PartyMon1Move1 - ld bc, $0030 + ld hl, PartyMon1Moves + ld bc, PartyMon2 - PartyMon1 call Functionf963 ld a, [hl] and a jr z, .asm_f6ce + call Functionf6e8 jr z, .asm_f6ce ld hl, $cfaa @@ -2721,7 +2719,7 @@ Functionf6e8: ; f6e8 ld [MonType], a call Functionf8ec ld hl, PartyMon1PP - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call Functionf963 ld a, [$d265] ld b, a @@ -2739,6 +2737,7 @@ Functionf6e8: ; f6e8 ld c, 5 cp MYSTERYBERRY jr z, .asm_f715 + ld c, 10 .asm_f715 @@ -2985,7 +2984,7 @@ WontHaveAnyEffect_NotUsedMessage: ; f7ca ld hl, WontHaveAnyEffectText call PrintText -; Item wasn't used. + ; Item wasn't used. ld a, $2 ld [$d0ec], a ret @@ -3000,7 +2999,7 @@ Ball_BoxIsFullMessage: ; f7dc ld hl, Ball_BoxIsFullText call PrintText -; Item wasn't used. + ; Item wasn't used. ld a, $2 ld [$d0ec], a ret @@ -3116,21 +3115,21 @@ GotOffTheItemText: ; 0xf847 Functionf84c: ; f84c - ld a, $2 + ld a, PartyMon1Moves - PartyMon1 call GetPartyParamLocation push hl - ld de, MagikarpLength - ld a, $5 + ld de, Buffer1 + ld a, PREDEF_FILLPP call Predef pop hl - ld bc, $0015 + ld bc, PartyMon1PP - PartyMon1Moves add hl, bc - ld de, MagikarpLength - ld b, $0 + ld de, Buffer1 + ld b, 0 .asm_f864 inc b ld a, b - cp $5 + cp NUM_MOVES + 1 ret z ld a, [$d265] dec a @@ -3157,14 +3156,14 @@ Functionf84c: ; f84c Functionf881: ; f881 push bc ld a, [de] - ld [$ffb6], a + ld [hDividend + 3], a xor a - ld [hProduct], a - ld [hMultiplicand], a - ld [$ffb5], a - ld a, $5 - ld [hMultiplier], a - ld b, $4 + ld [hDividend], a + ld [hDividend + 1], a + ld [hDividend + 2], a + ld a, 5 + ld [hDivisor], a + ld b, 4 call Divide ld a, [hl] ld b, a @@ -3197,16 +3196,16 @@ Functionf881: ; f881 ; f8b9 Functionf8b9: ; f8b9 - ld a, $17 + ld a, PartyMon1PP - PartyMon1 call GetPartyParamLocation push hl - ld a, $2 + ld a, PartyMon1Moves - PartyMon1 call GetPartyParamLocation pop de xor a ld [$cfa9], a ld [MonType], a - ld c, $4 + ld c, NUM_MOVES .asm_f8ce ld a, [hli] and a @@ -3265,21 +3264,21 @@ Functionf8ec: ; f8ec ld a, [hl] dec a push hl - ld hl, $5b00 - ld bc, $0007 + ld hl, Moves + MOVE_PP + ld bc, MOVE_LENGTH call AddNTimes - ld a, $10 + ld a, BANK(Moves) call GetFarByte ld b, a ld de, StringBuffer1 ld [de], a pop hl push bc - ld bc, $0015 + ld bc, PartyMon1PP - PartyMon1Moves ld a, [MonType] cp WILDMON jr nz, .asm_f942 - ld bc, $0006 + ld bc, EnemyMonPP - EnemyMonMoves .asm_f942 add hl, bc @@ -3310,7 +3309,7 @@ Functionf963: ; f963 Functionf969: ; f969 ld a, [$cfa9] ld c, a - ld b, $0 + ld b, 0 add hl, bc ret ; f971 diff --git a/main.asm b/main.asm index 23947c972..ffdeda602 100644 --- a/main.asm +++ b/main.asm @@ -5266,13 +5266,13 @@ Function6508: ; 6508 call CopyBytes Function6520: ; 6520 - ld hl, PartyMon1Move1 - ld bc, $0030 + ld hl, PartyMon1Moves + ld bc, PartyMon2 - PartyMon1 ld a, [CurPartyMon] call AddNTimes ld d, h ld e, l - ld b, $4 + ld b, NUM_MOVES .asm_6530 ld a, [hl] and a @@ -5284,9 +5284,11 @@ Function6520: ; 6520 call Function65d3 pop de jp c, Function65b5 + push hl push de ld [$d265], a + ld b, a ld a, [IsInBattle] and a @@ -5297,8 +5299,8 @@ Function6520: ; 6520 xor a ld [DisabledMove], a ld [PlayerDisableCount], a - .asm_6559 + call GetMoveName ld hl, UnknownText_0x6684 call PrintText @@ -5334,13 +5336,13 @@ Function6520: ; 6520 jp nz, Function65ca ld h, d ld l, e - ld de, BattleMonMove1 - ld bc, $0004 + ld de, BattleMonMoves + ld bc, NUM_MOVES call CopyBytes - ld bc, $0011 + ld bc, PartyMon1PP - (PartyMon1Moves + NUM_MOVES) add hl, bc - ld de, BattleMonPPMove1 - ld bc, $0004 + ld de, BattleMonPP + ld bc, NUM_MOVES call CopyBytes jp Function65ca ; 65b5 @@ -5370,11 +5372,11 @@ Function65d3: ; 65d3 call YesNoBox pop hl ret c - ld bc, $fffc + ld bc, -NUM_MOVES add hl, bc push hl ld de, $d25e - ld bc, $0004 + ld bc, NUM_MOVES call CopyBytes pop hl .asm_65ee @@ -5382,13 +5384,13 @@ Function65d3: ; 65d3 ld hl, UnknownText_0x6670 call PrintText hlcoord 5, 2 - ld b, $8 - ld c, $d + ld b, NUM_MOVES * 2 + ld c, MOVE_NAME_LENGTH call TextBox - hlcoord 7, 4 - ld a, $28 + hlcoord 5 + 2, 2 + 2 + ld a, SCREEN_WIDTH * 2 ld [Buffer1], a - ld a, $20 + ld a, PREDEF_LIST_MOVES call Predef ld a, $4 ld [$cfa1], a @@ -5420,7 +5422,7 @@ Function65d3: ; 65d3 ld a, [$cfa9] dec a ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] push af @@ -5474,9 +5476,6 @@ UnknownText_0x667f: ; 667f UnknownText_0x6684: ; 6684 text_jump UnknownText_0x1c5740 start_asm -; 6689 - -; 6689 push de ld de, SFX_SWITCH_POKEMON call PlaySFX @@ -7790,7 +7789,7 @@ PredefPointers: ; 856b dwb Function28f63, BANK(Function28f63) dwb Function28f24, BANK(Function28f24) dwb Function5084a, BANK(Function5084a) - dwb Function50d6f, BANK(Function50d6f) ; $20 + dwb ListMoves, BANK(ListMoves) ; $20 dwb Function50d2e, BANK(Function50d2e) dwb Function50cdb, BANK(Function50cdb) dwb Function50c50, BANK(Function50c50) @@ -12379,7 +12378,7 @@ Functiond88c: ; d88c .asm_d8fd ld a, [$ffae] dec a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes Functiond906: ; d906 ld e, l @@ -12409,25 +12408,21 @@ Functiond906: ; d906 ld a, [MonType] and a jr nz, .asm_d943 - ld de, EnemyMonMove1 - ld a, [de] - inc de - ld [hli], a - ld a, [de] - inc de - ld [hli], a + ld de, EnemyMonMoves + rept NUM_MOVES + -1 ld a, [de] inc de ld [hli], a + endr ld a, [de] ld [hl], a jr .asm_d950 .asm_d943 xor a + rept NUM_MOVES + -1 ld [hli], a - ld [hli], a - ld [hli], a + endr ld [hl], a ld [Buffer1], a ld a, $1b @@ -12553,9 +12548,10 @@ Functiond906: ; d906 ld a, [EnemyMonSpdSpclDV] ld [de], a inc de + push hl - ld hl, EnemyMonPPMove1 - ld b, $4 + ld hl, EnemyMonPP + ld b, NUM_MOVES .asm_da03 ld a, [hli] ld [de], a @@ -12563,7 +12559,8 @@ Functiond906: ; d906 dec b jr nz, .asm_da03 pop hl - ld a, $46 + + ld a, BASE_HAPPINESS ld [de], a inc de xor a @@ -12617,7 +12614,7 @@ Functiond906: ; d906 ld hl, PartyMon1DVs ld a, [PartyCount] dec a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld a, $2d call Predef @@ -12676,7 +12673,7 @@ Functionda96: ; da96 ld hl, PartyMon1Species ld a, [PartyCount] dec a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld e, l ld d, h @@ -12713,9 +12710,9 @@ Functionda96: ; da96 ld hl, PartyMon1Happiness ld a, [PartyCount] dec a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes - ld [hl], $46 + ld [hl], BASE_HAPPINESS .asm_db12 ld a, [CurPartySpecies] @@ -12724,7 +12721,7 @@ Functionda96: ; da96 ld hl, PartyMon1DVs ld a, [PartyCount] dec a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld a, $2d call Predef @@ -12781,7 +12778,7 @@ Functiondb3f: ; db3f ld a, [$d10b] dec a ld hl, PartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld a, [PartyCount] jr nz, .asm_db97 ld hl, BoxMon1Species @@ -12805,7 +12802,7 @@ Functiondb3f: ; db3f ld hl, BreedMon1Species jr z, .asm_dbbd ld hl, PartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 .asm_dbb7 ld a, [CurPartyMon] @@ -12996,7 +12993,7 @@ Functiondcb6: ; dcb6 ld a, [hli] and a jr z, .asm_dd18 - ld [TempMonMove1], a + ld [TempMonMoves+0], a ld a, BOXMON ld [MonType], a ld a, b @@ -13128,10 +13125,10 @@ Functiondd64: ; dd64 push bc ld b, $1 call Functione167 - ld hl, PartyMon1Move1 + ld hl, PartyMon1Moves ld a, [PartyCount] dec a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, h ld e, l @@ -13163,7 +13160,7 @@ Functionde1a: ; de1a ld a, [PartyCount] dec a ld hl, PartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, h ld e, l @@ -13197,7 +13194,7 @@ Functionde44: ; de44 call CopyBytes ld a, [CurPartyMon] ld hl, PartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld bc, $0020 jp CopyBytes @@ -13303,7 +13300,7 @@ Functionde6e: ; de6e .asm_df20 ld hl, BoxMon1Moves - ld de, TempMonMove1 + ld de, TempMonMoves ld bc, NUM_MOVES call CopyBytes ld hl, BoxMon1PP @@ -13417,7 +13414,7 @@ Functiondf8c:: ; df8c ld [CurPartySpecies], a ld a, [PartyCount] dec a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld hl, PartyMon1Species call AddNTimes ld a, [CurPartySpecies] @@ -13438,7 +13435,7 @@ Functiondf8c:: ; df8c ld a, [PartyCount] dec a ld hl, PartyMon1Happiness - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld a, [$c2cc] bit 1, a @@ -13451,7 +13448,7 @@ Functiondf8c:: ; df8c ld a, [PartyCount] dec a ld hl, PartyMon1HP - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes xor a ld [hli], a @@ -13875,7 +13872,7 @@ Functione277:: ; e277 jr z, .asm_e2e1 ld a, [CurPartyMon] ld hl, PartyMon1Item - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld a, [CurItem] ld [hl], a @@ -13958,7 +13955,7 @@ Functione277:: ; e277 push bc ld a, [CurPartyMon] ld hl, PartyMon1ID - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld a, $3 ld [hli], a @@ -14261,7 +14258,7 @@ UnknownText_0xe533: ; 0xe533 Functione538: ; e538 ld hl, PartyMon1HP - ld de, $0030 + ld de, PartyMon2 - PartyMon1 ld b, $0 .asm_e540 ld a, [CurPartyMon] @@ -14539,7 +14536,7 @@ Functione6fd: ; e6fd ld [CurPartySpecies], a call GetBaseData xor a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld hl, $df9c call ByteFill xor a @@ -20670,8 +20667,8 @@ Function12fd5: ; 12fd5 jp .asm_13018 .asm_130de - ld hl, PartyMon1Move1 - ld bc, $0030 + ld hl, PartyMon1Moves + ld bc, PartyMon2 - PartyMon1 ld a, [CurPartyMon] call AddNTimes push hl @@ -20682,7 +20679,7 @@ Function12fd5: ; 12fd5 call Function1313a ld a, [IsInBattle] jr z, .asm_13113 - ld hl, BattleMonMove1 + ld hl, BattleMonMoves ld bc, $0020 ld a, [CurPartyMon] call AddNTimes @@ -20804,14 +20801,14 @@ Function131ef: ; 131ef ld [MonType], a ld a, $1f call Predef - ld hl, TempMonMove1 + ld hl, TempMonMoves ld de, $d25e - ld bc, $0004 + ld bc, NUM_MOVES call CopyBytes - ld a, $28 + ld a, SCREEN_WIDTH * 2 ld [Buffer1], a hlcoord 2, 3 - ld a, $20 + ld a, PREDEF_LIST_MOVES call Predef hlcoord 10, 4 ld a, $23 @@ -20822,14 +20819,14 @@ Function131ef: ; 131ef inc a ld [$cfa3], a hlcoord 0, 11 - ld b, $5 - ld c, $12 + ld b, 5 + ld c, 18 jp TextBox ; 13235 Function13235: ; 13235 - ld hl, PartyMon1Move1 - ld bc, $0030 + ld hl, PartyMon1Moves + ld bc, PartyMon2 - PartyMon1 ld a, [CurPartyMon] call AddNTimes ld a, [$cfa9] @@ -20840,7 +20837,7 @@ Function13235: ; 13235 ld a, [hl] ld [CurSpecies], a hlcoord 1, 12 - ld bc, $0512 + lb bc, 5, 18 jp ClearBox ; 13256 @@ -28827,7 +28824,7 @@ Function16798: ; 16798 callba Functione538 jr c, .asm_167e9 ld hl, PartyMon1Item - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld a, [CurPartyMon] call AddNTimes ld d, [hl] @@ -29231,17 +29228,17 @@ Function169ac: ; 169ac call Function16a31 ld hl, EggOT call CopyBytes - ld hl, PartyMon1Species - ld bc, $0030 + ld hl, PartyMon1 + ld bc, PartyMon2 - PartyMon1 call Function16a31 - ld hl, EggSpecies + ld hl, EggMon ld bc, $0020 call CopyBytes call GetBaseData ld a, [PartyCount] dec a - ld hl, PartyMon1Species - ld bc, $0030 + ld hl, PartyMon1 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld b, h ld c, l @@ -36944,7 +36941,7 @@ Function28499: ; 28499 .asm_284db push bc call Function284f6 - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 add hl, bc pop bc dec c @@ -38183,7 +38180,7 @@ Function28b87: ; 28b87 ld a, c call GetPartyLocation ld de, TempMonSpecies - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call CopyBytes ld a, $7 call Predef @@ -39873,22 +39870,23 @@ Function29bfb: ; 29bfb pop bc pop hl jr c, .asm_29c5e - ld de, $0030 + ld de, PartyMon2 - PartyMon1 add hl, de dec b jr nz, .asm_29c13 - ld hl, PartyMon1Move1 + + ld hl, PartyMon1Moves ld a, [PartyCount] ld b, a .asm_29c2e - ld c, $4 + ld c, NUM_MOVES .asm_29c30 ld a, [hli] cp STRUGGLE + 1 jr nc, .asm_29c4c dec c jr nz, .asm_29c30 - ld de, $002c + ld de, PartyMon2 - (PartyMon1 + NUM_MOVES) add hl, de dec b jr nz, .asm_29c2e @@ -42153,11 +42151,11 @@ Function2c547: ; 2c547 callba Function50000 jr c, .asm_2c5c3 ld a, [CurPartySpecies] - cp $fd + cp EGG jr z, .asm_2c5bc ld a, [CurPartyMon] - ld hl, PartyMon1Move2 - ld bc, $0030 + ld hl, PartyMon1Moves + 1 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld a, [hl] and a @@ -42258,18 +42256,18 @@ Function2c5f9: ; 2c5f9 push bc dec a ld c, a - ld b, $0 - ld hl, PartyMon1Move1 + ld b, 0 + ld hl, PartyMon1Moves add hl, bc ld a, [CurPartyMon] - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes pop bc push bc inc b .asm_2c60f ld a, b - cp $5 + cp NUM_MOVES + 1 jr z, .asm_2c61b inc hl ld a, [hld] @@ -42282,21 +42280,22 @@ Function2c5f9: ; 2c5f9 xor a ld [hl], a pop bc + ld a, b push bc dec a ld c, a - ld b, $0 + ld b, 0 ld hl, PartyMon1PP add hl, bc ld a, [CurPartyMon] - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes pop bc inc b .asm_2c633 ld a, b - cp $5 + cp NUM_MOVES + 1 jr z, .asm_2c63f inc hl ld a, [hld] @@ -43108,7 +43107,7 @@ Function2ed44: ; 2ed44 ld hl, PartyMon1PokerusStatus ld a, [PartyCount] ld b, a - ld de, $0030 + ld de, PartyMon2 - PartyMon1 .loopMons ld a, [hl] and $f @@ -43757,7 +43756,7 @@ Function38170: ; 38170 ld d, a ld e, $0 ld hl, OTPartyMon1Level - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 .asm_3817c ld a, [hl] cp e @@ -44200,7 +44199,7 @@ Function3844b: ; 3844b .asm_3845b push bc - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 add hl, bc pop bc dec c @@ -44224,7 +44223,7 @@ Function3846c: ; 3846c push af ld a, [CurOTMon] ld hl, OTPartyMon1Status - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, h ld e, l @@ -44269,7 +44268,7 @@ Function384d5: ; 384d5 Function384e0: ; 384e0 ld a, [CurOTMon] ld hl, OTPartyMon1Status - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes xor a ld [hl], a @@ -44569,20 +44568,20 @@ Function39806: ; 39806 ld [CurPartyLevel], a ld a, [hli] ld [CurPartySpecies], a - ld a, $1 + ld a, OTPARTYMON ld [MonType], a push hl ld a, $6 call Predef ld a, [OTPartyCount] dec a - ld hl, OTPartyMon1Move1 - ld bc, $0030 + ld hl, OTPartyMon1Moves + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, h ld e, l pop hl - ld b, $4 + ld b, NUM_MOVES .asm_39830 ld a, [hli] ld [de], a @@ -44593,7 +44592,7 @@ Function39806: ; 39806 ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, h ld e, l @@ -44674,7 +44673,7 @@ Function3989d: ; 3989d ld a, [OTPartyCount] dec a ld hl, $d289 - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, h ld e, l @@ -44685,7 +44684,7 @@ Function3989d: ; 3989d ld a, [OTPartyCount] dec a ld hl, $d28a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, h ld e, l @@ -44701,7 +44700,7 @@ Function3989d: ; 3989d ld a, [OTPartyCount] dec a ld hl, OTPartyMon1 - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, h ld e, l @@ -47652,8 +47651,8 @@ Function421f5: ; 421f5 jp z, .asm_423f8 push hl - ld de, TempMonAtk - ld hl, TempMonDef + ld de, TempMonAttack + ld hl, TempMonDefense ld c, 2 call StringCmp ld a, ATK_EQ_DEF @@ -47850,7 +47849,7 @@ Function421f5: ; 421f5 ld [hl], a ld hl, TempMonSpecies - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call CopyBytes ld a, [CurSpecies] @@ -48014,11 +48013,11 @@ Function42487: ; 42487 jr nz, .asm_4249d push hl ld d, a - ld hl, PartyMon1Move1 + ld hl, PartyMon1Moves ld a, [CurPartyMon] - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes - ld b, $4 + ld b, NUM_MOVES .asm_424b9 ld a, [hli] cp d @@ -48121,7 +48120,7 @@ FillMoves: ; 424e1 and a jr z, .ShiftedMove push de - ld bc, PartyMon1PP - PartyMon1Move4 + ld bc, PartyMon1PP - (PartyMon1Moves + NUM_MOVES - 1) add hl, bc ld d, h ld e, l @@ -48161,7 +48160,7 @@ FillMoves: ; 424e1 ; 4256e ShiftMoves: ; 4256e - ld c, $3 + ld c, NUM_MOVES - 1 .asm_42570 inc de ld a, [de] @@ -48268,7 +48267,7 @@ AIChooseMove: ; 440ce and a jr z, .CheckPP - ld hl, EnemyMonMove1 + ld hl, EnemyMonMoves ld c, 0 .CheckDisabledMove cp [hl] @@ -48380,12 +48379,12 @@ AIChooseMove: ; 440ce inc [hl] dec hl inc a - cp EnemyMonMovesEnd - EnemyMonMoves + 1 + cp NUM_MOVES + 1 jr nz, .asm_44175 ld hl, Buffer1 ld de, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + ld c, NUM_MOVES .asm_44184 ld a, [de] and a @@ -48447,14 +48446,16 @@ AIScoringPointers: ; 441af Function441cf: ; 441cf ld hl, Unknown_441fc ld b, 25 -.asm_441d4 - ld a, [hli] - cp $fe - jr nz, .asm_441dd - ld hl, Unknown_441fc +.loop ld a, [hli] -.asm_441dd + ; Wrap around + cp $fe + jr nz, .ok + ld hl, Unknown_441fc + ld a, [hli] +.ok + ld [$c7db], a ld a, [hli] ld c, a @@ -48465,7 +48466,7 @@ Function441cf: ; 441cf pop bc call DelayFrames dec b - jr nz, .asm_441d4 + jr nz, .loop xor a ld [$c7db], a call Function44207 @@ -48475,11 +48476,11 @@ Function441cf: ; 441cf ; 441fc Unknown_441fc: ; 441fc - db $00, $07 - db $01, $07 - db $02, $07 - db $03, $07 - db $04, $07 + db 0, 7 + db 1, 7 + db 2, 7 + db 3, 7 + db 4, 7 db $fe ; 44207 @@ -48865,7 +48866,7 @@ Function44654:: ; 44654 jr c, .asm_446c6 ld a, [CurPartyMon] ld hl, PartyMon1Item - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, [hl] callba ItemIsMail @@ -48928,7 +48929,7 @@ Function446cc:: ; 446cc push af push bc ld hl, PartyMon1Item - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes pop bc ld [hl], b @@ -48954,7 +48955,7 @@ Function446cc:: ; 446cc call CopyBytes pop af ld hl, PartyMon1ID - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld a, [hli] ld [de], a @@ -49029,7 +49030,7 @@ Function44781: ; 44781 pop de pop hl ret c - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 add hl, bc dec e jr nz, .asm_4478b @@ -55796,7 +55797,7 @@ Function4d319: ; 4d319 dec a ld [CurPartyMon], a call LowVolume - ld a, $25 + ld a, PREDEF_STATS_SCREEN call Predef ld a, [CurPartyMon] inc a @@ -56615,12 +56616,12 @@ Function4d9e5: ; 4d9e5 ld hl, PartyMon1Species ld a, [PartyCount] dec a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld d, h ld e, l ld hl, $df9c - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call CopyBytes ld a, [PartyCount] dec a @@ -56902,7 +56903,7 @@ Function4dc0a: ; 4dc0a dec a push hl push bc - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes pop bc ld a, b @@ -56935,7 +56936,7 @@ Function4dc31: ; 4dc31 dec a push hl push bc - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes pop bc ld a, b @@ -57702,18 +57703,18 @@ Function4e147: ; 4e147 (13:6147) ld de, String_4e1a9 hlcoord 0, 10 call PlaceString - ld hl, TempMonMoves ; $d110 (aliases: TempMonMove1) + ld hl, TempMonMoves ld de, $d25e - ld bc, $4 + ld bc, NUM_MOVES call CopyBytes hlcoord 8, 10 - ld a, $28 - ld [Buffer1], a ; $d1ea (aliases: MagikarpLength) - ld a, $20 + ld a, SCREEN_WIDTH * 2 + ld [Buffer1], a + ld a, PREDEF_LIST_MOVES call Predef hlcoord 12, 11 ld a, $28 - ld [Buffer1], a ; $d1ea (aliases: MagikarpLength) + ld [Buffer1], a ld a, $23 call Predef ret @@ -59194,7 +59195,7 @@ Function500cf: ; 500cf Function50117: ; 50117 ld a, b - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld hl, PartyMon1HP call AddNTimes ld a, [hli] @@ -59234,7 +59235,7 @@ Function50138: ; 50138 jr z, .asm_5016b push hl ld a, b - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld hl, PartyMon1HP call AddNTimes ld e, l @@ -59407,7 +59408,7 @@ Function5022f: ; 5022f jr z, .asm_5025d push hl ld a, b - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld hl, PartyMon1Species call AddNTimes ld a, [hl] @@ -60415,7 +60416,7 @@ Function5084a: ; 5084a ld a, [CurPartyMon] call AddNTimes ld de, TempMonSpecies - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call CopyBytes .asm_5088a @@ -60739,16 +60740,16 @@ Function50b7b: ; 50b7b add hl, bc ld bc, $0014 add hl, bc - ld de, TempMonAtk + ld de, TempMonAttack ld bc, $0203 call Function50bab - ld de, TempMonDef + ld de, TempMonDefense call Function50bab ld de, TempMonSpclAtk call Function50bab ld de, TempMonSpclDef call Function50bab - ld de, TempMonSpd + ld de, TempMonSpeed jp PrintNum ; 50bab @@ -60916,8 +60917,8 @@ Function50c50: ; 50c50 inc hl ld d, h ld e, l - ld hl, TempMonMove1 - ld b, $0 + ld hl, TempMonMoves + ld b, 0 .asm_50c7a ld a, [hli] and a @@ -60937,7 +60938,7 @@ Function50c50: ; 50c50 pop de pop hl push hl - ld bc, $0014 + ld bc, TempMonPP - (TempMonMoves + 1) add hl, bc ld a, [hl] and $3f @@ -60956,7 +60957,7 @@ Function50c50: ; 50c50 pop hl ld a, [Buffer1] ld e, a - ld d, $0 + ld d, 0 add hl, de ld d, h ld e, l @@ -60964,7 +60965,7 @@ Function50c50: ; 50c50 pop bc inc b ld a, b - cp $4 + cp NUM_MOVES jr nz, .asm_50c7a .asm_50cc8 @@ -61095,7 +61096,8 @@ FrzString: db "FRZ@" ParString: db "PAR@" ; 50d6f -Function50d6f: ; 50d6f +ListMoves: ; 50d6f +; List moves at hl, spaced every [Buffer1] tiles. ld de, $d25e ld b, $0 .asm_50d74 @@ -61107,7 +61109,7 @@ Function50d6f: ; 50d6f push hl push hl ld [CurSpecies], a - ld a, $2 + ld a, MOVE_NAME ld [$cf61], a call GetName ld de, StringBuffer1 @@ -61122,12 +61124,12 @@ Function50d6f: ; 50d6f push bc ld a, [Buffer1] ld c, a - ld b, $0 + ld b, 0 add hl, bc pop bc pop de ld a, b - cp $4 + cp NUM_MOVES jr z, .asm_50db8 jr .asm_50d74 @@ -61135,14 +61137,14 @@ Function50d6f: ; 50d6f ld a, b .asm_50da8 push af - ld [hl], $e3 + ld [hl], "-" ld a, [Buffer1] ld c, a - ld b, $0 + ld b, 0 add hl, bc pop af inc a - cp $4 + cp NUM_MOVES jr nz, .asm_50da8 .asm_50db8 @@ -61151,41 +61153,42 @@ Function50d6f: ; 50d6f Function50db9: ; 50db9 ld a, [$d263] + cp $1 jr nz, .asm_50dca ld hl, OTPartyCount ld de, OTPartyMon1OT - ld a, $6 + ld a, ENEMY_OT_NAME jr .asm_50dfc - .asm_50dca + cp $4 jr nz, .asm_50dd8 ld hl, PartyCount ld de, PartyMon1OT - ld a, $5 + ld a, PARTY_OT_NAME jr .asm_50dfc - .asm_50dd8 + cp $5 jr nz, .asm_50de6 ld hl, $d0f0 ld de, PokemonNames - ld a, $1 + ld a, PKMN_NAME jr .asm_50dfc - .asm_50de6 + cp $2 jr nz, .asm_50df4 ld hl, NumItems - ld de, Function50000 - ld a, $4 + ld de, ItemNames + ld a, ITEM_NAME jr .asm_50dfc - .asm_50df4 + ld hl, $d0f0 - ld de, Function50000 - ld a, $4 + ld de, ItemNames + ld a, ITEM_NAME .asm_50dfc ld [$cf61], a @@ -61197,7 +61200,7 @@ Function50db9: ; 50db9 ld [$d102], a ld a, d ld [$d103], a - ld bc, $67c1 + ld bc, $67c1 ; XXX ItemAttributes? ld a, c ld [$d104], a ld a, b @@ -62047,12 +62050,12 @@ Function51322: ; 51322 ld de, $d018 call Function513e0 ld hl, $d01a - ld de, TempMonMove1 - ld bc, $0004 + ld de, TempMonMoves + ld bc, NUM_MOVES call CopyBytes ld hl, $d02f ld de, TempMonPP - ld bc, $0004 + ld bc, NUM_MOVES call CopyBytes ld a, [CurPartyMon] ld b, a @@ -62081,7 +62084,7 @@ Function5138b: ; 5138b dec a ld [$d265], a ld hl, PartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld de, $d018 call Function513e0 ret @@ -66509,7 +66512,7 @@ Function8653f: ; 8653f push bc ld a, c ld hl, PartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes ld c, l ld b, h @@ -73161,7 +73164,7 @@ Function8b2e9: ; 8b2e9 Function8b31a: ; 8b31a push bc - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 add hl, bc inc de pop bc @@ -96856,7 +96859,7 @@ Functione3316: ; e3316 ld hl, PartyMon1OT call Functione3376 ld hl, PartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call Functione3389 xor a ld [$d10b], a @@ -101146,7 +101149,7 @@ Functionfbb32: ; fbb32 jr nz, .asm_fbba4 ld a, [CurPartyMon] ld hl, PartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call AddNTimes push hl ld bc, $0015 @@ -103997,8 +104000,8 @@ Function100bc2: ; 100bc2 ld a, [$cfa9] dec a ld c, a - ld b, $0 - ld hl, BattleMonPPMove1 + ld b, 0 + ld hl, BattleMonPP add hl, bc ld a, [hl] and $3f @@ -104012,8 +104015,8 @@ Function100bc2: ; 100bc2 ld a, [$cfa9] dec a ld c, a - ld b, $0 - ld hl, BattleMonMove1 + ld b, 0 + ld hl, BattleMonMoves add hl, bc ld a, [hl] ld [CurPlayerMove], a @@ -104035,23 +104038,23 @@ Function100bc2: ; 100bc2 Function100c74: ; 100c74 hlcoord 0, 8 - ld b, $8 - ld c, $8 + ld b, 8 + ld c, 8 call TextBox - ld hl, BattleMonMove1 + ld hl, BattleMonMoves ld de, $d25e - ld bc, $0004 + ld bc, NUM_MOVES call CopyBytes - ld a, $28 + ld a, SCREEN_WIDTH * 2 ld [Buffer1], a hlcoord 2, 10 - ld a, $20 + ld a, PREDEF_LIST_MOVES call Predef ret ; 100c98 Function100c98: ; 100c98 - ld de, $4cad + ld de, Unknown_100cad call Function1bb1 ld a, [$d0eb] inc a @@ -104062,6 +104065,7 @@ Function100c98: ; 100c98 ret ; 100cad +Unknown_100cad: ; 100cad INCBIN "baserom.gbc",$100cad,$100cb5 - $100cad @@ -112882,7 +112886,7 @@ Function11b98f: ; 11b98f ld a, $ff ld [bc], a ld hl, PartyMon1Species - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld a, e ld [$cd2a], a .asm_11b9ba @@ -112896,7 +112900,7 @@ Function11b98f: ; 11b98f ld l, a ld a, [$cd23] ld h, a - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 call CopyBytes ld hl, PartyMon1OT ld bc, $000b @@ -119488,7 +119492,7 @@ Function1dc381: ; 1dc381 ld de, String1dc554 call PlaceString hlcoord 7, 14 - ld a, [TempMonMove1] + ld a, [TempMonMoves + 0] call Function1dc51a call Function1dc52c ld hl, TempMonDVs @@ -119498,7 +119502,7 @@ Function1dc381: ; 1dc381 xor a ld [hl], a ld a, [CurPartySpecies] - cp $c9 + cp UNOWN jr z, .asm_1dc469 inc [hl] @@ -119531,22 +119535,22 @@ Function1dc47b: ; 1dc47b hlcoord 0, 1 call CopyBytes hlcoord 7, 0 - ld a, [TempMonMove2] + ld a, [TempMonMoves + 1] call Function1dc51a hlcoord 7, 2 - ld a, [TempMonMove3] + ld a, [TempMonMoves + 2] call Function1dc51a hlcoord 7, 4 - ld a, [TempMonMove4] + ld a, [TempMonMoves + 3] call Function1dc51a hlcoord 7, 7 ld de, String1dc55d call PlaceString hlcoord 16, 7 - ld de, TempMonAtk + ld de, TempMonAttack call Function1dc507 hlcoord 16, 9 - ld de, TempMonDef + ld de, TempMonDefense call Function1dc507 hlcoord 16, 11 ld de, TempMonSpclAtk @@ -119555,7 +119559,7 @@ Function1dc47b: ; 1dc47b ld de, TempMonSpclDef call Function1dc507 hlcoord 16, 15 - ld de, TempMonSpd + ld de, TempMonSpeed call Function1dc507 call WaitBGMap ld b, $3 diff --git a/wram.asm b/wram.asm index bb510806a..eb572b201 100644 --- a/wram.asm +++ b/wram.asm @@ -6,11 +6,7 @@ party_struct: MACRO \1Species:: db \1Item:: db -\1Moves:: -\1Move1:: db -\1Move2:: db -\1Move3:: db -\1Move4:: db +\1Moves:: ds NUM_MOVES \1ID:: dw \1Exp:: ds 3 ; Big endian @@ -25,11 +21,7 @@ party_struct: MACRO \1AtkDefDV:: db \1SpdSpcDV:: db -\1PP:: -\1PPMove1:: db -\1PPMove2:: db -\1PPMove3:: db -\1PPMove4:: db +\1PP:: ds NUM_MOVES \1Happiness:: db \1PokerusStatus:: db @@ -483,15 +475,8 @@ BattleMonSpecies:: ; c62c BattleMonItem:: ; c62d ds 1 -BattleMonMoves:: -BattleMonMove1:: ; c62e - ds 1 -BattleMonMove2:: ; c62f - ds 1 -BattleMonMove3:: ; c630 - ds 1 -BattleMonMove4:: ; c631 - ds 1 +BattleMonMoves:: ; c62e + ds NUM_MOVES BattleMonDVs:: BattleMonAtkDefDV:: ; c632 @@ -499,15 +484,8 @@ BattleMonAtkDefDV:: ; c632 BattleMonSpdSpclDV:: ; c633 ds 1 -BattleMonPP:: -BattleMonPPMove1:: ; c634 - ds 1 -BattleMonPPMove2:: ; c635 - ds 1 -BattleMonPPMove3:: ; c636 - ds 1 -BattleMonPPMove4:: ; c637 - ds 1 +BattleMonPP:: ; c634 + ds NUM_MOVES BattleMonHappiness:: ; c638 ds 1 @@ -736,7 +714,14 @@ EnemyTurnsTaken:: ; c6dc PlayerTurnsTaken:: ; c6dd ds 1 - ds 5 + ds 1 + +PlayerSubstituteHP:: ; c6df + ds 1 +EnemySubstituteHP:: ; c6e0 + ds 1 + + ds 2 CurPlayerMove:: ; c6e3 ds 1 @@ -788,15 +773,17 @@ EnemyScreens:: ; c700 ; see PlayerScreens ds 1 +PlayerSafeguardCount:: ; c701 ds 1 - PlayerLightScreenCount:: ; c702 ds 1 PlayerReflectCount:: ; c703 ds 1 - ds 2 + ds 1 +EnemySafeguardCount:: ; c705 + ds 1 EnemyLightScreenCount:: ; c706 ds 1 EnemyReflectCount:: ; c707 @@ -1083,70 +1070,7 @@ CurPartyMon:: ; d109 ds 4 TempMon:: -TempMonSpecies:: ; d10e - ds 1 -TempMonItem:: ; d10f - ds 1 -TempMonMoves:: ; d110 -TempMonMove1:: ; d110 - ds 1 -TempMonMove2:: ; d111 - ds 1 -TempMonMove3:: ; d112 - ds 1 -TempMonMove4:: ; d113 - ds 1 -TempMonID:: ; d114 - ds 2 -TempMonExp:: ; d116 - ds 3 -TempMonHPExp:: ; d119 - ds 2 -TempMonAtkExp:: ; d11b - ds 2 -TempMonDefExp:: ; d11d - ds 2 -TempMonSpdExp:: ; d11f - ds 2 -TempMonSpclExp:: ; d121 - ds 2 -TempMonDVs:: ; d123 -; hp = %1000 for each dv - ds 1 ; atk/def - ds 1 ; spd/spc -TempMonPP:: ; d125 - ds 4 -TempMonHappiness:: ; d129 - ds 1 -TempMonPokerusStatus:: ; d12a - ds 1 -TempMonCaughtData:: ; d12b -TempMonCaughtTime:: ; d12b -TempMonCaughtLevel:: ; d12b - ds 1 -TempMonCaughtGender:: ; d12c -TempMonCaughtLocation:: ; d12c - ds 1 -TempMonLevel:: ; d12d - ds 1 -TempMonStatus:: ; d12e - ds 1 -; d12f - ds 1 -TempMonHP:: ; d130 - ds 2 -TempMonMaxHP:: ; d132 - ds 2 -TempMonAtk:: ; d134 - ds 2 -TempMonDef:: ; d136 - ds 2 -TempMonSpd:: ; d138 - ds 2 -TempMonSpclAtk:: ; d13a - ds 2 -TempMonSpclDef:: ; d13c - ds 2 + party_struct TempMon TempMonEnd:: ; d13e ds 3 @@ -1316,15 +1240,8 @@ EnemyMonSpecies:: ; d206 EnemyMonItem:: ; d207 ds 1 -EnemyMonMoves:: -EnemyMonMove1:: ; d208 - ds 1 -EnemyMonMove2:: ; d209 - ds 1 -EnemyMonMove3:: ; d20a - ds 1 -EnemyMonMove4:: ; d20b - ds 1 +EnemyMonMoves:: ; d208 + ds NUM_MOVES EnemyMonMovesEnd:: EnemyMonDVs:: @@ -1333,16 +1250,9 @@ EnemyMonAtkDefDV:: ; d20c EnemyMonSpdSpclDV:: ; d20d ds 1 -EnemyMonPP:: -EnemyMonPPMove1:: ; d20e - ds 1 -EnemyMonPPMove2:: ; d20f - ds 1 -EnemyMonPPMove3:: ; d210 - ds 1 -EnemyMonPPMove4:: ; d211 - ds 1 - +EnemyMonPP:: ; d20e + ds NUM_MOVES + EnemyMonHappiness:: ; d212 ds 1 EnemyMonLevel:: ; d213 @@ -1729,7 +1639,10 @@ StatusFlags2:: ; d84d Money:: ; d84e ds 3 - ds 4 +wMomsMoney:: ; d851 + ds 3 +wMomSavingMoney:: ; d854 + ds 1 Coins:: ; d855 ds 2 @@ -2087,7 +2000,7 @@ EggNick:: ; df65 ds 11 EggOT:: ; df70 ds 11 -EggStats:: +EggMon:: EggSpecies:: ; df7b ds 1 ds 31