mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
Groundwork for Tradeback Move Tutor
Currently the move tutor is a little bit broken - the IDs are 1 above how they should be. Shell speculates that it's searching at the table starting from Kangaskhan due to the way the decrements shake up but it may just be making things more complicated than they are. Big cheese code is `PrepareTradebackMoveList`, it's where things are mucking up. Also, the code can be significantly optimised, as it's currently being adapted from the function above, `PrepareRelearnableMoveList`; It doesn't need to check levels, for example. Note that the relearner functions properly, so use it as a reference. I may have removed something important. Technically, we could have NO_MON as an entry which may make things shake out properly. But I'd rather have a proper fix.
This commit is contained in:
parent
5e21c159f9
commit
2f01628cd9
24 changed files with 1657 additions and 97 deletions
|
|
@ -22,8 +22,8 @@ SetIshiharaTeam:
|
|||
|
||||
IshiharaTeam:
|
||||
db EXEGGUTOR_A, 90
|
||||
db PINSIR, 90
|
||||
db CARAPTHOR, 90
|
||||
db RHYDON, 90
|
||||
db KANGASKHAN, 90
|
||||
db KASANAGI, 50
|
||||
IF DEF(_DEBUG)
|
||||
db KOKANA, 50
|
||||
|
|
|
|||
|
|
@ -702,4 +702,109 @@ PrepareRelearnableMoveList:: ; I don't know how the fuck you're a single colon i
|
|||
ld [hl], c
|
||||
ret
|
||||
|
||||
; Modified Mateo/jojobear13 code for a Tradeback Move Tutor
|
||||
PrepareTradebackMoveList:: ; I still don't know how the fuck you're a single colon in shin pokered but it sure as shit doesn't work here - PvK
|
||||
; Loads Tradeback move list to wRelearnableMoves - we can reuse this variable.
|
||||
; Input: party mon index = [wWhichPokemon]
|
||||
; Get mon id.
|
||||
ld a, [wWhichPokemon]
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, wPartySpecies
|
||||
add hl, bc
|
||||
ld a, [hl] ; a = mon id
|
||||
ld [wd0b5], a ;joenote - put mon id into wram for potential later usage of GetMonHeader
|
||||
; Get pointer to evos moves data.
|
||||
dec a
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, TradebackMovesPointerTable
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a ; hl = pointer to evos moves data for our mon
|
||||
push hl
|
||||
; Get pointer to mon's currently-known moves.
|
||||
ld a, [wWhichPokemon]
|
||||
ld hl, wPartyMon1Level
|
||||
ld bc, wPartyMon2 - wPartyMon1
|
||||
call AddNTimes
|
||||
ld a, [hl]
|
||||
ld b, a
|
||||
push bc
|
||||
ld a, [wWhichPokemon]
|
||||
ld hl, wPartyMon1Moves
|
||||
ld bc, wPartyMon2 - wPartyMon1
|
||||
call AddNTimes
|
||||
pop bc
|
||||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
; Skip over evolution data.
|
||||
.skipEvoEntriesLoop
|
||||
ld a, [hli]
|
||||
and a
|
||||
jr nz, .skipEvoEntriesLoop
|
||||
; Write list of relearnable moves, while keeping count along the way.
|
||||
; de = pointer to mon's currently-known moves
|
||||
; hl = pointer to moves data for our mon
|
||||
; b = mon's level
|
||||
ld c, 0 ; c = count of relearnable moves
|
||||
.loop
|
||||
ld a, [hli]
|
||||
and a
|
||||
jr z, .done
|
||||
cp b
|
||||
jr c, .addMove
|
||||
jr nz, .done
|
||||
.addMove
|
||||
push bc
|
||||
ld a, [hli] ; move id
|
||||
ld b, a
|
||||
; Check if move is already known by our mon.
|
||||
push de
|
||||
ld a, [de]
|
||||
cp b
|
||||
jr z, .knowsMove
|
||||
inc de
|
||||
ld a, [de]
|
||||
cp b
|
||||
jr z, .knowsMove
|
||||
inc de
|
||||
ld a, [de]
|
||||
cp b
|
||||
jr z, .knowsMove
|
||||
inc de
|
||||
ld a, [de]
|
||||
cp b
|
||||
jr z, .knowsMove
|
||||
.tradebackMove
|
||||
pop de
|
||||
push hl
|
||||
; Add move to the list, and update the running count.
|
||||
ld a, b
|
||||
ld b, 0
|
||||
ld hl, wMoveBuffer + 1
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
pop hl
|
||||
pop bc
|
||||
inc c
|
||||
jr .loop
|
||||
.knowsMove
|
||||
pop de
|
||||
pop bc
|
||||
jr .loop
|
||||
.done
|
||||
ld b, 0
|
||||
ld hl, wMoveBuffer + 1
|
||||
add hl, bc
|
||||
ld a, $ff
|
||||
ld [hl], a
|
||||
ld hl, wMoveBuffer
|
||||
ld [hl], c
|
||||
ret
|
||||
|
||||
INCLUDE "data/pokemon/evos_moves.asm"
|
||||
INCLUDE "data/pokemon/tradeback_moves.asm"
|
||||
Loading…
Add table
Add a link
Reference in a new issue