diff options
Diffstat (limited to 'battle')
-rw-r--r-- | battle/core.asm | 223 | ||||
-rw-r--r-- | battle/effect_commands.asm | 475 |
2 files changed, 370 insertions, 328 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 - - |