changeset 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 d5e5c73af7e6
children 0c3fbb313e49
files clojure/com/aurellem/gb/hxc.clj clojure/com/aurellem/gb/moves.clj
diffstat 2 files changed, 85 insertions(+), 348 deletions(-) [+]
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 +
     2.1 --- a/clojure/com/aurellem/gb/moves.clj	Tue Mar 27 21:08:44 2012 -0500
     2.2 +++ b/clojure/com/aurellem/gb/moves.clj	Tue Mar 27 22:41:24 2012 -0500
     2.3 @@ -1,179 +1,27 @@
     2.4  (ns com.aurellem.gb.moves
     2.5 -  (:use (com.aurellem.gb gb-driver util constants))
     2.6 +  (:use (com.aurellem.gb gb-driver util constants hxc))
     2.7    (:import [com.aurellem.gb.gb_driver SaveState]))
     2.8  
     2.9 -(def move-code->move-name
    2.10 -  {
    2.11 -   0x00   :end-of-moves
    2.12 -   0x01   :pound
    2.13 -   0x02   :karate-chop
    2.14 -   0x03   :doubleslap
    2.15 -   0x04   :comet-punch
    2.16 -   0x05   :mega-punch
    2.17 -   0x06   :pay-day
    2.18 -   0x07   :fire-punch
    2.19 -   0x08   :ice-punch
    2.20 -   0x09   :thunderpunch
    2.21 -   0x0A   :scratch
    2.22 -   0x0B   :vicegrip
    2.23 -   0x0C   :guillotine
    2.24 -   0x0D   :razor-wind
    2.25 -   0x0E   :swords-dance
    2.26 -   0x0F   :cut
    2.27 -   0x10   :gust
    2.28 -   0x11   :wing-attack
    2.29 -   0x12   :whirlwind
    2.30 -   0x13   :fly
    2.31 -   0x14   :bind
    2.32 -   0x15   :slam
    2.33 -   0x16   :vine-whip
    2.34 -   0x17   :stomp
    2.35 -   0x18   :double-kick
    2.36 -   0x19   :mega-kick
    2.37 -   0x1A   :jump-kick
    2.38 -   0x1B   :rolling-kick
    2.39 -   0x1C   :sand-attack
    2.40 -   0x1D   :headbutt
    2.41 -   0x1E   :horn-attack
    2.42 -   0x1F   :fury-attack
    2.43 -   0x20   :horn-drill
    2.44 -   0x21   :tackle
    2.45 -   0x22   :body-slam
    2.46 -   0x23   :wrap
    2.47 -   0x24   :take-down
    2.48 -   0x25   :thrash
    2.49 -   0x26   :double-edge
    2.50 -   0x27   :tail-whip
    2.51 -   0x28   :poison-sting
    2.52 -   0x29   :twinneedle
    2.53 -   0x2A   :pin-missle
    2.54 -   0x2B   :leer
    2.55 -   0x2C   :bite
    2.56 -   0x2D   :growl
    2.57 -   0x2E   :roar
    2.58 -   0x2F   :sing
    2.59 -   0x30   :supersonic
    2.60 -   0x31   :sonicboom
    2.61 -   0x32   :disable
    2.62 -   0x33   :acid
    2.63 -   0x34   :ember
    2.64 -   0x35   :flamethrower
    2.65 -   0x36   :mist
    2.66 -   0x37   :water-gun
    2.67 -   0x38   :hydro-pump
    2.68 -   0x39   :surf
    2.69 -   0x3A   :ice-beam
    2.70 -   0x3B   :blizzard
    2.71 -   0x3C   :psybeam
    2.72 -   0x3D   :bubblebeam
    2.73 -   0x3E   :aurora-beam
    2.74 -   0x3F   :hyper-beam
    2.75 -   0x40   :peck
    2.76 -   0x41   :drill-peck
    2.77 -   0x42   :submission
    2.78 -   0x43   :low-kick
    2.79 -   0x44   :counter
    2.80 -   0x45   :seismic-toss
    2.81 -   0x46   :strength
    2.82 -   0x47   :absorb
    2.83 -   0x48   :mega-drain
    2.84 -   0x49   :leech-seed
    2.85 -   0x4A   :growth
    2.86 -   0x4B   :razor-leaf
    2.87 -   0x4C   :solarbeam
    2.88 -   0x4D   :poisonpowder
    2.89 -   0x4E   :stun-spore
    2.90 -   0x4F   :sleep-powder
    2.91 -   0x50   :petal-dance
    2.92 -   0x51   :string-shot
    2.93 -   0x52   :dragon-rage
    2.94 -   0x53   :fire-spin
    2.95 -   0x54   :thundershock
    2.96 -   0x55   :thunderbolt
    2.97 -   0x56   :thunder-wave
    2.98 -   0x57   :thunder
    2.99 -   0x58   :rock-throw
   2.100 -   0x59   :earthquake
   2.101 -   0x5A   :fissure
   2.102 -   0x5B   :dig
   2.103 -   0x5C   :toxic
   2.104 -   0x5D   :confusion
   2.105 -   0x5E   :psychic
   2.106 -   0x5F   :hypnosis
   2.107 -   0x60   :meditate
   2.108 -   0x61   :agility
   2.109 -   0x62   :quick-attack
   2.110 -   0x63   :rage
   2.111 -   0x64   :teleport
   2.112 -   0x65   :night-shade
   2.113 -   0x66   :mimic
   2.114 -   0x67   :screech
   2.115 -   0x68   :double-team
   2.116 -   0x69   :recover
   2.117 -   0x6A   :harden
   2.118 -   0x6B   :minimize
   2.119 -   0x6C   :smokescreen
   2.120 -   0x6D   :confuse-ray
   2.121 -   0x6E   :withdraw
   2.122 -   0x6F   :defense-curl
   2.123 -   0x70   :barrier
   2.124 -   0x71   :light-screen
   2.125 -   0x72   :haze
   2.126 -   0x73   :reflect
   2.127 -   0x74   :focus-energy
   2.128 -   0x75   :bide
   2.129 -   0x76   :metronome
   2.130 -   0x77   :mirror-move
   2.131 -   0x78   :selfdestruct
   2.132 -   0x79   :egg-bomb
   2.133 -   0x7A   :lick
   2.134 -   0x7B   :smog
   2.135 -   0x7C   :sludge
   2.136 -   0x7D   :bone-club
   2.137 -   0x7E   :fire-blast
   2.138 -   0x7F   :waterfall
   2.139 -   0x80   :clamp
   2.140 -   0x81   :swift
   2.141 -   0x82   :skull-bash
   2.142 -   0x83   :spike-cannon
   2.143 -   0x84   :constrict
   2.144 -   0x85   :amnesia
   2.145 -   0x86   :kinesis
   2.146 -   0x87   :softboiled
   2.147 -   0x88   :hi-jump-kick
   2.148 -   0x89   :glare
   2.149 -   0x8A   :dream-eater
   2.150 -   0x8B   :poison-gas
   2.151 -   0x8C   :barrage
   2.152 -   0x8D   :leech-life
   2.153 -   0x8E   :lovely-kiss
   2.154 -   0x8F   :sky-attack
   2.155 -   0x90   :transform
   2.156 -   0x91   :bubble
   2.157 -   0x92   :dizzy-punch
   2.158 -   0x93   :spore
   2.159 -   0x94   :flash
   2.160 -   0x95   :psywave
   2.161 -   0x96   :splash
   2.162 -   0x97   :acid-armor
   2.163 -   0x98   :crabhammer
   2.164 -   0x99   :explosion
   2.165 -   0x9A   :fury-swipes
   2.166 -   0x9B   :bonemerang
   2.167 -   0x9C   :rest
   2.168 -   0x9D   :rock-slide
   2.169 -   0x9E   :hyper-fang
   2.170 -   0x9F   :sharpen
   2.171 -   0xA0   :conversion
   2.172 -   0xA1   :tri-attack
   2.173 -   0xA2   :super-fang
   2.174 -   0xA3   :slash
   2.175 -   0xA4   :substitute
   2.176 -   0xA5   :struggle       })
   2.177  
   2.178 -(def move-name->move-code
   2.179 -  (zipmap (vals move-code->move-name)
   2.180 -          (keys move-code->move-name)))
   2.181 +;;; grab the move data directly from the rom
   2.182 +(def move-code->move-name ;; alternate name: moves
   2.183 +  ((comp vec cons)
   2.184 +   :end-of-moves
   2.185 +   (map format-name (hxc-move-names)))))
   2.186 +
   2.187 +(def move-name->move-code ;; alternate name: move-id
   2.188 +  (zipmap
   2.189 +   move-names
   2.190 +   (range)))
   2.191 +
   2.192 +(def move-name->move-pp
   2.193 +  (comp :pp (hxc-move-data)))
   2.194 +
   2.195 +(defn max-pp [name pp-ups]
   2.196 +  (if (= 40 (move-name->move-pp name))
   2.197 +    (+ 40 (* 7 pp-ups))
   2.198 +    (int (* (+ 1 (* (/ 1 5) pp-ups))
   2.199 +            (move-name->move-pp name)))))
   2.200  
   2.201  (def moves-codes-pokemon-1 0xD172)
   2.202  
   2.203 @@ -284,176 +132,3 @@
   2.204       (give-moves-pps @current-state poke-num moves-pps)))
   2.205             
   2.206  
   2.207 -(def move-name->move-pp
   2.208 -  {
   2.209 -   :absorb        20
   2.210 -   :acid          30
   2.211 -   :acid-armor    40 ;; WTF happens with 3 PP-UPs??! (answer: 61PP!)
   2.212 -   :agility       30
   2.213 -   :amnesia       20
   2.214 -   :aurora-beam   20
   2.215 -   :barrage       20
   2.216 -   :barrier       30
   2.217 -   :bide          10
   2.218 -   :bind          20
   2.219 -   :bite          25
   2.220 -   :blizzard       5 
   2.221 -   :body-slam     15
   2.222 -   :bone-club     20
   2.223 -   :bonemerang    10
   2.224 -   :bubble        30
   2.225 -   :bubblebeam    20
   2.226 -   :clamp         10
   2.227 -   :comet-punch   15
   2.228 -   :confuse-ray   10
   2.229 -   :confusion     25
   2.230 -   :constrict     35
   2.231 -   :conversion    30
   2.232 -   :counter       20
   2.233 -   :crabhammer    10
   2.234 -   :cut           30
   2.235 -   :defense-curl  40
   2.236 -   :dig           10
   2.237 -   :disable       20
   2.238 -   :dizzy-punch   10
   2.239 -   :double-edge   15
   2.240 -   :double-kick   30
   2.241 -   :double-team   10
   2.242 -   :doubleslap    15
   2.243 -   :dragon-rage   10
   2.244 -   :dream-eater   15
   2.245 -   :drill-peck    20
   2.246 -   :earthquake    10
   2.247 -   :egg-bomb      10
   2.248 -   :ember         25
   2.249 -   :explosion      5
   2.250 -   :fire-blast     5
   2.251 -   :fire-punch    15
   2.252 -   :fire-spin     15
   2.253 -   :fissure        5
   2.254 -   :flamethrower  15
   2.255 -   :flash         20
   2.256 -   :fly           15
   2.257 -   :focus-energy  30
   2.258 -   :fury-attack   20
   2.259 -   :fury-swipes   15
   2.260 -   :glare         30
   2.261 -   :growl         40
   2.262 -   :growth        40
   2.263 -   :guillotine     5
   2.264 -   :gust          35
   2.265 -   :harden        30
   2.266 -   :haze          30
   2.267 -   :headbutt      15
   2.268 -   :hi-jump-kick  20
   2.269 -   :horn-attack   25
   2.270 -   :horn-drill     5
   2.271 -   :hydro-pump     5
   2.272 -   :hyper-beam     5
   2.273 -   :hyper-fang    15
   2.274 -   :hypnosis      20
   2.275 -   :ice-beam      10
   2.276 -   :ice-punch     15
   2.277 -   :jump-kick     25
   2.278 -   :karate-chop   25
   2.279 -   :kinesis       15
   2.280 -   :leech-life    15
   2.281 -   :leech-seed    10
   2.282 -   :leer          30
   2.283 -   :lick          30
   2.284 -   :light-screen  30
   2.285 -   :lovely-kiss   10
   2.286 -   :low-kick      20
   2.287 -   :meditate      40
   2.288 -   :mega-drain    10
   2.289 -   :mega-kick      5
   2.290 -   :mega-punch    20
   2.291 -   :metronome     10
   2.292 -   :mimic         10
   2.293 -   :minimize      20
   2.294 -   :mirror-move   20
   2.295 -   :mist          30
   2.296 -   :night-shade   15
   2.297 -   :pay-day       20
   2.298 -   :peck          35
   2.299 -   :petal-dance   20
   2.300 -   :pin-missle    20
   2.301 -   :poison-gas    40
   2.302 -   :poison-sting  35
   2.303 -   :poisonpowder  35
   2.304 -   :pound         35
   2.305 -   :psybeam       20
   2.306 -   :psychic       10
   2.307 -   :psywave       15
   2.308 -   :quick-attack  30
   2.309 -   :rage          20
   2.310 -   :razor-leaf    25
   2.311 -   :razor-wind    10
   2.312 -   :recover       20
   2.313 -   :reflect       20
   2.314 -   :rest          10
   2.315 -   :roar          20
   2.316 -   :rock-slide    10
   2.317 -   :rock-throw    15
   2.318 -   :rolling-kick  15
   2.319 -   :sand-attack   15
   2.320 -   :scratch       35
   2.321 -   :screech       40
   2.322 -   :seismic-toss  20
   2.323 -   :selfdestruct   5
   2.324 -   :sharpen       30
   2.325 -   :sing          15
   2.326 -   :skull-bash    15
   2.327 -   :sky-attack     5
   2.328 -   :slam          20
   2.329 -   :slash         20
   2.330 -   :sleep-powder  15
   2.331 -   :sludge        20
   2.332 -   :smog          20
   2.333 -   :smokescreen   20
   2.334 -   :softboiled    10
   2.335 -   :solarbeam     10
   2.336 -   :sonicboom     20
   2.337 -   :spike-cannon  15
   2.338 -   :splash        40
   2.339 -   :spore         15
   2.340 -   :stomp         20
   2.341 -   :strength      15
   2.342 -   :string-shot   40
   2.343 -   :struggle       1
   2.344 -   :stun-spore    30
   2.345 -   :submission    25
   2.346 -   :substitute    10
   2.347 -   :super-fang    10
   2.348 -   :supersonic    20
   2.349 -   :surf          15
   2.350 -   :swift         20
   2.351 -   :swords-dance  30
   2.352 -   :tackle        35
   2.353 -   :tail-whip     30
   2.354 -   :take-down     20
   2.355 -   :teleport      20
   2.356 -   :thrash        20
   2.357 -   :thunder       10
   2.358 -   :thunder-wave  20
   2.359 -   :thunderbolt   15
   2.360 -   :thunderpunch  15
   2.361 -   :thundershock  30
   2.362 -   :toxic         10
   2.363 -   :transform     10
   2.364 -   :tri-attack    10
   2.365 -   :twinneedle    20
   2.366 -   :vicegrip      30
   2.367 -   :vine-whip     10
   2.368 -   :water-gun     25
   2.369 -   :waterfall     15
   2.370 -   :whirlwind     20
   2.371 -   :wing-attack   35
   2.372 -   :withdraw      40
   2.373 -   :wrap          20})
   2.374 -
   2.375 -(defn max-pp [name pp-ups]
   2.376 -  (if (= 40 (move-name->move-pp name))
   2.377 -    (+ 40 (* 7 pp-ups))
   2.378 -    (int (* (+ 1 (* (/ 1 5) pp-ups))
   2.379 -            (move-name->move-pp name)))))
   2.380 \ No newline at end of file