diff options
Diffstat (limited to 'engine/battle/core.asm')
-rwxr-xr-x | engine/battle/core.asm | 90 |
1 files changed, 56 insertions, 34 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 7b1c1d12..c2616ff7 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2221,53 +2221,66 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) .throwSafariBallWasSelected ld a, SAFARI_BALL ld [wcf91], a - jr .useItem + jr UseBagItem + .upperLeftMenuItemWasNotSelected ; a menu item other than the upper left item was selected cp $2 - jp nz, .partyMenuOrRockOrRunWasSelected + jp nz, PartyMenuOrRockOrRun + ; either the bag (normal battle) or bait (safari battle) was selected ld a, [W_ISLINKBATTLE] cp $4 jr nz, .notLinkBattle + ; can't use items in link battles - ld hl, .itemsCantBeUsedHereText + ld hl, ItemsCantBeUsedHereText call PrintText jp DisplayBattleMenu + .notLinkBattle call SaveScreenTilesToBuffer2 ld a, [W_BATTLETYPE] cp $2 ; is it a safari battle? - jr nz, .bagWasSelected + jr nz, BagWasSelected + ; bait was selected ld a, SAFARI_BAIT ld [wcf91], a - jr .useItem -.bagWasSelected + jr UseBagItem + +BagWasSelected: call LoadScreenTilesFromBuffer1 ld a, [W_BATTLETYPE] and a ; is it a normal battle? jr nz, .next + ; normal battle call DrawHUDsAndHPBars .next ld a, [W_BATTLETYPE] dec a ; is it the old man tutorial? - jr nz, .getPlayerBagPointer ; no, it is a normal battle - ld hl, .oldManItemList + jr nz, DisplayPlayerBag ; no, it is a normal battle + ld hl, OldManItemList ld a, l ld [wcf8b], a ld a, h ld [wcf8c], a - jr .displayBagMenu -.oldManItemList - db $01, POKE_BALL, 50, $ff -.getPlayerBagPointer ; get the pointer to player's bag when in a normal battle + jr DisplayBagMenu + +OldManItemList: + db 1 ; # items + db POKE_BALL, 50 + db -1 + +DisplayPlayerBag: + ; get the pointer to player's bag when in a normal battle ld hl, wNumBagItems ld a, l ld [wcf8b], a ld a, h ld [wcf8c], a -.displayBagMenu + +DisplayBagMenu: xor a ld [wcf93], a ld a, ITEMLISTMENU @@ -2281,7 +2294,9 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ld [wcc37], a ld [wMenuItemToSwap], a jp c, DisplayBattleMenu ; go back to battle menu if an item was not selected -.useItem ; either use an item from the bag or use a safari zone item + +UseBagItem: + ; either use an item from the bag or use a safari zone item ld a, [wcf91] ld [wd11e], a call GetItemName @@ -2296,9 +2311,11 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ld a, [W_BATTLETYPE] cp $2 ; is it a safari battle? jr z, .checkIfMonCaptured + ld a, [wcd6a] and a ; was the item used successfully? - jp z, .bagWasSelected ; if not, go back to the bag menu + jp z, BagWasSelected ; if not, go back to the bag menu + ld a, [W_PLAYERBATTSTATUS1] bit 5, a ; is the player using a multi-turn move like wrap? jr z, .checkIfMonCaptured @@ -2307,10 +2324,12 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) jr nz, .checkIfMonCaptured ld hl, W_PLAYERBATTSTATUS1 res 5, [hl] ; not using multi-turn move any more + .checkIfMonCaptured ld a, [wd11c] and a ; was the enemy mon captured with a ball? jr nz, .returnAfterCapturingMon + ld a, [W_BATTLETYPE] cp $2 ; is it a safari battle? jr z, .returnAfterUsingItem_NoCapture @@ -2319,9 +2338,11 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) call DrawHUDsAndHPBars call Delay3 .returnAfterUsingItem_NoCapture + call GBPalNormal and a ; reset carry ret + .returnAfterCapturingMon call GBPalNormal xor a @@ -2331,11 +2352,11 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) scf ; set carry ret -.itemsCantBeUsedHereText +ItemsCantBeUsedHereText: TX_FAR _ItemsCantBeUsedHereText db "@" -.partyMenuOrRockOrRunWasSelected +PartyMenuOrRockOrRun: dec a ; was Run selected? jp nz, BattleMenu_RunWasSelected ; party menu or rock was selected @@ -2346,7 +2367,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) ; safari battle ld a, SAFARI_ROCK ld [wcf91], a - jp .useItem + jp UseBagItem .partyMenuWasSelected call LoadScreenTilesFromBuffer1 xor a @@ -5595,7 +5616,7 @@ asm_3e70b: ; 3e70b (f:670b) res 6, [hl] ; no longer invulnerable to typical attacks ld a, [W_ENEMYMOVENUM] ld [wd0b5], a - ld a, $2c + ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME ld [W_LISTTYPE], a @@ -6070,10 +6091,11 @@ GetCurrentMove: ; 3eabe (f:6abe) call AddNTimes ld a, BANK(Moves) call FarCopyData - ld a, $2c + + ld a, BANK(MoveNames) ld [wPredefBank], a - ld a, $2 - ld [W_LISTTYPE], a ; list type 2 = move name + ld a, MOVE_NAME + ld [W_LISTTYPE], a call GetName ld de, wcd6d jp CopyStringToCF4B @@ -7203,16 +7225,16 @@ PoisonEffect: ; 3f24f (f:724f) dec de ld a, [H_WHOSETURN] and a - ld b, $c7 + ld b, ANIM_C7 ld hl, W_PLAYERBATTSTATUS3 ld a, [de] ld de, W_PLAYERTOXICCOUNTER jr nz, .asm_3f2b0 - ld b, $a9 + ld b, ANIM_A9 ld hl, W_ENEMYBATTSTATUS3 ld de, W_ENEMYTOXICCOUNTER .asm_3f2b0 - cp $5c + cp TOXIC jr nz, .asm_3f2bd set 0, [hl] xor a @@ -7314,14 +7336,14 @@ FreezeBurnParalyzeEffect: ; 3f30c (f:730c) ld a, 1 << PAR ld [wEnemyMonStatus], a call QuarterSpeedDueToParalysis ;quarter speed of affected monster - ld a, $a9 + ld a, ANIM_A9 call Func_3fbb9 ;animation jp PrintMayNotAttackText ;print paralysis text .burn ld a, 1 << BRN ld [wEnemyMonStatus], a call HalveAttackDueToBurn - ld a, $a9 + ld a, ANIM_A9 call Func_3fbb9 ;animation ld hl, BurnedText jp PrintText @@ -7329,7 +7351,7 @@ FreezeBurnParalyzeEffect: ; 3f30c (f:730c) call Func_3f9cf ;resets bit 5 of the D063/D068 flags ld a, 1 << FRZ ld [wEnemyMonStatus], a - ld a, $a9 + ld a, ANIM_A9 call Func_3fbb9 ;animation ld hl, FrozenText jp PrintText @@ -7867,7 +7889,7 @@ BideEffect: ; 3f6e5 (f:76e5) inc a ld [bc], a ld a, [H_WHOSETURN] - add $ae + add XSTATITEM_ANIM jp Func_3fb96 ThrashPetalDanceEffect: ; 3f717 (f:7717) @@ -7886,7 +7908,7 @@ ThrashPetalDanceEffect: ; 3f717 (f:7717) inc a ld [de], a ld a, [H_WHOSETURN] - add $b0 + add ANIM_B0 jp Func_3fb96 SwitchAndTeleportEffect: ; 3f739 (f:7739) @@ -8082,11 +8104,11 @@ ChargeEffect: ; 3f88c (f:788c) ld de, W_PLAYERMOVEEFFECT ld a, [H_WHOSETURN] and a - ld b, $ae + ld b, XSTATITEM_ANIM jr z, .asm_3f8a1 ld hl, W_ENEMYBATTSTATUS1 ld de, W_ENEMYMOVEEFFECT - ld b, $af + ld b, ANIM_AF .asm_3f8a1 set 4, [hl] ld a, [de] @@ -8094,13 +8116,13 @@ ChargeEffect: ; 3f88c (f:788c) cp FLY_EFFECT jr nz, .asm_3f8ad set 6, [hl] ; mon is now invulnerable to typical attacks (fly/dig) - ld b, $64 + ld b, TELEPORT .asm_3f8ad ld a, [de] cp DIG jr nz, .asm_3f8b6 set 6, [hl] ; mon is now invulnerable to typical attacks (fly/dig) - ld b, $c0 + ld b, ANIM_C0 .asm_3f8b6 xor a ld [wcc5b], a |