2015-02-08 08:17:03 +00:00
|
|
|
; tests if mon [wcf91] can learn move [wMoveNum]
|
2014-06-16 20:03:05 +00:00
|
|
|
CanLearnTM: ; 1373e (4:773e)
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wcf91]
|
|
|
|
ld [wd0b5], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call GetMonHeader
|
|
|
|
ld hl, W_MONHLEARNSET
|
|
|
|
push hl
|
2015-02-08 08:17:03 +00:00
|
|
|
ld a, [wMoveNum]
|
2014-05-22 22:13:20 +00:00
|
|
|
ld b, a
|
|
|
|
ld c, $0
|
|
|
|
ld hl, TechnicalMachines
|
|
|
|
.findTMloop
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr z, .TMfoundLoop
|
|
|
|
inc c
|
|
|
|
jr .findTMloop
|
|
|
|
.TMfoundLoop
|
|
|
|
pop hl
|
|
|
|
ld b, $2 ; read corresponding bit from TM compatibility array
|
2014-06-16 20:57:26 +00:00
|
|
|
predef_jump FlagActionPredef
|
2014-05-22 22:13:20 +00:00
|
|
|
|
2014-05-26 21:04:56 +00:00
|
|
|
; converts TM/HM number in wd11e into move number
|
2014-05-22 22:13:20 +00:00
|
|
|
; HMs start at 51
|
|
|
|
TMToMove: ; 13763 (4:7763)
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wd11e]
|
2014-05-22 22:13:20 +00:00
|
|
|
dec a
|
|
|
|
ld hl, TechnicalMachines
|
|
|
|
ld b, $0
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wd11e], a
|
2014-05-22 22:13:20 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
INCLUDE "data/tms.asm"
|