2018-06-24 07:09:41 -07:00
|
|
|
ConsumeHeldItem:
|
2017-12-15 17:10:54 -08:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2017-12-15 17:10:54 -08:00
|
|
|
and a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wOTPartyMon1Item
|
|
|
|
ld de, wEnemyMonItem
|
|
|
|
ld a, [wCurOTMon]
|
2017-12-15 17:10:54 -08:00
|
|
|
jr z, .theirturn
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1Item
|
|
|
|
ld de, wBattleMonItem
|
|
|
|
ld a, [wCurBattleMon]
|
2017-12-15 17:10:54 -08:00
|
|
|
|
|
|
|
.theirturn
|
|
|
|
push hl
|
|
|
|
push af
|
|
|
|
ld a, [de]
|
|
|
|
ld b, a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall GetItemHeldEffect
|
2018-01-25 18:34:42 -08:00
|
|
|
ld hl, ConsumableEffects
|
2017-12-15 17:10:54 -08:00
|
|
|
.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
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2017-12-15 17:10:54 -08:00
|
|
|
and a
|
|
|
|
jr nz, .ourturn
|
|
|
|
ld a, [wBattleMode]
|
|
|
|
dec a
|
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
.ourturn
|
2018-01-25 18:34:42 -08:00
|
|
|
ld [hl], NO_ITEM
|
2017-12-15 17:10:54 -08:00
|
|
|
|
|
|
|
.done
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-01-25 18:34:42 -08:00
|
|
|
INCLUDE "data/battle/held_consumables.asm"
|