shithub: pokered

ref: b852fe5b421fecd2b75c85bf5da926dd878434c0
dir: /engine/items/tmhm.asm/

View raw version
; checks if the mon in [wWhichPokemon] already knows the move in [wMoveNum]
CheckIfMoveIsKnown: ; 2fe18 (b:7e18)
	ld a, [wWhichPokemon]
	ld hl, wPartyMon1Moves
	ld bc, wPartyMon2 - wPartyMon1
	call AddNTimes
	ld a, [wMoveNum]
	ld b, a
	ld c, NUM_MOVES
.loop
	ld a, [hli]
	cp b
	jr z, .alreadyKnown ; found a match
	dec c
	jr nz, .loop
	and a
	ret
.alreadyKnown
	ld hl, AlreadyKnowsText
	call PrintText
	scf
	ret

AlreadyKnowsText: ; 2fe3b (b:7e3b)
	TX_FAR _AlreadyKnowsText
	db "@"