diff clojure/com/aurellem/gb/hxc.clj @ 294:9f466a332448

merge
author Robert McIntyre <rlm@mit.edu>
date Fri, 30 Mar 2012 18:15:28 -0500
parents c31cb3043087
children 2873f50b7291
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/hxc.clj	Fri Mar 30 18:14:14 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/hxc.clj	Fri Mar 30 18:15:28 2012 -0500
     1.3 @@ -449,8 +449,12 @@
     1.4  
     1.5  
     1.6  (defn hxc-advantage
     1.7 -  "The hardcoded type advantages in memory, returned as tuples of atk-type def-type multiplier. By default (i.e. if not listed here),
     1.8 -the multiplier is 1."
     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 @@ -750,6 +754,52 @@
    1.19  
    1.20  
    1.21  
    1.22 +
    1.23 +
    1.24 +(defn hxc-ptrs-wild
    1.25 +  "A list of the hardcoded wild encounter data in memory. Pointers
    1.26 +  begin at ROM@0CB95; data begins at ROM@0x04D89" 
    1.27 +  ([] (hxc-ptrs-wild com.aurellem.gb.gb-driver/original-rom))
    1.28 +  ([rom]
    1.29 +     (let [ptrs
    1.30 +           (map (fn [[a b]] (+ a (* 0x100 b)))
    1.31 +            (take-while (partial not= (list 0xFF 0xFF))
    1.32 +                            (partition 2 (drop 0xCB95 rom))))]
    1.33 +       ptrs)))
    1.34 +
    1.35 +
    1.36 +
    1.37 +(defn hxc-wilds
    1.38 +  "A list of the hardcoded wild encounter data in memory. Pointers
    1.39 +  begin at ROM@0CB95; data begins at ROM@0x04D89" 
    1.40 +  ([] (hxc-wilds com.aurellem.gb.gb-driver/original-rom))
    1.41 +  ([rom]
    1.42 +     (let [pokenames (zipmap (range) (hxc-pokenames rom))]
    1.43 +       (map
    1.44 +        (partial map (fn [[a b]] {:species (pokenames (dec b)) :level
    1.45 +                                  a}))
    1.46 +        (partition 10
    1.47 +                     
    1.48 +                      (take-while (comp (partial not= 1)
    1.49 +                                        first) 
    1.50 +                                 (partition 2
    1.51 +                                            (drop 0xCD8C rom))
    1.52 +                   
    1.53 +                   ))))))
    1.54 +
    1.55 +
    1.56 +
    1.57 +
    1.58 +
    1.59 +
    1.60 +
    1.61 +
    1.62 +
    1.63 +
    1.64 +
    1.65 +
    1.66 +
    1.67 +
    1.68  ;; ********************** MANIPULATION FNS
    1.69  
    1.70