Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LearnEvolutionMove:
- ; load the evolution move table into hl
- ld hl, .EvolutionMoveTable
- ; load species into b (since we are going to use a to read the move table)
- ld a, [wd11e]
- ld b, a
- .loop
- ; load species from the move table (hli means hl will also increase by 1)
- ld a, [hli]
- ; does it concern the mon we evolved?
- cp b
- jr z, .got_move
- ; It doesn't. See if we reached the end (we have $ff as terminator)
- cp $ff
- ret z
- ; We aren't done yet. Increase hl once more to advance to the next species
- ; since the table is species + move (so 2 bytes)
- inc hl
- jr .loop
- .got_move
- ; The species we are evolving's evolution move is now what hl points to.
- ld a, [hl]
- ; Do move learning here
- ret
- .learnSetLoop ; loop over the learn set until we reach a move that is learnt at the current level or the end of the list
- push hl
- ld d, a ; ID of move to learn
- ld hl, wPartyMon1Moves
- ld a, [wWhichPokemon]
- ld bc, wPartyMon2 - wPartyMon1
- call AddNTimes
- ld b, NUM_MOVES
- .checkCurrentMovesLoop ; check if the move to learn is already known
- ld a, [hli]
- cp d
- jr z, .hasMove ; if already known, jump
- dec b
- jr nz, .checkCurrentMovesLoop
- ld a, d
- ld [wMoveNum], a
- ld [wd11e], a
- call GetMoveName
- call CopyStringToCF4B
- predef LearnMove
- .hasMove
- pop hl
- jr .learnSetLoop
- .EvolutionMoveTable:
- ; just some examples of what you can do
- db IVYSAUR, BULLET_SEED
- db METAPOD, HARDEN
- db BUTTERFREE, CONFUSION
- db KAKUNA, HARDEN
- db BEEDRILL, FURY_ATTACK
- db KADABRA, KINESIS
- db VILEPLUME, RAZOR_LEAF
- ; terminator
- db $ff
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement