changeset 370:5aabbe326eb0

fixed a few blocks that were not tangling properly.
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 08 Apr 2012 07:59:15 -0500
parents 497ca041f5af
children b477970d0b7a
files clojure/com/aurellem/gb/hxc.clj org/rom.org
diffstat 2 files changed, 75 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/hxc.clj	Sun Apr 08 07:55:06 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/hxc.clj	Sun Apr 08 07:59:15 2012 -0500
     1.3 @@ -482,7 +482,22 @@
     1.4  
     1.5  
     1.6  
     1.7 -
     1.8 +(defn hxc-advantage
     1.9 +  ;; in-game multipliers are stored as 10x their effective value
    1.10 +  ;; to allow for fractional multipliers like 1/2
    1.11 +  
    1.12 +  "The hardcoded type advantages in memory, returned as tuples of
    1.13 +  atk-type def-type multiplier. By default (i.e. if not listed here),
    1.14 +the multiplier is 1. List begins at 0x3E62D."
    1.15 +  ([] (hxc-advantage com.aurellem.gb.gb-driver/original-rom))
    1.16 +  ([rom]
    1.17 +     (map
    1.18 +      (fn [[atk def mult]] [(get pkmn-types atk (hex atk))
    1.19 +                            (get pkmn-types def (hex def))
    1.20 +                            (/ mult 10)])
    1.21 +      (partition 3
    1.22 +                 (take-while (partial not= 0xFF)
    1.23 +                             (drop 0x3E62D rom))))))
    1.24  
    1.25  
    1.26  
    1.27 @@ -537,6 +552,63 @@
    1.28  
    1.29         )))
    1.30  
    1.31 +(defn hxc-evolution
    1.32 +  "Hardcoded evolution data in memory. The data exists at ROM@34000,
    1.33 +  sorted by internal order. Pointers to the data exist at ROM@3B1E5; see also, hxc-ptrs-evolve."
    1.34 +  ([] (hxc-evolution com.aurellem.gb.gb-driver/original-rom))
    1.35 +  ([rom]
    1.36 +       (apply assoc {}
    1.37 +               (interleave
    1.38 +                (hxc-pokenames rom)
    1.39 +                (map
    1.40 +                 (comp
    1.41 +                  format-evo
    1.42 +                  (partial take-while (comp not zero?))
    1.43 +                  #(drop % rom))
    1.44 +                 (hxc-ptrs-evolve rom)
    1.45 +                 )))))
    1.46 +
    1.47 +(defn hxc-evolution-pretty
    1.48 +  "Like hxc-evolution, except it uses the names of items and pokemon
    1.49 +--- grabbed from ROM --- rather than their numerical identifiers."
    1.50 +  ([] (hxc-evolution-pretty com.aurellem.gb.gb-driver/original-rom))
    1.51 +  ([rom]
    1.52 +     (let
    1.53 +         [poke-names (vec (hxc-pokenames rom))
    1.54 +          item-names (vec (hxc-items rom))
    1.55 +          use-names
    1.56 +          (fn [m]
    1.57 +            (loop [ks (keys m) new-map m]
    1.58 +              (let [k (first ks)]
    1.59 +                (cond (nil? ks) new-map
    1.60 +                      (= k :into)
    1.61 +                      (recur
    1.62 +                       (next ks)
    1.63 +                       (assoc new-map
    1.64 +                         :into
    1.65 +                         (poke-names
    1.66 +                          (:into
    1.67 +                           new-map))))
    1.68 +                      (= k :item)
    1.69 +                      (recur
    1.70 +                       (next ks)
    1.71 +                       (assoc new-map
    1.72 +                         :item
    1.73 +                         (item-names
    1.74 +                          (:item new-map))))
    1.75 +                      :else
    1.76 +                      (recur
    1.77 +                       (next ks)
    1.78 +                       new-map)
    1.79 +                      ))))]
    1.80 +
    1.81 +       (into {}
    1.82 +             (map (fn [[pkmn evo-coll]]
    1.83 +                    [pkmn (map use-names evo-coll)])
    1.84 +                  (hxc-evolution rom))))))
    1.85 +
    1.86 +
    1.87 +
    1.88  
    1.89  (defn hxc-learnsets
    1.90    "Hardcoded map associating pokemon names to lists of pairs [lvl
     2.1 --- a/org/rom.org	Sun Apr 08 07:55:06 2012 -0500
     2.2 +++ b/org/rom.org	Sun Apr 08 07:59:15 2012 -0500
     2.3 @@ -645,7 +645,7 @@
     2.4  #+end_src
     2.5  
     2.6  ** Type effectiveness
     2.7 -#+name type-advantage
     2.8 +#+name: type-advantage
     2.9  #+begin_src clojure
    2.10  (defn hxc-advantage
    2.11    ;; in-game multipliers are stored as 10x their effective value
    2.12 @@ -1236,6 +1236,7 @@
    2.13  
    2.14  
    2.15  <<evolution-header>>
    2.16 +<<evolution>>
    2.17  <<learnsets>>
    2.18  <<pokebase>>
    2.19