diff options
-rw-r--r-- | battle/ai/scoring.asm | 16 | ||||
-rw-r--r-- | battle/anim_commands.asm | 8 | ||||
-rw-r--r-- | battle/core.asm | 74 | ||||
-rw-r--r-- | battle/effect_command_pointers.asm | 6 | ||||
-rw-r--r-- | battle/effect_commands.asm | 752 | ||||
-rw-r--r-- | battle/effects/curse.asm | 20 | ||||
-rw-r--r-- | battle/effects/metronome.asm | 6 | ||||
-rw-r--r-- | battle/effects/mirror_move.asm | 4 | ||||
-rw-r--r-- | battle/moves/move_effects.asm | 94 | ||||
-rw-r--r-- | constants/battle_constants.asm | 4 | ||||
-rw-r--r-- | engine/predef.asm | 2 | ||||
-rw-r--r-- | items/item_effects.asm | 8 | ||||
-rw-r--r-- | macros/move_effect.asm | 6 | ||||
-rw-r--r-- | wram.asm | 3 |
14 files changed, 510 insertions, 493 deletions
diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index 1b2da2f42..bd8ef20ca 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -176,7 +176,7 @@ AI_Types: ; 38635 push de ld a, 1 ld [hBattleTurn], a - callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callab BattleCheckTypeMatchup pop de pop bc pop hl @@ -431,7 +431,7 @@ AI_Smart_LeechHit: ; 387f7 push hl ld a, 1 ld [hBattleTurn], a - callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callab BattleCheckTypeMatchup pop hl ; 60% chance to discourage this move if not very effective. @@ -512,7 +512,7 @@ AI_Smart_LockOn: ; 3881d push hl push bc - callba HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callba BattleCheckTypeMatchup ld a, [wd265] cp $a pop bc @@ -1384,7 +1384,7 @@ AI_Smart_Mimic: ; 38ba8 ld a, $1 ld [hBattleTurn], a - callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callab BattleCheckTypeMatchup ld a, [wd265] cp $a @@ -1504,7 +1504,7 @@ AI_Smart_Encore: ; 38c3b push hl ld a, [wEnemyMoveStruct + MOVE_TYPE] ld hl, EnemyMonType1 - predef Function347d3 + predef CheckTypeMatchup pop hl ld a, [wd265] @@ -1830,7 +1830,7 @@ AI_Smart_Conversion2: ; 38d98 xor a ld [hBattleTurn], a - callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callab BattleCheckTypeMatchup ld a, [wd265] cp $a @@ -2496,7 +2496,7 @@ AI_Smart_HiddenPower: ; 3909e ; Calculate Hidden Power's type and base power based on enemy's DVs. callab HiddenPowerDamage - callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callab BattleCheckTypeMatchup pop hl ; Discourage Hidden Power if not very effective. @@ -3498,7 +3498,7 @@ AI_Status: ; 39453 push de ld a, 1 ld [hBattleTurn], a - callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callab BattleCheckTypeMatchup pop de pop bc pop hl diff --git a/battle/anim_commands.asm b/battle/anim_commands.asm index b6dff896c..96bd1c45b 100644 --- a/battle/anim_commands.asm +++ b/battle/anim_commands.asm @@ -498,7 +498,7 @@ endr ret BattleAnimCmd_EF: ; cc383 (33:4383) - ld hl, wc689 + ld hl, wKickCounter ld a, [hl] and a jr z, .asm_cc39a @@ -568,7 +568,7 @@ endr BattleAnimCmd_F8: ; cc3d6 (33:43d6) call GetBattleAnimByte - ld hl, wc689 + ld hl, wKickCounter cp [hl] jr z, .jump @@ -598,7 +598,7 @@ endr BattleAnimCmd_EE: ; cc3fa (33:43fa) call GetBattleAnimByte ld e, a - ld a, [wc689] + ld a, [wKickCounter] and e jr nz, .jump @@ -1150,7 +1150,7 @@ BattleAnimCmd_E6: ; cc776 (33:4776) ld a, [CurPartySpecies] ; CurPartySpecies push af - ld a, [wc689] + ld a, [wKickCounter] ld [CurPartySpecies], a ; CurPartySpecies ld a, [hBattleTurn] ; $ff00+$e4 diff --git a/battle/core.asm b/battle/core.asm index 18cb3c2fd..93a39d6d4 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -424,7 +424,7 @@ Function3c27c: ; 3c27c call GetItemName ld hl, BattleText_UsersStringBuffer1Activated call StdBattleTextBox - callab BattleCommand_StatMessageUser + callab BattleCommand_StatUpMessage pop af bit SUBSTATUS_CONFUSED, a ret nz @@ -1133,7 +1133,7 @@ ResidualDamage: ; 3c716 ld c, l .did_toxic - call Function3cc3f + call SubtractHPFromUser .did_psn_brn call HasUserFainted @@ -1155,7 +1155,7 @@ ResidualDamage: ; 3c716 call SwitchTurnCore call GetEighthMaxHP - call Function3cc3f + call SubtractHPFromUser ld a, $1 ld [hBGMapMode], a call Function3ccef @@ -1175,7 +1175,7 @@ ResidualDamage: ; 3c716 ld de, ANIM_IN_NIGHTMARE call Function3ee0f call GetQuarterMaxHP - call Function3cc3f + call SubtractHPFromUser ld hl, HasANightmareText call StdBattleTextBox .asm_3c7c5 @@ -1193,7 +1193,7 @@ ResidualDamage: ; 3c716 ld de, ANIM_IN_NIGHTMARE call Function3ee0f call GetQuarterMaxHP - call Function3cc3f + call SubtractHPFromUser ld hl, HurtByCurseText call StdBattleTextBox @@ -1334,7 +1334,7 @@ Function3c874: ; 3c874 .asm_3c8d3 call GetSixteenthMaxHP - call Function3cc3f + call SubtractHPFromUser ld hl, BattleText_UsersHurtByStringBuffer1 jr .asm_3c8e1 @@ -1827,7 +1827,7 @@ HandleWeather: ; 3cb9e call Call_PlayBattleAnim call SwitchTurnCore call GetEighthMaxHP - call Function3cc3f + call SubtractHPFromUser ld hl, SandstormHitsText jp StdBattleTextBox @@ -1863,19 +1863,19 @@ endr dw BattleText_TheSandstormSubsided ; 3cc39 -Function3cc39: ; 3cc39 - call Function3cc45 +SubtractHPFromTarget: ; 3cc39 + call SubtractHP jp Function3cd3c ; 3cc3f -Function3cc3f: ; 3cc3f +SubtractHPFromUser: ; 3cc3f ; Subtract HP from Pkmn - call Function3cc45 + call SubtractHP jp Function3cd36 ; 3cc45 -Function3cc45: ; 3cc45 +SubtractHP: ; 3cc45 ld hl, BattleMonHP ld a, [hBattleTurn] and a @@ -3480,7 +3480,7 @@ LookUpTheEffectivenessOfEveryMove: ; 3d5d7 ld a, BANK(Moves) call FarCopyBytes call SetEnemyTurn - callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callab BattleCheckTypeMatchup pop bc pop de pop hl @@ -3516,13 +3516,13 @@ IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618 ld a, [BattleMonType1] ld [wPlayerMoveStruct + MOVE_TYPE], a call SetPlayerTurn - callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callab BattleCheckTypeMatchup ld a, [wd265] cp 10 + 1 ; 1.0 + 0.1 jr nc, .asm_3d663 ld a, [BattleMonType2] ld [wPlayerMoveStruct + MOVE_TYPE], a - callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + callab BattleCheckTypeMatchup ld a, [wd265] cp 10 + 1 ; 1.0 + 0.1 jr nc, .asm_3d663 @@ -3749,7 +3749,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 xor a ld [wcfca], a - ld [wc689], a + ld [wKickCounter], a call SetEnemyTurn ld de, ANIM_SEND_OUT_MON call Call_PlayBattleAnim @@ -3757,7 +3757,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call BattleCheckEnemyShininess jr nc, .asm_3d800 ld a, 1 ; shiny anim - ld [wc689], a + ld [wKickCounter], a ld de, ANIM_SEND_OUT_MON call Call_PlayBattleAnim .asm_3d800 @@ -3811,8 +3811,8 @@ endr ; 3d867 ResetEnemyStatLevels: ; 3d867 - ld a, 7 - ld b, 8 + ld a, BASE_STAT_LEVEL + ld b, NUM_LEVEL_STATS ld hl, EnemyStatLevels .loop ld [hli], a @@ -4142,8 +4142,8 @@ GetEnemyMonDVs: ; 3da97 ; 3dab1 ResetPlayerStatLevels: ; 3dab1 - ld a, 7 - ld b, 8 + ld a, BASE_STAT_LEVEL + ld b, NUM_LEVEL_STATS ld hl, PlayerStatLevels .loop ld [hli], a @@ -4255,13 +4255,13 @@ Function3db5f: ; 3db5f call SetPlayerTurn xor a ld [wcfca], a - ld [wc689], a + ld [wKickCounter], a ld de, ANIM_SEND_OUT_MON call Call_PlayBattleAnim call BattleCheckPlayerShininess jr nc, .asm_3dbbc ld a, $1 - ld [wc689], a + ld [wKickCounter], a ld de, ANIM_SEND_OUT_MON call Call_PlayBattleAnim @@ -4351,7 +4351,7 @@ SpikesDamage: ; 3dc23 call StdBattleTextBox call GetEighthMaxHP - call Function3cc39 + call SubtractHPFromTarget pop hl call .hl @@ -4627,15 +4627,15 @@ Function3dde9: ; 3dde9 res SUBSTATUS_CONFUSED, [hl] .asm_3de26 - ld hl, Function365fd + ld hl, CalcEnemyStats ld a, [hBattleTurn] and a jr z, .asm_3de31 - ld hl, Function365d7 + ld hl, CalcPlayerStats .asm_3de31 call SwitchTurnCore - ld a, BANK(Function365fd) + ld a, BANK(CalcEnemyStats) rst FarCall call SwitchTurnCore call Function3ddc8 @@ -4761,7 +4761,7 @@ endr call GetItemName ld hl, BattleText_UsersStringBuffer1Activated call StdBattleTextBox - callab BattleCommand_StatMessageUser + callab BattleCommand_StatUpMessage ret .asm_3def9 @@ -6170,18 +6170,18 @@ Function3e7c1: ; 3e7c1 call SetEnemyTurn callab UpdateMoveData call CheckSubstatus_RechargeChargedRampageBideRollout - jr nz, .asm_3e894 + jr nz, .raging xor a ld [wc733], a -.asm_3e894 +.raging ld a, [wEnemyMoveStruct + MOVE_EFFECT] cp EFFECT_FURY_CUTTER - jr z, .asm_3e89f + jr z, .fury_cutter xor a ld [EnemyFuryCutterCount], a -.asm_3e89f +.fury_cutter ld a, [wEnemyMoveStruct + MOVE_EFFECT] cp EFFECT_RAGE jr z, .asm_3e8af @@ -6929,11 +6929,11 @@ Function3ec30: ; 3ec30 Function3ec31: ; 3ec31 ld [hBattleTurn], a - call Function3ec39 - jp Function3ec76 + call ApplyPrzEffectOnSpeed + jp ApplyBrnEffectOnAttack ; 3ec39 -Function3ec39: ; 3ec39 +ApplyPrzEffectOnSpeed: ; 3ec39 ld a, [hBattleTurn] and a jr z, .asm_3ec5a @@ -6979,7 +6979,7 @@ Function3ec39: ; 3ec39 ret ; 3ec76 -Function3ec76: ; 3ec76 +ApplyBrnEffectOnAttack: ; 3ec76 ld a, [hBattleTurn] and a jr z, .asm_3ec93 @@ -9547,7 +9547,7 @@ BattleStartMessage: ; 3fc8b ld a, 1 ld [hBattleTurn], a ld a, 1 - ld [wc689], a + ld [wKickCounter], a ld de, ANIM_SEND_OUT_MON call Call_PlayBattleAnim diff --git a/battle/effect_command_pointers.asm b/battle/effect_command_pointers.asm index 530578439..f355ffc83 100644 --- a/battle/effect_command_pointers.asm +++ b/battle/effect_command_pointers.asm @@ -11,7 +11,7 @@ BattleCommandPointers: ; 3fd28 dw BattleCommand_DamageVariation ; 34cfd dw BattleCommand_CheckHit ; 34d32 dw BattleCommand_LowerSub ; 34eee - dw BattleCommand0b ; 34f60 + dw BattleCommand_HitTargetNoSub ; 34f60 dw BattleCommand_RaiseSub ; 35004 dw BattleCommand_ResultText ; 35023 dw BattleCommand_CheckFaint ; 3505e @@ -140,8 +140,8 @@ BattleCommandPointers: ; 3fd28 dw BattleCommand_SpecialDefenseDown2 ; 362d9 dw BattleCommand_AccuracyDown2 ; 362dd dw BattleCommand_EvasionDown2 ; 362e1 - dw BattleCommand_StatMessageUser ; 363b8 - dw BattleCommand_StatMessageTarget ; 363e9 + dw BattleCommand_StatUpMessage ; 363b8 + dw BattleCommand_StatDownMessage ; 363e9 dw BattleCommand_StatUpFailText ; 3644c dw BattleCommand_StatDownFailText ; 3646a dw BattleCommand_EffectChance ; 34ecc diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index b782ee62c..2239385f3 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -133,7 +133,7 @@ BattleCommand_CheckTurn: ; 34084 xor a ld [AttackMissed], a ld [EffectFailed], a - ld [wc689], a + ld [wKickCounter], a ld [AlreadyDisobeyed], a ld [AlreadyFailed], a ld [wc73e], a @@ -635,7 +635,7 @@ MoveDisabled: ; 3438d ld a, BATTLE_VARS_MOVE call GetBattleVar - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetMoveName ld hl, DisabledMoveText @@ -1058,7 +1058,7 @@ BattleCommand_DoTurn: ; 34555 and 1 << SUBSTATUS_IN_LOOP | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE ret nz - call .asm_345ad + call .consume_pp ld a, b and a jp nz, EndMoveEffect @@ -1077,24 +1077,24 @@ endr ld hl, PartyMon1PP ld a, [CurBattleMon] - jr z, .asm_345a4 + jr z, .player ; skip this part entirely if wildbattle ld a, [wBattleMode] dec a - jr z, .asm_345c5 + jr z, .wild ld hl, OTPartyMon1PP ld a, [CurOTMon] -.asm_345a4 +.player call GetPartyLocation push hl call Function3460b pop hl ret c -.asm_345ad +.consume_pp ld a, [hBattleTurn] and a ld a, [CurMoveNum] @@ -1112,7 +1112,7 @@ endr ld b, 0 ret -.asm_345c5 +.wild ld hl, EnemyMonMoves ld a, [CurEnemyMoveNum] ld c, a @@ -1129,7 +1129,7 @@ endr .mimic ld hl, wCaughtMonPP - call .asm_345ad + call .consume_pp ret .asm_345e3 @@ -1169,10 +1169,10 @@ Function3460b: ; 3460b ld a, [hBattleTurn] and a ld a, [CurMoveNum] - jr z, .asm_34616 + jr z, .player ld a, [CurEnemyMoveNum] -.asm_34616 +.player ld c, a ld a, 2 call UserPartyAttr @@ -1300,7 +1300,7 @@ endr BattleCommand_TripleKick: ; 346b2 ; triplekick - ld a, [wc689] + ld a, [wKickCounter] ld b, a inc b ld hl, CurDamage + 1 @@ -1308,7 +1308,7 @@ BattleCommand_TripleKick: ; 346b2 ld e, a ld a, [hli] ld d, a -.asm_346be +.next_kick dec b ret z ld a, [hl] @@ -1319,7 +1319,7 @@ BattleCommand_TripleKick: ; 346b2 ld [hli], a ; No overflow. - jr nc, .asm_346be + jr nc, .next_kick ld a, $ff ld [hld], a ld [hl], a @@ -1330,7 +1330,7 @@ BattleCommand_TripleKick: ; 346b2 BattleCommand_KickCounter: ; 346cd ; kickcounter - ld hl, wc689 + ld hl, wKickCounter inc [hl] ret ; 346d2 @@ -1368,7 +1368,7 @@ BattleCommand_Stab: ; 346d2 .go ld a, BATTLE_VARS_MOVE_TYPE call GetBattleVarAddr - ld [wd265], a + ld [wTypeMatchup], a push hl push de @@ -1384,7 +1384,7 @@ BattleCommand_Stab: ; 346d2 pop bc pop de - ld a, [wd265] + ld a, [wTypeMatchup] cp b jr z, .stab cp c @@ -1512,29 +1512,29 @@ endr jr .TypesLoop .end - call HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn - ld a, [wd265] + call BattleCheckTypeMatchup + ld a, [wTypeMatchup] ld b, a ld a, [TypeModifier] - and $80 + and %10000000 or b ld [TypeModifier], a ret ; 347c8 -HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn: ; 347c8 +BattleCheckTypeMatchup: ; 347c8 ld hl, EnemyMonType1 ld a, [hBattleTurn] and a - jr z, Function347d3 + jr z, CheckTypeMatchup ld hl, BattleMonType1 ; fallthrough ; 347d3 -Function347d3: ; 347d3 +CheckTypeMatchup: ; 347d3 push hl push de push bc @@ -1545,7 +1545,7 @@ Function347d3: ; 347d3 inc hl ld c, [hl] ld a, 10 ; 1.0 - ld [wd265], a + ld [wTypeMatchup], a ld hl, TypeMatchup .TypesLoop ld a, [hli] @@ -1579,7 +1579,7 @@ Function347d3: ; 347d3 ld [hMultiplicand + 1], a ld a, [hli] ld [hMultiplicand + 2], a - ld a, [wd265] + ld a, [wTypeMatchup] ld [hMultiplier], a call Multiply ld a, 10 @@ -1589,7 +1589,7 @@ Function347d3: ; 347d3 call Divide pop bc ld a, [hQuotient + 2] - ld [wd265], a + ld [wTypeMatchup], a jr .TypesLoop .End @@ -1601,8 +1601,8 @@ Function347d3: ; 347d3 BattleCommanda3: ; 34833 - call HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn - ld a, [wd265] + call BattleCheckTypeMatchup + ld a, [wTypeMatchup] and a ld a, 10 ; 1.0 jr nz, .skip @@ -1612,8 +1612,9 @@ BattleCommanda3: ; 34833 inc a ld [AttackMissed], a ret + .skip - ld [wd265], a + ld [wTypeMatchup], a ret ; 3484e @@ -1645,8 +1646,8 @@ Function3484e: ; 3484e inc hl call GetMoveByte ld hl, EnemyMonType - call Function347d3 - ld a, [wd265] + call CheckTypeMatchup + ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr nc, .super_effective and a @@ -1690,8 +1691,8 @@ Function3484e: ; 3484e ld a, [BattleMonType1] ld b, a ld hl, EnemyMonType1 - call Function347d3 - ld a, [wd265] + call CheckTypeMatchup + ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok call Function34931 @@ -1699,8 +1700,8 @@ Function3484e: ; 3484e ld a, [BattleMonType2] cp b jr z, .ok2 - call Function347d3 - ld a, [wd265] + call CheckTypeMatchup + ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok2 call Function34931 @@ -1720,7 +1721,7 @@ Function348de: ; 348de ld b, NUM_MOVES + 1 ld c, 0 - ld a, [wd265] + ld a, [wTypeMatchup] push af .loop dec b @@ -1740,9 +1741,9 @@ Function348de: ; 348de inc hl call GetMoveByte ld hl, BattleMonType1 - call Function347d3 + call CheckTypeMatchup - ld a, [wd265] + ld a, [wTypeMatchup] ; immune and a jr z, .loop @@ -1765,7 +1766,7 @@ endr .exit pop af - ld [wd265], a + ld [wTypeMatchup], a ld a, c and a @@ -2008,8 +2009,8 @@ Function34a2a: ; 34a2a inc hl call GetMoveByte ld hl, BaseType - call Function347d3 - ld a, [wd265] + call CheckTypeMatchup + ld a, [wTypeMatchup] and a jr nz, .asm_34a77 @@ -2098,8 +2099,8 @@ Function34aa7: ; 34aa7 inc hl call GetMoveByte ld hl, BattleMonType1 - call Function347d3 - ld a, [wd265] + call CheckTypeMatchup + ld a, [wTypeMatchup] cp 10 jr c, .asm_34ae9 @@ -2195,16 +2196,16 @@ Function34b20: ; 34b20 .asm_34b4a ld a, [BattleMonType1] ld hl, BaseType - call Function347d3 - ld a, [wd265] + call CheckTypeMatchup + ld a, [wTypeMatchup] cp $b jr nc, .asm_34b6d ld a, [BattleMonType2] .asm_34b5d ld hl, BaseType - call Function347d3 - ld a, [wd265] + call CheckTypeMatchup + ld a, [wTypeMatchup] cp $b jr nc, .asm_34b6d @@ -2732,9 +2733,9 @@ BattleCommand_LowerSub: ; 34eee ld [wcfca], a ld [FXAnimIDHi], a inc a - ld [wc689], a + ld [wKickCounter], a ld a, SUBSTITUTE - jp Function37e44 + jp PlayMoveAnim_KeepHiID .asm_34f36 call BattleCommanda7 @@ -2764,12 +2765,12 @@ BattleCommand_LowerSub: ; 34eee BattleCommand_HitTarget: ; 34f57 ; hittarget call BattleCommand_LowerSub - call BattleCommand0b + call BattleCommand_HitTargetNoSub jp BattleCommand_RaiseSub ; 34f60 -BattleCommand0b: ; 34f60 +BattleCommand_HitTargetNoSub: ; 34f60 ld a, [AttackMissed] and a jp nz, BattleCommand_MoveDelay @@ -2797,7 +2798,7 @@ BattleCommand0b: ; 34f60 cp EFFECT_TRIPLE_KICK jr z, .triplekick xor a - ld [wc689], a + ld [wKickCounter], a .triplekick @@ -2818,10 +2819,10 @@ BattleCommand0b: ; 34f60 ; clear sprite jp Function37ec7 .multihit_conversion_doublehit_twineedle - ld a, [wc689] + ld a, [wKickCounter] and 1 xor 1 - ld [wc689], a + ld [wKickCounter], a ld a, [de] cp $1 push af @@ -2865,7 +2866,7 @@ BattleCommand_StatDownAnim: ; 34fdb BattleCommand_StatUpDownAnim: ; 34feb ld [wcfca], a xor a - ld [wc689], a + ld [wKickCounter], a ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld e, a @@ -2899,9 +2900,9 @@ BattleCommand_RaiseSub: ; 35004 ld [wcfca], a ld [FXAnimIDHi], a ld a, $2 - ld [wc689], a + ld [wKickCounter], a ld a, SUBSTITUTE - jp Function37e44 + jp PlayMoveAnim_KeepHiID ; 35023 @@ -2998,7 +2999,7 @@ BattleCommand_CheckFaint: ; 3505e .asm_350ab call GetOpponentItem ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, HungOnText @@ -3085,8 +3086,8 @@ Function350e4: ; 350e4 ld hl, CrashedText call StdBattleTextBox ld a, $1 - ld [wc689], a - call Function37e36 + ld [wKickCounter], a + call PlayPlayerMoveAnim_ClearHiID ld c, $1 ld a, [hBattleTurn] and a @@ -3252,9 +3253,9 @@ BattleCommand_CheckDestinyBond: ; 351c0 ld [wcfca], a ld [FXAnimIDHi], a inc a - ld [wc689], a - ld a, $c2 - call Function37e44 + ld [wKickCounter], a + ld a, DESTINY_BOND + call PlayMoveAnim_KeepHiID call BattleCommand_SwitchTurn jr .asm_3524d ; 3522f $1c @@ -3750,44 +3751,47 @@ BattleCommand_BeatUp: ; 35461 call ResetDamage ld a, [hBattleTurn] and a - jp nz, .asm_354ef + jp nz, .enemy_beats_up ld a, [PlayerSubStatus3] bit SUBSTATUS_IN_LOOP, a - jr nz, .asm_35482 + jr nz, .next_mon ld c, 20 call DelayFrames xor a ld [PlayerRolloutCount], a ld [DefaultFlypoint], a ld [wc72d], a - jr .asm_3548d -.asm_35482 + jr .got_mon + +.next_mon ld a, [PlayerRolloutCount] ld b, a ld a, [PartyCount] sub b ld [DefaultFlypoint], a -.asm_3548d + +.got_mon ld a, [DefaultFlypoint] ld hl, PartyMonNicknames call GetNick - ld a, $22 - call Function355bd + ld a, MON_HP + call GetBeatupMonLocation ld a, [hli] or [hl] - jp z, Function355b0 + jp z, .beatup_fail ; fainted ld a, [DefaultFlypoint] ld c, a ld a, [CurBattleMon] cp [hl] ld hl, BattleMonStatus - jr z, .asm_354b2 - ld a, $20 - call Function355bd -.asm_354b2 + jr z, .active_mon + ld a, MON_STATUS + call GetBeatupMonLocation +.active_mon ld a, [hl] and a - jp nz, Function355b0 + jp nz, .beatup_fail + ld a, $1 ld [wc72d], a ld hl, BeatUpAttackText @@ -3798,8 +3802,8 @@ BattleCommand_BeatUp: ; 35461 ld a, [BaseDefense] ld c, a push bc - ld a, $0 - call Function355bd + ld a, MON_SPECIES + call GetBeatupMonLocation ld a, [hl] ld [CurSpecies], a call GetBaseData @@ -3807,8 +3811,8 @@ BattleCommand_BeatUp: ; 35461 pop bc ld b, a push bc - ld a, $1f - call Function355bd + ld a, MON_LEVEL + call GetBeatupMonLocation ld a, [hl] ld e, a pop bc @@ -3816,35 +3820,35 @@ BattleCommand_BeatUp: ; 35461 ld d, a ret -.asm_354ef +.enemy_beats_up ld a, [EnemySubStatus3] bit SUBSTATUS_IN_LOOP, a - jr nz, .asm_35502 + jr nz, .not_first_enemy_beatup xor a ld [EnemyRolloutCount], a ld [DefaultFlypoint], a ld [wc72d], a - jr .asm_3550d + jr .enemy_continue -.asm_35502 +.not_first_enemy_beatup ld a, [EnemyRolloutCount] ld b, a ld a, [OTPartyCount] sub b ld [DefaultFlypoint], a -.asm_3550d +.enemy_continue ld a, [wBattleMode] dec a - jr z, .asm_3556b + jr z, .wild ld a, [wLinkMode] and a - jr nz, .asm_35532 + jr nz, .link_or_tower ld a, [InBattleTowerBattle] and a - jr nz, .asm_35532 + jr nz, .link_or_tower ld a, [DefaultFlypoint] ld c, a @@ -3852,49 +3856,50 @@ BattleCommand_BeatUp: ; 35461 ld hl, OTPartySpecies add hl, bc ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName - jr .asm_35544 + jr .got_enemy_nick -.asm_35532 +.link_or_tower ld a, [DefaultFlypoint] ld hl, OTPartyMonNicknames ld bc, NAME_LENGTH call AddNTimes ld de, StringBuffer1 call CopyBytes -.asm_35544 - ld a, $22 - call Function355bd +.got_enemy_nick + ld a, MON_HP + call GetBeatupMonLocation ld a, [hli] or [hl] - jp z, Function355b0 + jp z, .beatup_fail ld a, [DefaultFlypoint] ld b, a ld a, [CurOTMon] cp b ld hl, EnemyMonStatus - jr z, .asm_35560 + jr z, .active_enemy - ld a, $20 - call Function355bd -.asm_35560 + ld a, MON_STATUS + call GetBeatupMonLocation +.active_enemy ld a, [hl] and a - jr nz, Function355b0 + jr nz, .beatup_fail ld a, $1 ld [wc72d], a - jr .asm_3557d + jr .finish_beatup -.asm_3556b +.wild ld a, [EnemyMonSpecies] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, BeatUpAttackText call StdBattleTextBox jp EnemyAttackDamage -.asm_3557d + +.finish_beatup ld hl, BeatUpAttackText call StdBattleTextBox ld a, [BattleMonSpecies] @@ -3903,8 +3908,8 @@ BattleCommand_BeatUp: ; 35461 ld a, [BaseDefense] ld c, a push bc - ld a, $0 - call Function355bd + ld a, MON_SPECIES + call GetBeatupMonLocation ld a, [hl] ld [CurSpecies], a call GetBaseData @@ -3912,8 +3917,8 @@ BattleCommand_BeatUp: ; 35461 pop bc ld b, a push bc - ld a, $1f - call Function355bd + ld a, MON_LEVEL + call GetBeatupMonLocation ld a, [hl] ld e, a pop bc @@ -3923,7 +3928,7 @@ BattleCommand_BeatUp: ; 35461 ; 355b0 -Function355b0: ; 355b0 +.beatup_fail: ; 355b0 ld b, buildopponentrage_command jp SkipToBattleCommand ; 355b5 @@ -3938,7 +3943,7 @@ BattleCommanda8: ; 355b5 ; 355bd -Function355bd: ; 355bd +GetBeatupMonLocation: ; 355bd push bc ld c, a ld b, 0 @@ -4445,7 +4450,7 @@ BattleCommand_Counter: ; 35813 ret z call BattleCommanda3 - ld a, [wd265] + ld a, [wTypeMatchup] and a ret z @@ -4775,18 +4780,18 @@ BattleCommand_Conversion2: ; 359e6 push hl ld a, d ld [hl], a - call HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn + call BattleCheckTypeMatchup pop hl pop af ld [hl], a pop hl - ld a, [wd265] - cp $a + ld a, [wTypeMatchup] + cp 10 jr nc, .asm_35a13 call BattleCommand_SwitchTurn ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a predef GetTypeName ld hl, TransformedTypeText jp StdBattleTextBox @@ -4852,7 +4857,7 @@ BattleCommand_Sketch: ; 35a74 .asm_35aa5 ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar - ld [wd265], a + ld [wTypeMatchup], a ld b, a and a jr z, .asm_35b10 @@ -5009,13 +5014,13 @@ BattleCommand_SleepTalk: ; 35b33 ld [hl], a call Function34548 jr nz, .asm_35b9a - ld a, [wc689] + ld a, [wKickCounter] push af call BattleCommand_LowerSub pop af - ld [wc689], a + ld [wKickCounter], a .asm_35b9a - call Function37e36 + call PlayPlayerMoveAnim_ClearHiID call UpdateMoveData jp ResetTurn .asm_35ba3 @@ -5138,7 +5143,7 @@ BattleCommand_Spite: ; 35c0f ld a, [hli] cp b jr nz, .asm_35c33 - ld [wd265], a + ld [wTypeMatchup], a dec hl ld b, 0 push bc @@ -5192,7 +5197,7 @@ endr call AnimateCurrentMove pop de ld a, d - ld [wd265], a + ld [wTypeMatchup], a ld hl, SpiteEffectText jp StdBattleTextBox .asm_35c91 @@ -5276,8 +5281,8 @@ BattleCommand_HealBell: ; 35cc9 ld a, [hBattleTurn] and a - jp z, Function365d7 - jp Function365fd + jp z, CalcPlayerStats + jp CalcEnemyStats ; 35d00 @@ -5495,8 +5500,8 @@ UpdateMoveData: ; 35e40 ld a, BATTLE_VARS_MOVE call GetBattleVar - ld [CurSpecies], a ; not CurSpecies - ld [wd265], a + ld [CurMove], a + ld [wNamedObjectIndexBuffer], a dec a call GetMoveData @@ -5514,7 +5519,7 @@ BattleCommand_SleepTarget: ; 35e5c jr nz, .asm_35e70 ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, ProtectedByText jr .asm_35ec6 @@ -5633,7 +5638,7 @@ BattleCommand_PoisonTarget: ; 35eee ret nz call Function35ff5 ld de, ANIM_PSN - call Function37e54 + call PlayOpponentBattleAnim call RefreshBattleHuds ld hl, WasPoisonedText @@ -5667,7 +5672,7 @@ BattleCommand_Poison: ; 35f2c cp HELD_PREVENT_POISON jr nz, .asm_35f5f ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, ProtectedByText jr .asm_35fb8 @@ -5909,10 +5914,10 @@ BattleCommand_BurnTarget: ; 3608c call GetBattleVarAddr set BRN, [hl] call UpdateOpponentInParty - ld hl, Function3ec76 + ld hl, ApplyBrnEffectOnAttack call CallBattleCore ld de, ANIM_BRN - call Function37e54 + call PlayOpponentBattleAnim call RefreshBattleHuds ld hl, WasBurnedText @@ -5983,7 +5988,7 @@ BattleCommand_FreezeTarget: ; 36102 set FRZ, [hl] call UpdateOpponentInParty ld de, ANIM_FRZ - call Function37e54 + call PlayOpponentBattleAnim call RefreshBattleHuds ld hl, WasFrozenText @@ -6031,10 +6036,10 @@ BattleCommand_ParalyzeTarget: ; 36165 call GetBattleVarAddr set PAR, [hl] call UpdateOpponentInParty - ld hl, Function3ec39 + ld hl, ApplyPrzEffectOnSpeed call CallBattleCore ld de, ANIM_PAR - call Function37e54 + call PlayOpponentBattleAnim call RefreshBattleHuds call PrintParalyze ld hl, Function3dde9 @@ -6044,59 +6049,59 @@ BattleCommand_ParalyzeTarget: ; 36165 BattleCommand_AttackUp: ; 361ac ; attackup - ld b, $0 + ld b, ATTACK jr BattleCommand_StatUp BattleCommand_DefenseUp: ; 361b0 ; defenseup - ld b, $1 + ld b, DEFENSE jr BattleCommand_StatUp BattleCommand_SpeedUp: ; 361b4 ; speedup - ld b, $2 + ld b, SPEED jr BattleCommand_StatUp BattleCommand_SpecialAttackUp: ; 361b8 ; specialattackup - ld b, $3 + ld b, SP_ATTACK jr BattleCommand_StatUp BattleCommand_SpecialDefenseUp: ; 361bc ; specialdefenseup - ld b, $4 + ld b, SP_DEFENSE jr BattleCommand_StatUp BattleCommand_AccuracyUp: ; 361c0 ; accuracyup - ld b, $5 + ld b, ACCURACY jr BattleCommand_StatUp BattleCommand_EvasionUp: ; 361c4 ; evasionup - ld b, $6 + ld b, EVASION jr BattleCommand_StatUp BattleCommand_AttackUp2: ; 361c8 ; attackup2 - ld b, $10 + ld b, $10 | ATTACK jr BattleCommand_StatUp BattleCommand_DefenseUp2: ; 361cc ; defenseup2 - ld b, $11 + ld b, $10 | DEFENSE jr BattleCommand_StatUp BattleCommand_SpeedUp2: ; 361d0 ; speedup2 - ld b, $12 + ld b, $10 | SPEED jr BattleCommand_StatUp BattleCommand_SpecialAttackUp2: ; 361d4 ; specialattackup2 - ld b, $13 + ld b, $10 | SP_ATTACK jr BattleCommand_StatUp BattleCommand_SpecialDefenseUp2: ; 361d8 ; specialdefenseup2 - ld b, $14 + ld b, $10 | SP_DEFENSE jr BattleCommand_StatUp BattleCommand_AccuracyUp2: ; 361dc ; accuracyup2 - ld b, $15 + ld b, $10 | ACCURACY jr BattleCommand_StatUp BattleCommand_EvasionUp2: ; 361e0 ; evasionup2 - ld b, $16 + ld b, $10 | EVASION jr BattleCommand_StatUp BattleCommand_StatUp: ; 361e4 ; statup @@ -6114,15 +6119,15 @@ CheckIfStatCanBeRaised: ; 361ef ld hl, PlayerStatLevels ld a, [hBattleTurn] and a - jr z, .asm_361fe ; 0x361f9 $3 + jr z, .got_stat_levels ; 0x361f9 $3 ld hl, EnemyStatLevels -.asm_361fe +.got_stat_levels ld a, [AttackMissed] and a - jp nz, Function3627b + jp nz, .stat_raise_failed ld a, [EffectFailed] and a - jp nz, Function3627b + jp nz, .stat_raise_failed ld a, [LoweredStat] and $f ld c, a @@ -6132,29 +6137,29 @@ CheckIfStatCanBeRaised: ; 361ef inc b ld a, $d cp b - jp c, Function36270 + jp c, .cant_raise_stat ld a, [LoweredStat] and $f0 - jr z, .asm_3622b ; 0x36222 $7 + jr z, .got_num_stages ; 0x36222 $7 inc b ld a, $d cp b - jr nc, .asm_3622b ; 0x36228 $1 + jr nc, .got_num_stages ; 0x36228 $1 ld b, a -.asm_3622b +.got_num_stages ld [hl], b push hl ld a, c cp $5 - jr nc, .asm_36268 ; 0x36230 $36 + jr nc, .done_calcing_stats ; 0x36230 $36 ld hl, BattleMonStats + 1 ld de, PlayerStats ld a, [hBattleTurn] and a - jr z, .asm_36243 ; 0x3623b $6 + jr z, .got_stats_pointer ; 0x3623b $6 ld hl, EnemyMonStats + 1 ld de, EnemyStats -.asm_36243 +.got_stats_pointer push bc sla c ld b, 0 @@ -6162,25 +6167,25 @@ CheckIfStatCanBeRaised: ; 361ef ld a, c add e ld e, a - jr nc, .asm_3624f ; 0x3624c $1 + jr nc, .no_carry ; 0x3624c $1 inc d -.asm_3624f +.no_carry pop bc ld a, [hld] sub 999 % $100 - jr nz, .asm_3625b ; 0x36253 $6 + jr nz, .not_already_max ; 0x36253 $6 ld a, [hl] sbc 999 / $100 - jp z, Function3626e -.asm_3625b + jp z, .stats_already_max +.not_already_max ld a, [hBattleTurn] and a - jr z, .asm_36265 ; 0x3625e $5 - call Function365fd - jr .asm_36268 ; 0x36263 $3 -.asm_36265 - call Function365d7 -.asm_36268 + jr z, .calc_player_stats ; 0x3625e $5 + call CalcEnemyStats + jr .done_calcing_stats ; 0x36263 $3 +.calc_player_stats + call CalcPlayerStats +.done_calcing_stats pop hl xor a ld [FailedMessage], a @@ -6188,14 +6193,14 @@ CheckIfStatCanBeRaised: ; 361ef ; 3626e -Function3626e: ; 3626e +.stats_already_max: ; 3626e pop hl dec [hl] ; fallthrough ; 36270 -Function36270: ; 36270 +.cant_raise_stat: ; 36270 ld a, $2 ld [FailedMessage], a ld a, $1 @@ -6204,7 +6209,7 @@ Function36270: ; 36270 ; 3627b -Function3627b: ; 3627b +.stat_raise_failed: ; 3627b ld a, $1 ld [FailedMessage], a ret @@ -6216,18 +6221,20 @@ Function36281: ; 36281 ld hl, Function3f447 ld a, [hBattleTurn] and a - jr z, .asm_36292 ; 0x3628a $6 + jr z, .do_player ; 0x3628a $6 ld bc, wc6fa ld hl, Function3f486 -.asm_36292 +.do_player ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar cp MINIMIZE ret nz + ld a, $1 ld [bc], a call Function37ed5 ret nc + xor a ld [$ffd4], a call CallBattleCore @@ -6297,7 +6304,7 @@ BattleCommand_StatDown: ; 362e3 ld [LoweredStat], a - call Function36391 + call CheckMist jp nz, .Mist ld hl, EnemyStatLevels @@ -6380,11 +6387,11 @@ BattleCommand_StatDown: ; 362e3 ld de, EnemyStats ld a, [hBattleTurn] and a - jr z, .asm_36366 + jr z, .do_enemy ld hl, BattleMonAttack + 1 ld de, PlayerStats -.asm_36366 - call Function3641a +.do_enemy + call TryLowerStat pop hl jr z, .CouldntLower @@ -6417,25 +6424,26 @@ BattleCommand_StatDown: ; 362e3 ; 36391 -Function36391: ; 36391 +CheckMist: ; 36391 ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_ATTACK_DOWN - jr c, .asm_363ae + jr c, .dont_check_mist cp EFFECT_EVASION_DOWN + 1 - jr c, .asm_363b0 + jr c, .check_mist cp EFFECT_ATTACK_DOWN_2 - jr c, .asm_363ae + jr c, .dont_check_mist cp EFFECT_EVASION_DOWN_2 + 1 - jr c, .asm_363b0 + jr c, .check_mist cp EFFECT_ATTACK_DOWN_HIT - jr c, .asm_363ae + jr c, .dont_check_mist cp EFFECT_EVASION_DOWN_HIT + 1 - jr c, .asm_363b0 -.asm_363ae + jr c, .check_mist +.dont_check_mist xor a ret -.asm_363b0 + +.check_mist ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar bit SUBSTATUS_MIST, a @@ -6443,7 +6451,7 @@ Function36391: ; 36391 ; 363b8 -BattleCommand_StatMessageUser: ; 363b8 +BattleCommand_StatUpMessage: ; 363b8 ld a, [FailedMessage] and a ret nz @@ -6477,7 +6485,7 @@ BattleCommand_StatMessageUser: ; 363b8 ; 363e9 -BattleCommand_StatMessageTarget: ; 363e9 +BattleCommand_StatDownMessage: ; 363e9 ld a, [FailedMessage] and a ret nz @@ -6510,7 +6518,7 @@ BattleCommand_StatMessageTarget: ; 363e9 ; 3641a -Function3641a: ; 3641a +TryLowerStat: ; 3641a ; Lower stat c from stat struct hl (buffer de). push bc @@ -6521,32 +6529,32 @@ Function3641a: ; 3641a ld a, c add e ld e, a - jr nc, .asm_36426 + jr nc, .no_carry inc d -.asm_36426 +.no_carry pop bc ; The lowest possible stat is 1. ld a, [hld] sub 1 - jr nz, .asm_3642f + jr nz, .not_min ld a, [hl] and a ret z -.asm_3642f +.not_min ld a, [hBattleTurn] and a jr z, .Player call BattleCommand_SwitchTurn - call Function365d7 + call CalcPlayerStats call BattleCommand_SwitchTurn jr .end .Player call BattleCommand_SwitchTurn - call Function365fd + call CalcEnemyStats call BattleCommand_SwitchTurn .end ld a, 1 @@ -6626,24 +6634,20 @@ GetStatName: ; 3648f ; 364e6 -Table0x364e6: ; 364e6 - db 25, 100 - db 28, 100 - db 33, 100 - db 40, 100 - db 50, 100 - db 66, 100 -; 364f2 - - -StatLevelMulipliers: ; 364f2 - db 1, 1 ; 1.0x - db 15, 10 ; 1.5x - db 2, 1 ; 2.0x - db 25, 10 ; 2.5x - db 3, 1 ; 3.0x - db 35, 10 ; 3.5x - db 4, 1 ; 4.0x +StatLevelMultipliers: ; 364e6 + db 25, 100 ; 0.25x + db 28, 100 ; 0.28x + db 33, 100 ; 0.33x + db 40, 100 ; 0.40x + db 50, 100 ; 0.50x + db 66, 100 ; 0.66x + db 1, 1 ; 1.00x + db 15, 10 ; 1.50x + db 2, 1 ; 2.00x + db 25, 10 ; 2.50x + db 3, 1 ; 3.00x + db 35, 10 ; 3.50x + db 4, 1 ; 4.00x ; 36500 @@ -6653,27 +6657,27 @@ BattleCommand_AllStatsUp: ; 36500 ; Attack call ResetMiss call BattleCommand_AttackUp - call BattleCommand_StatMessageUser + call BattleCommand_StatUpMessage ; Defense call ResetMiss call BattleCommand_DefenseUp - call BattleCommand_StatMessageUser + call BattleCommand_StatUpMessage ; Speed call ResetMiss call BattleCommand_SpeedUp - call BattleCommand_StatMessageUser + call BattleCommand_StatUpMessage ; Special Attack call ResetMiss call BattleCommand_SpecialAttackUp - call BattleCommand_StatMessageUser + call BattleCommand_StatUpMessage ; Special Defense call ResetMiss call BattleCommand_SpecialDefenseUp - jp BattleCommand_StatMessageUser + jp BattleCommand_StatUpMessage ; 3652d @@ -6684,16 +6688,16 @@ ResetMiss: ; 3652d ; 36532 -Function36532: ; 36532 +LowerStat: ; 36532 ld [LoweredStat], a ld hl, PlayerStatLevels ld a, [hBattleTurn] and a - jr z, .asm_36540 + jr z, .got_target ld hl, EnemyStatLevels -.asm_36540 +.got_target ld a, [LoweredStat] and $f ld c, a @@ -6701,56 +6705,56 @@ Function36532: ; 36532 add hl, bc ld b, [hl] dec b - jr z, .asm_36589 + jr z, .cant_lower_anymore ld a, [LoweredStat] and $f0 - jr z, .asm_36558 + jr z, .got_num_stages dec b - jr nz, .asm_36558 + jr nz, .got_num_stages inc b -.asm_36558 +.got_num_stages ld [hl], b ld a, c cp 5 - jr nc, .asm_36576 + jr nc, .accuracy_evasion push hl ld hl, BattleMonStats + 1 ld de, PlayerStats ld a, [hBattleTurn] and a - jr z, .asm_36570 + jr z, .got_target_2 ld hl, EnemyMonStats + 1 ld de, EnemyStats -.asm_36570 - call Function3641a +.got_target_2 + call TryLowerStat pop hl - jr z, .asm_36588 + jr z, .failed -.asm_36576 +.accuracy_evasion ld a, [hBattleTurn] and a - jr z, .asm_36580 + jr z, .player - call Function365fd + call CalcEnemyStats - jr .asm_36583 + jr .finish -.asm_36580 - call Function365d7 +.player + call CalcPlayerStats -.asm_36583 +.finish xor a ld [FailedMessage], a ret -.asm_36588 +.failed inc [hl] -.asm_36589 +.cant_lower_anymore ld a, 2 ld [FailedMessage], a ret @@ -6817,51 +6821,51 @@ BattleCommanda7: ; 365c3 ; 365d7 -Function365d7: ; 365d7 +CalcPlayerStats: ; 365d7 ld hl, PlayerAtkLevel ld de, PlayerStats ld bc, BattleMonAttack - ld a, $5 - call Function3661d + ld a, 5 + call CalcStats ld hl, BadgeStatBoosts call CallBattleCore call BattleCommand_SwitchTurn - ld hl, Function3ec39 + ld hl, ApplyPrzEffectOnSpeed call CallBattleCore - ld hl, Function3ec76 + ld hl, ApplyBrnEffectOnAttack call CallBattleCore jp BattleCommand_SwitchTurn ; 365fd -Function365fd: ; 365fd +CalcEnemyStats: ; 365fd ld hl, EnemyAtkLevel ld de, EnemyStats ld bc, EnemyMonAttack - ld a, $5 - call Function3661d + ld a, 5 + call CalcStats call BattleCommand_SwitchTurn - ld hl, Function3ec39 + ld hl, ApplyPrzEffectOnSpeed call CallBattleCore - ld hl, Function3ec76 + ld hl, ApplyBrnEffectOnAttack call CallBattleCore jp BattleCommand_SwitchTurn ; 3661d -Function3661d: ; 3661d -.asm_3661d +CalcStats: ; 3661d +.loop push af ld a, [hli] push hl @@ -6870,7 +6874,7 @@ Function3661d: ; 3661d ld c, a dec c ld b, 0 - ld hl, Table0x364e6 + ld hl, StatLevelMultipliers rept 2 add hl, bc endr @@ -6897,25 +6901,25 @@ endr ld b, a ld a, [hQuotient + 2] or b - jr nz, .asm_36651 + jr nz, .check_maxed_out ld a, 1 ld [hQuotient + 2], a - jr .asm_36662 + jr .not_maxed_out -.asm_36651 +.check_maxed_out ld a, [hQuotient + 2] cp 999 % $100 ld a, b sbc 999 / $100 - jr c, .asm_36662 + jr c, .not_maxed_out ld a, 999 % $100 ld [$ffb6], a ld a, 999 / $100 ld [$ffb5], a -.asm_36662 +.not_maxed_out pop bc ld a, [$ffb5] ld [bc], a @@ -6926,7 +6930,7 @@ endr pop hl pop af dec a - jr nz, .asm_3661d + jr nz, .loop ret ; 36671 @@ -6943,11 +6947,11 @@ BattleCommand_StoreEnergy: ; 36671 ld hl, PlayerRolloutCount ld a, [hBattleTurn] and a - jr z, .asm_36684 + jr z, .check_still_storing_energy ld hl, EnemyRolloutCount -.asm_36684 +.check_still_storing_energy dec [hl] - jr nz, .asm_366dc + jr nz, .still_storing ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr @@ -6961,13 +6965,13 @@ BattleCommand_StoreEnergy: ; 36671 ld a, 1 ld [hl], a ld hl, PlayerDamageTaken + 1 - ld de, wc732 + ld de, wc732 ; player ld a, [hBattleTurn] and a - jr z, .asm_366ad + jr z, .player ld hl, EnemyDamageTaken + 1 - ld de, wc733 -.asm_366ad + ld de, wc733 ; enemy +.player ld a, [hld] add a ld b, a @@ -6975,16 +6979,16 @@ BattleCommand_StoreEnergy: ; 36671 ld a, [hl] rl a ld [CurDamage], a - jr nc, .asm_366c3 + jr nc, .not_maxed ld a, $ff ld [CurDamage], a ld [CurDamage + 1], a -.asm_366c3 +.not_maxed or b - jr nz, .asm_366cb + jr nz, .built_up_something ld a, 1 ld [AttackMissed], a -.asm_366cb +.built_up_something xor a ld [hli], a ld [hl], a @@ -6998,7 +7002,7 @@ BattleCommand_StoreEnergy: ; 36671 ld b, unleashenergy_command jp SkipToBattleCommand -.asm_366dc +.still_storing ld hl, StoringEnergyText call StdBattleTextBox jp EndMoveEffect @@ -7032,7 +7036,7 @@ rept 2 endr ld [bc], a ld a, 1 - ld [wc689], a + ld [wKickCounter], a call AnimateCurrentMove jp EndMoveEffect ; 3671a @@ -7044,33 +7048,35 @@ BattleCommand_CheckRampage: ; 3671a ld de, PlayerRolloutCount ld a, [hBattleTurn] and a - jr z, .asm_36725 ; 36720 $3 + jr z, .player ; 36720 $3 ld de, EnemyRolloutCount -.asm_36725 +.player ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr - bit 1, [hl] + bit SUBSTATUS_RAMPAGE, [hl] ret z ld a, [de] dec a ld [de], a - jr nz, .asm_3674c ; 36730 $1a - res 1, [hl] + jr nz, .continue_rampage ; 36730 $1a + + res SUBSTATUS_RAMPAGE, [hl] call BattleCommand_SwitchTurn call Function37962 push af call BattleCommand_SwitchTurn pop af - jr nz, .asm_3674c ; 3673f $b - set 7, [hl] + jr nz, .continue_rampage ; 3673f $b + + set SUBSTATUS_CONFUSED, [hl] call BattleRandom - and $1 + and %00000001 rept 2 inc a endr - inc de + inc de ; ConfuseCount ld [de], a -.asm_3674c +.continue_rampage ld b, rampage_command jp SkipToBattleCommand ; 36751 @@ -7094,8 +7100,9 @@ BattleCommand_Rampage: ; 36751 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr set SUBSTATUS_RAMPAGE, [hl] +; Rampage for 1 or 2 more turns call BattleRandom - and 1 + and %00000001 inc a ld [de], a ld a, 1 @@ -7121,34 +7128,39 @@ BattleCommand_Teleport: ; 36778 call GetBattleVar bit SUBSTATUS_CANT_RUN, a jr nz, .failed +; Only need to check these next things if it's your turn ld a, [hBattleTurn] and a - jr nz, .asm_367bf + jr nz, .enemy_turn +; Can't teleport from a trainer battle ld a, [wBattleMode] dec a jr nz, .failed +; If your level is greater than the opponent's, you run without fail. ld a, [CurPartyLevel] ld b, a ld a, [BattleMonLevel] cp b - jr nc, .asm_367df + jr nc, .run_away +; Generate a number between 0 and (YourLevel + TheirLevel). add b ld c, a inc c -.asm_367ac +.loop_player call BattleRandom cp c - jr nc, .asm_367ac ; 367b0 $fa + jr nc, .loop_player ; 367b0 $fa +; If that number is greater than 4 times your level, run away. srl b srl b cp b - jr nc, .asm_367df ; 367b7 $26 + jr nc, .run_away ; 367b7 $26 .failed call AnimateFailedMove jp PrintButItFailed -.asm_367bf +.enemy_turn ld a, [wBattleMode] dec a jr nz, .failed @@ -7156,38 +7168,38 @@ BattleCommand_Teleport: ; 36778 ld b, a ld a, [CurPartyLevel] cp b - jr nc, .asm_367df ; 367cd $10 + jr nc, .run_away ; 367cd $10 add b ld c, a inc c -.asm_367d2 +.loop_enemy call BattleRandom cp c - jr nc, .asm_367d2 ; 367d6 $fa + jr nc, .loop_enemy ; 367d6 $fa srl b srl b cp b - jr nc, .asm_367df ; 367dd $0 -.asm_367df + jr nc, .run_away ; 367dd $0 +.run_away call UpdateBattleMonInParty xor a ld [wcfca], a inc a ld [wd232], a - ld [wc689], a - call Function36804 + ld [wKickCounter], a + call SetBattleDraw call BattleCommand_LowerSub - call Function37e36 + call PlayPlayerMoveAnim_ClearHiID ld c, 20 call DelayFrames - call Function36804 + call SetBattleDraw ld hl, FledFromBattleText jp StdBattleTextBox ; 36804 -Function36804: ; 36804 +SetBattleDraw: ; 36804 ld a, [wBattleResult] and $c0 or $2 @@ -7241,7 +7253,7 @@ BattleCommand_ForceSwitch: ; 3680f ld [wcfca], a inc a ld [wd232], a - call Function36804 + call SetBattleDraw ld a, [wPlayerMoveStruct + MOVE_ANIM] jp .asm_36975 .asm_36869 @@ -7252,7 +7264,7 @@ BattleCommand_ForceSwitch: ; 3680f jr z, .asm_368ca ; 36872 $56 call UpdateEnemyMonInParty ld a, $1 - ld [wc689], a + ld [wKickCounter], a call AnimateCurrentMove ld c, $14 call DelayFrames @@ -7332,7 +7344,7 @@ BattleCommand_ForceSwitch: ; 3680f ld [wcfca], a inc a ld [wd232], a - call Function36804 + call SetBattleDraw ld a, [wEnemyMoveStruct + MOVE_ANIM] jr .asm_36975 @@ -7346,7 +7358,7 @@ BattleCommand_ForceSwitch: ; 3680f call UpdateBattleMonInParty ld a, $1 - ld [wc689], a + ld [wKickCounter], a call AnimateCurrentMove ld c, $14 call DelayFrames @@ -7397,9 +7409,9 @@ BattleCommand_ForceSwitch: ; 3680f .asm_36975 push af - call Function36804 + call SetBattleDraw ld a, $1 - ld [wc689], a + ld [wKickCounter], a call AnimateCurrentMove ld c, $14 call DelayFrames @@ -7760,8 +7772,8 @@ BattleCommand_Charge: ; 36b4d xor a ld [wcfca], a inc a - ld [wc689], a - call Function37e36 + ld [wKickCounter], a + call PlayPlayerMoveAnim_ClearHiID ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar cp FLY @@ -8068,7 +8080,7 @@ BattleCommand_Confuse: ; 36d3b cp HELD_PREVENT_CONFUSE jr nz, .asm_36d53 ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName call AnimateFailedMove ld hl, ProtectedByText @@ -8122,7 +8134,7 @@ endr .asm_36d99 ld de, ANIM_CONFUSED - call Function37e54 + call PlayOpponentBattleAnim ld hl, BecameConfusedText call StdBattleTextBox @@ -8166,7 +8178,7 @@ BattleCommand_Paralyze: ; 36dc7 cp HELD_PREVENT_PARALYZE jr nz, .asm_36def ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetItemName call AnimateFailedMove ld hl, ProtectedByText @@ -8212,7 +8224,7 @@ BattleCommand_Paralyze: ; 36dc7 call GetBattleVarAddr set PAR, [hl] call UpdateOpponentInParty - ld hl, Function3ec39 + ld hl, ApplyPrzEffectOnSpeed call CallBattleCore call UpdateBattleHuds call PrintParalyze @@ -8283,7 +8295,7 @@ BattleCommand_Substitute: ; 36e7c ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a - jr nz, .asm_36ef4 + jr nz, .already_has_sub ld a, [hli] ld b, [hl] @@ -8302,10 +8314,10 @@ endr ld a, [hl] sbc 0 ld d, a - jr c, .asm_36eff + jr c, .too_weak_to_sub ld a, d or e - jr z, .asm_36eff + jr z, .too_weak_to_sub ld [hl], d inc hl ld [hl], e @@ -8318,43 +8330,43 @@ endr ld de, wc72e ld a, [hBattleTurn] and a - jr z, .asm_36ecf + jr z, .player ld hl, wc731 ld de, wc72f -.asm_36ecf +.player xor a ld [hl], a ld [de], a call Function37ed5 - jr c, .asm_36ee8 + jr c, .mobile xor a ld [wcfca], a ld [FXAnimIDHi], a - ld [wc689], a + ld [wKickCounter], a ld a, SUBSTITUTE - call Function37e44 - jr .asm_36eeb + call PlayMoveAnim_KeepHiID + jr .finish -.asm_36ee8 +.mobile call BattleCommanda6 -.asm_36eeb +.finish ld hl, MadeSubstituteText call StdBattleTextBox jp RefreshBattleHuds -.asm_36ef4 +.already_has_sub call Function34548 call nz, BattleCommand_RaiseSub ld hl, HasSubstituteText - jr .asm_36f08 + jr .jp_stdbattletextbox -.asm_36eff +.too_weak_to_sub call Function34548 call nz, BattleCommand_RaiseSub ld hl, TooWeakSubText -.asm_36f08 +.jp_stdbattletextbox jp StdBattleTextBox ; 36f0b @@ -8461,7 +8473,7 @@ BattleCommand_Mimic: ; 36f46 ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar ld [hl], a - ld [wd265], a + ld [wNamedObjectIndexBuffer], a ld bc, BattleMonPP - BattleMonMoves add hl, bc ld [hl], 5 @@ -8589,7 +8601,7 @@ BattleCommand_Disable: ; 36fed ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar ld [hl], a - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetMoveName ld hl, WasDisabledText jp StdBattleTextBox @@ -8716,7 +8728,7 @@ BattleCommand_Conversion: ; 3707f ld [de], a inc de ld [de], a - ld [wd265], a + ld [wNamedObjectIndexBuffer], a callba GetTypeName call AnimateCurrentMove ld hl, TransformedTypeText @@ -8737,9 +8749,9 @@ BattleCommand_ResetStats: ; 3710e push af call SetPlayerTurn - call Function365d7 + call CalcPlayerStats call SetEnemyTurn - call Function365fd + call CalcEnemyStats pop af ld [hBattleTurn], a @@ -8805,10 +8817,10 @@ BattleCommand_Heal: ; 3713e ld a, [hBattleTurn] and a jr nz, .asm_37193 - call Function365d7 + call CalcPlayerStats jr .asm_37196 .asm_37193 - call Function365fd + call CalcEnemyStats .asm_37196 pop af pop de @@ -8853,7 +8865,7 @@ BattleCommand_Transform: ; 371cd ld [wcfca], a ld [FXAnimIDHi], a ld a, $1 - ld [wc689], a + ld [wKickCounter], a ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarAddr bit SUBSTATUS_SUBSTITUTE, [hl] @@ -8862,7 +8874,7 @@ BattleCommand_Transform: ; 371cd call Function34548 jr nz, .asm_37200 ld a, SUBSTITUTE - call Function37e44 + call PlayMoveAnim_KeepHiID .asm_37200 ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarAddr @@ -8938,15 +8950,15 @@ endr jr nz, .asm_3725f pop hl ld a, [hl] - ld [wd265], a + ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, EnemyStats ld de, PlayerStats - ld bc, $000a + ld bc, 2 * 5 call BattleSideCopy ld hl, EnemyStatLevels ld de, PlayerStatLevels - ld bc, $0008 + ld bc, 8 call BattleSideCopy call Function37ed5 jr c, .asm_372a8 @@ -8958,7 +8970,7 @@ endr .asm_372a0 and a jr nz, .asm_372a8 - call Function37e36 + call PlayPlayerMoveAnim_ClearHiID jr .asm_372ae .asm_372a8 call BattleCommand_MoveDelay @@ -8968,10 +8980,10 @@ endr ld [wcfca], a ld [FXAnimIDHi], a ld a, $2 - ld [wc689], a + ld [wKickCounter], a pop af ld a, SUBSTITUTE - call nz, Function37e44 + call nz, PlayMoveAnim_KeepHiID ld hl, TransformedText jp StdBattleTextBox ; 372c6 @@ -9165,9 +9177,9 @@ BattleCommand_SelfDestruct: ; 37380 ld [hli], a ld [hl], a ld a, $1 - ld [wc689], a + ld [wKickCounter], a call BattleCommand_LowerSub - call Function37e36 + call PlayPlayerMoveAnim_ClearHiID ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarAddr res SUBSTATUS_LEECH_SEED, [hl] @@ -9218,10 +9230,10 @@ ResetTurn: ; 3747b ld hl, wc732 ld a, [hBattleTurn] and a - jr z, .asm_37486 + jr z, .player ld hl, wc733 -.asm_37486 +.player ld [hl], 1 xor a ld [AlreadyDisobeyed], a @@ -9509,7 +9521,7 @@ BattleCommand_Present: ; 37874 pop bc .asm_37889 - ld a, [wd265] + ld a, [wTypeMatchup] and a jp z, AnimateFailedMove ld a, [AttackMissed] @@ -9533,8 +9545,8 @@ BattleCommand_Present: ; 37874 .asm_378ad ld a, c - ld [wc689], a - call Function37de9 + ld [wKickCounter], a + call AnimateCurrentMoveEitherSide ld d, [hl] pop bc ret @@ -9542,7 +9554,7 @@ BattleCommand_Present: ; 37874 .asm_378b7 pop bc ld a, $3 - ld [wc689], a + ld [wKickCounter], a call AnimateCurrentMove call BattleCommand_SwitchTurn ld hl, AICheckPlayerMaxHP @@ -9694,7 +9706,7 @@ endr push de inc hl ld a, [hl] - ld [wd265], a + ld [wTypeMatchup], a call BattleCommand_MoveDelay ld hl, MagnitudeText call StdBattleTextBox @@ -9788,7 +9800,7 @@ BattleCommand_BatonPass: ; 379c9 ld hl, Function3d57a call CallBattleCore ld a, 1 - ld [wd265], a + ld [wTypeMatchup], a ld hl, ApplyStatLevelMultiplierOnAllStats call CallBattleCore @@ -10170,7 +10182,7 @@ BattleCommand_BellyDrum: ; 37c1a push bc call AnimateCurrentMove pop bc - callab Function3cc3f + callab SubtractHPFromUser call UpdateUserInParty ld a, 5 @@ -10225,10 +10237,10 @@ BattleCommand_PsychUp: ; 37c55 ld a, [hBattleTurn] and a jr nz, .asm_37c89 ; 37c82 $5 - call Function365d7 + call CalcPlayerStats jr .asm_37c8c ; 37c87 $3 .asm_37c89 - call Function365fd + call CalcEnemyStats .asm_37c8c call AnimateCurrentMove ld hl, CopiedStatsText @@ -10254,7 +10266,7 @@ BattleCommand_MirrorCoat: ; 37c95 ret z call BattleCommanda3 - ld a, [wd265] + ld a, [wTypeMatchup] and a ret z @@ -10491,16 +10503,16 @@ GetItem: ; 37dd0 ; 37de9 -Function37de9: ; 37de9 +AnimateCurrentMoveEitherSide: ; 37de9 push hl push de push bc - ld a, [wc689] + ld a, [wKickCounter] push af call BattleCommand_LowerSub pop af - ld [wc689], a - call Function37e19 + ld [wKickCounter], a + call PlayMoveAnim_ClearHiID call BattleCommand_RaiseSub pop bc pop de @@ -10513,12 +10525,12 @@ AnimateCurrentMove: ; 37e01 push hl push de push bc - ld a, [wc689] + ld a, [wKickCounter] push af call BattleCommand_LowerSub pop af - ld [wc689], a - call Function37e36 + ld [wKickCounter], a + call PlayPlayerMoveAnim_ClearHiID call BattleCommand_RaiseSub pop bc pop de @@ -10527,7 +10539,7 @@ AnimateCurrentMove: ; 37e01 ; 37e19 -Function37e19: ; 37e19 +PlayMoveAnim_ClearHiID: ; 37e19 xor a ld [FXAnimIDHi], a @@ -10541,17 +10553,17 @@ Function37e19: ; 37e19 ld a, [hBattleTurn] and a ld a, 1 - jr z, .asm_37e30 + jr z, .player ld a, 4 -.asm_37e30 +.player ld [wcfca], a - jp Function37e47 + jp PlayUserBattleAnim ; 37e36 -Function37e36: ; 37e36 +PlayPlayerMoveAnim_ClearHiID: ; 37e36 xor a ld [wcfca], a ld [FXAnimIDHi], a @@ -10565,7 +10577,7 @@ Function37e36: ; 37e36 ; 37e44 -Function37e44: ; 37e44 +PlayMoveAnim_KeepHiID: ; 37e44 ld [FXAnimIDLo], a @@ -10573,7 +10585,7 @@ Function37e44: ; 37e44 ; 37e47 -Function37e47: ; 37e47 +PlayUserBattleAnim: ; 37e47 push hl push de push bc @@ -10585,7 +10597,7 @@ Function37e47: ; 37e47 ; 37e54 -Function37e54: ; 37e54 +PlayOpponentBattleAnim: ; 37e54 ld a, e ld [FXAnimIDLo], a ld a, d diff --git a/battle/effects/curse.asm b/battle/effects/curse.asm index 2c9ce4365..dceb3b8d5 100644 --- a/battle/effects/curse.asm +++ b/battle/effects/curse.asm @@ -26,13 +26,13 @@ BattleCommand_Curse: ; 37588 ; Attack ld a, [bc] - cp 13 ; max + cp MAX_STAT_LEVEL jr c, .raise ; Defense inc bc ld a, [bc] - cp 13 ; max + cp MAX_STAT_LEVEL jr nc, .cantraise .raise @@ -40,19 +40,19 @@ BattleCommand_Curse: ; 37588 ; Raise Attack and Defense, and lower Speed. ld a, $1 - ld [wc689], a + ld [wKickCounter], a call AnimateCurrentMove - ld a, $2 - call Function36532 + ld a, SPEED + call LowerStat call BattleCommand_SwitchTurn - call BattleCommand_StatMessageTarget + call BattleCommand_StatDownMessage call ResetMiss call BattleCommand_SwitchTurn call BattleCommand_AttackUp - call BattleCommand_StatMessageUser + call BattleCommand_StatUpMessage call ResetMiss call BattleCommand_DefenseUp - jp BattleCommand_StatMessageUser + jp BattleCommand_StatUpMessage .ghost @@ -74,7 +74,7 @@ BattleCommand_Curse: ; 37588 call AnimateCurrentMove ld hl, GetHalfMaxHP call CallBattleCore - ld hl, Function3cc3f + ld hl, SubtractHPFromUser call CallBattleCore call UpdateUserInParty ld hl, PutACurseText @@ -89,7 +89,7 @@ BattleCommand_Curse: ; 37588 ; Can't raise either stat. - ld b, $8 ; ABILITY + ld b, ABILITY + 1 call GetStatName call AnimateFailedMove ld hl, WontRiseAnymoreText diff --git a/battle/effects/metronome.asm b/battle/effects/metronome.asm index 016d67089..af574061d 100644 --- a/battle/effects/metronome.asm +++ b/battle/effects/metronome.asm @@ -5,14 +5,14 @@ BattleCommand_Metronome: ; 37418 call Function34548 jr nz, .asm_3742b - ld a, [wc689] + ld a, [wKickCounter] push af call BattleCommand_LowerSub pop af - ld [wc689], a + ld [wKickCounter], a .asm_3742b - call Function37e36 + call PlayPlayerMoveAnim_ClearHiID .GetMove call BattleRandom diff --git a/battle/effects/mirror_move.asm b/battle/effects/mirror_move.asm index 1b39b1ad3..e6196466b 100644 --- a/battle/effects/mirror_move.asm +++ b/battle/effects/mirror_move.asm @@ -40,11 +40,11 @@ BattleCommand_MirrorMove: ; 373c9 call Function34548 jr nz, .done - ld a, [wc689] + ld a, [wKickCounter] push af call BattleCommand_LowerSub pop af - ld [wc689], a + ld [wKickCounter], a .done call BattleCommand_MoveDelay diff --git a/battle/moves/move_effects.asm b/battle/moves/move_effects.asm index b5aadf1a1..451d1481a 100644 --- a/battle/moves/move_effects.asm +++ b/battle/moves/move_effects.asm @@ -208,7 +208,7 @@ Explosion: damagevariation checkhit selfdestruct - effect0x0b + hittargetnosub resulttext checkfaint criticaltext @@ -255,7 +255,7 @@ AttackUp: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -269,7 +269,7 @@ DefenseUp: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -281,7 +281,7 @@ SpeedUp: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -294,7 +294,7 @@ SpecialAttackUp: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -306,7 +306,7 @@ SpecialDefenseUp: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -318,7 +318,7 @@ AccuracyUp: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -333,7 +333,7 @@ EvasionUp: statupanim effect0xa7 raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -346,7 +346,7 @@ AttackUp2: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -360,7 +360,7 @@ DefenseUp2: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -373,7 +373,7 @@ SpeedUp2: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -385,7 +385,7 @@ SpecialAttackUp2: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -398,7 +398,7 @@ SpecialDefenseUp2: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -410,7 +410,7 @@ AccuracyUp2: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -422,7 +422,7 @@ EvasionUp2: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove @@ -436,7 +436,7 @@ AttackDown: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -451,7 +451,7 @@ DefenseDown: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -465,7 +465,7 @@ SpeedDown: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -478,7 +478,7 @@ SpecialAttackDown: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -491,7 +491,7 @@ SpecialDefenseDown: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -508,7 +508,7 @@ AccuracyDown: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -522,7 +522,7 @@ EvasionDown: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -536,7 +536,7 @@ AttackDown2: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -550,7 +550,7 @@ DefenseDown2: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -565,7 +565,7 @@ SpeedDown2: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -578,7 +578,7 @@ SpecialAttackDown2: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -591,7 +591,7 @@ SpecialDefenseDown2: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -604,7 +604,7 @@ AccuracyDown2: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -617,7 +617,7 @@ EvasionDown2: lowersub statdownanim raisesub - statmessagetarget + statdownmessage statdownfailtext endmove @@ -641,7 +641,7 @@ AttackDownHit: checkdestinybond buildopponentrage attackdown - statmessagetarget + statdownmessage endmove Acid: @@ -667,7 +667,7 @@ DefenseDownHit: buildopponentrage effectchance defensedown - statmessagetarget + statdownmessage endmove Bubblebeam: @@ -693,7 +693,7 @@ SpeedDownHit: checkdestinybond buildopponentrage speeddown - statmessagetarget + statdownmessage endmove SpecialAttackDownHit: @@ -715,7 +715,7 @@ SpecialAttackDownHit: checkdestinybond buildopponentrage specialattackdown - statmessagetarget + statdownmessage endmove PsychicM: @@ -740,7 +740,7 @@ SpecialDefenseDownHit: checkdestinybond buildopponentrage specialdefensedown - statmessagetarget + statdownmessage endmove MudSlap: @@ -764,7 +764,7 @@ AccuracyDownHit: checkdestinybond buildopponentrage accuracydown - statmessagetarget + statdownmessage endmove EvasionDownHit: @@ -786,7 +786,7 @@ EvasionDownHit: checkdestinybond buildopponentrage evasiondown - statmessagetarget + statdownmessage endmove SteelWing: @@ -809,7 +809,7 @@ DefenseUpHit: checkdestinybond buildopponentrage defenseup - statmessageuser + statupmessage endmove MetalClaw: @@ -832,7 +832,7 @@ AttackUpHit: checkdestinybond buildopponentrage attackup - statmessageuser + statupmessage endmove Ancientpower: @@ -966,7 +966,7 @@ MultiHit: stab damagevariation clearmissdamage - effect0x0b + hittargetnosub resulttext checkfaint criticaltext @@ -994,7 +994,7 @@ PoisonMultiHit: stab damagevariation clearmissdamage - effect0x0b + hittargetnosub resulttext checkfaint criticaltext @@ -1350,7 +1350,7 @@ Dig: stab damagevariation checkhit - effect0x0b + hittargetnosub raisesub resulttext checkfaint @@ -1571,7 +1571,7 @@ TripleKick: stab damagevariation clearmissdamage - effect0x0b + hittargetnosub resulttext checkfaint criticaltext @@ -1730,7 +1730,7 @@ Swagger: raisesub resulttext switchturn - statmessageuser + statupmessage switchturn confusetarget endmove @@ -2041,7 +2041,7 @@ SkullBash: kingsrock endturn defenseup - statmessageuser + statupmessage endmove Twister: @@ -2097,7 +2097,7 @@ FutureSight: futuresight damagevariation checkhit - effect0x0b + hittargetnosub resulttext checkfaint checkdestinybond @@ -2211,7 +2211,7 @@ BeatUp: damagecalc damagevariation clearmissdamage - effect0x0b + hittargetnosub resulttext checkfaint criticaltext @@ -2234,6 +2234,6 @@ DefenseCurl: lowersub statupanim raisesub - statmessageuser + statupmessage statupfailtext endmove diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 62531c7be..99cc04d4d 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -4,6 +4,8 @@ EGG_LEVEL EQU 5 NUM_MOVES EQU 4 REST_TURNS EQU 2 +MAX_STAT_LEVEL EQU 13 +BASE_STAT_LEVEL EQU 7 const_def const ATTACK @@ -13,6 +15,8 @@ REST_TURNS EQU 2 const SP_DEFENSE const ACCURACY const EVASION + const ABILITY +NUM_LEVEL_STATS EQU const_value ; move struct const_def diff --git a/engine/predef.asm b/engine/predef.asm index 44be28628..2fc3525bc 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -95,7 +95,7 @@ PredefPointers:: ; 856b add_predef Function5108b add_predef GetTrainerPic add_predef DecompressPredef ; $40 - add_predef Function347d3 + add_predef CheckTypeMatchup add_predef ConvertMon_1to2 add_predef Functionfb877 add_predef Functiond0000 diff --git a/items/item_effects.asm b/items/item_effects.asm index 8f1717947..f1ca0c2a9 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -403,7 +403,7 @@ endr jr c, .not_kurt_ball ld a, POKE_BALL .not_kurt_ball - ld [wc689], a + ld [wKickCounter], a ld de, ANIM_THROW_POKE_BALL ld a, e @@ -1567,7 +1567,7 @@ Functionf030: ; f030 (3:7030) res 7, [hl] .asm_f04f push bc - callba Function365d7 + callba CalcPlayerStats pop bc ret @@ -2344,7 +2344,7 @@ endr callba CheckIfStatCanBeRaised call WaitSFX - callba BattleCommand_StatMessageUser + callba BattleCommand_StatUpMessage callba BattleCommand_StatUpFailText ld a, [CurBattleMon] @@ -2959,7 +2959,7 @@ UseBallInTrainerBattle: ; f7a0 ld a, d ld [FXAnimIDHi], a xor a - ld [wc689], a + ld [wKickCounter], a ld [hBattleTurn], a ld [wcfca], a predef PlayBattleAnim diff --git a/macros/move_effect.asm b/macros/move_effect.asm index 7d0eda319..0c2325e8d 100644 --- a/macros/move_effect.asm +++ b/macros/move_effect.asm @@ -15,7 +15,7 @@ endm command damagevariation command checkhit command lowersub - command effect0x0b + command hittargetnosub command raisesub command resulttext command checkfaint @@ -144,8 +144,8 @@ endm command specialdefensedown2 command accuracydown2 command evasiondown2 - command statmessageuser - command statmessagetarget + command statupmessage + command statdownmessage command statupfailtext command statdownfailtext command effectchance @@ -600,7 +600,7 @@ EnemyDamageTaken:: ; c684 wc686:: ds 2 wc688:: ds 1 -wc689:: ds 1 +wKickCounter:: ds 1 wc68a:: BattleScriptBuffer:: ; c68a ds 40 @@ -1898,6 +1898,7 @@ wd264:: ds 1 wFoundMatchingIDInParty:: wNamedObjectIndexBuffer:: wCurTMHM:: +wTypeMatchup:: wd265:: ds 1 wd266:: ds 1 wd267:: ds 1 |