comparison clojure/com/aurellem/gb/hxc.clj @ 267:498af3c3cf15

Added hardcoded learnsets.
author Dylan Holmes <ocsenave@gmail.com>
date Mon, 26 Mar 2012 23:18:22 -0500
parents a44a2c459aeb
children 82ee2704c973
comparison
equal deleted inserted replaced
266:c85549460218 267:498af3c3cf15
438 :min-level (nth coll 1) ;; always 1 for trade. 438 :min-level (nth coll 1) ;; always 1 for trade.
439 :into (dec (nth coll 2))})))) 439 :into (dec (nth coll 2))}))))
440 440
441 441
442 (defn hxc-ptrs-evolve 442 (defn hxc-ptrs-evolve
443 "A hardcoded collection of 190 pointers to evolution/learnset data, 443 "A hardcoded collection of 190 pointers to alternating evolution/learnset data,
444 in internal order." 444 in internal order."
445 ([] 445 ([]
446 (hxc-ptrs-evolve com.aurellem.gb.gb-driver/original-rom)) 446 (hxc-ptrs-evolve com.aurellem.gb.gb-driver/original-rom))
447 ([rom] 447 ([rom]
448 (let [names (hxc-pokenames rom) 448 (let [names (hxc-pokenames rom)
454 (drop 0x3b1e5 rom))))] 454 (drop 0x3b1e5 rom))))]
455 (map (partial + 0x34000) ptrs) 455 (map (partial + 0x34000) ptrs)
456 456
457 ))) 457 )))
458 458
459
460 (defn hxc-learnsets
461 "Hardcoded map associating pokemon names to lists of pairs [lvl
462 move] of abilities they learn as they level up. The data
463 exists at ROM@3400, sorted by internal order. Pointers to the data
464 exist at ROM@3B1E5; see also, hxc-ptrs-evolve"
465 ([] (hxc-learnsets com.aurellem.gb.gb-driver/original-rom))
466 ([rom]
467 (apply assoc
468 {}
469 (interleave
470 (map format-name (hxc-pokenames rom))
471 (map (comp
472 (partial map vec)
473 (partial partition 2)
474 ;; keep the learnset data
475 (partial take-while (comp not zero?))
476 ;; skip the evolution data
477 rest
478 (partial drop-while (comp not zero?)))
479 (map #(drop % rom)
480 (hxc-ptrs-evolve rom)))))))
481
482 (defn hxc-learnsets-pretty
483 "Live hxc-learnsets except it reports the name of each move --- as
484 it appears in rom --- rather than the move index."
485 ([] (hxc-learnsets-pretty com.aurellem.gb.gb-driver/original-rom))
486 ([rom]
487 (let [moves (vec(map format-name (hxc-move-names)))]
488 (into {}
489 (map (fn [[pkmn learnset]]
490 [pkmn (map (fn [[lvl mv]] [lvl (moves (dec mv))])
491 learnset)])
492 (hxc-learnsets rom))))))
493
494
495
496
459 (defn hxc-evolution 497 (defn hxc-evolution
460 "Hardcoded evolution data in memory. The data exists at ROM@34000, 498 "Hardcoded evolution data in memory. The data exists at ROM@34000,
461 sorted by internal order. Pointers to the data exist at ROM@3B1E5; see also, hxc-ptrs-evolve." 499 sorted by internal order. Pointers to the data exist at ROM@3B1E5; see also, hxc-ptrs-evolve."
462 ([] (hxc-evolution com.aurellem.gb.gb-driver/original-rom)) 500 ([] (hxc-evolution com.aurellem.gb.gb-driver/original-rom))
463 ([rom] 501 ([rom]
464 (apply assoc {} 502 (apply assoc {}
465 (interleave 503 (interleave
466 (map format-name (hxc-pokenames)) 504 (map format-name (hxc-pokenames rom))
467 (map 505 (map
468 (comp 506 (comp
469 format-evo 507 format-evo
470 (partial take-while (comp not zero?)) 508 (partial take-while (comp not zero?))
471 #(drop % rom)) 509 #(drop % rom))