Mercurial > vba-clojure
diff 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 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/hxc.clj Mon Mar 26 23:04:12 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/hxc.clj Mon Mar 26 23:18:22 2012 -0500 1.3 @@ -440,7 +440,7 @@ 1.4 1.5 1.6 (defn hxc-ptrs-evolve 1.7 - "A hardcoded collection of 190 pointers to evolution/learnset data, 1.8 + "A hardcoded collection of 190 pointers to alternating evolution/learnset data, 1.9 in internal order." 1.10 ([] 1.11 (hxc-ptrs-evolve com.aurellem.gb.gb-driver/original-rom)) 1.12 @@ -456,6 +456,44 @@ 1.13 1.14 ))) 1.15 1.16 + 1.17 +(defn hxc-learnsets 1.18 + "Hardcoded map associating pokemon names to lists of pairs [lvl 1.19 + move] of abilities they learn as they level up. The data 1.20 +exists at ROM@3400, sorted by internal order. Pointers to the data 1.21 + exist at ROM@3B1E5; see also, hxc-ptrs-evolve" 1.22 + ([] (hxc-learnsets com.aurellem.gb.gb-driver/original-rom)) 1.23 + ([rom] 1.24 + (apply assoc 1.25 + {} 1.26 + (interleave 1.27 + (map format-name (hxc-pokenames rom)) 1.28 + (map (comp 1.29 + (partial map vec) 1.30 + (partial partition 2) 1.31 + ;; keep the learnset data 1.32 + (partial take-while (comp not zero?)) 1.33 + ;; skip the evolution data 1.34 + rest 1.35 + (partial drop-while (comp not zero?))) 1.36 + (map #(drop % rom) 1.37 + (hxc-ptrs-evolve rom))))))) 1.38 + 1.39 +(defn hxc-learnsets-pretty 1.40 + "Live hxc-learnsets except it reports the name of each move --- as 1.41 +it appears in rom --- rather than the move index." 1.42 + ([] (hxc-learnsets-pretty com.aurellem.gb.gb-driver/original-rom)) 1.43 + ([rom] 1.44 + (let [moves (vec(map format-name (hxc-move-names)))] 1.45 + (into {} 1.46 + (map (fn [[pkmn learnset]] 1.47 + [pkmn (map (fn [[lvl mv]] [lvl (moves (dec mv))]) 1.48 + learnset)]) 1.49 + (hxc-learnsets rom)))))) 1.50 + 1.51 + 1.52 + 1.53 + 1.54 (defn hxc-evolution 1.55 "Hardcoded evolution data in memory. The data exists at ROM@34000, 1.56 sorted by internal order. Pointers to the data exist at ROM@3B1E5; see also, hxc-ptrs-evolve." 1.57 @@ -463,7 +501,7 @@ 1.58 ([rom] 1.59 (apply assoc {} 1.60 (interleave 1.61 - (map format-name (hxc-pokenames)) 1.62 + (map format-name (hxc-pokenames rom)) 1.63 (map 1.64 (comp 1.65 format-evo