mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
d3cc861d33
Renamed a bunch of files, most of them one-off functions, to better fit the general snake_case naming scheme. Also renamed some awfully long filenames.
58 lines
696 B
NASM
58 lines
696 B
NASM
ConsumeHeldItem: ; 27192
|
|
push hl
|
|
push de
|
|
push bc
|
|
ld a, [hBattleTurn]
|
|
and a
|
|
ld hl, wOTPartyMon1Item
|
|
ld de, wEnemyMonItem
|
|
ld a, [wCurOTMon]
|
|
jr z, .theirturn
|
|
ld hl, wPartyMon1Item
|
|
ld de, wBattleMonItem
|
|
ld a, [wCurBattleMon]
|
|
|
|
.theirturn
|
|
push hl
|
|
push af
|
|
ld a, [de]
|
|
ld b, a
|
|
farcall GetItemHeldEffect
|
|
ld hl, ConsumableEffects
|
|
.loop
|
|
ld a, [hli]
|
|
cp b
|
|
jr z, .ok
|
|
inc a
|
|
jr nz, .loop
|
|
pop af
|
|
pop hl
|
|
pop bc
|
|
pop de
|
|
pop hl
|
|
ret
|
|
|
|
.ok
|
|
xor a
|
|
ld [de], a
|
|
pop af
|
|
pop hl
|
|
call GetPartyLocation
|
|
ld a, [hBattleTurn]
|
|
and a
|
|
jr nz, .ourturn
|
|
ld a, [wBattleMode]
|
|
dec a
|
|
jr z, .done
|
|
|
|
.ourturn
|
|
ld [hl], NO_ITEM
|
|
|
|
.done
|
|
pop bc
|
|
pop de
|
|
pop hl
|
|
ret
|
|
|
|
INCLUDE "data/battle/held_consumables.asm"
|