diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index e0c0248e5..c99cf6a7c 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -162,7 +162,7 @@ AIScoring_RedSuperEffective: ; 38635 push de ld a, 1 ld [hBattleTurn], a - callab Function0x347c8 + callab Function347c8 pop de pop bc pop hl @@ -412,7 +412,7 @@ AIScoring_LeechHit: ; 387f7 push hl ld a, 1 ld [hBattleTurn], a - callab Function0x347c8 + callab Function347c8 pop hl ld a, [$d265] @@ -559,7 +559,7 @@ AIScoring_LockOn: ; 3881d AIScoring_Explosion: ; 388a6 push hl - callba Function0x349f4 + callba Function349f4 pop hl jr nc, .asm_388b7 @@ -904,7 +904,7 @@ AIScoring_Bide: ; 38a1e AIScoring_Whirlwind: ; 38a2a push hl - callab Function0x3484e + callab Function3484e ld a, [$c716] cp $a pop hl @@ -1760,7 +1760,7 @@ AIScoring_MeanLook: ; 38dfb jr nz, .asm_38e26 push hl - callab Function0x3484e + callab Function3484e ld a, [$c716] cp $b pop hl @@ -1874,7 +1874,7 @@ AIScoring_Curse: ; 38e5c jp nz, AIDiscourageMove push hl - callba Function0x349f4 + callba Function349f4 pop hl jr nc, .asm_38eb0 @@ -2003,7 +2003,7 @@ AIScoring_Foresight: ; 38f1d AIScoring_PerishSong: ; 38f4a push hl - callab Function0x349f4 + callab Function349f4 pop hl jr c, .asm_38f75 @@ -2012,7 +2012,7 @@ AIScoring_PerishSong: ; 38f4a jr nz, .asm_38f6f push hl - callab Function0x3484e + callab Function3484e ld a, [$c716] cp 10 ; 1.0 pop hl @@ -2242,7 +2242,7 @@ AIScoring_Earthquake: ; 39044 AIScoring_BatonPass: ; 39062 push hl - callab Function0x3484e + callab Function3484e ld a, [$c716] cp 10 ; 1.0 pop hl @@ -2299,7 +2299,7 @@ AIScoring_HiddenPower: ; 3909e ld hl, $7ced ld a, $3e rst FarCall - callab Function0x347c8 + callab Function347c8 pop hl ld a, [$d265] @@ -3223,7 +3223,7 @@ AIScoring_StatusImmunity: ; 39453 push de ld a, 1 ld [hBattleTurn], a - callab Function0x347c8 + callab Function347c8 pop de pop bc pop hl diff --git a/battle/anim_commands.asm b/battle/anim_commands.asm index c8077b710..34c946e33 100644 --- a/battle/anim_commands.asm +++ b/battle/anim_commands.asm @@ -1430,7 +1430,7 @@ Functioncc8d3: ; cc8d3 ld e, [hl] inc hl ld d, [hl] - ld hl, $506f + ld hl, BattleAnimations add hl, de add hl, de call Function3ae1 diff --git a/battle/core.asm b/battle/core.asm index e014d80e2..be7abc8fe 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -1,3 +1,5 @@ +BattleCore: + ; Core components of the battle engine. @@ -26,11 +28,10 @@ Function3c000: ; 3c000 ld a, [InLinkBattle] and a jr z, .asm_3c031 + ld a, [$ffcb] cp $2 -.data_3c02f - db $28 - db $1b + jr z, .asm_3c04c .asm_3c031 ld a, [IsInBattle] @@ -38,14 +39,16 @@ Function3c000: ; 3c000 jr z, .asm_3c047 xor a ld [$c718], a - call Function3d834 - call Function3d867 - call Function3dc18 + call NewEnemyMonStatus + call ResetEnemyStatLevels + call BreakAttraction call Function3d4e1 .asm_3c047 - ld c, $28 + ld c, 40 call DelayFrames + +.asm_3c04c call Function309d call Function3d873 ld a, d @@ -85,15 +88,15 @@ Function3c000: ; 3c000 call Function309d call Function3d57a call Function3da0d - call Function3dab1 + call ResetPlayerStatLevels call Function3f26d - call Function3dbde - call Function3dc18 + call NewBattleMonStatus + call BreakAttraction call Function3db5f call EmptyBattleTextBox call Function309d call SetPlayerTurn - call Function3dc23 + call SpikesDamage ld a, [InLinkBattle] and a jr z, .asm_3c0df @@ -102,12 +105,12 @@ Function3c000: ; 3c000 jr nz, .asm_3c0df xor a ld [$c718], a - call Function3d834 - call Function3d867 - call Function3dc18 + call NewEnemyMonStatus + call ResetEnemyStatLevels + call BreakAttraction call Function3d4e1 call SetEnemyTurn - call Function3dc23 + call SpikesDamage .asm_3c0df jp Function3c12f @@ -127,18 +130,18 @@ Function3c0e5: ; 3c0e5 ld [$d0ee], a ld a, [InLinkBattle] and a - ld hl, $47bd + ld hl, BattleText_0x807bd jr z, .asm_3c115 ld a, [$d0ee] and $c0 ld [$d0ee], a - ld hl, $47cf + ld hl, BattleText_0x807cf call Function3d2e0 jr nc, .asm_3c115 ld hl, $cd2a bit 4, [hl] jr nz, .asm_3c118 - ld hl, $5863 + ld hl, BattleText_0x81863 .asm_3c115 call StdBattleTextBox @@ -351,47 +354,53 @@ Function3c25c: ; 3c25c Function3c27c: ; 3c27c ld a, [$ffcb] cp $1 - jr z, .asm_3c287 - call .asm_3c28a - jr .asm_3c296 + jr z, .reverse -.asm_3c287 - call .asm_3c296 -.asm_3c28a + call .player + jr .enemy + +.reverse + call .enemy +; jr .player + +.player call SetPlayerTurn ld de, PartyMon1Item ld a, [CurBattleMon] ld b, a - jr .asm_3c2a0 + jr .go -.asm_3c296 +.enemy call SetEnemyTurn ld de, OTPartyMon1Item ld a, [CurOTMon] ld b, a +; jr .go -.asm_3c2a0 +.go push de push bc callab GetUserItem ld a, [hl] ld [$d265], a - sub $98 + sub BERSERK_GENE pop bc pop de ret nz + ld [hl], a + ld h, d ld l, e ld a, b call GetPartyLocation xor a ld [hl], a - ld a, $2 + ld a, BATTLE_VARS_SUBSTATUS3 call _GetBattleVar push af - set 7, [hl] - ld a, $c + set SUBSTATUS_CONFUSED, [hl] + ld a, BATTLE_VARS_MOVE_ANIM call _GetBattleVar push hl push af @@ -404,18 +413,18 @@ Function3c27c: ; 3c27c pop hl ld [hl], a call GetItemName - ld hl, $4bde + ld hl, BattleText_0x80bde call StdBattleTextBox callab BattleCommand8c pop af - bit 7, a + bit SUBSTATUS_CONFUSED, a ret nz xor a ld [$cfca], a ld de, $0103 call Function3ee0f call Function3c8e4 - ld hl, $4d97 + ld hl, BecameConfusedText jp StdBattleTextBox ; 3c300 @@ -468,7 +477,7 @@ Function3c314: ; 3c314 .asm_3c34c callab Function3846c call SetEnemyTurn - call Function3dc23 + call SpikesDamage jp Function3c3f3 .asm_3c35b @@ -666,7 +675,7 @@ Function3c434: ; 3c434 cp $74 jr z, .asm_3c4c9 xor a - ld [$c679], a + ld [PlayerProtectCount], a jr .asm_3c4c9 .asm_3c4b5 @@ -676,7 +685,7 @@ Function3c434: ; 3c434 .asm_3c4ba xor a ld [PlayerFuryCutterCount], a - ld [$c679], a + ld [PlayerProtectCount], a ld [$c72b], a ld hl, PlayerSubStatus4 res 6, [hl] @@ -689,7 +698,7 @@ Function3c434: ; 3c434 .asm_3c4ce xor a ld [PlayerFuryCutterCount], a - ld [$c679], a + ld [PlayerProtectCount], a ld [$c72b], a ld hl, PlayerSubStatus4 res 6, [hl] @@ -727,7 +736,7 @@ Function3c4df: ; 3c4df ld hl, PlayerSubStatus5 res 4, [hl] call SetEnemyTurn - ld hl, $4c8a + ld hl, BattleText_0x80c8a jp StdBattleTextBox .asm_3c518 @@ -751,7 +760,7 @@ Function3c4df: ; 3c4df ld hl, EnemySubStatus5 res 4, [hl] call SetPlayerTurn - ld hl, $4c8a + ld hl, BattleText_0x80c8a jp StdBattleTextBox ; 3c543 @@ -1047,12 +1056,12 @@ Function3c706: ; 3c706 jr z, Function3c710 Function3c70b: ; 3c70b ld hl, EnemyMonHPHi - jr asm_3c713 + jr Function3c713 Function3c710: ; 3c710 ld hl, BattleMonHP -asm_3c713 +Function3c713: ; 3c713 ld a, [hli] or [hl] ret @@ -1065,11 +1074,11 @@ Function3c716: ; 3c716 call GetBattleVar and $18 jr z, .asm_3c768 - ld hl, $47e2 + ld hl, BattleText_0x807e2 ld de, $0106 and $10 jr z, .asm_3c733 - ld hl, $47f8 + ld hl, BattleText_0x807f8 ld de, $0105 .asm_3c733 @@ -1127,7 +1136,7 @@ Function3c716: ; 3c716 ld a, $1 ld [hBGMapMode], a call Function3ccef - ld hl, $480e + ld hl, BattleText_0x8080e call StdBattleTextBox .asm_3c7a1 @@ -1143,7 +1152,7 @@ Function3c716: ; 3c716 call Function3ee0f call GetQuarterMaxHP call Function3cc3f - ld hl, $4822 + ld hl, BattleText_0x80822 call StdBattleTextBox .asm_3c7c5 @@ -1159,7 +1168,7 @@ Function3c716: ; 3c716 call Function3ee0f call GetQuarterMaxHP call Function3cc3f - ld hl, $4836 + ld hl, BattleText_0x80836 call StdBattleTextBox .asm_3c7e9 @@ -1211,7 +1220,7 @@ Function3c801: ; 3c801 ld a, [hl] ld [$d265], a push af - ld hl, $4864 + ld hl, BattleText_0x80864 call StdBattleTextBox pop af ret nz @@ -1301,11 +1310,11 @@ Function3c874: ; 3c874 .asm_3c8d3 call Function3cc76 call Function3cc3f - ld hl, $4de2 + ld hl, BattleText_0x80de2 jr .asm_3c8e1 .asm_3c8de - ld hl, $4df5 + ld hl, BattleText_0x80df5 .asm_3c8e1 jp StdBattleTextBox @@ -1337,7 +1346,7 @@ Function3c8eb: ; 3c8eb ld [$d265], a call GetItemName ld a, b - cp $3 + cp HELD_LEFTOVERS ret nz ld hl, BattleMonHP ld a, [hBattleTurn] @@ -1361,7 +1370,7 @@ Function3c8eb: ; 3c8eb call Function3cc76 call Function3c8e4 call Function3ccef - ld hl, $4880 + ld hl, BattleText_0x80880 jp StdBattleTextBox ; 3c93c @@ -1501,7 +1510,7 @@ Function3c93c: ; 3c93c call Function3c8e4 call Function3ddc8 call Function3c8e4 - ld hl, $4899 + ld hl, BattleText_0x80899 jp StdBattleTextBox ; 3ca26 @@ -1533,7 +1542,7 @@ Function3ca26: ; 3ca26 ld [hl], a cp $1 ret nz - ld hl, $48b6 + ld hl, BattleText_0x808b6 call StdBattleTextBox ld a, $10 call _GetBattleVar @@ -1585,7 +1594,7 @@ Function3ca8f: ; 3ca8f ld [hl], $0 call UpdateBattleHuds call SetEnemyTurn - ld hl, $524b + ld hl, DefrostedOpponentText jp StdBattleTextBox .asm_3cac9 @@ -1611,7 +1620,7 @@ Function3ca8f: ; 3ca8f .asm_3caef call UpdateBattleHuds call SetPlayerTurn - ld hl, $524b + ld hl, DefrostedOpponentText jp StdBattleTextBox ; 3cafb @@ -1649,7 +1658,7 @@ Function3cafb: ; 3cafb .asm_3cb2e ld [hBattleTurn], a - ld hl, $48d2 + ld hl, BattleText_0x808d2 jp StdBattleTextBox ; 3cb36 @@ -2120,7 +2129,7 @@ Function3cd55: ; 3cd55 ld [$d0ec], a call Function3cf4a jp z, Function3c0e5 - jr asm_3cdca + jr Function3cdca .asm_3cdba ld a, $1 @@ -2130,8 +2139,9 @@ Function3cd55: ; 3cd55 xor a ld [$d0ec], a ret +; 3cdca -asm_3cdca +Function3cdca: ; 3cdca ld a, [$ffcb] cp $1 jr z, .asm_3cde6 @@ -2141,14 +2151,14 @@ asm_3cdca call ClearBox call Function3d2b3 ld a, $1 - call asm_3cf78 + call EnemyPartyMonEntrance jr .asm_3cdfc .asm_3cde6 ld a, [CurPartyMon] push af ld a, $1 - call asm_3cf78 + call EnemyPartyMonEntrance call ClearSprites call Function309d pop af @@ -2180,8 +2190,8 @@ Function3ce01: ; 3ce01 ld hl, EnemyDamageTaken ld [hli], a ld [hl], a - call Function3d834 - call Function3dc18 + call NewEnemyMonStatus + call BreakAttraction ld a, [IsInBattle] dec a jr z, .asm_3ce2f @@ -2379,17 +2389,18 @@ Function3cf4a: ; 3cf4a ld a, [hli] or [hl] ld a, $0 - jr nz, asm_3cf78 + jr nz, EnemyPartyMonEntrance inc a ret +; 3cf78 -asm_3cf78 +EnemyPartyMonEntrance: ; 3cf78 push af xor a ld [$c718], a - call Function3d834 - call Function3d867 - call Function3dc18 + call NewEnemyMonStatus + call ResetEnemyStatLevels + call BreakAttraction pop af and a jr nz, .asm_3cf8f @@ -2397,12 +2408,12 @@ asm_3cf78 jr .asm_3cf92 .asm_3cf8f - call asm_3d517 + call Function3d517 .asm_3cf92 call Function3d57a call SetEnemyTurn - call Function3dc23 + call SpikesDamage xor a ld [EnemyMoveAnimation], a ld [$d0ec], a @@ -2758,7 +2769,7 @@ Function3d14e: ; 3d14e ld [$d0ec], a call Function3cf4a jp z, Function3c0e5 - jp asm_3cdca + jp Function3cdca ; 3d1aa Function3d1aa: ; 3d1aa @@ -2830,7 +2841,7 @@ Function3d227: ; 3d227 call EmptyBattleTextBox call Function1d6e call Function3d2f7 - call Function3d362 + call ForcePickPartyMonInBattle ld a, [InLinkBattle] and a jr z, .asm_3d241 @@ -2869,7 +2880,7 @@ Function3d227: ; 3d227 ld [CurBattleMon], a call Function3d581 call Function3da0d - call Function3dab1 + call ResetPlayerStatLevels call ClearPalettes call DelayFrame call Function3eda6 @@ -2877,13 +2888,13 @@ Function3d227: ; 3d227 call ClearSGB call Function32f9 call Function3f26d - call Function3dbde - call Function3dc18 + call NewBattleMonStatus + call BreakAttraction call Function3db5f call EmptyBattleTextBox call Function309d call SetPlayerTurn - call Function3dc23 + call SpikesDamage ld a, $1 and a ld c, a @@ -2897,15 +2908,15 @@ Function3d2b3: ; 3d2b3 ld [CurBattleMon], a call Function3d581 call Function3da0d - call Function3dab1 + call ResetPlayerStatLevels call Function3f26d - call Function3dbde - call Function3dc18 + call NewBattleMonStatus + call BreakAttraction call Function3db5f call EmptyBattleTextBox call Function309d call SetPlayerTurn - jp Function3dc23 + jp SpikesDamage ; 3d2e0 @@ -2961,9 +2972,9 @@ Function3d329: ; 3d329 ret ; 3d33c -Function3d33c: ; 3d33c +PickPartyMonInBattle: ; 3d33c .asm_3d33c - ld a, $2 + ld a, $2 ; Which PKMN? ld [PartyMenuActionText], a call Function3d313 call Function3d329 @@ -2974,52 +2985,58 @@ Function3d33c: ; 3d33c ret ; 3d34f -Function3d34f: ; 3d34f +SwitchMonAlreadyOut: ; 3d34f ld hl, CurBattleMon ld a, [CurPartyMon] cp [hl] - jr nz, .asm_3d360 + jr nz, .notout + ld hl, BattleText_0x80c0d call StdBattleTextBox scf ret -.asm_3d360 +.notout xor a ret ; 3d362 -Function3d362: ; 3d362 -.asm_3d362 - call Function3d33c +ForcePickPartyMonInBattle: ; 3d362 +; Can't back out. + +.pick + call PickPartyMonInBattle ret nc call Function3d2e0 ret c + ld de, SFX_WRONG call PlaySFX call WaitSFX - jr .asm_3d362 + jr .pick ; 3d375 - -Function3d375: ; 3d375 -.asm_3d375 - call Function3d33c +PickSwitchMonInBattle: ; 3d375 +.pick + call PickPartyMonInBattle ret c - call Function3d34f - jr c, .asm_3d375 + call SwitchMonAlreadyOut + jr c, .pick xor a ret ; 3d380 -Function3d380: ; 3d380 -.asm_3d380 - call Function3d362 +ForcePickSwitchMonInBattle: ; 3d380 +; Can't back out. + +.pick + call ForcePickPartyMonInBattle call Function3d2e0 ret c - call Function3d34f - jr c, .asm_3d380 + call SwitchMonAlreadyOut + jr c, .pick + xor a ret ; 3d38e @@ -3240,10 +3257,10 @@ Function3d4c3: ; 3d4c3 ld b, a call Function3d6ca call Function3d7a0 - call Function3d834 - call Function3d867 + call NewEnemyMonStatus + call ResetEnemyStatLevels call Function3d7c7 - call Function3dc18 + call BreakAttraction call Function3d57a ret ; 3d4e1 @@ -3251,7 +3268,7 @@ Function3d4c3: ; 3d4c3 Function3d4e1: ; 3d4e1 call Function3d714 - jr nc, asm_3d517 + jr nc, Function3d517 call Function3d557 call Function3d533 jr c, .asm_3d4f1 @@ -3274,8 +3291,9 @@ Function3d4e1: ; 3d4e1 ld [$c711], a call Function309d jp Function3e3ad +; 3d517 -asm_3d517 +Function3d517: ; 3d517 call Function3d557 call Function3d533 jr c, .asm_3d522 @@ -3416,7 +3434,7 @@ Function3d5d7: ; 3d5d7 ld a, BANK(Moves) call FarCopyBytes call SetEnemyTurn - callab Function0x347c8 + callab Function347c8 pop bc pop de pop hl @@ -3441,23 +3459,23 @@ Function3d618: ; 3d618 add hl, bc ld a, [hl] dec a - ld hl, $542b - ld bc, $0020 + ld hl, BaseData + 7 ; type + ld bc, $20 call AddNTimes ld de, EnemyMonType1 - ld bc, $0002 - ld a, $14 + ld bc, 2 + ld a, BANK(BaseData) call FarCopyBytes ld a, [BattleMonType1] ld [PlayerMoveType], a call SetPlayerTurn - callab Function0x347c8 + callab Function347c8 ld a, [$d265] cp $b jr nc, .asm_3d663 ld a, [BattleMonType2] ld [PlayerMoveType], a - callab Function0x347c8 + callab Function347c8 ld a, [$d265] cp $b jr nc, .asm_3d663 @@ -3623,7 +3641,7 @@ Function3d74b: ; 3d74b dec a jr nz, .asm_3d79a call Function3d2f7 - call Function3d375 + call PickSwitchMonInBattle jr c, .asm_3d791 ld a, [CurBattleMon] ld [$c71a], a @@ -3720,7 +3738,7 @@ Function3d7c7: ; 3d7c7 ret ; 3d834 -Function3d834: ; 3d834 +NewEnemyMonStatus: ; 3d834 xor a ld [LastEnemyCounterMove], a ld [LastPlayerCounterMove], a @@ -3745,14 +3763,14 @@ Function3d834: ; 3d834 ret ; 3d867 -Function3d867: ; 3d867 - ld a, $7 - ld b, $8 - ld hl, EnemyAtkLevel -.asm_3d86e +ResetEnemyStatLevels: ; 3d867 + ld a, 7 + ld b, 8 + ld hl, EnemyStatLevels +.loop ld [hli], a dec b - jr nz, .asm_3d86e + jr nz, .loop ret ; 3d873 @@ -4035,12 +4053,12 @@ Function3da0d: ; 3da0d Function3da74: ; 3da74 call Function3da85 - jr asm_3da7c + jr Function3da7c Function3da79: ; 3da79 call Function3da97 -asm_3da7c +Function3da7c: ; 3da7c ld b, h ld c, l callab CheckShininess @@ -4071,14 +4089,14 @@ Function3da97: ; 3da97 jp GetPartyLocation ; 3dab1 -Function3dab1: ; 3dab1 - ld a, $7 - ld b, $8 - ld hl, PlayerAtkLevel -.asm_3dab8 +ResetPlayerStatLevels: ; 3dab1 + ld a, 7 + ld b, 8 + ld hl, PlayerStatLevels +.loop ld [hli], a dec b - jr nz, .asm_3dab8 + jr nz, .loop ret ; 3dabd @@ -4145,9 +4163,9 @@ Function3db32: ; 3db32 ld [CurBattleMon], a call Function3d581 call Function3da0d - call Function3dab1 - call Function3dbde - call Function3dc18 + call ResetPlayerStatLevels + call NewBattleMonStatus + call BreakAttraction call Function3db5f call EmptyBattleTextBox call Function309d @@ -4215,7 +4233,7 @@ Function3db5f: ; 3db5f ret ; 3dbde -Function3dbde: ; 3dbde +NewBattleMonStatus: ; 3dbde xor a ld [LastEnemyCounterMove], a ld [LastPlayerCounterMove], a @@ -4233,7 +4251,7 @@ Function3dbde: ; 3dbde ld [hl], a ld [PlayerDisableCount], a ld [PlayerFuryCutterCount], a - ld [$c679], a + ld [PlayerProtectCount], a ld [$c72b], a ld [DisabledMove], a ld [$c6fe], a @@ -4241,50 +4259,56 @@ Function3dbde: ; 3dbde ld [$c730], a ld [PlayerTurnsTaken], a ld hl, EnemySubStatus5 - res 7, [hl] + res SUBSTATUS_CANT_RUN, [hl] ret ; 3dc18 -Function3dc18: ; 3dc18 +BreakAttraction: ; 3dc18 ld hl, PlayerSubStatus1 - res 7, [hl] + res SUBSTATUS_IN_LOVE, [hl] ld hl, EnemySubStatus1 - res 7, [hl] + res SUBSTATUS_IN_LOVE, [hl] ret ; 3dc23 -Function3dc23: ; 3dc23 +SpikesDamage: ; 3dc23 ld hl, PlayerScreens ld de, BattleMonType1 ld bc, Function3df48 ld a, [hBattleTurn] and a - jr z, .asm_3dc3a + jr z, .ok ld hl, EnemyScreens ld de, EnemyMonType1 ld bc, Function3e036 +.ok -.asm_3dc3a - bit 0, [hl] + bit SCREENS_SPIKES, [hl] ret z + +; Flying-types aren't affected by Spikes. ld a, [de] - cp $2 + cp FLYING ret z inc de ld a, [de] - cp $2 + cp FLYING ret z + push bc - ld hl, BattleText_0x80bae + + ld hl, BattleText_0x80bae ; "hurt by SPIKES!" call StdBattleTextBox + call GetEighthMaxHP call Function3cc39 - pop hl - call Function3dc5a - jp WaitBGMap -; 3dc5a -Function3dc5a: ; 3dc5a + pop hl + call .hl + + jp WaitBGMap + +.hl jp [hl] ; 3dc5b @@ -4549,15 +4573,15 @@ Function3dde9: ; 3dde9 res 7, [hl] .asm_3de26 - ld hl, Function0x365fd + ld hl, Function365fd ld a, [hBattleTurn] and a jr z, .asm_3de31 - ld hl, Function0x365d7 + ld hl, Function365d7 .asm_3de31 call Function3c8e4 - ld a, BANK(Function0x365fd) + ld a, BANK(Function365fd) rst FarCall call Function3c8e4 call Function3ddc8 @@ -5110,7 +5134,7 @@ Function3e19b: ; 3e19b ld hl, $cd2a bit 4, [hl] jr nz, .asm_3e1c5 - ld hl, $5863 + ld hl, BattleText_0x81863 call StdBattleTextBox ld c, $3c call DelayFrames @@ -5370,7 +5394,7 @@ Function3e3ad: ; 3e3ad jr nz, .asm_3e3cf .asm_3e3ca - call Function3e40b + call BattleMonEntrance and a ret @@ -5391,14 +5415,14 @@ Function3e3ad: ; 3e3ad ld a, [$ffcb] cp $1 jr z, .asm_3e3f7 - call Function3e40b + call BattleMonEntrance call Function3e3ff and a ret .asm_3e3f7 call Function3e3ff - call Function3e40b + call BattleMonEntrance and a ret ; 3e3ff @@ -5406,48 +5430,54 @@ Function3e3ad: ; 3e3ad Function3e3ff: ; 3e3ff callab Function3846c call SetEnemyTurn - jp Function3dc23 + jp SpikesDamage ; 3e40b -Function3e40b: ; 3e40b +BattleMonEntrance: ; 3e40b call Function3f2f4 - ld c, $32 + + ld c, 50 call DelayFrames + ld hl, PlayerSubStatus4 - res 6, [hl] + res SUBSTATUS_RAGE, [hl] + call SetEnemyTurn call Function3dc5b jr c, .asm_3e423 call Function3dce6 - .asm_3e423 - ld hl, $c535 - ld bc, $050b + + hlcoord 9, 7 + lb bc, 5, 11 call ClearBox + ld a, [CurBattleMon] ld [CurPartyMon], a call Function3d581 call Function3da0d - call Function3dab1 + call ResetPlayerStatLevels call Function3f26d - call Function3dbde - call Function3dc18 + call NewBattleMonStatus + call BreakAttraction call Function3db5f call EmptyBattleTextBox call Function309d call SetPlayerTurn - call Function3dc23 + call SpikesDamage ld a, $2 ld [$cfa9], a ret ; 3e459 -Function3e459: ; 3e459 - ld c, $32 +PassedBattleMonEntrance: ; 3e459 + ld c, 50 call DelayFrames - ld hl, $c535 - ld bc, $050b + + hlcoord 9, 7 + lb bc, 5, 11 call ClearBox + ld a, [CurPartyMon] ld [CurBattleMon], a call Function3d581 @@ -5459,7 +5489,7 @@ Function3e459: ; 3e459 call EmptyBattleTextBox call Function309d call SetPlayerTurn - jp Function3dc23 + jp SpikesDamage ; 3e489 @@ -8250,12 +8280,12 @@ Function3f43d: ; 3f43d ld a, [PlayerSubStatus4] bit 4, a ld hl, BattleAnimCmd_DD - jr nz, asm_3f46f + jr nz, Function3f46f Function3f447: ; 3f447 ld a, [$c6fe] and a ld hl, BattleAnimCmd_E2 - jr nz, asm_3f46f + jr nz, Function3f46f ld a, [CurPartySpecies] push af ld a, [BattleMonSpecies] @@ -8269,8 +8299,9 @@ Function3f447: ; 3f447 pop af ld [CurPartySpecies], a ret +; 3f46f -asm_3f46f +Function3f46f: ; 3f46f ld a, [hBattleTurn] push af xor a @@ -8286,12 +8317,12 @@ Function3f47c: ; 3f47c ld a, [EnemySubStatus4] bit 4, a ld hl, BattleAnimCmd_DD - jr nz, asm_3f4b4 + jr nz, Function3f4b4 Function3f486: ; 3f486 ld a, [$c6fa] and a ld hl, BattleAnimCmd_E2 - jr nz, asm_3f4b4 + jr nz, Function3f4b4 ld a, [CurPartySpecies] push af ld a, [EnemyMonSpecies] @@ -8307,8 +8338,9 @@ Function3f486: ; 3f486 pop af ld [CurPartySpecies], a ret +; 3f4b4 -asm_3f4b4 +Function3f4b4: ; 3f4b4 ld a, [hBattleTurn] push af call SetEnemyTurn @@ -8524,47 +8556,52 @@ Function3f607: ; 3f607 Function3f662: ; 3f662 ld hl, EnemyMonMove1 ld de, $d25e - ld b, $4 -.asm_3f66a + ld b, 4 +.loop ld a, [de] inc de ld [hli], a and a - jr z, .asm_3f690 + jr z, .clearpp + push bc push hl + push hl dec a - ld hl, $5b00 - ld bc, $0007 + ld hl, Moves + MOVE_PP + ld bc, Move2 - Move1 call AddNTimes - ld a, $10 + ld a, BANK(Moves) call GetFarByte pop hl - ld bc, $0005 + + ld bc, EnemyMonPP - (EnemyMonMoves + 1) add hl, bc ld [hl], a + pop hl pop bc + dec b - jr nz, .asm_3f66a + jr nz, .loop ret -.asm_3f68e +.clear xor a ld [hli], a -.asm_3f690 +.clearpp push bc push hl - ld bc, $0005 + ld bc, EnemyMonPP - (EnemyMonMoves + 1) add hl, bc xor a ld [hl], a pop hl pop bc dec b - jr nz, .asm_3f68e + jr nz, .clear ret ; 3f69e diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 666a75ef7..b9de61922 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -126,7 +126,7 @@ BattleCommand01: ; 34084 ld a, BATTLE_VARS_MOVE call GetBattleVar inc a - jp z, Function0x34385 + jp z, Function34385 xor a ld [AttackMissed], a @@ -157,7 +157,7 @@ CheckPlayerTurn: call StdBattleTextBox call CantMove - jp Function0x34385 + jp Function34385 .CheckSleep @@ -183,8 +183,8 @@ CheckPlayerTurn: call CantMove call UpdateBattleMonInParty - ld hl, $5f48 - call CallBankF + ld hl, Function3df48 + call CallBattleCore ld a, $1 ld [$ffd4], a ld hl, PlayerSubStatus1 @@ -204,7 +204,7 @@ CheckPlayerTurn: cp SLEEP_TALK jr z, .CheckFrozen call CantMove - jp Function0x34385 + jp Function34385 .CheckFrozen @@ -224,7 +224,7 @@ CheckPlayerTurn: call StdBattleTextBox call CantMove - jp Function0x34385 + jp Function34385 .CheckFlinch @@ -239,7 +239,7 @@ CheckPlayerTurn: call StdBattleTextBox call CantMove - jp Function0x34385 + jp Function34385 .CheckDisabled @@ -300,7 +300,7 @@ CheckPlayerTurn: call HitConfusion call CantMove - jp Function0x34385 + jp Function34385 .CheckAttract @@ -328,7 +328,7 @@ CheckPlayerTurn: call StdBattleTextBox call CantMove - jp Function0x34385 + jp Function34385 .CheckDisabledMove @@ -344,7 +344,7 @@ CheckPlayerTurn: call MoveDisabled call CantMove - jp Function0x34385 + jp Function34385 .CheckParalyzed @@ -361,7 +361,7 @@ CheckPlayerTurn: ld hl, FullyParalyzedText call StdBattleTextBox call CantMove - jp Function0x34385 + jp Function34385 ; 341f0 @@ -389,12 +389,12 @@ CantMove: ; 341f0 .asm_3420f res 5, [hl] res 6, [hl] - jp Function0x37ece + jp Function37ece ; 34216 -Function0x34216: ; 34216 +Function34216: ; 34216 call SwitchTurn call CantMove jp SwitchTurn @@ -414,7 +414,7 @@ CheckEnemyTurn: ; 3421f ld hl, MustRechargeText call StdBattleTextBox call CantMove - jp Function0x34385 + jp Function34385 .CheckSleep @@ -443,8 +443,8 @@ CheckEnemyTurn: ; 3421f call StdBattleTextBox call CantMove call UpdateEnemyMonInParty - ld hl, $6036 - call CallBankF + ld hl, Function3e036 + call CallBattleCore ld a, $1 ld [$ffd4], a ld hl, EnemySubStatus1 @@ -460,7 +460,7 @@ CheckEnemyTurn: ; 3421f cp SLEEP_TALK jr z, .CheckFrozen call CantMove - jp Function0x34385 + jp Function34385 .CheckFrozen @@ -477,7 +477,7 @@ CheckEnemyTurn: ; 3421f ld hl, FrozenSolidText call StdBattleTextBox call CantMove - jp Function0x34385 + jp Function34385 .CheckFlinch @@ -492,7 +492,7 @@ CheckEnemyTurn: ; 3421f call StdBattleTextBox call CantMove - jp Function0x34385 + jp Function34385 .CheckDisabled @@ -557,7 +557,7 @@ CheckEnemyTurn: ; 3421f ld hl, HurtItselfText call StdBattleTextBox - call Function0x355dd + call Function355dd call BattleCommand62 @@ -574,12 +574,12 @@ CheckEnemyTurn: ; 3421f call z, PlayFXAnimID ld c, $1 - call Function0x35d1c + call Function35d1c call BattleCommand0c call CantMove - jp Function0x34385 + jp Function34385 .CheckAttract @@ -607,7 +607,7 @@ CheckEnemyTurn: ; 3421f call StdBattleTextBox call CantMove - jp Function0x34385 + jp Function34385 .CheckDisabledMove @@ -624,7 +624,7 @@ CheckEnemyTurn: ; 3421f call MoveDisabled call CantMove - jp Function0x34385 + jp Function34385 .CheckParalyzed @@ -647,7 +647,7 @@ CheckEnemyTurn: ; 3421f ; 34385 -Function0x34385: ; 34385 +Function34385: ; 34385 ld a, $1 ld [$c6b4], a jp ResetDamage @@ -681,7 +681,7 @@ HitConfusion: ; 343a5 xor a ld [CriticalHit], a - call Function0x355dd + call Function355dd call BattleCommand62 @@ -697,14 +697,14 @@ HitConfusion: ; 343a5 and $60 call z, PlayFXAnimID - ld hl, $5f48 - call CallBankF + ld hl, Function3df48 + call CallBattleCore ld a, $1 ld [$ffd4], a ld c, $1 - call Function0x35d7e + call Function35d7e jp BattleCommand0c ; 343db @@ -718,7 +718,7 @@ BattleCommand02: ; 343db and a ret nz - call Function0x34548 + call Function34548 ret nz ; If we've already checked this turn @@ -858,7 +858,7 @@ BattleCommand02: ; 343db call HitConfusion - jp Function0x3450c + jp Function3450c .Nap @@ -899,7 +899,7 @@ BattleCommand02: ; 343db .Print call StdBattleTextBox - jp Function0x3450c + jp Function3450c .UseInstead @@ -1007,7 +1007,7 @@ BattleCommand02: ; 343db ; 3450c -Function0x3450c: ; 3450c +Function3450c: ; 3450c xor a ld [LastPlayerMove], a ld [LastEnemyCounterMove], a @@ -1059,7 +1059,7 @@ BattleCommand03: ; 34541 ; 34548 -Function0x34548: ; 34548 +Function34548: ; 34548 ld a, [hBattleTurn] and a @@ -1073,7 +1073,7 @@ Function0x34548: ; 34548 BattleCommand04: ; 34555 - call Function0x34548 + call Function34548 ret nz ld hl, BattleMonPP @@ -1134,7 +1134,7 @@ BattleCommand04: ; 34555 .asm_345a4 call GetPartyLocation push hl - call Function0x3460b + call Function3460b pop hl ret c @@ -1209,7 +1209,7 @@ BattleCommand04: ; 34555 db $ff ; 3460b -Function0x3460b: ; 3460b +Function3460b: ; 3460b ld a, [hBattleTurn] and a ld a, [CurMoveNum] @@ -1313,7 +1313,7 @@ BattleCommand05: ; 34631 push bc call GetUserItem ld a, b - cp $49 ; Increased critical chance. Only Scope Lens has this. + cp HELD_CRITICAL_UP ; Increased critical chance. Only Scope Lens has this. pop bc jr nz, .Tally @@ -1552,7 +1552,7 @@ BattleCommand07: ; 346d2 jr .asm_34743 .end - call Function0x347c8 + call Function347c8 ld a, [$d265] ld b, a ld a, [TypeModifier] @@ -1563,18 +1563,18 @@ BattleCommand07: ; 346d2 ; 347c8 -Function0x347c8: ; 347c8 +Function347c8: ; 347c8 ld hl, EnemyMonType1 ld a, [hBattleTurn] and a - jr z, Function0x347d3 + jr z, Function347d3 ld hl, BattleMonType1 ; fallthrough ; 347d3 -Function0x347d3: ; 347d3 +Function347d3: ; 347d3 push hl push de push bc @@ -1640,7 +1640,7 @@ Function0x347d3: ; 347d3 BattleCommanda3: ; 34833 - call Function0x347c8 + call Function347c8 ld a, [$d265] and a ld a, $a @@ -1657,7 +1657,7 @@ BattleCommanda3: ; 34833 ; 3484e -Function0x3484e: ; 3484e +Function3484e: ; 3484e push hl push de push bc @@ -1682,7 +1682,7 @@ Function0x3484e: ; 3484e inc hl call GetMoveByte ld hl, EnemyMonType1 - call Function0x347d3 + call Function347d3 ld a, [$d265] cp $b jr nc, .asm_34895 ; 0x3487f $14 @@ -1699,7 +1699,7 @@ Function0x3484e: ; 3484e ld e, $2 jr .asm_3489b ; 0x34893 $6 .asm_34895 - call Function0x34931 + call Function34931 pop hl jr .asm_348d7 ; 0x34899 $3c .asm_3489b @@ -1710,32 +1710,32 @@ Function0x3484e: ; 3484e ld a, e cp $2 jr z, .asm_348d7 ; 0x348a2 $33 - call Function0x34939 + call Function34939 ld a, e and a jr nz, .asm_348d7 ; 0x348a9 $2c - call Function0x34939 + call Function34939 jr .asm_348d7 ; 0x348ae $27 .asm_348b0 ld a, [BattleMonType1] ld b, a ld hl, EnemyMonType1 - call Function0x347d3 + call Function347d3 ld a, [$d265] cp $b jr c, .asm_348c4 ; 0x348bf $3 - call Function0x34931 + call Function34931 .asm_348c4 ld a, [BattleMonType2] cp b jr z, .asm_348d7 ; 0x348c8 $d - call Function0x347d3 + call Function347d3 ld a, [$d265] cp $b jr c, .asm_348d7 ; 0x348d2 $3 - call Function0x34931 + call Function34931 .asm_348d7 - call Function0x348de + call Function348de pop bc pop de pop hl @@ -1743,7 +1743,7 @@ Function0x3484e: ; 3484e ; 348de -Function0x348de: ; 348de +Function348de: ; 348de ld de, EnemyMonMove1 ld b, 5 ld c, 0 @@ -1769,7 +1769,7 @@ Function0x348de: ; 348de inc hl call GetMoveByte ld hl, BattleMonType1 - call Function0x347d3 + call Function347d3 ld a, [$d265] and a jr z, .loop @@ -1798,19 +1798,19 @@ Function0x348de: ; 348de and a jr z, .doubledown ; double down cp $5 - jr c, Function0x34931 ; down + jr c, Function34931 ; down cp $64 ret c - jr Function0x34939 ; up + jr Function34939 ; up .doubledown - call Function0x34931 + call Function34931 ; fallthrough ; 34931 -Function0x34931: ; 34931 +Function34931: ; 34931 ld a, [$c716] dec a ld [$c716], a @@ -1818,7 +1818,7 @@ Function0x34931: ; 34931 ; 34939 -Function0x34939: ; 34939 +Function34939: ; 34939 ld a, [$c716] inc a ld [$c716], a @@ -1826,10 +1826,10 @@ Function0x34939: ; 34939 ; 34941 -Function0x34941: ; 34941 +Function34941: ; 34941 xor a ld [$c717], a - call Function0x349f4 + call Function349f4 ret c ld a, [EnemySubStatus1] @@ -1840,10 +1840,10 @@ Function0x34941: ; 34941 cp $1 jr nz, .asm_34986 - call Function0x349f4 - call Function0x34b77 - call Function0x34b20 - call Function0x34a85 + call Function349f4 + call Function34b77 + call Function34b20 + call Function34a85 ld a, e cp $2 @@ -1855,7 +1855,7 @@ Function0x34941: ; 34941 ret .asm_34971 - call Function0x349f4 + call Function349f4 sla c sla c ld b, $ff @@ -1871,7 +1871,7 @@ Function0x34941: ; 34941 ret .asm_34986 - call Function0x3484e + call Function3484e ld a, [$c716] cp $b ret nc @@ -1880,13 +1880,13 @@ Function0x34941: ; 34941 and a jr z, .asm_349d2 - call Function0x34a2a + call Function34a2a ld a, [$c716] and a jr z, .asm_349d2 ld c, a - call Function0x34aa7 + call Function34aa7 ld a, [$c716] cp $ff ret z @@ -1896,7 +1896,7 @@ Function0x34941: ; 34941 cp $2 jr z, .asm_349be - call Function0x3484e + call Function3484e ld a, [$c716] cp $a ret nc @@ -1908,7 +1908,7 @@ Function0x34941: ; 34941 .asm_349be ld c, $10 - call Function0x3484e + call Function3484e ld a, [$c716] cp $a jr nc, .asm_349cc @@ -1921,15 +1921,15 @@ Function0x34941: ; 34941 ret .asm_349d2 - call Function0x3484e + call Function3484e ld a, [$c716] cp $a ret nc - call Function0x349f4 - call Function0x34b77 - call Function0x34b20 - call Function0x34a85 + call Function349f4 + call Function34b77 + call Function34b20 + call Function34a85 ld a, e cp $2 @@ -1942,7 +1942,7 @@ Function0x34941: ; 34941 ; 349f4 -Function0x349f4: ; 349f4 +Function349f4: ; 349f4 ld a, [OTPartyCount] cp 2 jr c, .asm_34a26 @@ -1993,7 +1993,7 @@ Function0x349f4: ; 349f4 ; 34a2a -Function0x34a2a: ; 34a2a +Function34a2a: ; 34a2a ld hl, OTPartyMon1 ld a, [OTPartyCount] ld b, a @@ -2031,7 +2031,7 @@ Function0x34a2a: ; 34a2a inc hl call GetMoveByte ld hl, $d23d - call Function0x347d3 + call Function347d3 ld a, [$d265] and a jr nz, .asm_34a77 @@ -2055,7 +2055,7 @@ Function0x34a2a: ; 34a2a ; 34a85 -Function0x34a85: ; 34a85 +Function34a85: ; 34a85 push bc ld a, [OTPartyCount] ld e, a @@ -2089,7 +2089,7 @@ Function0x34a85: ; 34a85 ; fallthrough ; 34aa7 -Function0x34aa7: ; 34aa7 +Function34aa7: ; 34aa7 ld a, $ff ld [$c716], a @@ -2121,7 +2121,7 @@ Function0x34aa7: ; 34aa7 inc hl call GetMoveByte ld hl, BattleMonType1 - call Function0x347d3 + call Function347d3 ld a, [$d265] cp $a jr c, .asm_34ae9 @@ -2187,7 +2187,7 @@ Function0x34aa7: ; 34aa7 ; 34b20 -Function0x34b20: ; 34b20 +Function34b20: ; 34b20 push bc ld hl, OTPartySpecies ld b, $20 @@ -2218,7 +2218,7 @@ Function0x34b20: ; 34b20 .asm_34b4a ld a, [BattleMonType1] ld hl, $d23d - call Function0x347d3 + call Function347d3 ld a, [$d265] cp $b jr nc, .asm_34b6d @@ -2226,7 +2226,7 @@ Function0x34b20: ; 34b20 .asm_34b5d ld hl, $d23d - call Function0x347d3 + call Function347d3 ld a, [$d265] cp $b jr nc, .asm_34b6d @@ -2249,7 +2249,7 @@ Function0x34b20: ; 34b20 ; 34b77 -Function0x34b77: ; 34b77 +Function34b77: ; 34b77 push bc ld de, OTPartySpecies ld b, $20 @@ -2715,6 +2715,7 @@ BattleCommand90: ; 34ecc BattleCommand0a: ; 34eee +; lowersub ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar @@ -2743,11 +2744,11 @@ BattleCommand0a: ; 34eee call .Rampage jr z, .asm_34f21 - call Function0x34548 + call Function34548 ret nz .asm_34f21 - call Function0x37ed5 + call Function37ed5 jr c, .asm_34f36 xor a @@ -2755,8 +2756,8 @@ BattleCommand0a: ; 34eee ld [FXAnimIDHi], a inc a ld [$c689], a - ld a, $a4 - jp Function0x37e44 + ld a, SUBSTITUTE + jp Function37e44 .asm_34f36 call BattleCommanda7 @@ -2838,7 +2839,7 @@ BattleCommand0b: ; 34f60 .asm_34fad ; clear sprite - jp Function0x37ec7 + jp Function37ec7 .asm_34fb0 ld a, [$c689] and 1 @@ -2908,12 +2909,14 @@ BattleCommand93: ; 34ffd BattleCommand0c: ; 35004 +; raisesub + ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a ret z - call Function0x37ed5 + call Function37ed5 jp c, BattleCommanda6 xor a @@ -2921,8 +2924,8 @@ BattleCommand0c: ; 35004 ld [FXAnimIDHi], a ld a, $2 ld [$c689], a - ld a, $a4 - jp Function0x37e44 + ld a, SUBSTITUTE + jp Function37e44 ; 35023 @@ -2932,7 +2935,7 @@ BattleCommand0d: ; 35023 and a ret z - call Function0x350e4 + call Function350e4 ld a, BATTLE_VARS_MOVE_ANIM call _GetBattleVar @@ -2962,7 +2965,7 @@ BattleCommand0d: ; 35023 call _GetBattleVar res SUBSTATUS_UNDERGROUND, [hl] res SUBSTATUS_FLYING, [hl] - call Function0x37ece + call Function37ece jp EndMoveEffect ; 3505e @@ -3000,11 +3003,11 @@ BattleCommand0e: ; 3505e ld a, [hBattleTurn] and a jr nz, .asm_3509b - call Function0x35d1c + call Function35d1c jr .asm_3509e .asm_3509b - call Function0x35d7e + call Function35d7e .asm_3509e pop bc @@ -3058,7 +3061,7 @@ BattleCommand0e: ; 3505e ; 350e4 -Function0x350e4: ; 350e4 +Function350e4: ; 350e4 ld hl, DoesntAffectText ld de, DoesntAffectText ld a, [TypeModifier] @@ -3077,7 +3080,7 @@ Function0x350e4: ; 350e4 jr nz, .asm_35110 ; 0x3510b $3 ld hl, UnaffectedText .asm_35110 - call Function0x35157 + call Function35157 xor a ld [CriticalHit], a ld a, BATTLE_VARS_MOVE_EFFECT @@ -3108,14 +3111,14 @@ Function0x350e4: ; 350e4 call StdBattleTextBox ld a, $1 ld [$c689], a - call Function0x37e36 + call Function37e36 ld c, $1 ld a, [hBattleTurn] and a - jp nz, Function0x35d1c - jp Function0x35d7e + jp nz, Function35d1c + jp Function35d7e -Function0x35157: ; 35157 +Function35157: ; 35157 ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_PROTECT, a @@ -3278,7 +3281,7 @@ BattleCommand11: ; 351c0 inc a ld [$c689], a ld a, $c2 - call Function0x37e44 + call Function37e44 call SwitchTurn jr .asm_3524d ; 3522f $1c @@ -3441,7 +3444,7 @@ PlayerAttackDamage: ; 352e2 ret z ld a, [hl] - cp FIRE + cp SPECIAL jr nc, .special @@ -3505,7 +3508,7 @@ PlayerAttackDamage: ; 352e2 call ThickClubBoost .done - call Function0x3534d + call Function3534d ld a, [BattleMonLevel] ld e, a @@ -3517,7 +3520,7 @@ PlayerAttackDamage: ; 352e2 ; 3534d -Function0x3534d: ; 3534d +Function3534d: ; 3534d ; Truncate 16-bit values hl and bc to 8-bit values b and c respectively. ; b = hl, c = bc @@ -3553,7 +3556,7 @@ Function0x3534d: ; 3534d ld a, h or b - jr nz, Function0x3534d + jr nz, Function3534d .done ld b, l @@ -3583,7 +3586,7 @@ GetDamageStats: ; 3537e and a jr nz, .enemy ld a, [PlayerMoveType] - cp FIRE + cp SPECIAL ; special ld a, [PlayerSAtkLevel] ld b, a @@ -3597,7 +3600,7 @@ GetDamageStats: ; 3537e .enemy ld a, [EnemyMoveType] - cp FIRE + cp SPECIAL ; special ld a, [EnemySAtkLevel] ld b, a @@ -3702,7 +3705,7 @@ EnemyAttackDamage: ; 353f6 ret z ld a, [hl] - cp FIRE + cp SPECIAL jr nc, .Special @@ -3763,7 +3766,7 @@ EnemyAttackDamage: ; 353f6 call ThickClubBoost .done - call Function0x3534d + call Function3534d ld a, [EnemyMonLevel] ld e, a @@ -3801,12 +3804,12 @@ BattleCommanda1: ; 35461 .asm_3548d ld a, [DefaultFlypoint] ld hl, PartyMon1Nickname - call $38a2 + call GetNick ld a, $22 - call Function0x355bd + call Function355bd ld a, [hli] or [hl] - jp z, Function0x355b0 + jp z, Function355b0 ld a, [DefaultFlypoint] ld c, a ld a, [CurBattleMon] @@ -3814,32 +3817,32 @@ BattleCommanda1: ; 35461 ld hl, BattleMonStatus jr z, .asm_354b2 ; 354ab $5 ld a, $20 - call Function0x355bd + call Function355bd .asm_354b2 ld a, [hl] and a - jp nz, Function0x355b0 + jp nz, Function355b0 ld a, $1 ld [$c72d], a ld hl, BeatUpAttackText call StdBattleTextBox ld a, [EnemyMonSpecies] ld [CurSpecies], a - call $3856 + call GetBaseData ld a, [$d239] ld c, a push bc ld a, $0 - call Function0x355bd + call Function355bd ld a, [hl] ld [CurSpecies], a - call $3856 + call GetBaseData ld a, [$d238] pop bc ld b, a push bc ld a, $1f - call Function0x355bd + call Function355bd ld a, [hl] ld e, a pop bc @@ -3884,7 +3887,7 @@ BattleCommanda1: ; 35461 add hl, bc ld a, [hl] ld [$d265], a - call $343b + call GetPokemonName jr .asm_35544 .asm_35532 @@ -3896,10 +3899,10 @@ BattleCommanda1: ; 35461 call CopyBytes .asm_35544 ld a, $22 - call Function0x355bd + call Function355bd ld a, [hli] or [hl] - jp z, Function0x355b0 + jp z, Function355b0 ld a, [DefaultFlypoint] ld b, a ld a, [CurOTMon] @@ -3908,11 +3911,11 @@ BattleCommanda1: ; 35461 jr z, .asm_35560 ld a, $20 - call Function0x355bd + call Function355bd .asm_35560 ld a, [hl] and a - jr nz, Function0x355b0 + jr nz, Function355b0 ld a, $1 ld [$c72d], a @@ -3921,7 +3924,7 @@ BattleCommanda1: ; 35461 .asm_3556b ld a, [EnemyMonSpecies] ld [$d265], a - call $343b + call GetPokemonName ld hl, BeatUpAttackText call StdBattleTextBox jp EnemyAttackDamage @@ -3935,7 +3938,7 @@ BattleCommanda1: ; 35461 ld c, a push bc ld a, $0 - call Function0x355bd + call Function355bd ld a, [hl] ld [CurSpecies], a call GetBaseData @@ -3944,7 +3947,7 @@ BattleCommanda1: ; 35461 ld b, a push bc ld a, $1f - call Function0x355bd + call Function355bd ld a, [hl] ld e, a pop bc @@ -3954,7 +3957,7 @@ BattleCommanda1: ; 35461 ; 355b0 -Function0x355b0: ; 355b0 +Function355b0: ; 355b0 ld b, $12 ; buildopponentrage jp SkipToBattleCommand ; 355b5 @@ -3968,7 +3971,7 @@ BattleCommanda8: ; 355b5 ; 355bd -Function0x355bd: ; 355bd +Function355bd: ; 355bd push bc ld c, a ld b, 0 @@ -3996,7 +3999,7 @@ BattleCommanda9: ; 355d5 ; 355dd -Function0x355dd: ; 355dd +Function355dd: ; 355dd call ResetDamage ld a, [hBattleTurn] and a @@ -4026,7 +4029,7 @@ Function0x355dd: ; 355dd ld a, [hli] ld l, [hl] ld h, a - call Function0x3534d + call Function3534d ld d, $28 pop af ld e, a @@ -4461,51 +4464,58 @@ BattleCommand3f: ; 35726 BattleCommand40: ; 35813 ; counter - ld a, $1 + ld a, 1 ld [AttackMissed], a ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar and a ret z + ld b, a - callab GetMoveEffect - ld a, b - cp $59 + cp EFFECT_COUNTER ret z + call BattleCommanda3 ld a, [$d265] and a ret z - call Function0x36abf + + call Function36abf ret z + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar dec a ld de, StringBuffer1 call GetMoveData + ld a, [$d075] and a ret z + ld a, [$d076] - cp $14 + cp SPECIAL ret nc + ld hl, CurDamage ld a, [hli] or [hl] ret z + ld a, [hl] add a ld [hld], a ld a, [hl] adc a ld [hl], a - jr nc, .asm_3585f ; 35859 $4 + jr nc, .capped ld a, $ff ld [hli], a ld [hl], a -.asm_3585f +.capped + xor a ld [AttackMissed], a ret @@ -4526,13 +4536,13 @@ BattleCommand41: ; 35864 ld a, BATTLE_VARS_LAST_MOVE_OPP call GetBattleVar and a - jp z, Function0x35923 + jp z, Function35923 cp STRUGGLE - jp z, Function0x35923 + jp z, Function35923 cp ENCORE - jp z, Function0x35923 + jp z, Function35923 cp MIRROR_MOVE - jp z, Function0x35923 + jp z, Function35923 ld b, a .asm_3588e @@ -4544,14 +4554,14 @@ BattleCommand41: ; 35864 add hl, bc ld a, [hl] and $3f - jp z, Function0x35923 + jp z, Function35923 ld a, [AttackMissed] and a - jp nz, Function0x35923 + jp nz, Function35923 ld a, BATTLE_VARS_SUBSTATUS5_OPP call _GetBattleVar bit 4, [hl] - jp nz, Function0x35923 + jp nz, Function35923 set 4, [hl] call BattleRandom and $3 @@ -4559,7 +4569,7 @@ BattleCommand41: ; 35864 inc a inc a ld [de], a - call Function0x36abf + call Function36abf jr nz, .asm_3591a ld a, [hBattleTurn] and a @@ -4581,7 +4591,7 @@ BattleCommand41: ; 35864 res 4, [hl] xor a ld [de], a - jr Function0x35923 + jr Function35923 .asm_358dd pop hl ld a, c @@ -4610,7 +4620,7 @@ BattleCommand41: ; 35864 res 4, [hl] xor a ld [de], a - jr Function0x35923 + jr Function35923 .asm_3590a pop hl ld a, c @@ -4621,14 +4631,14 @@ BattleCommand41: ; 35864 ld de, EnemyMoveStruct call GetMoveData .asm_3591a - call Function0x37e01 + call AnimateCurrentMove ld hl, GotAnEncoreText jp StdBattleTextBox ; 35923 -Function0x35923: ; 35923 +Function35923: ; 35923 jp PrintDidntAffect2 ; 35926 @@ -4638,10 +4648,10 @@ BattleCommand42: ; 35926 ld a, [AttackMissed] and a - jp nz, Function0x359cd + jp nz, Function359cd call CheckSubstituteOpp - jp nz, Function0x359cd - call Function0x37e01 + jp nz, Function359cd + call AnimateCurrentMove ld hl, $c63f ld de, EnemyMonMaxHPLo call .asm_3597d @@ -4659,7 +4669,7 @@ BattleCommand42: ; 35926 ld [$d1eb], a ld a, [hl] ld [$d1ea], a - call Function0x359ac + call Function359ac xor a ld [$d10a], a call ResetDamage @@ -4706,7 +4716,7 @@ BattleCommand42: ; 35926 ; 359ac -Function0x359ac: ; 359ac +Function359ac: ; 359ac ld c, [hl] dec hl ld a, [$d257] @@ -4731,7 +4741,7 @@ Function0x359ac: ; 359ac ret ; 359cd -Function0x359cd: ; 359cd +Function359cd: ; 359cd jp PrintDidntAffect2 ; 359d0 @@ -4745,7 +4755,7 @@ BattleCommand43: ; 359d0 call ResetDamage ld a, $1 ld [AttackMissed], a - call Function0x37354 + call Function37354 jp EndMoveEffect ; 359e6 @@ -4774,7 +4784,7 @@ BattleCommand44: ; 359e6 pop hl cp CURSE_T jr z, .asm_35a50 ; 35a0b $43 - call Function0x37e01 + call AnimateCurrentMove call SwitchTurn .asm_35a13 @@ -4796,7 +4806,7 @@ BattleCommand44: ; 359e6 push hl ld a, d ld [hl], a - call Function0x347c8 + call Function347c8 pop hl pop af ld [hl], a @@ -4810,10 +4820,10 @@ BattleCommand44: ; 359e6 ld [$d265], a ld a, $29 call Predef - ld hl, $5452 + ld hl, TransformedTypeText jp StdBattleTextBox .asm_35a50 - jp Function0x37354 + jp Function37354 ; 35a53 @@ -4828,13 +4838,13 @@ BattleCommand45: ; 35a53 ld a, BATTLE_VARS_SUBSTATUS5_OPP call _GetBattleVar set SUBSTATUS_LOCK_ON, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, TookAimText jp StdBattleTextBox .asm_35a6e - call Function0x37e77 + call AnimateFailedMove jp PrintDidntAffect ; 35a74 @@ -4842,11 +4852,11 @@ BattleCommand45: ; 35a53 BattleCommand46: ; 35a74 ; sketch - call Function0x372d8 + call Function372d8 ld a, [InLinkBattle] and a jr z, .asm_35a83 ; 35a7b $6 - call Function0x37e77 + call AnimateFailedMove jp PrintNothingHappened .asm_35a83 call CheckSubstituteOpp @@ -4931,13 +4941,13 @@ BattleCommand46: ; 35a74 ld [hl], a .asm_35b04 call GetMoveName - call Function0x37e01 + call AnimateCurrentMove ld hl, SketchedText jp StdBattleTextBox .asm_35b10 - call Function0x37e77 + call AnimateFailedMove jp PrintDidntAffect ; 35b16 @@ -4948,7 +4958,7 @@ BattleCommand47: ; 35b16 ; If the opponent isn't frozen, raise Attack one stage. ; If the opponent is frozen, thaw them and raise Accuracy two stages. - call Function0x37e01 + call AnimateCurrentMove ld a, BATTLE_VARS_STATUS_OPP call _GetBattleVar @@ -4975,7 +4985,7 @@ BattleCommand47: ; 35b16 BattleCommand48: ; 35b33 ; sleeptalk - call Function0x372d8 + call Function372d8 ld a, [AttackMissed] and a jr nz, .asm_35ba3 ; 35b3a $67 @@ -5024,7 +5034,7 @@ BattleCommand48: ; 35b33 call _GetBattleVar ld a, e ld [hl], a - call Function0x34548 + call Function34548 jr nz, .asm_35b9a ; 35b8d $b ld a, [$c689] push af @@ -5032,11 +5042,11 @@ BattleCommand48: ; 35b33 pop af ld [$c689], a .asm_35b9a - call Function0x37e36 + call Function37e36 call UpdateMoveData jp ResetTurn .asm_35ba3 - call Function0x37e77 + call AnimateFailedMove jp TryPrintButItFailed .asm_35ba9 @@ -5123,7 +5133,7 @@ BattleCommand49: ; 35bff ld a, BATTLE_VARS_SUBSTATUS5 call _GetBattleVar set 6, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, DestinyBondEffectText jp StdBattleTextBox ; 35c0f @@ -5205,7 +5215,7 @@ BattleCommand4a: ; 35c0f ld [hl], e .asm_35c82 push de - call Function0x37e01 + call AnimateCurrentMove pop de ld a, d ld [$d265], a @@ -5285,15 +5295,15 @@ BattleCommand4c: ; 35cc9 add hl, bc dec d jr nz, .asm_35ce9 - call Function0x37e01 + call AnimateCurrentMove ld hl, BellChimedText call StdBattleTextBox ld a, [hBattleTurn] and a - jp z, Function0x365d7 - jp Function0x365fd + jp z, Function365d7 + jp Function365fd ; 35d00 @@ -5324,7 +5334,7 @@ PlayFXAnimID: ; 35d08 ; 35d1c -Function0x35d1c: ; 35d1c +Function35d1c: ; 35d1c ld hl, CurDamage ld a, [hli] ld b, a @@ -5338,7 +5348,7 @@ Function0x35d1c: ; 35d1c ld a, [EnemySubStatus4] bit 4, a - jp nz, Function0x35de0 + jp nz, Function35de0 .asm_35d31 ld a, [hld] ld b, a @@ -5383,7 +5393,7 @@ Function0x35d1c: ; 35d1c ; 35d7e -Function0x35d7e: ; 35d7e +Function35d7e: ; 35d7e ld hl, CurDamage ld a, [hli] ld b, a @@ -5397,7 +5407,7 @@ Function0x35d7e: ; 35d7e ld a, [PlayerSubStatus4] bit 4, a - jp nz, Function0x35de0 + jp nz, Function35de0 .asm_35d93 ld a, [hld] ld b, a @@ -5441,7 +5451,7 @@ Function0x35d7e: ; 35d7e ; 35de0 -Function0x35de0: ; 35de0 +Function35de0: ; 35de0 ld hl, SubTookDamageText call StdBattleTextBox @@ -5478,7 +5488,7 @@ Function0x35de0: ; 35de0 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar and $60 ; fly | dig - call z, Function0x37ec7 + call z, Function37ec7 call SwitchTurn ld a, BATTLE_VARS_MOVE_EFFECT @@ -5550,7 +5560,7 @@ BattleCommand14: ; 35e5c jp nz, PrintDidntAffect2 ld hl, DidntAffect1Text - call Function0x35ece + call Function35ece jr c, .asm_35ec6 ld a, [de] @@ -5560,7 +5570,7 @@ BattleCommand14: ; 35e5c call CheckSubstituteOpp jr nz, .asm_35ec6 - call Function0x37e01 + call AnimateCurrentMove ld b, $7 ld a, [$cfc0] and a @@ -5583,18 +5593,18 @@ BattleCommand14: ; 35e5c callba Function3dde9 - jp z, Function0x34216 + jp z, Function34216 ret .asm_35ec6 push hl - call Function0x37e77 + call AnimateFailedMove pop hl jp StdBattleTextBox ; 35ece -Function0x35ece: ; 35ece +Function35ece: ; 35ece ; Enemy turn ld a, [hBattleTurn] and a @@ -5637,7 +5647,7 @@ BattleCommand13: ; 35eee ld a, [TypeModifier] and $7f ret z - call Function0x35fe1 + call Function35fe1 ret z call GetOpponentItem ld a, b @@ -5646,11 +5656,11 @@ BattleCommand13: ; 35eee ld a, [EffectFailed] and a ret nz - call Function0x37962 + call Function37962 ret nz - call Function0x35ff5 + call Function35ff5 ld de, $0106 - call Function0x37e54 + call Function37e54 call RefreshBattleHuds ld hl, WasPoisonedText @@ -5668,7 +5678,7 @@ BattleCommand2f: ; 35f2c ld a, [TypeModifier] and $7f jp z, .asm_35fb8 - call Function0x35fe1 + call Function35fe1 jp z, .asm_35fb8 ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar @@ -5712,9 +5722,9 @@ BattleCommand2f: ; 35f2c ld a, [AttackMissed] and a jr nz, .asm_35fb8 ; 35f92 $24 - call Function0x35fc9 + call Function35fc9 jr z, .asm_35fa4 ; 35f97 $b - call Function0x35fc0 + call Function35fc0 ld hl, WasPoisonedText call StdBattleTextBox @@ -5724,7 +5734,7 @@ BattleCommand2f: ; 35f2c set 0, [hl] xor a ld [de], a - call Function0x35fc0 + call Function35fc0 ld hl, BadlyPoisonedText call StdBattleTextBox @@ -5735,20 +5745,20 @@ BattleCommand2f: ; 35f2c .asm_35fb8 push hl - call Function0x37e77 + call AnimateFailedMove pop hl jp StdBattleTextBox ; 35fc0 -Function0x35fc0: ; 35fc0 - call Function0x37e01 - call Function0x35ff5 +Function35fc0: ; 35fc0 + call AnimateCurrentMove + call Function35ff5 jp RefreshBattleHuds ; 35fc9 -Function0x35fc9: ; 35fc9 +Function35fc9: ; 35fc9 ld a, BATTLE_VARS_SUBSTATUS5_OPP call _GetBattleVar ld a, [hBattleTurn] @@ -5764,7 +5774,7 @@ Function0x35fc9: ; 35fc9 ; 35fe1 -Function0x35fe1: ; 35fe1 +Function35fe1: ; 35fe1 ld de, EnemyMonType1 ld a, [hBattleTurn] and a @@ -5781,7 +5791,7 @@ Function0x35fe1: ; 35fe1 ; 35ff5 -Function0x35ff5: ; 35ff5 +Function35ff5: ; 35ff5 ld a, BATTLE_VARS_STATUS_OPP call _GetBattleVar set PSN, [hl] @@ -5791,7 +5801,7 @@ Function0x35ff5: ; 35ff5 BattleCommand15: ; 35fff ; draintarget - call Function0x36011 + call Function36011 ld hl, SuckedHealthText jp StdBattleTextBox ; 36008 @@ -5799,13 +5809,13 @@ BattleCommand15: ; 35fff BattleCommand16: ; 36008 ; eatdream - call Function0x36011 + call Function36011 ld hl, DreamEatenText jp StdBattleTextBox ; 36011 -Function0x36011: ; 36011 +Function36011: ; 36011 ld hl, CurDamage ld a, [hli] srl a @@ -5902,7 +5912,7 @@ BattleCommand17: ; 3608c ld a, [TypeModifier] and $7f ret z - call Function0x36e5b + call Function36e5b ret z call GetOpponentItem ld a, b @@ -5911,16 +5921,16 @@ BattleCommand17: ; 3608c ld a, [EffectFailed] and a ret nz - call Function0x37962 + call Function37962 ret nz ld a, BATTLE_VARS_STATUS_OPP call _GetBattleVar set 4, [hl] call UpdateOpponentInParty - ld hl, $6c76 - call CallBankF + ld hl, Function3ec76 + call CallBattleCore ld de, $0105 - call Function0x37e54 + call Function37e54 call RefreshBattleHuds ld hl, WasBurnedText @@ -5975,7 +5985,7 @@ BattleCommand18: ; 36102 ld a, [Weather] cp $2 ret z - call Function0x36e5b + call Function36e5b ret z call GetOpponentItem ld a, b @@ -5984,14 +5994,14 @@ BattleCommand18: ; 36102 ld a, [EffectFailed] and a ret nz - call Function0x37962 + call Function37962 ret nz ld a, BATTLE_VARS_STATUS_OPP call _GetBattleVar set 5, [hl] call UpdateOpponentInParty ld de, $0108 - call Function0x37e54 + call Function37e54 call RefreshBattleHuds ld hl, WasFrozenText @@ -5999,7 +6009,7 @@ BattleCommand18: ; 36102 callba Function3dde9 ret nz - call Function0x34216 + call Function34216 call EndRechargeOpp ld hl, $c740 ld a, [hBattleTurn] @@ -6033,20 +6043,20 @@ BattleCommand19: ; 36165 ld a, [EffectFailed] and a ret nz - call Function0x37962 + call Function37962 ret nz ld a, BATTLE_VARS_STATUS_OPP call _GetBattleVar set 6, [hl] call UpdateOpponentInParty - ld hl, $6c39 - call CallBankF + ld hl, Function3ec39 + call CallBattleCore ld de, $0109 - call Function0x37e54 + call Function37e54 call RefreshBattleHuds call PrintParalyze - ld hl, $5de9 - jp CallBankF + ld hl, Function3dde9 + jp CallBattleCore ; 361ac @@ -6108,15 +6118,15 @@ BattleCommand7d: ; 361e0 jr BattleCommand1c BattleCommand1c: ; 361e4 ; statup - call Function0x361ef + call Function361ef ld a, [FailedMessage] and a ret nz - jp Function0x36281 + jp Function36281 ; 361ef -Function0x361ef: ; 361ef +Function361ef: ; 361ef ld a, b ld [LoweredStat], a ld hl, PlayerStatLevels @@ -6127,10 +6137,10 @@ Function0x361ef: ; 361ef .asm_361fe ld a, [AttackMissed] and a - jp nz, Function0x3627b + jp nz, Function3627b ld a, [EffectFailed] and a - jp nz, Function0x3627b + jp nz, Function3627b ld a, [LoweredStat] and $f ld c, a @@ -6140,7 +6150,7 @@ Function0x361ef: ; 361ef inc b ld a, $d cp b - jp c, Function0x36270 + jp c, Function36270 ld a, [LoweredStat] and $f0 jr z, .asm_3622b ; 0x36222 $7 @@ -6179,15 +6189,15 @@ Function0x361ef: ; 361ef jr nz, .asm_3625b ; 0x36253 $6 ld a, [hl] sbc $3 - jp z, Function0x3626e + jp z, Function3626e .asm_3625b ld a, [hBattleTurn] and a jr z, .asm_36265 ; 0x3625e $5 - call Function0x365fd + call Function365fd jr .asm_36268 ; 0x36263 $3 .asm_36265 - call Function0x365d7 + call Function365d7 .asm_36268 pop hl xor a @@ -6196,14 +6206,14 @@ Function0x361ef: ; 361ef ; 3626e -Function0x3626e: ; 3626e +Function3626e: ; 3626e pop hl dec [hl] ; fallthrough ; 36270 -Function0x36270: ; 36270 +Function36270: ; 36270 ld a, $2 ld [FailedMessage], a ld a, $1 @@ -6212,33 +6222,33 @@ Function0x36270: ; 36270 ; 3627b -Function0x3627b: ; 3627b +Function3627b: ; 3627b ld a, $1 ld [FailedMessage], a ret ; 36281 -Function0x36281: ; 36281 +Function36281: ; 36281 ld bc, $c6fe - ld hl, $7447 + ld hl, Function3f447 ld a, [hBattleTurn] and a jr z, .asm_36292 ; 0x3628a $6 ld bc, $c6fa - ld hl, $7486 + ld hl, Function3f486 .asm_36292 - ld a, $c + ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar - cp $6b + cp MINIMIZE ret nz ld a, $1 ld [bc], a - call Function0x37ed5 + call Function37ed5 ret nc xor a ld [$ffd4], a - call CallBankF + call CallBattleCore call WaitBGMap jp BattleCommandaa ; 362ad @@ -6305,7 +6315,7 @@ BattleCommand1d: ; 362e3 ld [LoweredStat], a - call Function0x36391 + call Function36391 jp nz, .Mist ld hl, EnemyStatLevels @@ -6391,7 +6401,7 @@ BattleCommand1d: ; 362e3 ld hl, BattleMonAtk + 1 ld de, PlayerStats .asm_36366 - call Function0x3641a + call Function3641a pop hl jr z, .CouldntLower @@ -6424,7 +6434,7 @@ BattleCommand1d: ; 362e3 ; 36391 -Function0x36391: ; 36391 +Function36391: ; 36391 ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_ATTACK_DOWN @@ -6517,7 +6527,7 @@ BattleCommand8d: ; 363e9 ; 3641a -Function0x3641a: ; 3641a +Function3641a: ; 3641a ; Lower stat c from stat struct hl (buffer de). push bc @@ -6547,13 +6557,13 @@ Function0x3641a: ; 3641a jr z, .Player call SwitchTurn - call Function0x365d7 + call Function365d7 call SwitchTurn jr .end .Player call SwitchTurn - call Function0x365fd + call Function365fd call SwitchTurn .end ld a, 1 @@ -6691,7 +6701,7 @@ ResetMiss: ; 3652d ; 36532 -Function0x36532: ; 36532 +Function36532: ; 36532 ld [LoweredStat], a ld hl, PlayerStatLevels @@ -6733,7 +6743,7 @@ Function0x36532: ; 36532 ld de, EnemyStats .asm_36570 - call Function0x3641a + call Function3641a pop hl jr z, .asm_36588 @@ -6742,12 +6752,12 @@ Function0x36532: ; 36532 and a jr z, .asm_36580 - call Function0x365fd + call Function365fd jr .asm_36583 .asm_36580 - call Function0x365d7 + call Function365d7 .asm_36583 xor a @@ -6797,77 +6807,77 @@ BattleCommandaf: ; 365a7 BattleCommanda6: ; 365af - ld hl, $743d + ld hl, Function3f43d ld a, [hBattleTurn] and a jr z, .asm_365ba ; 365b5 $3 - ld hl, $747c + ld hl, Function3f47c .asm_365ba xor a ld [$ffd4], a - call CallBankF + call CallBattleCore jp WaitBGMap ; 365c3 BattleCommanda7: ; 365c3 - ld hl, $7447 + ld hl, Function3f447 ld a, [hBattleTurn] and a jr z, .asm_365ce ; 365c9 $3 - ld hl, $7486 + ld hl, Function3f486 .asm_365ce xor a ld [$ffd4], a - call CallBankF + call CallBattleCore jp WaitBGMap ; 365d7 -Function0x365d7: ; 365d7 +Function365d7: ; 365d7 ld hl, PlayerAtkLevel ld de, PlayerStats ld bc, BattleMonAtk ld a, $5 - call Function0x3661d + call Function3661d ld hl, BadgeStatBoosts - call CallBankF + call CallBattleCore call SwitchTurn - ld hl, $6c39 - call CallBankF + ld hl, Function3ec39 + call CallBattleCore - ld hl, $6c76 - call CallBankF + ld hl, Function3ec76 + call CallBattleCore jp SwitchTurn ; 365fd -Function0x365fd: ; 365fd +Function365fd: ; 365fd ld hl, EnemyAtkLevel ld de, EnemyStats ld bc, EnemyMonAtk ld a, $5 - call Function0x3661d + call Function3661d call SwitchTurn - ld hl, $6c39 - call CallBankF + ld hl, Function3ec39 + call CallBattleCore - ld hl, $6c76 - call CallBankF + ld hl, Function3ec76 + call CallBattleCore jp SwitchTurn ; 3661d -Function0x3661d: ; 3661d +Function3661d: ; 3661d .asm_3661d push af ld a, [hli] @@ -7036,7 +7046,7 @@ BattleCommand22: ; 366e5 ld [bc], a ld a, $1 ld [$c689], a - call Function0x37e01 + call AnimateCurrentMove jp EndMoveEffect ; 3671a @@ -7060,7 +7070,7 @@ BattleCommand3e: ; 3671a jr nz, .asm_3674c ; 36730 $1a res 1, [hl] call SwitchTurn - call Function0x37962 + call Function37962 push af call SwitchTurn pop af @@ -7147,7 +7157,7 @@ BattleCommanda0: ; 36778 jr nc, .asm_367df ; 367b7 $26 .asm_367b9 - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed .asm_367bf @@ -7177,19 +7187,19 @@ BattleCommanda0: ; 36778 inc a ld [$d232], a ld [$c689], a - call Function0x36804 + call Function36804 call BattleCommand0a - call Function0x37e36 + call Function37e36 ld c, 20 call DelayFrames - call Function0x36804 + call Function36804 ld hl, FledFromBattleText jp StdBattleTextBox ; 36804 -Function0x36804: ; 36804 +Function36804: ; 36804 ld a, [$d0ee] and $c0 or $2 @@ -7243,11 +7253,11 @@ BattleCommand23: ; 3680f ld [$cfca], a inc a ld [$d232], a - call Function0x36804 + call Function36804 ld a, [PlayerMoveAnimation] jp .asm_36975 .asm_36869 - call Function0x349f4 + call Function349f4 jr c, .asm_368ca ; 3686c $5c ld a, [$c70f] and a @@ -7255,7 +7265,7 @@ BattleCommand23: ; 3680f call UpdateEnemyMonInParty ld a, $1 ld [$c689], a - call Function0x37e01 + call AnimateCurrentMove ld c, $14 call DelayFrames ld hl, $c4a1 @@ -7291,8 +7301,8 @@ BattleCommand23: ; 3680f ld hl, DraggedOutText call StdBattleTextBox - ld hl, $5c23 - jp CallBankF + ld hl, SpikesDamage + jp CallBattleCore .asm_368ca jp .asm_36969 @@ -7334,12 +7344,12 @@ BattleCommand23: ; 3680f ld [$cfca], a inc a ld [$d232], a - call Function0x36804 + call Function36804 ld a, [EnemyMoveAnimation] jr .asm_36975 .asm_36908 - call Function0x36994 + call Function36994 jr c, .asm_36969 ld a, [$c70f] @@ -7349,12 +7359,12 @@ BattleCommand23: ; 3680f call UpdateBattleMonInParty ld a, $1 ld [$c689], a - call Function0x37e01 + call AnimateCurrentMove ld c, $14 call DelayFrames ld hl, $c535 ld bc, $050b - call $0fb6 + call ClearBox ld c, $14 call DelayFrames ld a, [PartyCount] @@ -7382,14 +7392,14 @@ BattleCommand23: ; 3680f ld a, d ld [CurPartyMon], a - ld hl, $5b32 - call CallBankF + ld hl, Function3db32 + call CallBattleCore ld hl, DraggedOutText call StdBattleTextBox - ld hl, $5c23 - jp CallBankF + ld hl, SpikesDamage + jp CallBattleCore .asm_36969 call BattleCommand0a @@ -7399,10 +7409,10 @@ BattleCommand23: ; 3680f .asm_36975 push af - call Function0x36804 + call Function36804 ld a, $1 ld [$c689], a - call Function0x37e01 + call AnimateCurrentMove ld c, $14 call DelayFrames pop af @@ -7416,7 +7426,7 @@ BattleCommand23: ; 3680f ; 36994 -Function0x36994: ; 36994 +Function36994: ; 36994 ld a, [PartyCount] ld d, a ld e, 0 @@ -7590,8 +7600,8 @@ BattleCommand94: ; 36a82 call GetBattleVar and $27 jr nz, .asm_36a9a ; 36a93 $5 - call Function0x36abf - jr z, Function0x36ab5 ; 36a98 $1b + call Function36abf + jr z, Function36ab5 ; 36a98 $1b .asm_36a9a ld a, 1 ld [AttackMissed], a @@ -7606,7 +7616,7 @@ BattleCommand25: ; 36aa0 call GetBattleVar and $27 ret nz - call Function0x36abf + call Function36abf ret nz ld a, [EffectFailed] and a @@ -7616,7 +7626,7 @@ BattleCommand25: ; 36aa0 ; 36ab5 -Function0x36ab5: ; 36ab5 +Function36ab5: ; 36ab5 ld a, BATTLE_VARS_SUBSTATUS3_OPP call _GetBattleVar set 3, [hl] @@ -7624,7 +7634,7 @@ Function0x36ab5: ; 36ab5 ; 36abf -Function0x36abf: ; 36abf +Function36abf: ; 36abf push bc ld a, [$c70f] ld b, a @@ -7644,7 +7654,7 @@ BattleCommand4d: ; 36ac9 call GetUserItem ld a, b - cp $4b ; king's rock + cp HELD_TRADE_EVOLVE ; king's rock ret nz call CheckSubstituteOpp @@ -7758,7 +7768,7 @@ BattleCommand39: ; 36b4d ld [$cfca], a inc a ld [$c689], a - call Function0x37e36 + call Function37e36 ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar cp $13 @@ -7768,7 +7778,7 @@ BattleCommand39: ; 36b4d call BattleCommand0c jr .asm_36b99 ; 36b94 $3 .asm_36b96 - call Function0x37ec0 + call Function37ec0 .asm_36b99 ld a, BATTLE_VARS_SUBSTATUS3 call _GetBattleVar @@ -7786,7 +7796,7 @@ BattleCommand39: ; 36b4d set 6, [hl] .asm_36bb2 - call Function0x34548 + call Function34548 jr nz, .asm_36bc3 ; 36bb5 $c ld a, BATTLE_VARS_LAST_COUNTER_MOVE call _GetBattleVar @@ -7944,11 +7954,11 @@ BattleCommand28: ; 36c7e bit 1, [hl] jr nz, .asm_36c92 ; 36c85 $b set 1, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, MistText jp StdBattleTextBox .asm_36c92 - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed ; 36c98 @@ -7961,11 +7971,11 @@ BattleCommand29: ; 36c98 bit 2, [hl] jr nz, .asm_36cac ; 36c9f $b set 2, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, GettingPumpedText jp StdBattleTextBox .asm_36cac - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed ; 36cb2 @@ -8046,7 +8056,7 @@ BattleCommand2b: ; 36d1d ld a, [EffectFailed] and a ret nz - call Function0x37962 + call Function37962 ret nz call CheckSubstituteOpp ret nz @@ -8054,7 +8064,7 @@ BattleCommand2b: ; 36d1d call _GetBattleVar bit 7, [hl] ret nz - jr Function0x36d70 + jr Function36d70 BattleCommand2a: ; 36d3b @@ -8067,7 +8077,7 @@ BattleCommand2a: ; 36d3b ld a, [hl] ld [$d265], a call GetItemName - call Function0x37e77 + call AnimateFailedMove ld hl, ProtectedByText jp StdBattleTextBox @@ -8076,22 +8086,22 @@ BattleCommand2a: ; 36d3b call _GetBattleVar bit 7, [hl] jr z, .asm_36d65 - call Function0x37e77 + call AnimateFailedMove ld hl, AlreadyConfusedText jp StdBattleTextBox .asm_36d65 call CheckSubstituteOpp - jr nz, Function0x36db6 + jr nz, Function36db6 ld a, [AttackMissed] and a - jr nz, Function0x36db6 + jr nz, Function36db6 ; fallthrough ; 36d70 -Function0x36d70: ; 36d70 +Function36d70: ; 36d70 ld bc, EnemyConfuseCount ld a, [hBattleTurn] and a @@ -8114,11 +8124,11 @@ Function0x36d70: ; 36d70 jr z, .asm_36d99 cp EFFECT_SWAGGER jr z, .asm_36d99 - call Function0x37e01 + call AnimateCurrentMove .asm_36d99 ld de, $0103 - call Function0x37e54 + call Function37e54 ld hl, BecameConfusedText call StdBattleTextBox @@ -8130,11 +8140,11 @@ Function0x36d70: ; 36d70 cp $10 ret nz .asm_36db0 - ld hl, $5e51 - jp CallBankF + ld hl, Function3de51 + jp CallBattleCore ; 36db6 -Function0x36db6: ; 36db6 +Function36db6: ; 36db6 ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_CONFUSE_HIT @@ -8164,7 +8174,7 @@ BattleCommand30: ; 36dc7 ld a, [hl] ld [$d265], a call GetItemName - call Function0x37e77 + call AnimateFailedMove ld hl, ProtectedByText jp StdBattleTextBox .asm_36def @@ -8195,32 +8205,32 @@ BattleCommand30: ; 36dc7 jr nz, .asm_36e52 ; 36e1f $31 ld c, $1e call DelayFrames - call Function0x37e01 + call AnimateCurrentMove ld a, $1 ld [$ffd4], a ld a, BATTLE_VARS_STATUS_OPP call _GetBattleVar set 6, [hl] call UpdateOpponentInParty - ld hl, $6c39 - call CallBankF + ld hl, Function3ec39 + call CallBattleCore call UpdateBattleHuds call PrintParalyze - ld hl, $5de9 - jp CallBankF + ld hl, Function3dde9 + jp CallBattleCore .asm_36e49 - call Function0x37e77 + call AnimateFailedMove ld hl, AlreadyParalyzedText jp StdBattleTextBox .asm_36e52 jp PrintDidntAffect2 .asm_36e55 - call Function0x37e77 + call AnimateFailedMove jp PrintDoesntAffect ; 36e5b -Function0x36e5b: ; 36e5b +Function36e5b: ; 36e5b ; Compare move type to user type. ; Return z if matching the user type (unless the move is Normal). @@ -8309,14 +8319,14 @@ BattleCommand31: ; 36e7c xor a ld [hl], a ld [de], a - call Function0x37ed5 + call Function37ed5 jr c, .asm_36ee8 ; 36ed5 $11 xor a ld [$cfca], a ld [FXAnimIDHi], a ld [$c689], a ld a, $a4 - call Function0x37e44 + call Function37e44 jr .asm_36eeb ; 36ee6 $3 .asm_36ee8 call BattleCommanda6 @@ -8325,12 +8335,12 @@ BattleCommand31: ; 36e7c call StdBattleTextBox jp RefreshBattleHuds .asm_36ef4 - call Function0x34548 + call Function34548 call nz, BattleCommand0c ld hl, HasSubstituteText jr .asm_36f08 ; 36efd $9 .asm_36eff - call Function0x34548 + call Function34548 call nz, BattleCommand0c ld hl, TooWeakSubText .asm_36f08 @@ -8404,7 +8414,7 @@ DoubleDamage: ; 36f37 BattleCommand33: ; 36f46 ; mimic - call Function0x372d8 + call Function372d8 call BattleCommandaa ld a, [AttackMissed] and a @@ -8445,11 +8455,11 @@ BattleCommand33: ; 36f46 add hl, bc ld [hl], $5 call GetMoveName - call Function0x37e01 + call AnimateCurrentMove ld hl, LearnedMoveText jp StdBattleTextBox .asm_36f9a - jp Function0x37357 + jp Function37357 ; 36f9d @@ -8478,21 +8488,21 @@ BattleCommand35: ; 36f9d bit 7, [hl] jr nz, .asm_36fd8 ; 36fc5 $11 set 7, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, WasSeededText jp StdBattleTextBox .asm_36fd2 - call Function0x37e77 + call AnimateFailedMove jp PrintDoesntAffect .asm_36fd8 - call Function0x37e77 + call AnimateFailedMove ld hl, EvadedText jp StdBattleTextBox ; 36fe1 BattleCommand36: ; 36fe1 - call Function0x37e01 + call AnimateCurrentMove callba Function1060e5 jp PrintNothingHappened ; 36fed @@ -8548,7 +8558,7 @@ BattleCommand37: ; 36fed swap c add c ld [de], a - call Function0x37e01 + call AnimateCurrentMove ld hl, DisabledMove ld a, [hBattleTurn] and a @@ -8563,7 +8573,7 @@ BattleCommand37: ; 36fed ld hl, WasDisabledText jp StdBattleTextBox .asm_37059 - jp Function0x37354 + jp Function37354 ; 3705c @@ -8656,7 +8666,7 @@ BattleCommand1f: ; 3707f inc hl jr .asm_370bd ; 370d1 $ea .asm_370d3 - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed .asm_370d9 call BattleRandom @@ -8684,7 +8694,7 @@ BattleCommand1f: ; 3707f ld [de], a ld [$d265], a callba GetTypeName - call Function0x37e01 + call AnimateCurrentMove ld hl, TransformedTypeText jp StdBattleTextBox ; 3710e @@ -8703,14 +8713,14 @@ BattleCommand20: ; 3710e push af call SetPlayerTurn - call Function0x365d7 + call Function365d7 call SetEnemyTurn - call Function0x365fd + call Function365fd pop af ld [hBattleTurn], a - call Function0x37e01 + call AnimateCurrentMove ld hl, EliminatedStatsText jp StdBattleTextBox @@ -8771,27 +8781,27 @@ BattleCommand2c: ; 3713e ld a, [hBattleTurn] and a jr nz, .asm_37193 ; 3718c $5 - call Function0x365d7 + call Function365d7 jr .asm_37196 ; 37191 $3 .asm_37193 - call Function0x365fd + call Function365fd .asm_37196 pop af pop de pop hl .asm_37199 jr z, .asm_371a3 ; 37199 $8 - ld hl, $4c9f - call CallBankF + ld hl, GetHalfMaxHP + call CallBattleCore jr .asm_371a9 ; 371a1 $6 .asm_371a3 - ld hl, $4cac - call CallBankF + ld hl, GetMaxHP + call CallBattleCore .asm_371a9 - call Function0x37e01 + call AnimateCurrentMove call SwitchTurn - ld hl, $4cef - call CallBankF + ld hl, Function3ccef + call CallBattleCore call SwitchTurn call UpdateUserInParty call RefreshBattleHuds @@ -8799,7 +8809,7 @@ BattleCommand2c: ; 3713e jp StdBattleTextBox .asm_371c4 - call Function0x37e77 + call AnimateFailedMove ld hl, HPIsFullText jp StdBattleTextBox ; 371cd @@ -8808,13 +8818,13 @@ BattleCommand2c: ; 3713e BattleCommand2d: ; 371cd ; transform - call Function0x372d8 + call Function372d8 ld a, BATTLE_VARS_SUBSTATUS5_OPP call _GetBattleVar bit 3, [hl] - jp nz, Function0x372d2 + jp nz, Function372d2 call CheckHiddenOpponent - jp nz, Function0x372d2 + jp nz, Function372d2 xor a ld [$cfca], a ld [FXAnimIDHi], a @@ -8825,15 +8835,15 @@ BattleCommand2d: ; 371cd bit 4, [hl] push af jr z, .asm_37200 ; 371f4 $a - call Function0x34548 + call Function34548 jr nz, .asm_37200 ; 371f9 $5 ld a, $a4 - call Function0x37e44 + call Function37e44 .asm_37200 ld a, BATTLE_VARS_SUBSTATUS5 call _GetBattleVar set 3, [hl] - call Function0x372e7 + call ResetActorDisable ld hl, BattleMonSpecies ld de, EnemyMonSpecies ld a, [hBattleTurn] @@ -8851,7 +8861,7 @@ BattleCommand2d: ; 371cd inc de inc de ld bc, $0004 - call $3026 + call CopyBytes ld a, [hBattleTurn] and a jr z, .asm_3723a ; 3722e $a @@ -8878,7 +8888,7 @@ BattleCommand2d: ; 371cd ld e, l pop hl ld bc, $000c - call $3026 + call CopyBytes ld bc, $ffe2 add hl, bc push de @@ -8893,10 +8903,10 @@ BattleCommand2d: ; 371cd inc de and a jr z, .asm_3726c ; 37262 $8 - cp $a6 - ld a, $1 + cp SKETCH + ld a, 1 jr z, .asm_3726c ; 37268 $2 - ld a, $5 + ld a, 5 .asm_3726c ld [hli], a dec b @@ -8904,7 +8914,7 @@ BattleCommand2d: ; 371cd pop hl ld a, [hl] ld [$d265], a - call $343b + call GetPokemonName ld hl, EnemyStats ld de, PlayerStats ld bc, $000a @@ -8913,7 +8923,7 @@ BattleCommand2d: ; 371cd ld de, PlayerStatLevels ld bc, $0008 call BattleSideCopy - call Function0x37ed5 + call Function37ed5 jr c, .asm_372a8 ; 37293 $13 ld a, [hBattleTurn] and a @@ -8923,7 +8933,7 @@ BattleCommand2d: ; 371cd .asm_372a0 and a jr nz, .asm_372a8 ; 372a1 $5 - call Function0x37e36 + call Function37e36 jr .asm_372ae ; 372a6 $6 .asm_372a8 call BattleCommandaa @@ -8936,7 +8946,7 @@ BattleCommand2d: ; 371cd ld [$c689], a pop af ld a, $a4 - call nz, Function0x37e44 + call nz, Function37e44 ld hl, TransformedText jp StdBattleTextBox ; 372c6 @@ -8959,13 +8969,13 @@ BattleSideCopy: ; 372c6 ; 372d2 -Function0x372d2: ; 372d2 - call Function0x37e77 +Function372d2: ; 372d2 + call AnimateFailedMove jp PrintButItFailed ; 372d8 -Function0x372d8: ; 372d8 +Function372d8: ; 372d8 ld a, BATTLE_VARS_LAST_COUNTER_MOVE call _GetBattleVar xor a @@ -8979,7 +8989,7 @@ Function0x372d8: ; 372d8 ; 372e7 -Function0x372e7: ; 372e7 +ResetActorDisable: ; 372e7 ld a, [hBattleTurn] and a jr z, .player @@ -9035,11 +9045,11 @@ BattleCommand2e: ; 372fc ld hl, ReflectEffectText .asm_37331 - call Function0x37e01 + call AnimateCurrentMove jp StdBattleTextBox .asm_37337 - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed ; 3733d @@ -9074,15 +9084,15 @@ PrintButItFailed: ; 3734e ; 37354 -Function0x37354: ; 37354 - call Function0x37e77 +Function37354: ; 37354 + call AnimateFailedMove ; fallthrough ; 37357 -Function0x37357: ; 37357 +Function37357: ; 37357 ld hl, ButItFailedText ; 'but it failed!' ld de, ItFailedText ; 'it failed!' - jp Function0x35157 + jp Function35157 ; 37360 @@ -9094,10 +9104,10 @@ PrintDidntAffect: ; 37360 PrintDidntAffect2: ; 37366 - call Function0x37e77 + call AnimateFailedMove ld hl, DidntAffect1Text ; 'it didn't affect' ld de, DidntAffect2Text ; 'it didn't affect' - jp Function0x35157 + jp Function35157 ; 37372 @@ -9132,14 +9142,14 @@ BattleCommand1a: ; 37380 ld a, $1 ld [$c689], a call BattleCommand0a - call Function0x37e36 + call Function37e36 ld a, BATTLE_VARS_SUBSTATUS4 call _GetBattleVar res 7, [hl] ld a, BATTLE_VARS_SUBSTATUS5_OPP call _GetBattleVar res 6, [hl] - call Function0x37ed5 + call Function37ed5 ret nc callba DrawPlayerHUD callba Function3e043 @@ -9216,12 +9226,12 @@ BattleCommand51: ; 37517 ; Otherwise trap the opponent. set SUBSTATUS_CANT_RUN, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, CantEscapeNowText jp StdBattleTextBox .failed - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed ; 37536 @@ -9351,7 +9361,7 @@ BattleCommand5f: ; 377ce ld a, [AttackMissed] and a jr nz, .asm_377f2 - call Function0x377f5 + call Function377f5 jr c, .asm_377f2 call CheckHiddenOpponent jr nz, .asm_377f2 @@ -9361,18 +9371,18 @@ BattleCommand5f: ; 377ce jr nz, .asm_377f2 set 7, [hl] - call Function0x37e01 + call AnimateCurrentMove ; 'fell in love!' ld hl, FellInLoveText jp StdBattleTextBox .asm_377f2 - jp Function0x37354 + jp Function37354 ; 377f5 -Function0x377f5: ; 377f5 +Function377f5: ; 377f5 ld a, 0 call BattlePartyAttr ld a, [hl] @@ -9474,10 +9484,10 @@ BattleCommand61: ; 37874 .asm_37889 ld a, [$d265] and a - jp z, Function0x37e77 + jp z, AnimateFailedMove ld a, [AttackMissed] and a - jp nz, Function0x37e77 + jp nz, AnimateFailedMove push bc call BattleRandom ld b, a @@ -9495,7 +9505,7 @@ BattleCommand61: ; 37874 .asm_378ad ld a, c ld [$c689], a - call Function0x37de9 + call Function37de9 ld d, [hl] pop bc ret @@ -9503,7 +9513,7 @@ BattleCommand61: ; 37874 pop bc ld a, $3 ld [$c689], a - call Function0x37e01 + call AnimateCurrentMove call SwitchTurn ld hl, AICheckPlayerMaxHP ld a, [hBattleTurn] @@ -9514,11 +9524,11 @@ BattleCommand61: ; 37874 ld a, BANK(AICheckPlayerMaxHP) rst FarCall jr c, .asm_378f3 ; 378d1 $20 - ld hl, $4c8e - call CallBankF + ld hl, GetQuarterMaxHP + call CallBattleCore call SwitchTurn - ld hl, $4cef - call CallBankF + ld hl, Function3ccef + call CallBattleCore call SwitchTurn ld hl, RegainedHealthText call StdBattleTextBox @@ -9527,9 +9537,9 @@ BattleCommand61: ; 37874 jr .asm_37904 ; 378f1 $11 .asm_378f3 call SwitchTurn - call Function0x37ed5 + call Function37ed5 jr nc, .asm_37904 ; 378f9 $9 - call Function0x37e77 + call AnimateFailedMove ld hl, RefusedGiftText call StdBattleTextBox .asm_37904 @@ -9589,16 +9599,16 @@ BattleCommand64: ; 37939 set 2, [hl] ld a, $5 ld [de], a - call Function0x37e01 + call AnimateCurrentMove ld hl, CoveredByVeilText jp StdBattleTextBox .asm_3795c - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed ; 37962 -Function0x37962: ; 37962 +Function37962: ; 37962 push hl ld hl, EnemyScreens ld a, [hBattleTurn] @@ -9678,85 +9688,85 @@ BattleCommand67: ; 379c9 and a jp nz, .Enemy - call Function0x37ae9 - jp z, Function0x37aab + +; Need something to switch to + call CheckAnyOtherAlivePartyMons + jp z, FailedBatonPass call UpdateBattleMonInParty - call Function0x37e01 + call AnimateCurrentMove ld c, 50 call DelayFrames +; Transition into switchmon menu call Function1d6e - callba Function3d2f7 - callba Function3d380 + callba ForcePickSwitchMonInBattle +; Return to battle scene call ClearPalettes - callba Function3ed9f - call Function1c17 call ClearSprites - - ld hl, $c4a1 - ld bc, $040a + hlcoord 1, 0 + lb bc, 4, 10 call ClearBox - ld b, 1 call GetSGBLayout call Function32f9 - call Function0x37a67 + call BatonPass_LinkPlayerSwitch +; Mobile link battles handle entrances differently callba Function3d2e0 - jp c, EndMoveEffect - ld hl, Function3e459 - call CallBankF - call Function0x37ab1 + ld hl, PassedBattleMonEntrance + call CallBattleCore + call ResetBatonPassStatus ret -.Enemy - ld a, [IsInBattle] - dec a - jp z, Function0x37aab - call Function0x37af6 - jp z, Function0x37aab +.Enemy + +; Wildmons don't have anything to switch to + ld a, [IsInBattle] + dec a ; WILDMON + jp z, FailedBatonPass + + call CheckAnyOtherAliveEnemyMons + jp z, FailedBatonPass call UpdateEnemyMonInParty - call Function0x37e01 - call Function0x37a82 + call AnimateCurrentMove + call BatonPass_LinkEnemySwitch +; Mobile link battles handle entrances differently callba Function3d2e0 jp c, EndMoveEffect +; Passed enemy PartyMon entrance xor a ld [$c718], a - - ld hl, $5517 - call CallBankF - - ld hl, $557a - call CallBankF - + ld hl, Function3d517 + call CallBattleCore + ld hl, Function3d57a + call CallBattleCore ld a, 1 ld [$d265], a + ld hl, Function3ecab + call CallBattleCore - ld hl, $6cab - call CallBankF + ld hl, SpikesDamage + call CallBattleCore - ld hl, $5c23 - call CallBankF - - jr Function0x37ab1 + jr ResetBatonPassStatus ; 37a67 -Function0x37a67: ; 37a67 +BatonPass_LinkPlayerSwitch: ; 37a67 ld a, [InLinkBattle] and a ret z @@ -9764,76 +9774,84 @@ Function0x37a67: ; 37a67 ld a, 1 ld [$d0ec], a - call $1d6e - - ld hl, $68e4 - call CallBankF - - call $1c17 + call Function1d6e + ld hl, Function3e8e4 + call CallBattleCore + call Function1c17 xor a ld [$d0ec], a - ret ; 37a82 -Function0x37a82; 37a82 +BatonPass_LinkEnemySwitch: ; 37a82 ld a, [InLinkBattle] and a ret z - call $1d6e - ld hl, $68e4 - call CallBankF + call Function1d6e + ld hl, Function3e8e4 + call CallBattleCore + ld a, [OTPartyCount] - add $4 + add 4 ld b, a ld a, [$d430] - cp $4 + cp 4 jr c, .asm_37aa0 - cp b jr c, .asm_37aa8 .asm_37aa0 ld a, [CurOTMon] - add $4 + add 4 ld [$d430], a .asm_37aa8 - jp $1c17 + jp Function1c17 ; 37aab -Function0x37aab: ; 37aab - call Function0x37e77 +FailedBatonPass: ; 37aab + call AnimateFailedMove jp PrintButItFailed ; 37ab1 -Function0x37ab1: ; 37ab1 +ResetBatonPassStatus: ; 37ab1 +; Reset status changes that aren't passed by Baton Pass. + +; Nightmare isn't passed. ld a, BATTLE_VARS_STATUS call GetBattleVar - and 7 - jr nz, .asm_37ac1 + and SLP + jr nz, .ok + ld a, BATTLE_VARS_SUBSTATUS1 call _GetBattleVar - res 0, [hl] + res SUBSTATUS_NIGHTMARE, [hl] +.ok -.asm_37ac1 - call Function0x372e7 +; Disable isn't passed. + call ResetActorDisable + +; Attraction isn't passed. ld hl, PlayerSubStatus1 - res 7, [hl] + res SUBSTATUS_IN_LOVE, [hl] ld hl, EnemySubStatus1 - res 7, [hl] + res SUBSTATUS_IN_LOVE, [hl] ld hl, PlayerSubStatus5 + ld a, BATTLE_VARS_SUBSTATUS5 call _GetBattleVar res 3, [hl] res 4, [hl] + +; New mon hasn't used a move yet. ld a, BATTLE_VARS_LAST_MOVE call _GetBattleVar ld [hl], 0 + xor a ld [$c730], a ld [$c731], a @@ -9841,17 +9859,17 @@ Function0x37ab1: ; 37ab1 ; 37ae9 -Function0x37ae9: ; 37ae9 +CheckAnyOtherAlivePartyMons: ; 37ae9 ld hl, PartyMon1CurHP ld a, [PartyCount] ld d, a ld a, [CurBattleMon] ld e, a - jr Function0x37b01 + jr CheckAnyOtherAliveMons ; 37af6 -Function0x37af6: ; 37af6 +CheckAnyOtherAliveEnemyMons: ; 37af6 ld hl, OTPartyMon1CurHP ld a, [OTPartyCount] ld d, a @@ -9861,17 +9879,21 @@ Function0x37af6: ; 37af6 ; fallthrough ; 37b01 -Function0x37b01: ; 37b01 +CheckAnyOtherAliveMons: ; 37b01 +; Check for nonzero HP starting from partymon +; HP at hl for d partymons, besides current mon e. + +; Return nz if any are alive. + xor a ld b, a ld c, a -.asm_37b04 +.loop ld a, c cp d - jr z, .asm_37b1a - + jr z, .done cp e - jr z, .asm_37b11 + jr z, .next ld a, [hli] or b @@ -9879,15 +9901,16 @@ Function0x37b01: ; 37b01 ld a, [hld] or b ld b, a -.asm_37b11 + +.next push bc - ld bc, $30 + ld bc, PartyMon2 - PartyMon1 add hl, bc pop bc inc c - jr .asm_37b04 + jr .loop -.asm_37b1a +.done ld a, b and a ret @@ -10028,7 +10051,7 @@ BattleCommand6a6c: ; 37b7e ld a, BANK(GetMaxHP) rst FarCall - call Function0x37e01 + call AnimateCurrentMove call SwitchTurn callab Function3ccef @@ -10041,7 +10064,7 @@ BattleCommand6a6c: ; 37b7e jp StdBattleTextBox .Full - call Function0x37e77 + call AnimateFailedMove ; 'hp is full!' ld hl, HPIsFullText @@ -10061,7 +10084,7 @@ BattleCommand6d: ; 37be8 ld a, [AttackMissed] and a ret nz - callba GetHiddenPower + callba HiddenPowerDamage ret ; 37bf4 @@ -10072,7 +10095,7 @@ BattleCommand6e: ; 37bf4 ld [Weather], a ld a, 5 ld [WeatherCount], a - call Function0x37e01 + call AnimateCurrentMove ld hl, DownpourText jp StdBattleTextBox ; 37c07 @@ -10084,7 +10107,7 @@ BattleCommand6f: ; 37c07 ld [Weather], a ld a, 5 ld [WeatherCount], a - call Function0x37e01 + call AnimateCurrentMove ld hl, SunGotBrightText jp StdBattleTextBox ; 37c1a @@ -10103,7 +10126,7 @@ BattleCommand95: ; 37c1a jr nc, .asm_37c4f push bc - call Function0x37e01 + call AnimateCurrentMove pop bc callab Function3cc3f call UpdateUserInParty @@ -10119,7 +10142,7 @@ BattleCommand95: ; 37c1a ld hl, BellyDrumText jp StdBattleTextBox .asm_37c4f - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed ; 37c55 @@ -10146,7 +10169,7 @@ BattleCommand96: ; 37c55 dec b jr nz, .asm_37c67 ; 37c6d $f8 pop hl - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed .asm_37c76 pop hl @@ -10160,12 +10183,12 @@ BattleCommand96: ; 37c55 ld a, [hBattleTurn] and a jr nz, .asm_37c89 ; 37c82 $5 - call Function0x365d7 + call Function365d7 jr .asm_37c8c ; 37c87 $3 .asm_37c89 - call Function0x365fd + call Function365fd .asm_37c8c - call Function0x37e01 + call AnimateCurrentMove ld hl, CopiedStatsText jp StdBattleTextBox ; 37c95 @@ -10174,49 +10197,59 @@ BattleCommand96: ; 37c55 BattleCommand9a: ; 37c95 ; mirrorcoat - ld a, $1 + ld a, 1 ld [AttackMissed], a + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar and a ret z + ld b, a callab GetMoveEffect ld a, b - cp $90 + cp EFFECT_MIRROR_COAT ret z + call BattleCommanda3 ld a, [$d265] and a ret z - call Function0x36abf + + call Function36abf ret z + ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar dec a ld de, StringBuffer1 call GetMoveData + ld a, [$d075] and a ret z + ld a, [$d076] - cp $14 + cp SPECIAL ret c + ld hl, CurDamage ld a, [hli] or [hl] ret z + ld a, [hl] add a ld [hld], a ld a, [hl] adc a ld [hl], a - jr nc, .asm_37ce1 ; 37cdb $4 + jr nc, .capped ld a, $ff ld [hli], a ld [hl], a -.asm_37ce1 +.capped + xor a ld [AttackMissed], a ret @@ -10288,7 +10321,7 @@ BattleCommand9b: ; 37d0d BattleCommand9c: ; 37d34 ; futuresight - call Function0x34548 + call Function34548 jr nz, .asm_37d4b ; 37d37 $12 ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -10335,7 +10368,7 @@ BattleCommand9c: ; 37d34 .asm_37d87 pop bc call ResetDamage - call Function0x37e77 + call AnimateFailedMove call PrintButItFailed jp EndMoveEffect ; 37d94 @@ -10416,7 +10449,7 @@ GetItem: ; 37dd0 ; 37de9 -Function0x37de9: ; 37de9 +Function37de9: ; 37de9 push hl push de push bc @@ -10425,7 +10458,7 @@ Function0x37de9: ; 37de9 call BattleCommand0a pop af ld [$c689], a - call Function0x37e19 + call Function37e19 call BattleCommand0c pop bc pop de @@ -10434,7 +10467,7 @@ Function0x37de9: ; 37de9 ; 37e01 -Function0x37e01: ; 37e01 +AnimateCurrentMove: ; 37e01 push hl push de push bc @@ -10443,7 +10476,7 @@ Function0x37e01: ; 37e01 call BattleCommand0a pop af ld [$c689], a - call Function0x37e36 + call Function37e36 call BattleCommand0c pop bc pop de @@ -10452,7 +10485,7 @@ Function0x37e01: ; 37e01 ; 37e19 -Function0x37e19: ; 37e19 +Function37e19: ; 37e19 xor a ld [FXAnimIDHi], a @@ -10472,11 +10505,11 @@ Function0x37e19: ; 37e19 .asm_37e30 ld [$cfca], a - jp Function0x37e47 + jp Function37e47 ; 37e36 -Function0x37e36: ; 37e36 +Function37e36: ; 37e36 xor a ld [$cfca], a ld [FXAnimIDHi], a @@ -10490,7 +10523,7 @@ Function0x37e36: ; 37e36 ; 37e44 -Function0x37e44: ; 37e44 +Function37e44: ; 37e44 ld [FXAnimIDLo], a @@ -10498,7 +10531,7 @@ Function0x37e44: ; 37e44 ; 37e47 -Function0x37e47: ; 37e47 +Function37e47: ; 37e47 push hl push de push bc @@ -10510,7 +10543,7 @@ Function0x37e47: ; 37e47 ; 37e54 -Function0x37e54: ; 37e54 +Function37e54: ; 37e54 ld a, e ld [FXAnimIDLo], a ld a, d @@ -10533,14 +10566,14 @@ Function0x37e54: ; 37e54 ; 37e73 -CallBankF: ; 37e73 - ld a, $f +CallBattleCore: ; 37e73 + ld a, BANK(BattleCore) rst FarCall ret ; 37e77 -Function0x37e77: ; 37e77 +AnimateFailedMove: ; 37e77 call BattleCommand0a call BattleCommandaa jp BattleCommand0c @@ -10612,25 +10645,25 @@ GetMoveByte: ; 37ebb ; 37ec0 -Function0x37ec0: ; 37ec0 +Function37ec0: ; 37ec0 callba Functionfbd54 ret ; 37ec7 -Function0x37ec7: ; 37ec7 +Function37ec7: ; 37ec7 callba Functionfbd71 ret ; 37ece -Function0x37ece: ; 37ece +Function37ece: ; 37ece callba Functionfbd69 ret ; 37ed5 -Function0x37ed5: ; 37ed5 +Function37ed5: ; 37ed5 ; Related to mobile link battles. push hl push de diff --git a/battle/effects/curse.asm b/battle/effects/curse.asm index 9dc7f4b1d..fc08beae6 100644 --- a/battle/effects/curse.asm +++ b/battle/effects/curse.asm @@ -41,9 +41,9 @@ BattleCommand54: ; 37588 ld a, $1 ld [$c689], a - call Function0x37e01 + call AnimateCurrentMove ld a, $2 - call Function0x36532 + call Function36532 call SwitchTurn call BattleCommand8d call ResetMiss @@ -71,17 +71,17 @@ BattleCommand54: ; 37588 jr nz, .failed set 1, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, GetHalfMaxHP - call CallBankF + call CallBattleCore ld hl, Function3cc3f - call CallBankF + call CallBattleCore call UpdateUserInParty ld hl, PutACurseText jp StdBattleTextBox .failed - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed @@ -91,7 +91,7 @@ BattleCommand54: ; 37588 ld b, $8 ; ABILITY call GetStatName - call Function0x37e77 + call AnimateFailedMove ld hl, WontRiseAnymoreText jp StdBattleTextBox ; 37618 diff --git a/battle/effects/endure.asm b/battle/effects/endure.asm index b2c622079..f449dcebd 100644 --- a/battle/effects/endure.asm +++ b/battle/effects/endure.asm @@ -10,7 +10,7 @@ BattleCommand5a: ; 3766f call _GetBattleVar set SUBSTATUS_ENDURE, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, BracedItselfText jp StdBattleTextBox diff --git a/battle/effects/foresight.asm b/battle/effects/foresight.asm index ed2e629a0..7a8f33493 100644 --- a/battle/effects/foresight.asm +++ b/battle/effects/foresight.asm @@ -14,11 +14,11 @@ BattleCommand57: ; 376a0 jr nz, .failed set SUBSTATUS_IDENTIFIED, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, IdentifiedText jp StdBattleTextBox .failed - jp Function0x37354 + jp Function37354 ; 376c2 diff --git a/battle/effects/metronome.asm b/battle/effects/metronome.asm index fd3d151f0..3762ec372 100644 --- a/battle/effects/metronome.asm +++ b/battle/effects/metronome.asm @@ -1,8 +1,8 @@ BattleCommand34: ; 37418 ; metronome - call Function0x372d8 - call Function0x34548 + call Function372d8 + call Function34548 jr nz, .asm_3742b ld a, [$c689] @@ -12,7 +12,7 @@ BattleCommand34: ; 37418 ld [$c689], a .asm_3742b - call Function0x37e36 + call Function37e36 .GetMove call BattleRandom diff --git a/battle/effects/mirror_move.asm b/battle/effects/mirror_move.asm index c54977a91..60748bdae 100644 --- a/battle/effects/mirror_move.asm +++ b/battle/effects/mirror_move.asm @@ -1,7 +1,7 @@ BattleCommand1b: ; 373c9 ; mirrormove - call Function0x372d8 + call Function372d8 ld a, BATTLE_VARS_MOVE call _GetBattleVar @@ -15,7 +15,7 @@ BattleCommand1b: ; 373c9 jr nz, .use .failed - call Function0x37e77 + call AnimateFailedMove ld hl, MirrorMoveFailedText call StdBattleTextBox @@ -37,7 +37,7 @@ BattleCommand1b: ; 373c9 call GetMoveData call GetMoveName call CopyName1 - call Function0x34548 + call Function34548 jr nz, .done ld a, [$c689] diff --git a/battle/effects/nightmare.asm b/battle/effects/nightmare.asm index 6cd1f0a64..cd3210cab 100644 --- a/battle/effects/nightmare.asm +++ b/battle/effects/nightmare.asm @@ -28,12 +28,12 @@ BattleCommand52: ; 37536 ; Otherwise give the opponent a nightmare. set SUBSTATUS_NIGHTMARE, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, StartedNightmareText jp StdBattleTextBox .failed - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed ; 37563 diff --git a/battle/effects/perish_song.asm b/battle/effects/perish_song.asm index 4f206d5d2..423d299fa 100644 --- a/battle/effects/perish_song.asm +++ b/battle/effects/perish_song.asm @@ -30,12 +30,12 @@ BattleCommand58: ; 376c2 ld [EnemyPerishCount], a .done - call Function0x37e01 + call AnimateCurrentMove ld hl, StartPerishText jp StdBattleTextBox .failed - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed ; 376f8 diff --git a/battle/effects/protect.asm b/battle/effects/protect.asm index 45e9a75d4..a28c0461e 100644 --- a/battle/effects/protect.asm +++ b/battle/effects/protect.asm @@ -7,7 +7,7 @@ BattleCommand55: ; 37618 call _GetBattleVar set SUBSTATUS_PROTECT, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, ProtectedItselfText jp StdBattleTextBox @@ -23,7 +23,7 @@ ProtectChance: ; 3762c ld de, EnemyProtectCount .asm_37637 - call Function0x36abf + call Function36abf jr nz, .failed ; Can't have a substitute. @@ -73,7 +73,7 @@ ProtectChance: ; 3762c .failed xor a ld [de], a - call Function0x37e77 + call AnimateFailedMove call PrintButItFailed scf ret diff --git a/battle/effects/sandstorm.asm b/battle/effects/sandstorm.asm index ad3bac9d1..b4f782721 100644 --- a/battle/effects/sandstorm.asm +++ b/battle/effects/sandstorm.asm @@ -9,12 +9,12 @@ BattleCommand59: ; 376f8 ld [Weather], a ld a, 5 ld [WeatherCount], a - call Function0x37e01 + call AnimateCurrentMove ld hl, SandstormBrewedText jp StdBattleTextBox .failed - call Function0x37e77 + call AnimateFailedMove jp PrintButItFailed ; 37718 diff --git a/battle/effects/spikes.asm b/battle/effects/spikes.asm index 1b93f9fa1..2d9357941 100644 --- a/battle/effects/spikes.asm +++ b/battle/effects/spikes.asm @@ -17,12 +17,12 @@ BattleCommand56: ; 37683 set SCREENS_SPIKES, [hl] - call Function0x37e01 + call AnimateCurrentMove ld hl, SpikesText jp StdBattleTextBox .failed - jp Function0x37354 + jp Function37354 ; 376a0 diff --git a/battle/hidden_power.asm b/battle/hidden_power.asm index 3dc40c946..b02b31d12 100644 --- a/battle/hidden_power.asm +++ b/battle/hidden_power.asm @@ -1,75 +1,76 @@ -GetHiddenPower: ; fbced -; Override Hidden Power's type and power based on the actor's DVs. +HiddenPowerDamage: ; fbced +; Override Hidden Power's type and power based on the user's DVs. ld hl, BattleMonDVs ld a, [hBattleTurn] and a - jr z, .GotDVs + jr z, .got_dvs ld hl, EnemyMonDVs -.GotDVs +.got_dvs ; Power: -; Take the top bit from... +; Take the top bit from each stat -; Atk + ; Attack ld a, [hl] swap a and 8 + + ; Defense ld b, a -; Def ld a, [hli] and 8 srl a or b + + ; Speed ld b, a -; Spd ld a, [hl] swap a and 8 srl a srl a or b + + ; Special ld b, a -; Spc ld a, [hl] and 8 srl a srl a srl a or b - ld b, a -; * 5 +; Multiply by 5 + ld b, a add a add a add b - ld b, a -; + (Spc & 3) +; Add Special & 3 + ld b, a ld a, [hld] and 3 add b -; / 2 +; Divide by 2 and add 30 + 1 srl a - -; + 30 add 30 -; + 1 inc a + ld d, a ; Type: -; Def & 3 + ; Def & 3 ld a, [hl] and 3 ld b, a -; + (Atk & 3) << 2 + ; + (Atk & 3) << 2 ld a, [hl] and 3 << 4 swap a @@ -80,27 +81,30 @@ GetHiddenPower: ; fbced ; Skip Normal inc a -; Skip type 6 (unused) - cp 6 - jr c, .GotType +; Skip Bird + cp BIRD + jr c, .done inc a -; Skip unused types between Steel and Fire - cp STEEL + 1 - jr c, .GotType - add FIRE - (STEEL + 1) +; Skip unused types + cp UNUSED_TYPES + jr c, .done + add SPECIAL - UNUSED_TYPES +.done -.GotType +; Overwrite the current move type. push af ld a, BATTLE_VARS_MOVE_TYPE call _GetBattleVar pop af ld [hl], a +; Get the rest of the damage formula variables +; based on the new type, but keep base power. ld a, d push af - callba BattleCommand06 + callba BattleCommand06 ; damagestats pop af ld d, a ret diff --git a/constants.asm b/constants.asm index 7ffaba56a..2c07ebb5a 100644 --- a/constants.asm +++ b/constants.asm @@ -12,6 +12,7 @@ INCLUDE "hram.asm" INCLUDE "constants/wram_constants.asm" INCLUDE "constants/pokemon_constants.asm" +INCLUDE "constants/type_constants.asm" INCLUDE "constants/move_constants.asm" INCLUDE "constants/battle_constants.asm" INCLUDE "constants/map_constants.asm" @@ -31,25 +32,6 @@ INCLUDE "constants/gfx_constants.asm" NONE EQU 0 -; types -NORMAL EQU $00 -FIGHTING EQU $01 -FLYING EQU $02 -POISON EQU $03 -GROUND EQU $04 -ROCK EQU $05 -BUG EQU $07 -GHOST EQU $08 -STEEL EQU $09 -CURSE_T EQU $13 -FIRE EQU $14 -WATER EQU $15 -GRASS EQU $16 -ELECTRIC EQU $17 -PSYCHIC EQU $18 -ICE EQU $19 -DRAGON EQU $1A -DARK EQU $1B ; egg group constants MONSTER EQU $01 diff --git a/constants/move_constants.asm b/constants/move_constants.asm index 9fc237fc9..092fcd366 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -1,259 +1,259 @@ const_def - const NO_MOVE - const POUND - const KARATE_CHOP - const DOUBLESLAP - const COMET_PUNCH - const MEGA_PUNCH - const PAY_DAY - const FIRE_PUNCH - const ICE_PUNCH - const THUNDERPUNCH - const SCRATCH - const VICEGRIP - const GUILLOTINE - const RAZOR_WIND - const SWORDS_DANCE - const CUT - const GUST - const WING_ATTACK - const WHIRLWIND - const FLY - const BIND - const SLAM - const VINE_WHIP - const STOMP - const DOUBLE_KICK - const MEGA_KICK - const JUMP_KICK - const ROLLING_KICK - const SAND_ATTACK - const HEADBUTT - const HORN_ATTACK - const FURY_ATTACK - const HORN_DRILL - const TACKLE - const BODY_SLAM - const WRAP - const TAKE_DOWN - const THRASH - const DOUBLE_EDGE - const TAIL_WHIP - const POISON_STING - const TWINEEDLE - const PIN_MISSILE - const LEER - const BITE - const GROWL - const ROAR - const SING - const SUPERSONIC - const SONICBOOM - const DISABLE - const ACID - const EMBER - const FLAMETHROWER - const MIST - const WATER_GUN - const HYDRO_PUMP - const SURF - const ICE_BEAM - const BLIZZARD - const PSYBEAM - const BUBBLEBEAM - const AURORA_BEAM - const HYPER_BEAM - const PECK - const DRILL_PECK - const SUBMISSION - const LOW_KICK - const COUNTER - const SEISMIC_TOSS - const STRENGTH - const ABSORB - const MEGA_DRAIN - const LEECH_SEED - const GROWTH - const RAZOR_LEAF - const SOLARBEAM - const POISONPOWDER - const STUN_SPORE - const SLEEP_POWDER - const PETAL_DANCE - const STRING_SHOT - const DRAGON_RAGE - const FIRE_SPIN - const THUNDERSHOCK - const THUNDERBOLT - const THUNDER_WAVE - const THUNDER - const ROCK_THROW - const EARTHQUAKE - const FISSURE - const DIG - const TOXIC - const CONFUSION - const PSYCHIC_M - const HYPNOSIS - const MEDITATE - const AGILITY - const QUICK_ATTACK - const RAGE - const TELEPORT - const NIGHT_SHADE - const MIMIC - const SCREECH - const DOUBLE_TEAM - const RECOVER - const HARDEN - const MINIMIZE - const SMOKESCREEN - const CONFUSE_RAY - const WITHDRAW - const DEFENSE_CURL - const BARRIER - const LIGHT_SCREEN - const HAZE - const REFLECT - const FOCUS_ENERGY - const BIDE - const METRONOME - const MIRROR_MOVE - const SELFDESTRUCT - const EGG_BOMB - const LICK - const SMOG - const SLUDGE - const BONE_CLUB - const FIRE_BLAST - const WATERFALL - const CLAMP - const SWIFT - const SKULL_BASH - const SPIKE_CANNON - const CONSTRICT - const AMNESIA - const KINESIS - const SOFTBOILED - const HI_JUMP_KICK - const GLARE - const DREAM_EATER - const POISON_GAS - const BARRAGE - const LEECH_LIFE - const LOVELY_KISS - const SKY_ATTACK - const TRANSFORM - const BUBBLE - const DIZZY_PUNCH - const SPORE - const FLASH - const PSYWAVE - const SPLASH - const ACID_ARMOR - const CRABHAMMER - const EXPLOSION - const FURY_SWIPES - const BONEMERANG - const REST - const ROCK_SLIDE - const HYPER_FANG - const SHARPEN - const CONVERSION - const TRI_ATTACK - const SUPER_FANG - const SLASH - const SUBSTITUTE - const STRUGGLE - const SKETCH - const TRIPLE_KICK - const THIEF - const SPIDER_WEB - const MIND_READER - const NIGHTMARE - const FLAME_WHEEL - const SNORE - const CURSE - const FLAIL - const CONVERSION2 - const AEROBLAST - const COTTON_SPORE - const REVERSAL - const SPITE - const POWDER_SNOW - const PROTECT - const MACH_PUNCH - const SCARY_FACE - const FAINT_ATTACK - const SWEET_KISS - const BELLY_DRUM - const SLUDGE_BOMB - const MUD_SLAP - const OCTAZOOKA - const SPIKES - const ZAP_CANNON - const FORESIGHT - const DESTINY_BOND - const PERISH_SONG - const ICY_WIND - const DETECT - const BONE_RUSH - const LOCK_ON - const OUTRAGE - const SANDSTORM - const GIGA_DRAIN - const ENDURE - const CHARM - const ROLLOUT - const FALSE_SWIPE - const SWAGGER - const MILK_DRINK - const SPARK - const FURY_CUTTER - const STEEL_WING - const MEAN_LOOK - const ATTRACT - const SLEEP_TALK - const HEAL_BELL - const RETURN - const PRESENT - const FRUSTRATION - const SAFEGUARD - const PAIN_SPLIT - const SACRED_FIRE - const MAGNITUDE - const DYNAMICPUNCH - const MEGAHORN - const DRAGONBREATH - const BATON_PASS - const ENCORE - const PURSUIT - const RAPID_SPIN - const SWEET_SCENT - const IRON_TAIL - const METAL_CLAW - const VITAL_THROW - const MORNING_SUN - const SYNTHESIS - const MOONLIGHT - const HIDDEN_POWER - const CROSS_CHOP - const TWISTER - const RAIN_DANCE - const SUNNY_DAY - const CRUNCH - const MIRROR_COAT - const PSYCH_UP - const EXTREMESPEED - const ANCIENTPOWER - const SHADOW_BALL - const FUTURE_SIGHT - const ROCK_SMASH - const WHIRLPOOL - const BEAT_UP + const NO_MOVE ; $00 + const POUND ; $01 + const KARATE_CHOP ; $02 + const DOUBLESLAP ; $03 + const COMET_PUNCH ; $04 + const MEGA_PUNCH ; $05 + const PAY_DAY ; $06 + const FIRE_PUNCH ; $07 + const ICE_PUNCH ; $08 + const THUNDERPUNCH ; $09 + const SCRATCH ; $0a + const VICEGRIP ; $0b + const GUILLOTINE ; $0c + const RAZOR_WIND ; $0d + const SWORDS_DANCE ; $0e + const CUT ; $0f + const GUST ; $10 + const WING_ATTACK ; $11 + const WHIRLWIND ; $12 + const FLY ; $13 + const BIND ; $14 + const SLAM ; $15 + const VINE_WHIP ; $16 + const STOMP ; $17 + const DOUBLE_KICK ; $18 + const MEGA_KICK ; $19 + const JUMP_KICK ; $1a + const ROLLING_KICK ; $1b + const SAND_ATTACK ; $1c + const HEADBUTT ; $1d + const HORN_ATTACK ; $1e + const FURY_ATTACK ; $1f + const HORN_DRILL ; $20 + const TACKLE ; $21 + const BODY_SLAM ; $22 + const WRAP ; $23 + const TAKE_DOWN ; $24 + const THRASH ; $25 + const DOUBLE_EDGE ; $26 + const TAIL_WHIP ; $27 + const POISON_STING ; $28 + const TWINEEDLE ; $29 + const PIN_MISSILE ; $2a + const LEER ; $2b + const BITE ; $2c + const GROWL ; $2d + const ROAR ; $2e + const SING ; $2f + const SUPERSONIC ; $30 + const SONICBOOM ; $31 + const DISABLE ; $32 + const ACID ; $33 + const EMBER ; $34 + const FLAMETHROWER ; $35 + const MIST ; $36 + const WATER_GUN ; $37 + const HYDRO_PUMP ; $38 + const SURF ; $39 + const ICE_BEAM ; $3a + const BLIZZARD ; $3b + const PSYBEAM ; $3c + const BUBBLEBEAM ; $3d + const AURORA_BEAM ; $3e + const HYPER_BEAM ; $3f + const PECK ; $40 + const DRILL_PECK ; $41 + const SUBMISSION ; $42 + const LOW_KICK ; $43 + const COUNTER ; $44 + const SEISMIC_TOSS ; $45 + const STRENGTH ; $46 + const ABSORB ; $47 + const MEGA_DRAIN ; $48 + const LEECH_SEED ; $49 + const GROWTH ; $4a + const RAZOR_LEAF ; $4b + const SOLARBEAM ; $4c + const POISONPOWDER ; $4d + const STUN_SPORE ; $4e + const SLEEP_POWDER ; $4f + const PETAL_DANCE ; $50 + const STRING_SHOT ; $51 + const DRAGON_RAGE ; $52 + const FIRE_SPIN ; $53 + const THUNDERSHOCK ; $54 + const THUNDERBOLT ; $55 + const THUNDER_WAVE ; $56 + const THUNDER ; $57 + const ROCK_THROW ; $58 + const EARTHQUAKE ; $59 + const FISSURE ; $5a + const DIG ; $5b + const TOXIC ; $5c + const CONFUSION ; $5d + const PSYCHIC_M ; $5e + const HYPNOSIS ; $5f + const MEDITATE ; $60 + const AGILITY ; $61 + const QUICK_ATTACK ; $62 + const RAGE ; $63 + const TELEPORT ; $64 + const NIGHT_SHADE ; $65 + const MIMIC ; $66 + const SCREECH ; $67 + const DOUBLE_TEAM ; $68 + const RECOVER ; $69 + const HARDEN ; $6a + const MINIMIZE ; $6b + const SMOKESCREEN ; $6c + const CONFUSE_RAY ; $6d + const WITHDRAW ; $6e + const DEFENSE_CURL ; $6f + const BARRIER ; $70 + const LIGHT_SCREEN ; $71 + const HAZE ; $72 + const REFLECT ; $73 + const FOCUS_ENERGY ; $74 + const BIDE ; $75 + const METRONOME ; $76 + const MIRROR_MOVE ; $77 + const SELFDESTRUCT ; $78 + const EGG_BOMB ; $79 + const LICK ; $7a + const SMOG ; $7b + const SLUDGE ; $7c + const BONE_CLUB ; $7d + const FIRE_BLAST ; $7e + const WATERFALL ; $7f + const CLAMP ; $80 + const SWIFT ; $81 + const SKULL_BASH ; $82 + const SPIKE_CANNON ; $83 + const CONSTRICT ; $84 + const AMNESIA ; $85 + const KINESIS ; $86 + const SOFTBOILED ; $87 + const HI_JUMP_KICK ; $88 + const GLARE ; $89 + const DREAM_EATER ; $8a + const POISON_GAS ; $8b + const BARRAGE ; $8c + const LEECH_LIFE ; $8d + const LOVELY_KISS ; $8e + const SKY_ATTACK ; $8f + const TRANSFORM ; $90 + const BUBBLE ; $91 + const DIZZY_PUNCH ; $92 + const SPORE ; $93 + const FLASH ; $94 + const PSYWAVE ; $95 + const SPLASH ; $96 + const ACID_ARMOR ; $97 + const CRABHAMMER ; $98 + const EXPLOSION ; $99 + const FURY_SWIPES ; $9a + const BONEMERANG ; $9b + const REST ; $9c + const ROCK_SLIDE ; $9d + const HYPER_FANG ; $9e + const SHARPEN ; $9f + const CONVERSION ; $a0 + const TRI_ATTACK ; $a1 + const SUPER_FANG ; $a2 + const SLASH ; $a3 + const SUBSTITUTE ; $a4 + const STRUGGLE ; $a5 + const SKETCH ; $a6 + const TRIPLE_KICK ; $a7 + const THIEF ; $a8 + const SPIDER_WEB ; $a9 + const MIND_READER ; $aa + const NIGHTMARE ; $ab + const FLAME_WHEEL ; $ac + const SNORE ; $ad + const CURSE ; $ae + const FLAIL ; $af + const CONVERSION2 ; $b0 + const AEROBLAST ; $b1 + const COTTON_SPORE ; $b2 + const REVERSAL ; $b3 + const SPITE ; $b4 + const POWDER_SNOW ; $b5 + const PROTECT ; $b6 + const MACH_PUNCH ; $b7 + const SCARY_FACE ; $b8 + const FAINT_ATTACK ; $b9 + const SWEET_KISS ; $ba + const BELLY_DRUM ; $bb + const SLUDGE_BOMB ; $bc + const MUD_SLAP ; $bd + const OCTAZOOKA ; $be + const SPIKES ; $bf + const ZAP_CANNON ; $c0 + const FORESIGHT ; $c1 + const DESTINY_BOND ; $c2 + const PERISH_SONG ; $c3 + const ICY_WIND ; $c4 + const DETECT ; $c5 + const BONE_RUSH ; $c6 + const LOCK_ON ; $c7 + const OUTRAGE ; $c8 + const SANDSTORM ; $c9 + const GIGA_DRAIN ; $ca + const ENDURE ; $cb + const CHARM ; $cc + const ROLLOUT ; $cd + const FALSE_SWIPE ; $ce + const SWAGGER ; $cf + const MILK_DRINK ; $d0 + const SPARK ; $d1 + const FURY_CUTTER ; $d2 + const STEEL_WING ; $d3 + const MEAN_LOOK ; $d4 + const ATTRACT ; $d5 + const SLEEP_TALK ; $d6 + const HEAL_BELL ; $d7 + const RETURN ; $d8 + const PRESENT ; $d9 + const FRUSTRATION ; $da + const SAFEGUARD ; $db + const PAIN_SPLIT ; $dc + const SACRED_FIRE ; $dd + const MAGNITUDE ; $de + const DYNAMICPUNCH ; $df + const MEGAHORN ; $e0 + const DRAGONBREATH ; $e1 + const BATON_PASS ; $e2 + const ENCORE ; $e3 + const PURSUIT ; $e4 + const RAPID_SPIN ; $e5 + const SWEET_SCENT ; $e6 + const IRON_TAIL ; $e7 + const METAL_CLAW ; $e8 + const VITAL_THROW ; $e9 + const MORNING_SUN ; $ea + const SYNTHESIS ; $eb + const MOONLIGHT ; $ec + const HIDDEN_POWER ; $ed + const CROSS_CHOP ; $ee + const TWISTER ; $ef + const RAIN_DANCE ; $f0 + const SUNNY_DAY ; $f1 + const CRUNCH ; $f2 + const MIRROR_COAT ; $f3 + const PSYCH_UP ; $f4 + const EXTREMESPEED ; $f5 + const ANCIENTPOWER ; $f6 + const SHADOW_BALL ; $f7 + const FUTURE_SIGHT ; $f8 + const ROCK_SMASH ; $f9 + const WHIRLPOOL ; $fa + const BEAT_UP ; $fb const_value SET const_value + -1 - const NUM_ATTACKS + const NUM_ATTACKS ; $fb diff --git a/constants/type_constants.asm b/constants/type_constants.asm new file mode 100644 index 000000000..764f41453 --- /dev/null +++ b/constants/type_constants.asm @@ -0,0 +1,39 @@ + + const_def + +PHYSICAL EQU const_value + const NORMAL + const FIGHTING + const FLYING + const POISON + const GROUND + const ROCK + const BIRD + const BUG + const GHOST + const STEEL + + +UNUSED_TYPES EQU const_value + const TYPE_10 + const TYPE_11 + const TYPE_12 + const TYPE_13 + const TYPE_14 + const TYPE_15 + const TYPE_16 + const TYPE_17 + const TYPE_18 + const CURSE_T + + +SPECIAL EQU const_value + const FIRE + const WATER + const GRASS + const ELECTRIC + const PSYCHIC + const ICE + const DRAGON + const DARK + diff --git a/items/item_effects.asm b/items/item_effects.asm index e602b3d34..9118fb4f0 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -1542,7 +1542,7 @@ Functionf030: ; f030 (3:7030) res 7, [hl] .asm_f04f push bc - callba Function0x365d7 + callba Function365d7 pop bc ret @@ -2343,7 +2343,7 @@ XSpecial: ; f4c5 ld [hBattleTurn], a ld [AttackMissed], a ld [$c70d], a - callba Function0x361ef + callba Function361ef call WaitSFX callba BattleCommand8c diff --git a/main.asm b/main.asm index 3ae79784b..bdfa47345 100644 --- a/main.asm +++ b/main.asm @@ -5271,10 +5271,10 @@ Function6520: ; 6520 push hl push de dec a - ld hl, $5b00 - ld bc, $0007 + ld hl, Moves + MOVE_PP + ld bc, Move2 - Move1 call AddNTimes - ld a, $10 + ld a, BANK(Moves) call GetFarByte pop de pop hl @@ -7793,7 +7793,7 @@ PredefPointers: ; 856b dwb Function5108b, BANK(Function5108b) dwb Function5120d, BANK(Function5120d) dwb DecompressPredef, BANK(DecompressPredef) ; $40 - dwb Function0x347d3, BANK(Function0x347d3) + dwb Function347d3, BANK(Function347d3) dwb Functionfb908, BANK(Functionfb908) dwb Functionfb877, BANK(Functionfb877) dwb Functiond0000, BANK(Functiond0000) @@ -11050,7 +11050,7 @@ _CheckTossableItem: ; d427 ld a, 4 call GetItemAttr bit 7, a - jr nz, Function0xd47f + jr nz, Functiond47f and a ret ; d432 @@ -11060,7 +11060,7 @@ CheckSelectableItem: ; d432 ld a, 4 call GetItemAttr bit 6, a - jr nz, Function0xd47f + jr nz, Functiond47f and a ret ; d43d @@ -11120,7 +11120,7 @@ GetItemAttr: ; d460 ret ; d47f -Function0xd47f: ; d47f +Functiond47f: ; d47f ld a, 1 ld [$d142], a scf @@ -35591,7 +35591,7 @@ INCBIN "baserom.gbc",$2c4d7,$2c4e3 - $2c4d7 cp $3 jr z, .asm_2c541 jr Function2c545 - callba Function0x377f5 + callba Function377f5 jr c, .asm_2c541 ld a, [PlayerSubStatus1] ; $c668 bit 7, a @@ -36789,7 +36789,7 @@ ClearBattleRAM: ; 2ef18 xor a call ByteFill - callab Function3d867 + callab ResetEnemyStatLevels call Function1fbf @@ -36913,7 +36913,7 @@ Function38041: ; 38041 ; 38045 Function38045: ; 38045 - callab Function0x34941 + callab Function34941 ld a, [$c717] and $f0 jp z, Function38041 @@ -36946,7 +36946,7 @@ Function38045: ; 38045 ; 38083 Function38083: ; 38083 - callab Function0x34941 + callab Function34941 ld a, [$c717] and $f0 jp z, Function38041 @@ -36979,7 +36979,7 @@ Function38083: ; 38083 ; 380c1 Function380c1: ; 380c1 - callab Function0x34941 + callab Function34941 ld a, [$c717] and $f0 jp z, Function38041 @@ -37438,8 +37438,8 @@ Function3846c: ; 3846c .asm_384a3 ld a, $1 ld [$d264], a - callab Function3d834 - callab Function3d867 + callab NewEnemyMonStatus + callab ResetEnemyStatLevels ld hl, PlayerSubStatus1 res 7, [hl] callba Function3d4e1 @@ -37555,7 +37555,7 @@ Function38557 push bc call Function38571 pop bc - callba Function0x361ef + callba Function361ef jp Function38387 ; 38568 @@ -37807,10 +37807,10 @@ Function39806: ; 39806 push hl push bc dec a - ld hl, $5b00 - ld bc, $0007 + ld hl, Moves + MOVE_PP + ld bc, Move2 - Move1 call AddNTimes - ld a, $10 + ld a, BANK(Moves) call GetFarByte pop bc pop hl @@ -83077,11 +83077,11 @@ Function100bc2: ; 100bc2 ret .asm_100c63 - ld hl, $4c5b + ld hl, BattleText_0x80c5b jr .asm_100c6b .asm_100c68 - ld hl, $4c39 + ld hl, BattleText_0x80c39 .asm_100c6b call StdBattleTextBox @@ -86704,7 +86704,7 @@ UsedMoveText: ; 105db9 ; check actor ???? push hl - callba Function0x34548 + callba Function34548 pop hl jr nz, .grammar