# HG changeset patch # User Dylan Holmes # Date 1332821902 18000 # Node ID 498af3c3cf152432f89a0e31bc74f44866c0db1e # Parent c855494602184a6826d8e674882ec6b77f74898f Added hardcoded learnsets. diff -r c85549460218 -r 498af3c3cf15 clojure/com/aurellem/gb/hxc.clj --- a/clojure/com/aurellem/gb/hxc.clj Mon Mar 26 23:04:12 2012 -0500 +++ b/clojure/com/aurellem/gb/hxc.clj Mon Mar 26 23:18:22 2012 -0500 @@ -440,7 +440,7 @@ (defn hxc-ptrs-evolve - "A hardcoded collection of 190 pointers to evolution/learnset data, + "A hardcoded collection of 190 pointers to alternating evolution/learnset data, in internal order." ([] (hxc-ptrs-evolve com.aurellem.gb.gb-driver/original-rom)) @@ -456,6 +456,44 @@ ))) + +(defn hxc-learnsets + "Hardcoded map associating pokemon names to lists of pairs [lvl + move] of abilities they learn as they level up. The data +exists at ROM@3400, sorted by internal order. Pointers to the data + exist at ROM@3B1E5; see also, hxc-ptrs-evolve" + ([] (hxc-learnsets com.aurellem.gb.gb-driver/original-rom)) + ([rom] + (apply assoc + {} + (interleave + (map format-name (hxc-pokenames rom)) + (map (comp + (partial map vec) + (partial partition 2) + ;; keep the learnset data + (partial take-while (comp not zero?)) + ;; skip the evolution data + rest + (partial drop-while (comp not zero?))) + (map #(drop % rom) + (hxc-ptrs-evolve rom))))))) + +(defn hxc-learnsets-pretty + "Live hxc-learnsets except it reports the name of each move --- as +it appears in rom --- rather than the move index." + ([] (hxc-learnsets-pretty com.aurellem.gb.gb-driver/original-rom)) + ([rom] + (let [moves (vec(map format-name (hxc-move-names)))] + (into {} + (map (fn [[pkmn learnset]] + [pkmn (map (fn [[lvl mv]] [lvl (moves (dec mv))]) + learnset)]) + (hxc-learnsets rom)))))) + + + + (defn hxc-evolution "Hardcoded evolution data in memory. The data exists at ROM@34000, sorted by internal order. Pointers to the data exist at ROM@3B1E5; see also, hxc-ptrs-evolve." @@ -463,7 +501,7 @@ ([rom] (apply assoc {} (interleave - (map format-name (hxc-pokenames)) + (map format-name (hxc-pokenames rom)) (map (comp format-evo