From d077fae081127bcf7bd9b58f37771519587f5f9c Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 3 May 2013 02:43:44 -0400 Subject: [PATCH] more move effect cleanup --- battle/effect_commands.asm | 222 +++++++++++++++++++------------------ 1 file changed, 113 insertions(+), 109 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index a3d8d0523..78a03a899 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -664,7 +664,7 @@ MoveDisabled: ; 3438d ld a, BATTLE_VARS_MOVE call CleanGetBattleVarPair ld [$d265], a - call $34f8 + call GetMoveName ; 'disabled!' ld hl, DisabledMoveText @@ -1219,7 +1219,7 @@ Function0x3460b: ; 3460b .asm_34616 ld c, a ld a, 2 - call $3945 + call UserPartyAttr ld a, BATTLE_VARS_MOVE call CleanGetBattleVarPair @@ -1514,7 +1514,7 @@ BattleCommand07: ; 346d2 ld a, [hld] ld [$ffb6], a - call $3119 + call Multiply ld a, [$ffb4] ld b, a @@ -1528,7 +1528,7 @@ BattleCommand07: ; 346d2 ld a, $a ld [$ffb7], a ld b, $4 - call $3124 + call Divide ld a, [$ffb5] ld b, a ld a, [$ffb6] @@ -1578,7 +1578,7 @@ Function0x347d3: ; 347d3 push hl push de push bc - ld a, $f + ld a, BATTLE_VARS_MOVE_TYPE call CleanGetBattleVarPair ld d, a ld b, [hl] @@ -1593,9 +1593,9 @@ Function0x347d3: ; 347d3 jr z, .asm_3482f ; 0x347ea $43 cp $fe jr nz, .asm_347fb ; 0x347ee $b - ld a, $5 + ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 3, a + bit SUBSTATUS_IDENTIFIED, a jr nz, .asm_3482f ; 0x347f7 $36 jr .asm_347e7 ; 0x347f9 $ec .asm_347fb @@ -1675,7 +1675,7 @@ Function0x3484e: ; 3484e jr z, .asm_3489f ; 0x34863 $3a push hl dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .asm_3489b ; 0x3486e $2b @@ -1761,7 +1761,7 @@ Function0x348de: ; 348de inc de dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .loop @@ -2023,7 +2023,7 @@ Function0x34a2a: ; 34a2a call GetBaseData ld a, [LastEnemyCounterMove] dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .asm_34a77 @@ -2113,7 +2113,7 @@ Function0x34aa7: ; 34aa7 jr z, .asm_34aef dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .asm_34ae9 @@ -2206,7 +2206,7 @@ Function0x34b20: ; 34b20 jr z, .asm_34b4a dec a - ld hl, $5afd + ld hl, Moves + PlayerMovePower - PlayerMoveStruct call GetMoveAttr and a jr z, .asm_34b4a @@ -2389,7 +2389,7 @@ BattleCommand09: ; 34d32 ; Perfect-accuracy moves ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $11 + cp EFFECT_ALWAYS_HIT ret z call .StatModifiers @@ -2435,7 +2435,7 @@ BattleCommand09: ; 34d32 ; Keep the damage value intact if we're using (Hi) Jump Kick. ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $2d + cp EFFECT_JUMP_KICK jr z, .Missed call ResetDamage @@ -2450,12 +2450,12 @@ BattleCommand09: ; 34d32 ; a monster that isn't sleeping. ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $8 + cp EFFECT_DREAM_EATER ret nz ld a, BATTLE_VARS_STATUS_OPP call CleanGetBattleVarPair - and 7 ; sleep + and SLP ret @@ -2463,7 +2463,7 @@ BattleCommand09: ; 34d32 ; Return nz if the opponent is protected. ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 2, a + bit SUBSTATUS_PROTECT, a ret z ld c, 40 @@ -2486,13 +2486,13 @@ BattleCommand09: ; 34d32 ; Fissure or Magnitude on a monster that is flying. ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarPair - bit 5, [hl] - res 5, [hl] + bit SUBSTATUS_LOCK_ON, [hl] + res SUBSTATUS_LOCK_ON, [hl] ret z ld a, BATTLE_VARS_SUBSTATUS3_OPP call CleanGetBattleVarPair - bit 6, a ; flying + bit SUBSTATUS_FLYING, a jr z, .LockedOn ld a, BATTLE_VARS_MOVE_ANIM @@ -2513,15 +2513,15 @@ BattleCommand09: ; 34d32 .DrainSub ; Return z if using an HP drain move on a substitute. - call CheckSubstituteOpp ; CheckOpponentSub + call CheckSubstituteOpp jr z, .asm_34e00 ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $3 ; drain + cp EFFECT_LEECH_HIT ret z - cp $8 ; dream eater + cp EFFECT_DREAM_EATER ret z .asm_34e00 @@ -2536,10 +2536,10 @@ BattleCommand09: ; 34d32 ld a, BATTLE_VARS_SUBSTATUS3_OPP call CleanGetBattleVarPair - and $60 ; fly | dig + and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret z - bit 6, a + bit SUBSTATUS_FLYING, a jr z, .DigMoves ld a, BATTLE_VARS_MOVE_ANIM @@ -2570,7 +2570,7 @@ BattleCommand09: ; 34d32 ; Return z if the current move always hits in rain, and it is raining. ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $98 + cp EFFECT_THUNDER ret nz ld a, [Weather] @@ -2582,7 +2582,7 @@ BattleCommand09: ; 34d32 ; Return nz if unleashing energy from Bide. ld a, BATTLE_VARS_SUBSTATUS4 call CleanGetBattleVarPair - bit 0, a + bit SUBSTATUS_UNLEASH, a ret @@ -2611,7 +2611,7 @@ BattleCommand09: ; 34d32 ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 3, a + bit SUBSTATUS_IDENTIFIED, a ret nz .asm_34e6b @@ -2718,12 +2718,12 @@ BattleCommand0a: ; 34eee ld a, BATTLE_VARS_SUBSTATUS4 call CleanGetBattleVarPair - bit 4, a + bit SUBSTATUS_SUBSTITUTE, a ret z ld a, BATTLE_VARS_SUBSTATUS3 call CleanGetBattleVarPair - bit 4, a + bit SUBSTATUS_CHARGED, a jr nz, .asm_34f18 ld a, BATTLE_VARS_MOVE_EFFECT @@ -2841,8 +2841,8 @@ BattleCommand0b: ; 34f60 jp Function0x37ec7 .asm_34fb0 ld a, [$c689] - and $1 - xor $1 + and 1 + xor 1 ld [$c689], a ld a, [de] cp $1 @@ -2850,7 +2850,7 @@ BattleCommand0b: ; 34f60 ld a, BATTLE_VARS_MOVE_ANIM call CleanGetBattleVarPair ld e, a - ld d, $0 + ld d, 0 pop af jp z, PlayFXAnimID xor a @@ -2910,7 +2910,7 @@ BattleCommand93: ; 34ffd BattleCommand0c: ; 35004 ld a, BATTLE_VARS_SUBSTATUS4 call CleanGetBattleVarPair - bit 4, a + bit SUBSTATUS_SUBSTITUTE, a ret z call Function0x37ed5 @@ -2960,8 +2960,8 @@ BattleCommand0d: ; 35023 .asm_3504f ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair - res 5, [hl] - res 6, [hl] + res SUBSTATUS_UNDERGROUND, [hl] + res SUBSTATUS_FLYING, [hl] call Function0x37ece jp EndMoveEffect ; 3505e @@ -2972,7 +2972,7 @@ BattleCommand0e: ; 3505e ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 5, a + bit SUBSTATUS_ENDURE, a jr z, .asm_35072 ; 35065 $b call BattleCommand4b ld b, $0 @@ -3064,9 +3064,9 @@ Function0x350e4: ; 350e4 ld a, [TypeModifier] and $7f jr z, .asm_35110 ; 0x350ef $1f - ld a, $d + ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $94 + cp EFFECT_FUTURE_SIGHT ld hl, ButItFailedText ld de, ItFailedText jr z, .asm_35110 ; 0x350fe $10 @@ -3080,9 +3080,9 @@ Function0x350e4: ; 350e4 call Function0x35157 xor a ld [CriticalHit], a - ld a, $d + ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $2d + cp EFFECT_JUMP_KICK ret nz ld a, [TypeModifier] and $7f @@ -3118,7 +3118,7 @@ Function0x350e4: ; 350e4 Function0x35157: ; 35157 ld a, BATTLE_VARS_SUBSTATUS1_OPP call CleanGetBattleVarPair - bit 2, a ; protect + bit SUBSTATUS_PROTECT, a jr z, .asm_35162 ld h, d ld l, e @@ -3233,7 +3233,7 @@ BattleCommand11: ; 351c0 ld a, BATTLE_VARS_SUBSTATUS5_OPP call CleanGetBattleVarPair - bit 6, a + bit SUBSTATUS_DESTINY_BOND, a jr z, .asm_35231 ld hl, TookDownWithItText @@ -3316,7 +3316,7 @@ BattleCommand12: ; 35250 ld a, BATTLE_VARS_SUBSTATUS4_OPP call CleanGetBattleVarPair - bit 6, a + bit SUBSTATUS_RAGE, a ret z ld de, $c72c @@ -4271,23 +4271,23 @@ BattleCommand62: ; 35612 TypeBoostItems: ; 35703 - db $32, NORMAL ; Pink/Polkadot Bow - db $33, FIGHTING ; Blackbelt - db $34, FLYING ; Sharp Beak - db $35, POISON ; Poison Barb - db $36, GROUND ; Soft Sand - db $37, ROCK ; Hard Stone - db $38, BUG ; Silverpowder - db $39, GHOST ; Spell Tag - db $3a, FIRE ; Charcoal - db $3b, WATER ; Mystic Water - db $3c, GRASS ; Miracle Seed - db $3d, ELECTRIC ; Magnet - db $3e, PSYCHIC ; Twistedspoon - db $3f, ICE ; Nevermeltice - db $40, DRAGON ; Dragon Scale - db $41, DARK ; Blackglasses - db $42, STEEL ; Metal Coat + db HELD_NORMAL_BOOST, NORMAL ; Pink/Polkadot Bow + db HELD_FIGHTING_BOOST, FIGHTING ; Blackbelt + db HELD_FLYING_BOOST, FLYING ; Sharp Beak + db HELD_POISON_BOOST, POISON ; Poison Barb + db HELD_GROUND_BOOST, GROUND ; Soft Sand + db HELD_ROCK_BOOST, ROCK ; Hard Stone + db HELD_BUG_BOOST, BUG ; Silverpowder + db HELD_GHOST_BOOST, GHOST ; Spell Tag + db HELD_FIRE_BOOST, FIRE ; Charcoal + db HELD_WATER_BOOST, WATER ; Mystic Water + db HELD_GRASS_BOOST, GRASS ; Miracle Seed + db HELD_ELECTRIC_BOOST, ELECTRIC ; Magnet + db HELD_PSYCHIC_BOOST, PSYCHIC ; Twistedspoon + db HELD_ICE_BOOST, ICE ; Nevermeltice + db HELD_DRAGON_BOOST, DRAGON ; Dragon Scale + db HELD_DARK_BOOST, DARK ; Blackglasses + db HELD_STEEL_BOOST, STEEL ; Metal Coat db $ff ; 35726 @@ -4304,20 +4304,20 @@ BattleCommand3f: ; 35726 .asm_35731 ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $57 ; by level (seismic toss, night shade) + cp EFFECT_LEVEL_DAMAGE ld b, [hl] ld a, 0 jr z, .asm_3578c ld a, BATTLE_VARS_MOVE_EFFECT call CleanGetBattleVarPair - cp $58 ; variable (psywave) + cp EFFECT_PSYWAVE jr z, .asm_35758 - cp $28 ; half hp (super fang) + cp EFFECT_SUPER_FANG jr z, .asm_3576b - cp $63 ; by hp (flail, reversal) + cp EFFECT_REVERSAL jr z, .asm_35792 ld a, BATTLE_VARS_MOVE_POWER @@ -4383,7 +4383,7 @@ BattleCommand3f: ; 35726 ld [$ffb6], a ld a, $30 ld [$ffb7], a - call $3119 + call Multiply ld a, [hli] ld b, a ld a, [hl] @@ -4411,10 +4411,10 @@ BattleCommand3f: ; 35726 .asm_357d6 ld b, $4 - call $3124 + call Divide ld a, [$ffb6] ld b, a - ld hl, .table_35807 + ld hl, .FlailPower .asm_357e1 ld a, [hli] @@ -4447,13 +4447,14 @@ BattleCommand3f: ; 35726 ld [hl], 1 ret -.table_35807 - db 1, $c8 - db 4, $96 - db 9, $64 - db 16, $50 - db 32, $28 - db 48, $14 +.FlailPower + ; px, bp + db 1, 200 + db 4, 150 + db 9, 100 + db 16, 80 + db 32, 40 + db 48, 20 ; 35813 @@ -4743,7 +4744,7 @@ BattleCommand43: ; 359d0 ; snore ld a, BATTLE_VARS_STATUS call CleanGetBattleVarPair - and $7 + and SLP ret nz call ResetDamage ld a, $1 @@ -4771,11 +4772,11 @@ BattleCommand44: ; 359e6 jr z, .asm_35a50 ; 359fd $51 push hl dec a - ld hl, $5afe + ld hl, Moves + PlayerMoveType - PlayerMoveStruct call GetMoveAttr ld d, a pop hl - cp $13 + cp CURSE_T jr z, .asm_35a50 ; 35a0b $43 call Function0x37e01 @@ -4824,13 +4825,13 @@ BattleCommand45: ; 35a53 ; lockon call CheckSubstituteOpp - jr nz, .asm_35a6e ; 35a56 $16 + jr nz, .asm_35a6e ld a, [AttackMissed] and a - jr nz, .asm_35a6e ; 35a5c $10 + jr nz, .asm_35a6e ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarPair - set 5, [hl] + set SUBSTATUS_LOCK_ON, [hl] call Function0x37e01 ld hl, TookAimText @@ -4853,13 +4854,13 @@ BattleCommand46: ; 35a74 jp PrintNothingHappened .asm_35a83 call CheckSubstituteOpp - jp nz, $5b10 + jp nz, .asm_35b10 ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarPair bit 3, [hl] - jp nz, $5b10 + jp nz, .asm_35b10 ld a, $2 - call $3945 + call UserPartyAttr ld d, h ld e, l ld hl, BattleMonMoves @@ -4874,7 +4875,7 @@ BattleCommand46: ; 35a74 ld b, a and a jr z, .asm_35b10 ; 35aaf $5f - cp $a5 + cp STRUGGLE jr z, .asm_35b10 ; 35ab3 $5b ld c, $4 .asm_35ab7 @@ -4888,7 +4889,7 @@ BattleCommand46: ; 35a74 .asm_35ac1 dec c ld a, [hld] - cp $a6 + cp SKETCH jr nz, .asm_35ac1 ; 35ac5 $fa inc hl ld a, b @@ -4896,7 +4897,7 @@ BattleCommand46: ; 35a74 push bc push hl dec a - ld hl, $5b00 + ld hl, Moves + PlayerMovePP - PlayerMoveStruct call GetMoveAttr pop hl ld bc, $0006 @@ -4933,7 +4934,7 @@ BattleCommand46: ; 35a74 add hl, de ld [hl], a .asm_35b04 - call $34f8 + call GetMoveName call Function0x37e01 ld hl, SketchedText @@ -5139,7 +5140,7 @@ BattleCommand4a: ; 35c0f ld a, [AttackMissed] and a - jp nz, $5c91 + jp nz, .asm_35c91 ld bc, $0030 ld hl, EnemyMonMoves ld a, [hBattleTurn] @@ -5171,7 +5172,7 @@ BattleCommand4a: ; 35c0f and $3f jr z, .asm_35c91 ; 35c46 $49 push bc - call $34f8 + call GetMoveName call FarBattleRNG and $3 inc a @@ -5188,7 +5189,7 @@ BattleCommand4a: ; 35c0f ld [hl], a push af ld a, $17 - call $3951 + call OpponentPartyAttr ld d, b pop af pop bc @@ -7100,17 +7101,18 @@ BattleCommanda0: ; 36778 ; teleport ld a, [BattleType] - cp $7 ; BATTLE_SHINY + cp BATTLETYPE_SHINY jr z, .asm_367b9 - cp $9 ; ? + cp $9 jr z, .asm_367b9 - cp $b ; ? + cp $b jr z, .asm_367b9 - cp $c ; suicune + cp BATTLETYPE_SUICUNE jr z, .asm_367b9 + ld a, BATTLE_VARS_SUBSTATUS5_OPP call CleanGetBattleVarPair - bit 7, a + bit SUBSTATUS_CANT_RUN, a jr nz, .asm_367b9 ld a, [hBattleTurn] and a @@ -7169,7 +7171,7 @@ BattleCommanda0: ; 36778 call Function0x36804 call BattleCommand0a call Function0x37e36 - ld c, $14 + ld c, 20 call DelayFrames call Function0x36804 @@ -7191,13 +7193,13 @@ BattleCommand23: ; 3680f ; forceswitch ld a, [BattleType] - cp $7 + cp BATTLETYPE_SHINY jp z, .asm_36969 cp $9 jp z, .asm_36969 cp $b jp z, .asm_36969 - cp $c + cp BATTLETYPE_SUICUNE jp z, .asm_36969 ld a, [hBattleTurn] and a @@ -7455,7 +7457,7 @@ BattleCommand24: ; 369b6 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair bit 2, [hl] - jp nz, $6a43 + jp nz, .asm_36a43 set 2, [hl] ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarPair @@ -7521,6 +7523,8 @@ BattleCommand24: ; 369b6 .asm_36a3f ld a, $1 jr .asm_36a3a ; 36a41 $f7 + +.asm_36a43 ld a, [de] dec a ld [de], a @@ -8433,7 +8437,7 @@ BattleCommand33: ; 36f46 ld bc, $0006 add hl, bc ld [hl], $5 - call $34f8 + call GetMoveName call Function0x37e01 ld hl, LearnedMoveText jp FarBattleTextBox @@ -8550,7 +8554,7 @@ BattleCommand37: ; 36fed call CleanGetBattleVarPair ld [hl], a ld [$d265], a - call $34f8 + call GetMoveName ld hl, WasDisabledText jp FarBattleTextBox .asm_37059 @@ -8610,7 +8614,7 @@ BattleCommand1f: ; 3707f push hl push bc dec a - ld hl, $5afe + ld hl, Moves + PlayerMoveType - PlayerMoveStruct call GetMoveAttr ld [de], a inc de @@ -9176,7 +9180,7 @@ BattleCommand1b: ; 373c9 pop af dec a call GetMoveData - call $34f8 + call GetMoveName call $30d6 call Function0x34548 jr nz, .asm_37412 ; 37405 $b @@ -9443,7 +9447,7 @@ BattleCommand53: ; 37563 jr z, .asm_3757f ; 37576 $7 .asm_37578 ld a, $20 - call $3945 + call UserPartyAttr res 5, [hl] .asm_3757f call RefreshBattleHuds @@ -9967,11 +9971,11 @@ BattleCommand60: ; 3784b ld [$ffb6], a ld a, $a ld [$ffb7], a - call $3119 + call Multiply ld a, $19 ld [$ffb7], a ld b, $4 - call $3124 + call Divide ld a, [$ffb6] ld d, a pop bc @@ -10084,11 +10088,11 @@ BattleCommand63: ; 3790e ld [$ffb5], a ld a, $a ld [$ffb7], a - call $3119 + call Multiply ld a, $19 ld [$ffb7], a ld b, $4 - call $3124 + call Divide ld a, [$ffb6] ld d, a pop bc