# HG changeset patch # User Dylan Holmes # Date 1333889955 18000 # Node ID 5aabbe326eb09ae8141c214b1bc2d6ffde8e606f # Parent 497ca041f5af8431426498875c1208248d656e50 fixed a few blocks that were not tangling properly. diff -r 497ca041f5af -r 5aabbe326eb0 clojure/com/aurellem/gb/hxc.clj --- a/clojure/com/aurellem/gb/hxc.clj Sun Apr 08 07:55:06 2012 -0500 +++ b/clojure/com/aurellem/gb/hxc.clj Sun Apr 08 07:59:15 2012 -0500 @@ -482,7 +482,22 @@ - +(defn hxc-advantage + ;; in-game multipliers are stored as 10x their effective value + ;; to allow for fractional multipliers like 1/2 + + "The hardcoded type advantages in memory, returned as tuples of + atk-type def-type multiplier. By default (i.e. if not listed here), +the multiplier is 1. List begins at 0x3E62D." + ([] (hxc-advantage com.aurellem.gb.gb-driver/original-rom)) + ([rom] + (map + (fn [[atk def mult]] [(get pkmn-types atk (hex atk)) + (get pkmn-types def (hex def)) + (/ mult 10)]) + (partition 3 + (take-while (partial not= 0xFF) + (drop 0x3E62D rom)))))) @@ -537,6 +552,63 @@ ))) +(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." + ([] (hxc-evolution com.aurellem.gb.gb-driver/original-rom)) + ([rom] + (apply assoc {} + (interleave + (hxc-pokenames rom) + (map + (comp + format-evo + (partial take-while (comp not zero?)) + #(drop % rom)) + (hxc-ptrs-evolve rom) + ))))) + +(defn hxc-evolution-pretty + "Like hxc-evolution, except it uses the names of items and pokemon +--- grabbed from ROM --- rather than their numerical identifiers." + ([] (hxc-evolution-pretty com.aurellem.gb.gb-driver/original-rom)) + ([rom] + (let + [poke-names (vec (hxc-pokenames rom)) + item-names (vec (hxc-items rom)) + use-names + (fn [m] + (loop [ks (keys m) new-map m] + (let [k (first ks)] + (cond (nil? ks) new-map + (= k :into) + (recur + (next ks) + (assoc new-map + :into + (poke-names + (:into + new-map)))) + (= k :item) + (recur + (next ks) + (assoc new-map + :item + (item-names + (:item new-map)))) + :else + (recur + (next ks) + new-map) + ))))] + + (into {} + (map (fn [[pkmn evo-coll]] + [pkmn (map use-names evo-coll)]) + (hxc-evolution rom)))))) + + + (defn hxc-learnsets "Hardcoded map associating pokemon names to lists of pairs [lvl diff -r 497ca041f5af -r 5aabbe326eb0 org/rom.org --- a/org/rom.org Sun Apr 08 07:55:06 2012 -0500 +++ b/org/rom.org Sun Apr 08 07:59:15 2012 -0500 @@ -645,7 +645,7 @@ #+end_src ** Type effectiveness -#+name type-advantage +#+name: type-advantage #+begin_src clojure (defn hxc-advantage ;; in-game multipliers are stored as 10x their effective value @@ -1236,6 +1236,7 @@ <> +<> <> <>