comparison clojure/com/aurellem/exp/pokemon.clj @ 167:bfd06de5a934

made facilities for printing pokemon info.
author Robert McIntyre <rlm@mit.edu>
date Tue, 20 Mar 2012 19:17:14 -0500
parents 76b031d2f586
children 04dfda91db9c
comparison
equal deleted inserted replaced
166:76b031d2f586 167:bfd06de5a934
617 (let [base (+ (* pokemon-num pokemon-record-width) 0xD16A)] 617 (let [base (+ (* pokemon-num pokemon-record-width) 0xD16A)]
618 (set-memory-range state base new-data))) 618 (set-memory-range state base new-data)))
619 ([pokemon-num new-data] 619 ([pokemon-num new-data]
620 (set-pokemon-data @current-state pokemon-num new-data))) 620 (set-pokemon-data @current-state pokemon-num new-data)))
621 621
622 (defn print-pokemon-data [^SaveState save pokemon-num]) 622 (defn print-pokemon-data
623 ([^SaveState state pokemon-num]
624 (assert (<= 0 pokemon-num 5))
625 (let [poke-data (pokemon-data state pokemon-num)
626 backbone (sort (keys pokemon-1-info))]
627 (println "Pokemon " pokemon-num
628 "------------------------")
629 (dorun
630 (map
631 (comp println
632 (fn [desc data]
633 (format "%-16s : 0x%02X" desc data)))
634
635 (map pokemon-1-info backbone)
636 poke-data))))
637 ([pokemon-num]
638 (print-pokemon-data @current-state pokemon-num)))
639
623 640
624 641
625 (defn pre-battle [] (read-state "prepare-for-battle")) 642 (defn pre-battle [] (read-state "prepare-for-battle"))
643