diff clojure/com/aurellem/gb/moves.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 0587f266a735
children df9cad9909d2
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/moves.clj	Tue Mar 27 21:08:44 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/moves.clj	Tue Mar 27 22:41:24 2012 -0500
     1.3 @@ -1,179 +1,27 @@
     1.4  (ns com.aurellem.gb.moves
     1.5 -  (:use (com.aurellem.gb gb-driver util constants))
     1.6 +  (:use (com.aurellem.gb gb-driver util constants hxc))
     1.7    (:import [com.aurellem.gb.gb_driver SaveState]))
     1.8  
     1.9 -(def move-code->move-name
    1.10 -  {
    1.11 -   0x00   :end-of-moves
    1.12 -   0x01   :pound
    1.13 -   0x02   :karate-chop
    1.14 -   0x03   :doubleslap
    1.15 -   0x04   :comet-punch
    1.16 -   0x05   :mega-punch
    1.17 -   0x06   :pay-day
    1.18 -   0x07   :fire-punch
    1.19 -   0x08   :ice-punch
    1.20 -   0x09   :thunderpunch
    1.21 -   0x0A   :scratch
    1.22 -   0x0B   :vicegrip
    1.23 -   0x0C   :guillotine
    1.24 -   0x0D   :razor-wind
    1.25 -   0x0E   :swords-dance
    1.26 -   0x0F   :cut
    1.27 -   0x10   :gust
    1.28 -   0x11   :wing-attack
    1.29 -   0x12   :whirlwind
    1.30 -   0x13   :fly
    1.31 -   0x14   :bind
    1.32 -   0x15   :slam
    1.33 -   0x16   :vine-whip
    1.34 -   0x17   :stomp
    1.35 -   0x18   :double-kick
    1.36 -   0x19   :mega-kick
    1.37 -   0x1A   :jump-kick
    1.38 -   0x1B   :rolling-kick
    1.39 -   0x1C   :sand-attack
    1.40 -   0x1D   :headbutt
    1.41 -   0x1E   :horn-attack
    1.42 -   0x1F   :fury-attack
    1.43 -   0x20   :horn-drill
    1.44 -   0x21   :tackle
    1.45 -   0x22   :body-slam
    1.46 -   0x23   :wrap
    1.47 -   0x24   :take-down
    1.48 -   0x25   :thrash
    1.49 -   0x26   :double-edge
    1.50 -   0x27   :tail-whip
    1.51 -   0x28   :poison-sting
    1.52 -   0x29   :twinneedle
    1.53 -   0x2A   :pin-missle
    1.54 -   0x2B   :leer
    1.55 -   0x2C   :bite
    1.56 -   0x2D   :growl
    1.57 -   0x2E   :roar
    1.58 -   0x2F   :sing
    1.59 -   0x30   :supersonic
    1.60 -   0x31   :sonicboom
    1.61 -   0x32   :disable
    1.62 -   0x33   :acid
    1.63 -   0x34   :ember
    1.64 -   0x35   :flamethrower
    1.65 -   0x36   :mist
    1.66 -   0x37   :water-gun
    1.67 -   0x38   :hydro-pump
    1.68 -   0x39   :surf
    1.69 -   0x3A   :ice-beam
    1.70 -   0x3B   :blizzard
    1.71 -   0x3C   :psybeam
    1.72 -   0x3D   :bubblebeam
    1.73 -   0x3E   :aurora-beam
    1.74 -   0x3F   :hyper-beam
    1.75 -   0x40   :peck
    1.76 -   0x41   :drill-peck
    1.77 -   0x42   :submission
    1.78 -   0x43   :low-kick
    1.79 -   0x44   :counter
    1.80 -   0x45   :seismic-toss
    1.81 -   0x46   :strength
    1.82 -   0x47   :absorb
    1.83 -   0x48   :mega-drain
    1.84 -   0x49   :leech-seed
    1.85 -   0x4A   :growth
    1.86 -   0x4B   :razor-leaf
    1.87 -   0x4C   :solarbeam
    1.88 -   0x4D   :poisonpowder
    1.89 -   0x4E   :stun-spore
    1.90 -   0x4F   :sleep-powder
    1.91 -   0x50   :petal-dance
    1.92 -   0x51   :string-shot
    1.93 -   0x52   :dragon-rage
    1.94 -   0x53   :fire-spin
    1.95 -   0x54   :thundershock
    1.96 -   0x55   :thunderbolt
    1.97 -   0x56   :thunder-wave
    1.98 -   0x57   :thunder
    1.99 -   0x58   :rock-throw
   1.100 -   0x59   :earthquake
   1.101 -   0x5A   :fissure
   1.102 -   0x5B   :dig
   1.103 -   0x5C   :toxic
   1.104 -   0x5D   :confusion
   1.105 -   0x5E   :psychic
   1.106 -   0x5F   :hypnosis
   1.107 -   0x60   :meditate
   1.108 -   0x61   :agility
   1.109 -   0x62   :quick-attack
   1.110 -   0x63   :rage
   1.111 -   0x64   :teleport
   1.112 -   0x65   :night-shade
   1.113 -   0x66   :mimic
   1.114 -   0x67   :screech
   1.115 -   0x68   :double-team
   1.116 -   0x69   :recover
   1.117 -   0x6A   :harden
   1.118 -   0x6B   :minimize
   1.119 -   0x6C   :smokescreen
   1.120 -   0x6D   :confuse-ray
   1.121 -   0x6E   :withdraw
   1.122 -   0x6F   :defense-curl
   1.123 -   0x70   :barrier
   1.124 -   0x71   :light-screen
   1.125 -   0x72   :haze
   1.126 -   0x73   :reflect
   1.127 -   0x74   :focus-energy
   1.128 -   0x75   :bide
   1.129 -   0x76   :metronome
   1.130 -   0x77   :mirror-move
   1.131 -   0x78   :selfdestruct
   1.132 -   0x79   :egg-bomb
   1.133 -   0x7A   :lick
   1.134 -   0x7B   :smog
   1.135 -   0x7C   :sludge
   1.136 -   0x7D   :bone-club
   1.137 -   0x7E   :fire-blast
   1.138 -   0x7F   :waterfall
   1.139 -   0x80   :clamp
   1.140 -   0x81   :swift
   1.141 -   0x82   :skull-bash
   1.142 -   0x83   :spike-cannon
   1.143 -   0x84   :constrict
   1.144 -   0x85   :amnesia
   1.145 -   0x86   :kinesis
   1.146 -   0x87   :softboiled
   1.147 -   0x88   :hi-jump-kick
   1.148 -   0x89   :glare
   1.149 -   0x8A   :dream-eater
   1.150 -   0x8B   :poison-gas
   1.151 -   0x8C   :barrage
   1.152 -   0x8D   :leech-life
   1.153 -   0x8E   :lovely-kiss
   1.154 -   0x8F   :sky-attack
   1.155 -   0x90   :transform
   1.156 -   0x91   :bubble
   1.157 -   0x92   :dizzy-punch
   1.158 -   0x93   :spore
   1.159 -   0x94   :flash
   1.160 -   0x95   :psywave
   1.161 -   0x96   :splash
   1.162 -   0x97   :acid-armor
   1.163 -   0x98   :crabhammer
   1.164 -   0x99   :explosion
   1.165 -   0x9A   :fury-swipes
   1.166 -   0x9B   :bonemerang
   1.167 -   0x9C   :rest
   1.168 -   0x9D   :rock-slide
   1.169 -   0x9E   :hyper-fang
   1.170 -   0x9F   :sharpen
   1.171 -   0xA0   :conversion
   1.172 -   0xA1   :tri-attack
   1.173 -   0xA2   :super-fang
   1.174 -   0xA3   :slash
   1.175 -   0xA4   :substitute
   1.176 -   0xA5   :struggle       })
   1.177  
   1.178 -(def move-name->move-code
   1.179 -  (zipmap (vals move-code->move-name)
   1.180 -          (keys move-code->move-name)))
   1.181 +;;; grab the move data directly from the rom
   1.182 +(def move-code->move-name ;; alternate name: moves
   1.183 +  ((comp vec cons)
   1.184 +   :end-of-moves
   1.185 +   (map format-name (hxc-move-names)))))
   1.186 +
   1.187 +(def move-name->move-code ;; alternate name: move-id
   1.188 +  (zipmap
   1.189 +   move-names
   1.190 +   (range)))
   1.191 +
   1.192 +(def move-name->move-pp
   1.193 +  (comp :pp (hxc-move-data)))
   1.194 +
   1.195 +(defn max-pp [name pp-ups]
   1.196 +  (if (= 40 (move-name->move-pp name))
   1.197 +    (+ 40 (* 7 pp-ups))
   1.198 +    (int (* (+ 1 (* (/ 1 5) pp-ups))
   1.199 +            (move-name->move-pp name)))))
   1.200  
   1.201  (def moves-codes-pokemon-1 0xD172)
   1.202  
   1.203 @@ -284,176 +132,3 @@
   1.204       (give-moves-pps @current-state poke-num moves-pps)))
   1.205             
   1.206  
   1.207 -(def move-name->move-pp
   1.208 -  {
   1.209 -   :absorb        20
   1.210 -   :acid          30
   1.211 -   :acid-armor    40 ;; WTF happens with 3 PP-UPs??! (answer: 61PP!)
   1.212 -   :agility       30
   1.213 -   :amnesia       20
   1.214 -   :aurora-beam   20
   1.215 -   :barrage       20
   1.216 -   :barrier       30
   1.217 -   :bide          10
   1.218 -   :bind          20
   1.219 -   :bite          25
   1.220 -   :blizzard       5 
   1.221 -   :body-slam     15
   1.222 -   :bone-club     20
   1.223 -   :bonemerang    10
   1.224 -   :bubble        30
   1.225 -   :bubblebeam    20
   1.226 -   :clamp         10
   1.227 -   :comet-punch   15
   1.228 -   :confuse-ray   10
   1.229 -   :confusion     25
   1.230 -   :constrict     35
   1.231 -   :conversion    30
   1.232 -   :counter       20
   1.233 -   :crabhammer    10
   1.234 -   :cut           30
   1.235 -   :defense-curl  40
   1.236 -   :dig           10
   1.237 -   :disable       20
   1.238 -   :dizzy-punch   10
   1.239 -   :double-edge   15
   1.240 -   :double-kick   30
   1.241 -   :double-team   10
   1.242 -   :doubleslap    15
   1.243 -   :dragon-rage   10
   1.244 -   :dream-eater   15
   1.245 -   :drill-peck    20
   1.246 -   :earthquake    10
   1.247 -   :egg-bomb      10
   1.248 -   :ember         25
   1.249 -   :explosion      5
   1.250 -   :fire-blast     5
   1.251 -   :fire-punch    15
   1.252 -   :fire-spin     15
   1.253 -   :fissure        5
   1.254 -   :flamethrower  15
   1.255 -   :flash         20
   1.256 -   :fly           15
   1.257 -   :focus-energy  30
   1.258 -   :fury-attack   20
   1.259 -   :fury-swipes   15
   1.260 -   :glare         30
   1.261 -   :growl         40
   1.262 -   :growth        40
   1.263 -   :guillotine     5
   1.264 -   :gust          35
   1.265 -   :harden        30
   1.266 -   :haze          30
   1.267 -   :headbutt      15
   1.268 -   :hi-jump-kick  20
   1.269 -   :horn-attack   25
   1.270 -   :horn-drill     5
   1.271 -   :hydro-pump     5
   1.272 -   :hyper-beam     5
   1.273 -   :hyper-fang    15
   1.274 -   :hypnosis      20
   1.275 -   :ice-beam      10
   1.276 -   :ice-punch     15
   1.277 -   :jump-kick     25
   1.278 -   :karate-chop   25
   1.279 -   :kinesis       15
   1.280 -   :leech-life    15
   1.281 -   :leech-seed    10
   1.282 -   :leer          30
   1.283 -   :lick          30
   1.284 -   :light-screen  30
   1.285 -   :lovely-kiss   10
   1.286 -   :low-kick      20
   1.287 -   :meditate      40
   1.288 -   :mega-drain    10
   1.289 -   :mega-kick      5
   1.290 -   :mega-punch    20
   1.291 -   :metronome     10
   1.292 -   :mimic         10
   1.293 -   :minimize      20
   1.294 -   :mirror-move   20
   1.295 -   :mist          30
   1.296 -   :night-shade   15
   1.297 -   :pay-day       20
   1.298 -   :peck          35
   1.299 -   :petal-dance   20
   1.300 -   :pin-missle    20
   1.301 -   :poison-gas    40
   1.302 -   :poison-sting  35
   1.303 -   :poisonpowder  35
   1.304 -   :pound         35
   1.305 -   :psybeam       20
   1.306 -   :psychic       10
   1.307 -   :psywave       15
   1.308 -   :quick-attack  30
   1.309 -   :rage          20
   1.310 -   :razor-leaf    25
   1.311 -   :razor-wind    10
   1.312 -   :recover       20
   1.313 -   :reflect       20
   1.314 -   :rest          10
   1.315 -   :roar          20
   1.316 -   :rock-slide    10
   1.317 -   :rock-throw    15
   1.318 -   :rolling-kick  15
   1.319 -   :sand-attack   15
   1.320 -   :scratch       35
   1.321 -   :screech       40
   1.322 -   :seismic-toss  20
   1.323 -   :selfdestruct   5
   1.324 -   :sharpen       30
   1.325 -   :sing          15
   1.326 -   :skull-bash    15
   1.327 -   :sky-attack     5
   1.328 -   :slam          20
   1.329 -   :slash         20
   1.330 -   :sleep-powder  15
   1.331 -   :sludge        20
   1.332 -   :smog          20
   1.333 -   :smokescreen   20
   1.334 -   :softboiled    10
   1.335 -   :solarbeam     10
   1.336 -   :sonicboom     20
   1.337 -   :spike-cannon  15
   1.338 -   :splash        40
   1.339 -   :spore         15
   1.340 -   :stomp         20
   1.341 -   :strength      15
   1.342 -   :string-shot   40
   1.343 -   :struggle       1
   1.344 -   :stun-spore    30
   1.345 -   :submission    25
   1.346 -   :substitute    10
   1.347 -   :super-fang    10
   1.348 -   :supersonic    20
   1.349 -   :surf          15
   1.350 -   :swift         20
   1.351 -   :swords-dance  30
   1.352 -   :tackle        35
   1.353 -   :tail-whip     30
   1.354 -   :take-down     20
   1.355 -   :teleport      20
   1.356 -   :thrash        20
   1.357 -   :thunder       10
   1.358 -   :thunder-wave  20
   1.359 -   :thunderbolt   15
   1.360 -   :thunderpunch  15
   1.361 -   :thundershock  30
   1.362 -   :toxic         10
   1.363 -   :transform     10
   1.364 -   :tri-attack    10
   1.365 -   :twinneedle    20
   1.366 -   :vicegrip      30
   1.367 -   :vine-whip     10
   1.368 -   :water-gun     25
   1.369 -   :waterfall     15
   1.370 -   :whirlwind     20
   1.371 -   :wing-attack   35
   1.372 -   :withdraw      40
   1.373 -   :wrap          20})
   1.374 -
   1.375 -(defn max-pp [name pp-ups]
   1.376 -  (if (= 40 (move-name->move-pp name))
   1.377 -    (+ 40 (* 7 pp-ups))
   1.378 -    (int (* (+ 1 (* (/ 1 5) pp-ups))
   1.379 -            (move-name->move-pp name)))))
   1.380 \ No newline at end of file