Advertisement
Fotomac

Evolution Move Code

Jan 5th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. LearnEvolutionMove:
  2. ; load the evolution move table into hl
  3. ld hl, .EvolutionMoveTable
  4. ; load species into b (since we are going to use a to read the move table)
  5. ld a, [wd11e]
  6. ld b, a
  7. .loop
  8. ; load species from the move table (hli means hl will also increase by 1)
  9. ld a, [hli]
  10. ; does it concern the mon we evolved?
  11. cp b
  12. jr z, .got_move
  13. ; It doesn't. See if we reached the end (we have $ff as terminator)
  14. cp $ff
  15. ret z
  16. ; We aren't done yet. Increase hl once more to advance to the next species
  17. ; since the table is species + move (so 2 bytes)
  18. inc hl
  19. jr .loop
  20. .got_move
  21. ; The species we are evolving's evolution move is now what hl points to.
  22. ld a, [hl]
  23. ; Do move learning here
  24. ret
  25. .learnSetLoop ; loop over the learn set until we reach a move that is learnt at the current level or the end of the list
  26. push hl
  27. ld d, a ; ID of move to learn
  28. ld hl, wPartyMon1Moves
  29. ld a, [wWhichPokemon]
  30. ld bc, wPartyMon2 - wPartyMon1
  31. call AddNTimes
  32. ld b, NUM_MOVES
  33. .checkCurrentMovesLoop ; check if the move to learn is already known
  34. ld a, [hli]
  35. cp d
  36. jr z, .hasMove ; if already known, jump
  37. dec b
  38. jr nz, .checkCurrentMovesLoop
  39. ld a, d
  40. ld [wMoveNum], a
  41. ld [wd11e], a
  42. call GetMoveName
  43. call CopyStringToCF4B
  44. predef LearnMove
  45. .hasMove
  46. pop hl
  47. jr .learnSetLoop
  48. .EvolutionMoveTable:
  49. ; just some examples of what you can do
  50. db IVYSAUR, BULLET_SEED
  51. db METAPOD, HARDEN
  52. db BUTTERFREE, CONFUSION
  53. db KAKUNA, HARDEN
  54. db BEEDRILL, FURY_ATTACK
  55. db KADABRA, KINESIS
  56. db VILEPLUME, RAZOR_LEAF
  57. ; terminator
  58. db $ff
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement