diff clojure/com/aurellem/gb/hxc.clj @ 281:ca1afcef3542

Replaced manually listed move data in gb.moves with a call to hxc-move-data. Also, began work on hxc-shops, which lists shop inventory. todo: find out how the game converts internal order to pokedex order; todo: get hardcoded tm data.
author Dylan Holmes <ocsenave@gmail.com>
date Tue, 27 Mar 2012 22:41:24 -0500
parents 69184558fcf3
children 0c3fbb313e49
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/hxc.clj	Tue Mar 27 21:08:44 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/hxc.clj	Tue Mar 27 22:41:24 2012 -0500
     1.3 @@ -1,6 +1,6 @@
     1.4  (ns com.aurellem.gb.hxc
     1.5    (:use (com.aurellem.gb assembly characters gb-driver util
     1.6 -                         constants))
     1.7 +                         constants species))
     1.8    (:use (com.aurellem.world practice))
     1.9    (:import [com.aurellem.gb.gb_driver SaveState]))
    1.10  
    1.11 @@ -305,14 +305,17 @@
    1.12    ([rom]
    1.13       (let [names (vec (hxc-move-names rom))
    1.14             move-count (count names)
    1.15 -           move-size 6]
    1.16 +           move-size 6
    1.17 +           types pkmn-types ;;; !! hardcoded types
    1.18 +           ]
    1.19         (zipmap (map format-name names)
    1.20                 (map
    1.21 -                (fn [[idx effect power type accuracy pp]]
    1.22 +                (fn [[idx effect power type-id accuracy pp]]
    1.23                    {:name (names (dec idx))
    1.24                     :power power
    1.25                     :accuracy  accuracy
    1.26                     :pp pp
    1.27 +                   :type (types type-id)
    1.28                     :fx-id effect
    1.29                     :fx-txt (get move-effects effect) 
    1.30                     }
    1.31 @@ -416,6 +419,7 @@
    1.32                               (drop 0x3E62D rom))))))
    1.33  
    1.34  
    1.35 +
    1.36  (defn format-evo
    1.37    [coll]
    1.38    (let [method (first coll)]
    1.39 @@ -650,6 +654,39 @@
    1.40                                (drop 0x383DE
    1.41                                      rom)))))))
    1.42  
    1.43 +(defn hxc-shops
    1.44 +  ([] (hxc-shops com.aurellem.gb.gb-driver/original-rom))
    1.45 +  ([rom]
    1.46 +     (let [items (zipmap (range) (map format-name (hxc-items rom)))
    1.47 +
    1.48 +           ;; temporarily softcode the TM items
    1.49 +           items (into
    1.50 +                  items
    1.51 +                  (map (juxt identity
    1.52 +                             (comp keyword
    1.53 +                                   (partial str "tm-")
    1.54 +                                   (partial + 1 -200)
    1.55 +                                   )) 
    1.56 +                       (take 200 (drop 200 (range)))))
    1.57 +                        
    1.58 +           ]
    1.59 +
    1.60 +       ((fn parse-shop [coll [num-items & items-etc]]
    1.61 +         (let [inventory (take (dec num-items) (rest items-etc))
    1.62 +               [separator & items-etc] (drop num-items (rest items-etc))]
    1.63 +           (if (= separator 0x50)
    1.64 +             (map (partial mapv (comp items dec)) (conj coll inventory))
    1.65 +             (recur (conj coll inventory) items-etc)
    1.66 +             )
    1.67 +         ))
    1.68 +
    1.69 +        '()
    1.70 +        (take 1000 (drop 0x233C rom)))
    1.71 +
    1.72 +     
    1.73 +     )))
    1.74 +
    1.75 +
    1.76  
    1.77  ;; ********************** MANIPULATION FNS
    1.78  
    1.79 @@ -702,6 +739,28 @@
    1.80  
    1.81  
    1.82  
    1.83 +
    1.84 +;; (def dex-order
    1.85 +;;   [:bulbasaur
    1.86 +;;    :ivysaur
    1.87 +;;    :venusaur
    1.88 +;;    :charmander
    1.89 +;;    :charmeleon
    1.90 +;;    :charizard])
    1.91 +  
    1.92 +
    1.93 +;; (defn same-type-attack-bonus?
    1.94 +;;   ([pkmn move]
    1.95 +;;      (same-type-attack-bonus?
    1.96 +;;       com.aurellem.gb.gb-driver/original-rom pkmn move))
    1.97 +;;   ([rom pkmn move]
    1.98 +;;      (hxc-pokemon-base rom)))
    1.99 +
   1.100 +
   1.101 +
   1.102 +
   1.103 +
   1.104 +
   1.105  (comment 
   1.106  
   1.107  (def hxc-later
   1.108 @@ -724,3 +783,6 @@
   1.109  
   1.110  
   1.111  
   1.112 +
   1.113 +
   1.114 +