comparison 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
comparison
equal deleted inserted replaced
280:d5e5c73af7e6 281:ca1afcef3542
1 (ns com.aurellem.gb.moves 1 (ns com.aurellem.gb.moves
2 (:use (com.aurellem.gb gb-driver util constants)) 2 (:use (com.aurellem.gb gb-driver util constants hxc))
3 (:import [com.aurellem.gb.gb_driver SaveState])) 3 (:import [com.aurellem.gb.gb_driver SaveState]))
4 4
5 (def move-code->move-name
6 {
7 0x00 :end-of-moves
8 0x01 :pound
9 0x02 :karate-chop
10 0x03 :doubleslap
11 0x04 :comet-punch
12 0x05 :mega-punch
13 0x06 :pay-day
14 0x07 :fire-punch
15 0x08 :ice-punch
16 0x09 :thunderpunch
17 0x0A :scratch
18 0x0B :vicegrip
19 0x0C :guillotine
20 0x0D :razor-wind
21 0x0E :swords-dance
22 0x0F :cut
23 0x10 :gust
24 0x11 :wing-attack
25 0x12 :whirlwind
26 0x13 :fly
27 0x14 :bind
28 0x15 :slam
29 0x16 :vine-whip
30 0x17 :stomp
31 0x18 :double-kick
32 0x19 :mega-kick
33 0x1A :jump-kick
34 0x1B :rolling-kick
35 0x1C :sand-attack
36 0x1D :headbutt
37 0x1E :horn-attack
38 0x1F :fury-attack
39 0x20 :horn-drill
40 0x21 :tackle
41 0x22 :body-slam
42 0x23 :wrap
43 0x24 :take-down
44 0x25 :thrash
45 0x26 :double-edge
46 0x27 :tail-whip
47 0x28 :poison-sting
48 0x29 :twinneedle
49 0x2A :pin-missle
50 0x2B :leer
51 0x2C :bite
52 0x2D :growl
53 0x2E :roar
54 0x2F :sing
55 0x30 :supersonic
56 0x31 :sonicboom
57 0x32 :disable
58 0x33 :acid
59 0x34 :ember
60 0x35 :flamethrower
61 0x36 :mist
62 0x37 :water-gun
63 0x38 :hydro-pump
64 0x39 :surf
65 0x3A :ice-beam
66 0x3B :blizzard
67 0x3C :psybeam
68 0x3D :bubblebeam
69 0x3E :aurora-beam
70 0x3F :hyper-beam
71 0x40 :peck
72 0x41 :drill-peck
73 0x42 :submission
74 0x43 :low-kick
75 0x44 :counter
76 0x45 :seismic-toss
77 0x46 :strength
78 0x47 :absorb
79 0x48 :mega-drain
80 0x49 :leech-seed
81 0x4A :growth
82 0x4B :razor-leaf
83 0x4C :solarbeam
84 0x4D :poisonpowder
85 0x4E :stun-spore
86 0x4F :sleep-powder
87 0x50 :petal-dance
88 0x51 :string-shot
89 0x52 :dragon-rage
90 0x53 :fire-spin
91 0x54 :thundershock
92 0x55 :thunderbolt
93 0x56 :thunder-wave
94 0x57 :thunder
95 0x58 :rock-throw
96 0x59 :earthquake
97 0x5A :fissure
98 0x5B :dig
99 0x5C :toxic
100 0x5D :confusion
101 0x5E :psychic
102 0x5F :hypnosis
103 0x60 :meditate
104 0x61 :agility
105 0x62 :quick-attack
106 0x63 :rage
107 0x64 :teleport
108 0x65 :night-shade
109 0x66 :mimic
110 0x67 :screech
111 0x68 :double-team
112 0x69 :recover
113 0x6A :harden
114 0x6B :minimize
115 0x6C :smokescreen
116 0x6D :confuse-ray
117 0x6E :withdraw
118 0x6F :defense-curl
119 0x70 :barrier
120 0x71 :light-screen
121 0x72 :haze
122 0x73 :reflect
123 0x74 :focus-energy
124 0x75 :bide
125 0x76 :metronome
126 0x77 :mirror-move
127 0x78 :selfdestruct
128 0x79 :egg-bomb
129 0x7A :lick
130 0x7B :smog
131 0x7C :sludge
132 0x7D :bone-club
133 0x7E :fire-blast
134 0x7F :waterfall
135 0x80 :clamp
136 0x81 :swift
137 0x82 :skull-bash
138 0x83 :spike-cannon
139 0x84 :constrict
140 0x85 :amnesia
141 0x86 :kinesis
142 0x87 :softboiled
143 0x88 :hi-jump-kick
144 0x89 :glare
145 0x8A :dream-eater
146 0x8B :poison-gas
147 0x8C :barrage
148 0x8D :leech-life
149 0x8E :lovely-kiss
150 0x8F :sky-attack
151 0x90 :transform
152 0x91 :bubble
153 0x92 :dizzy-punch
154 0x93 :spore
155 0x94 :flash
156 0x95 :psywave
157 0x96 :splash
158 0x97 :acid-armor
159 0x98 :crabhammer
160 0x99 :explosion
161 0x9A :fury-swipes
162 0x9B :bonemerang
163 0x9C :rest
164 0x9D :rock-slide
165 0x9E :hyper-fang
166 0x9F :sharpen
167 0xA0 :conversion
168 0xA1 :tri-attack
169 0xA2 :super-fang
170 0xA3 :slash
171 0xA4 :substitute
172 0xA5 :struggle })
173 5
174 (def move-name->move-code 6 ;;; grab the move data directly from the rom
175 (zipmap (vals move-code->move-name) 7 (def move-code->move-name ;; alternate name: moves
176 (keys move-code->move-name))) 8 ((comp vec cons)
9 :end-of-moves
10 (map format-name (hxc-move-names)))))
11
12 (def move-name->move-code ;; alternate name: move-id
13 (zipmap
14 move-names
15 (range)))
16
17 (def move-name->move-pp
18 (comp :pp (hxc-move-data)))
19
20 (defn max-pp [name pp-ups]
21 (if (= 40 (move-name->move-pp name))
22 (+ 40 (* 7 pp-ups))
23 (int (* (+ 1 (* (/ 1 5) pp-ups))
24 (move-name->move-pp name)))))
177 25
178 (def moves-codes-pokemon-1 0xD172) 26 (def moves-codes-pokemon-1 0xD172)
179 27
180 (defn moves-codes-start [pokemon-num] 28 (defn moves-codes-start [pokemon-num]
181 (assert (<= 0 pokemon-num 5)) 29 (assert (<= 0 pokemon-num 5))
282 new-moves (range (count moves-pps))))) 130 new-moves (range (count moves-pps)))))
283 ([poke-num moves-pps] 131 ([poke-num moves-pps]
284 (give-moves-pps @current-state poke-num moves-pps))) 132 (give-moves-pps @current-state poke-num moves-pps)))
285 133
286 134
287 (def move-name->move-pp
288 {
289 :absorb 20
290 :acid 30
291 :acid-armor 40 ;; WTF happens with 3 PP-UPs??! (answer: 61PP!)
292 :agility 30
293 :amnesia 20
294 :aurora-beam 20
295 :barrage 20
296 :barrier 30
297 :bide 10
298 :bind 20
299 :bite 25
300 :blizzard 5
301 :body-slam 15
302 :bone-club 20
303 :bonemerang 10
304 :bubble 30
305 :bubblebeam 20
306 :clamp 10
307 :comet-punch 15
308 :confuse-ray 10
309 :confusion 25
310 :constrict 35
311 :conversion 30
312 :counter 20
313 :crabhammer 10
314 :cut 30
315 :defense-curl 40
316 :dig 10
317 :disable 20
318 :dizzy-punch 10
319 :double-edge 15
320 :double-kick 30
321 :double-team 10
322 :doubleslap 15
323 :dragon-rage 10
324 :dream-eater 15
325 :drill-peck 20
326 :earthquake 10
327 :egg-bomb 10
328 :ember 25
329 :explosion 5
330 :fire-blast 5
331 :fire-punch 15
332 :fire-spin 15
333 :fissure 5
334 :flamethrower 15
335 :flash 20
336 :fly 15
337 :focus-energy 30
338 :fury-attack 20
339 :fury-swipes 15
340 :glare 30
341 :growl 40
342 :growth 40
343 :guillotine 5
344 :gust 35
345 :harden 30
346 :haze 30
347 :headbutt 15
348 :hi-jump-kick 20
349 :horn-attack 25
350 :horn-drill 5
351 :hydro-pump 5
352 :hyper-beam 5
353 :hyper-fang 15
354 :hypnosis 20
355 :ice-beam 10
356 :ice-punch 15
357 :jump-kick 25
358 :karate-chop 25
359 :kinesis 15
360 :leech-life 15
361 :leech-seed 10
362 :leer 30
363 :lick 30
364 :light-screen 30
365 :lovely-kiss 10
366 :low-kick 20
367 :meditate 40
368 :mega-drain 10
369 :mega-kick 5
370 :mega-punch 20
371 :metronome 10
372 :mimic 10
373 :minimize 20
374 :mirror-move 20
375 :mist 30
376 :night-shade 15
377 :pay-day 20
378 :peck 35
379 :petal-dance 20
380 :pin-missle 20
381 :poison-gas 40
382 :poison-sting 35
383 :poisonpowder 35
384 :pound 35
385 :psybeam 20
386 :psychic 10
387 :psywave 15
388 :quick-attack 30
389 :rage 20
390 :razor-leaf 25
391 :razor-wind 10
392 :recover 20
393 :reflect 20
394 :rest 10
395 :roar 20
396 :rock-slide 10
397 :rock-throw 15
398 :rolling-kick 15
399 :sand-attack 15
400 :scratch 35
401 :screech 40
402 :seismic-toss 20
403 :selfdestruct 5
404 :sharpen 30
405 :sing 15
406 :skull-bash 15
407 :sky-attack 5
408 :slam 20
409 :slash 20
410 :sleep-powder 15
411 :sludge 20
412 :smog 20
413 :smokescreen 20
414 :softboiled 10
415 :solarbeam 10
416 :sonicboom 20
417 :spike-cannon 15
418 :splash 40
419 :spore 15
420 :stomp 20
421 :strength 15
422 :string-shot 40
423 :struggle 1
424 :stun-spore 30
425 :submission 25
426 :substitute 10
427 :super-fang 10
428 :supersonic 20
429 :surf 15
430 :swift 20
431 :swords-dance 30
432 :tackle 35
433 :tail-whip 30
434 :take-down 20
435 :teleport 20
436 :thrash 20
437 :thunder 10
438 :thunder-wave 20
439 :thunderbolt 15
440 :thunderpunch 15
441 :thundershock 30
442 :toxic 10
443 :transform 10
444 :tri-attack 10
445 :twinneedle 20
446 :vicegrip 30
447 :vine-whip 10
448 :water-gun 25
449 :waterfall 15
450 :whirlwind 20
451 :wing-attack 35
452 :withdraw 40
453 :wrap 20})
454
455 (defn max-pp [name pp-ups]
456 (if (= 40 (move-name->move-pp name))
457 (+ 40 (* 7 pp-ups))
458 (int (* (+ 1 (* (/ 1 5) pp-ups))
459 (move-name->move-pp name)))))