comparison clojure/com/aurellem/exp/pokemon.clj @ 150:544a97ac3d8a

discovered location of pokemon OT IDs.
author Robert McIntyre <rlm@mit.edu>
date Tue, 20 Mar 2012 00:38:03 -0500
parents 79ffbd639b41
children ced1c4cd1eea
comparison
equal deleted inserted replaced
149:79ffbd639b41 150:544a97ac3d8a
487 ;; PIKACHU stops following if you set it's OT to another name 487 ;; PIKACHU stops following if you set it's OT to another name
488 ;; and then back to you own. 488 ;; and then back to you own.
489 ;; But not if you set it to your own name, obviously. 489 ;; But not if you set it to your own name, obviously.
490 490
491 491
492
493
494 ;; OT ID Numbers.
495 ;; my own id is 05195. A quick search of memory between
496 ;; 0xD162 and 0xD31B revealed the pattern 0x144B exactly
497 ;; six times.
498
499 ;; the locations were:
500
501 (def OT-ID-addresses [0xD176 0xD1A2 0xD1CE 0xD1FA 0xD228 0xD252])
502
503
504 (defn set-pokemon-id
505 ([^SaveState state n new-id]
506 (assert (<= 0 n (dec (party-number state))))
507 (assert (<= 0 new-id 0xFFFF))
508 (set-memory-range
509 state
510 (OT-ID-addresses n)
511 [(bit-and new-id 0xFF00)
512 (bit-and new-id 0xFF)]))
513 ([n new-id]
514 (set-pokemon-id n new-id)))
515