view clojure/com/aurellem/exp/pokemon.clj @ 492:716752719a78

fleshing out image color calibration code.
author Robert McIntyre <rlm@mit.edu>
date Thu, 07 Jun 2012 22:52:30 -0500
parents d5dddf33543c
children
line wrap: on
line source
1 (ns com.aurellem.exp.pokemon
2 "Here I find out how pokemon are stored in memory."
3 (:use (com.aurellem.gb gb-driver items assembly util
4 constants
5 characters species moves))
6 (:import java.io.File)
7 (:import [com.aurellem.gb.gb_driver SaveState]))
10 (def pidgeot-lvl-36 (mid-game))
13 (def pidgeot-lvl-37 (read-state "pidgeot-lvl-37"))
16 (def pidgeot-lvl-38 (read-state "pidgeot-lvl-38"))
19 (def pidgeot-lvl-39 (read-state "pidgeot-lvl-39"))
22 (def pidgeot-lvl-40 (read-state "pidgeot-lvl-40"))
25 (defn level-analysis []
26 (apply common-differences
27 (map (comp vec memory)
28 [pidgeot-lvl-36
29 pidgeot-lvl-37
30 pidgeot-lvl-38
31 pidgeot-lvl-39
32 pidgeot-lvl-40])))
34 ;; inconclusive -- implies that level is calculated from
35 ;; some other values.
38 (def name-pidgeotto (read-state "name-pidgeotto"))
39 (def named-A (read-state "named-A"))
40 (def named-B (read-state "named-B"))
41 (def named-C (read-state "named-C"))
42 (def named-D (read-state "named-D"))
43 (def named-E (read-state "named-E"))
44 (def named-F (read-state "named-F"))
46 (defn name-analysis []
47 (apply common-differences
48 (map (comp vec memory)
49 [named-A
50 named-B
51 named-C
52 named-D
53 named-E
54 named-F])))
56 ;; resluted in 3 separate locations that could
57 ;; possibly hold the first letter of the pokemon's name
59 0xCF4A
60 0xD2EB
61 0xCEED
63 ;; try changing each of them
66 (defn test-cf4a []
67 (continue!
68 (set-memory named-A 0xCF4A (character->character-code "Z"))))
69 ;; result -- pidgeotto named "A"
71 (defn test-d2eb []
72 (continue!
73 (set-memory named-A 0xD2EB (character->character-code "Z"))))
74 ;; result -- pidgeotto named "Z"
76 (defn test-ceed []
77 (continue!
78 (set-memory named-A 0xCEED (character->character-code "Z"))))
79 ;; result -- pidgeotto named "A"
81 (def sixth-pokemon-name-start 0xD2EB)
84 (defn set-sixth-pokemon-name-first-character
85 ([state character]
86 (set-memory state sixth-pokemon-name-start
87 (character->character-code character)))
88 ([character]
89 (set-sixth-pokemon-name-first-character @current-state
90 character)))
93 ;;(def end-of-name-marker 0x50)
94 ;;(def max-name-length 10)
95 ;;(def name-width 11)
97 ;; (defn read-name [codes]
98 ;; (character-codes->str
99 ;; (take-while
100 ;; (partial not= end-of-name-marker) codes)))
103 (defn sixth-pokemon-name [^SaveState state]
104 (read-name
105 (subvec (vec (memory state))
106 sixth-pokemon-name-start
107 (+ (inc max-name-length)
108 sixth-pokemon-name-start))))
110 (defn rename-sixth-pokemon
111 ([^SaveState state new-name]
112 (assert (< (count new-name) max-name-length))
113 (set-memory-range state sixth-pokemon-name-start
114 (concat (str->character-codes new-name)
115 [end-of-name-marker])))
116 ([new-name]
117 (rename-sixth-pokemon @current-state new-name)))
120 (defn examine-name-memory []
121 (print-text
122 named-A
123 (- sixth-pokemon-name-start 100)
124 (+ sixth-pokemon-name-start 100)))
126 ;; results:
127 ;; 0xD287: end-of-name-sentinel
128 ;; 0xD288: R
129 ;; 0xD289: L
130 ;; 0xD28A: M
131 ;; 0xD28B: end-of-pokemon-name-sentinel
132 ;; 0xD28C: end-of-name-sentinel
133 ;; 0xD28D: end-of-name-sentinel
134 ;; 0xD28E: end-of-name-sentinel
135 ;; 0xD28F: end-of-name-sentinel
136 ;; 0xD290: end-of-name-sentinel
137 ;; 0xD291: end-of-name-sentinel
138 ;; 0xD292: end-of-name-sentinel
139 ;; 0xD293: R
140 ;; 0xD294: L
141 ;; 0xD295: M
142 ;; 0xD296: end-of-pokemon-name-sentinel
143 ;; 0xD297: end-of-name-sentinel
144 ;; 0xD298: end-of-name-sentinel
145 ;; 0xD299: end-of-name-sentinel
146 ;; 0xD29A: end-of-name-sentinel
147 ;; 0xD29B: end-of-name-sentinel
148 ;; 0xD29C: end-of-name-sentinel
149 ;; 0xD29D: end-of-name-sentinel
150 ;; 0xD29E: R
151 ;; 0xD29F: L
152 ;; 0xD2A0: M
153 ;; 0xD2A1: end-of-pokemon-name-sentinel
154 ;; 0xD2A2: end-of-name-sentinel
155 ;; 0xD2A3: end-of-name-sentinel
156 ;; 0xD2A4: end-of-name-sentinel
157 ;; 0xD2A5: end-of-name-sentinel
158 ;; 0xD2A6: end-of-name-sentinel
159 ;; 0xD2A7: end-of-name-sentinel
160 ;; 0xD2A8: end-of-name-sentinel
161 ;; 0xD2A9: R
162 ;; 0xD2AA: L
163 ;; 0xD2AB: M
164 ;; 0xD2AC: end-of-pokemon-name-sentinel
165 ;; 0xD2AD: end-of-name-sentinel
166 ;; 0xD2AE: end-of-name-sentinel
167 ;; 0xD2AF: end-of-name-sentinel
168 ;; 0xD2B0: end-of-name-sentinel
169 ;; 0xD2B1: end-of-name-sentinel
170 ;; 0xD2B2: end-of-name-sentinel
171 ;; 0xD2B3: end-of-name-sentinel
172 ;; 0xD2B4: P
173 ;; 0xD2B5: I
174 ;; 0xD2B6: D
175 ;; 0xD2B7: G
176 ;; 0xD2B8: E
177 ;; 0xD2B9: O
178 ;; 0xD2BA: T
179 ;; 0xD2BB: end-of-pokemon-name-sentinel
180 ;; 0xD2BC: end-of-pokemon-name-sentinel
181 ;; 0xD2BD: end-of-pokemon-name-sentinel
182 ;; 0xD2BE: end-of-pokemon-name-sentinel
183 ;; 0xD2BF: P
184 ;; 0xD2C0: I
185 ;; 0xD2C1: K
186 ;; 0xD2C2: A
187 ;; 0xD2C3: C
188 ;; 0xD2C4: H
189 ;; 0xD2C5: U
190 ;; 0xD2C6: end-of-pokemon-name-sentinel
191 ;; 0xD2C7: end-of-pokemon-name-sentinel
192 ;; 0xD2C8: end-of-pokemon-name-sentinel
193 ;; 0xD2C9: end-of-pokemon-name-sentinel
194 ;; 0xD2CA: C
195 ;; 0xD2CB: H
196 ;; 0xD2CC: A
197 ;; 0xD2CD: R
198 ;; 0xD2CE: I
199 ;; 0xD2CF: Z
200 ;; 0xD2D0: A
201 ;; 0xD2D1: R
202 ;; 0xD2D2: D
203 ;; 0xD2D3: end-of-pokemon-name-sentinel
204 ;; 0xD2D4: end-of-pokemon-name-sentinel
205 ;; 0xD2D5: V
206 ;; 0xD2D6: E
207 ;; 0xD2D7: N
208 ;; 0xD2D8: U
209 ;; 0xD2D9: S
210 ;; 0xD2DA: A
211 ;; 0xD2DB: U
212 ;; 0xD2DC: R
213 ;; 0xD2DD: end-of-pokemon-name-sentinel
214 ;; 0xD2DE: end-of-pokemon-name-sentinel
215 ;; 0xD2DF: end-of-pokemon-name-sentinel
216 ;; 0xD2E0: P
217 ;; 0xD2E1: R
218 ;; 0xD2E2: I
219 ;; 0xD2E3: M
220 ;; 0xD2E4: E
221 ;; 0xD2E5: A
222 ;; 0xD2E6: P
223 ;; 0xD2E7: E
224 ;; 0xD2E8: end-of-pokemon-name-sentinel
225 ;; 0xD2E9: end-of-pokemon-name-sentinel
226 ;; 0xD2EA: end-of-pokemon-name-sentinel
227 ;; 0xD2EB: A
228 ;; 0xD2EC: end-of-pokemon-name-sentinel
229 ;; 0xD2ED: S
230 ;; 0xD2EE: T
231 ;; 0xD2EF: E
232 ;; 0xD2F0: R
233 ;; 0xD2F1:
234 ;; 0xD2F2: B
235 ;; 0xD2F3: A
236 ;; 0xD2F4: L
237 ;; 0xD2F5: L
238 ;; 0xD2F6:
239 ;; 0xD2F7: A
240 ;; 0xD2F8:
241 ;; 0xD2F9:
242 ;; 0xD2FA: end-of-name-sentinel
243 ;; 0xD2FB: end-of-name-sentinel
244 ;; 0xD2FC: A
245 ;; 0xD2FD:
246 ;; 0xD2FE: end-of-name-sentinel
247 ;; 0xD2FF: end-of-name-sentinel
248 ;; 0xD300: end-of-name-sentinel
249 ;; 0xD301: end-of-name-sentinel
250 ;; 0xD302: end-of-name-sentinel
251 ;; 0xD303: end-of-name-sentinel
252 ;; 0xD304: end-of-name-sentinel
253 ;; 0xD305: end-of-name-sentinel
254 ;; 0xD306: end-of-name-sentinel
255 ;; 0xD307: end-of-name-sentinel
256 ;; 0xD308: end-of-name-sentinel
257 ;; 0xD309:
258 ;; 0xD30A: w
259 ;; 0xD30B:
260 ;; 0xD30C: V
261 ;; 0xD30D:
262 ;; 0xD30E:
263 ;; 0xD30F: K
264 ;; 0xD310:
265 ;; 0xD311:
266 ;; 0xD312:
267 ;; 0xD313: A
268 ;; 0xD314:
269 ;; 0xD315:
270 ;; 0xD316:
271 ;; 0xD317: i
272 ;; 0xD318:
273 ;; 0xD319:
274 ;; 0xD31A: end-of-name-sentinel
275 ;; 0xD31B: end-of-name-sentinel
276 ;; 0xD31C:
277 ;; 0xD31D:
278 ;; 0xD31E:
279 ;; 0xD31F:
280 ;; 0xD320:
281 ;; 0xD321:
282 ;; 0xD322:
283 ;; 0xD323:
284 ;; 0xD324:
285 ;; 0xD325:
286 ;; 0xD326:
287 ;; 0xD327:
288 ;; 0xD328:
289 ;; 0xD329:
290 ;; 0xD32A:
291 ;; 0xD32B:
292 ;; 0xD32C:
293 ;; 0xD32D:
294 ;; 0xD32E:
295 ;; 0xD32F:
296 ;; 0xD330:
297 ;; 0xD331: 9
298 ;; 0xD332: end-of-name-sentinel
299 ;; 0xD333: 9
300 ;; 0xD334:
301 ;; 0xD335: 9
302 ;; 0xD336:
303 ;; 0xD337: 9
304 ;; 0xD338: end-of-name-sentinel
305 ;; 0xD339: end-of-name-sentinel
306 ;; 0xD33A: end-of-name-sentinel
307 ;; 0xD33B: end-of-name-sentinel
308 ;; 0xD33C: end-of-name-sentinel
309 ;; 0xD33D: end-of-name-sentinel
310 ;; 0xD33E: end-of-name-sentinel
311 ;; 0xD33F: end-of-name-sentinel
312 ;; 0xD340: end-of-name-sentinel
313 ;; 0xD341: end-of-name-sentinel
314 ;; 0xD342: end-of-name-sentinel
315 ;; 0xD343: end-of-name-sentinel
316 ;; 0xD344: end-of-name-sentinel
317 ;; 0xD345: end-of-name-sentinel
318 ;; 0xD346:
319 ;; 0xD347:
320 ;; 0xD348:
321 ;; 0xD349: G
322 ;; 0xD34A: A
323 ;; 0xD34B: R
324 ;; 0xD34C: Y
325 ;; 0xD34D: end-of-pokemon-name-sentinel
326 ;; 0xD34E: J
329 ;; from this, it looks like the pokemon names are stored all
330 ;; together in one location that begins at 0xD2B4 and
331 ;; extends until 0xD2F5, with each name taking up 11 bytes.
332 ;;
333 ;; rival's name again clearly starts at 0xD349.
336 (def pokemon-names-start 0xD2B4)
339 ;; determine whether "number of pokemon in party"
340 ;; might be kept in RAM and if so, where?
342 (def six-pokemon (read-state "6-pokemon"))
343 (def five-pokemon (read-state "5-pokemon"))
344 (def four-pokemon (read-state "4-pokemon"))
345 (def three-pokemon (read-state "3-pokemon"))
346 (def two-pokemon (read-state "2-pokemon"))
347 (def one-pokemon (read-state "1-pokemon"))
350 (defn analyze-num-pokemon []
351 (apply common-differences
352 (map (comp vec memory)
353 [one-pokemon
354 two-pokemon
355 three-pokemon
356 four-pokemon
357 five-pokemon
358 six-pokemon])))
360 ;; ;; results
361 ;; ([53602 (1 2 3 4 5 6)]
362 ;; [65314 (105 61 93 60 92 34)]
363 ;; [55875 (34 36 43 52 7 0)]
364 ;; [55876 (18 0 33 52 54 30)]
365 ;; [49158 (197 194 77 117 174 134)]
366 ;; [49160 (29 26 57 239 15 243)]
367 ;; [49736 (74 93 34 89 91 59)]
368 ;; [49162 (165 162 182 179 197 109)]
369 ;; [49227 (187 105 204 5 90 238)]
370 ;; [53067 (128 136 132 145 135 11)]
371 ;; [53068 (147 131 141 136 128 7)]
372 ;; [53069 (136 134 148 140 145 2)]
373 ;; [49904 (2 11 10 3 27 12)]
374 ;; [49172 (100 109 213 195 68 104)]
375 ;; [65492 (11 103 128 160 19 56)]
376 ;; [49173 (80 77 72 75 76 67)]
377 ;; [49334 (8 10 11 5 3 1)]
378 ;; [49335 (49 10 11 19 17 15)]
379 ;; [49336 (8 10 11 5 3 1)]
380 ;; [49720 (106 14 118 0 38 11)]
381 ;; [65304 (32 88 19 114 106 33)]
382 ;; [53561 (59 229 48 17 155 103)]
383 ;; [55935 (6 5 4 3 2 1)])
386 ;; two canidates : 0xD162 or 0xDA7F
387 ;; they seem to always sum to 6...
389 ;; try to set both of them when having only one pokemon.
391 (defn change-party-number [^SaveState state new-num]
392 (set-memory state 0xD162 new-num))
394 ;; (continue! (change-party-number one-pokemon 3))
395 ;; result -- can scroll down beyone first pokemon, finding
396 ;; glitched pokemon in places where there were previously no
397 ;; pokemon.
400 (defn change-party-number* [^SaveState state new-num]
401 (set-memory state 0xDA7F new-num))
404 ;; (continue! (change-party-number* one-pokemon 3))
405 ;; cannot widthdraw any pokemon from box 1 past the third
406 ;; pokemon.
408 (def party-number-address 0xD162)
410 (defn party-number
411 ([^SaveState state]
412 (aget (memory state) party-number-address))
413 ([] (party-number @current-state)))
415 (def pokemon-in-box-1-address 0xDA7F)
417 (defn party-names
418 ([^SaveState state]
419 (let [raw-names
420 (subvec (vec (memory state))
421 pokemon-names-start
422 (+ pokemon-names-start
423 (* name-width 6)))]
424 (map
425 read-name
426 (take
427 (party-number state)
428 (partition name-width
429 raw-names)))))
430 ([] (party-names @current-state)))
433 (defn rename-pokemon
434 ([^SaveState state n new-name]
435 (assert (<= 0 n (dec (party-number state))))
436 (assert (<= (count new-name) max-name-length))
437 (set-memory-range
438 state
439 (+ (* n name-width) pokemon-names-start)
440 (concat (str->character-codes new-name) [end-of-name-marker])))
441 ([n new-name]
442 (rename-pokemon @current-state n new-name)))
444 ;; on further analysis, it appears that the original
445 ;; trainer info for each pokemon is also stored together,
446 ;; starting at 0xD272 and continuing to 0xD2B3, with
447 ;; 11 bytes reserved for each OT name.
449 (def OT-start 0xD272)
451 (defn original-trainers
452 ([^SaveState state]
453 (let [raw-names
454 (subvec (vec (memory state))
455 OT-start
456 (+ OT-start
457 (* name-width 6)))]
458 (map read-name
459 (take (party-number state)
460 (partition name-width raw-names)))))
461 ([] (original-trainers @current-state)))
463 (defn set-original-trainer
464 "Set the OT name for a pokemon.
465 Note that a pokemon is still considered 'yours' if
466 the OT ID is the same as your own."
467 ([^SaveState state n new-name]
468 (assert (<= 0 n (dec (party-number state))))
469 (assert (<= (count new-name) max-name-length))
470 (set-memory-range
471 state
472 (+ (* n name-width) OT-start)
473 (concat (str->character-codes new-name) [end-of-name-marker])))
474 ([n new-name]
475 (set-original-trainer @current-state n new-name)))
477 ;; PIKACHU stops following if you set it's OT to another name
478 ;; and then back to you own.
479 ;; But not if you set it to your own name, obviously.
484 ;; OT ID Numbers.
485 ;; My own id is 05195. A quick search of memory between
486 ;; 0xD162 and 0xD31B revealed the pattern 0x144B exactly
487 ;; six times.
489 ;; the locations were:
491 (def OT-ID-addresses [0xD176 0xD1A2 0xD1CE 0xD1FA 0xD228 0xD252])
494 (defn set-pokemon-id
495 ([^SaveState state n new-id]
496 (assert (<= 0 n (dec (party-number state))))
497 (assert (<= 0 new-id 0xFFFF))
498 (set-memory-range
499 state
500 (OT-ID-addresses n)
501 [(bit-shift-right (bit-and new-id 0xFF00) 8)
502 (bit-and new-id 0xFF)
503 ]))
504 ([n new-id]
505 (set-pokemon-id @current-state n new-id)))
508 (defn get-pokemon-1-info
509 ([state]
510 (subvec (vec (memory state))
511 0xD162 0xD197))
512 ([] (get-pokemon-1-info @current-state)))
514 (def baseline (File. "/home/r/baseline-poke"))
519 (import java.io.File)
521 (defn set-baseline [state]
522 (clojure.java.io/copy
523 (with-out-str (print-listing state 0xD162 0xD197))
524 baseline))
526 (defn compare-pokemon
527 ([state]
528 (let [target (File. "/home/r/temp-poke")]
529 (clojure.java.io/copy
530 (with-out-str (print-listing state 0xD162 0xD197))
531 target)
532 (println (:out
533 (clojure.java.shell/sh "diff"
534 (.getCanonicalPath baseline)
535 (.getCanonicalPath target))))))
536 ([] (compare-pokemon @current-state)))
539 (defn crazy-pid []
540 (read-state "crazy-pidgeot"))
542 (def unknown "[[[UNKNOWN]]]")
544 (def unknown "")
546 (def pokemon-1-info
547 {0xD16A "Color Map" ;; 0
548 0xD16B "Current-HP (h)" ;; 1
549 0xD16C "Current-HP (l)" ;; 2
550 0XD16D unknown ;; 3
551 0xD16E unknown ;; 4
552 0xD16F unknown ;; 5
553 0xD170 unknown ;; 6
554 0xD171 unknown ;; 7
555 0xD172 "Move 1 ID" ;; 8
556 0xD173 "Move 2 ID" ;; 9
557 0xD174 "Move 3 ID" ;; 10
558 0xD175 "Move 4 ID" ;; 11
559 0xD176 "OT-ID (h)" ;; 12
560 0xD177 "OT-ID (l)" ;; 13
561 0xD178 "Exp. Points (h)" ;; 14
562 0xD179 "Exp. Points (m)" ;; 15
563 0xD17A "Exp. Points (l)" ;; 16
564 0xD17B "HP Exp. (h)" ;; 17
565 0xD17C "HP Exp. (l)" ;; 18
566 0xD17D "Attack Exp. (h)" ;; 19
567 0xD17E "Attack Exp. (l)" ;; 20
568 0xD17F "Defense Exp. (h)" ;; 21
569 0xD180 "Defense Exp. (l)" ;; 22
570 0xD181 "Speed Exp. (h)" ;; 23
571 0xD182 "Speed Exp. (l)" ;; 24
572 0xD183 "Special Exp. (h)" ;; 25
573 0xD184 "Special Exp. (l)" ;; 26
574 0xD185 "DV Atk/Def" ;; 27
575 0xD186 "DV Speed/Spc" ;; 28
576 0xD187 "PP Move 1" ;; 29
577 0xD188 "PP Move 2" ;; 30
578 0xD189 "PP Move 3" ;; 31
579 0xD18A "PP Move 4" ;; 32
580 0xD18B "Current Level" ;; 33
581 0xD18C "HP Total (h)" ;; 34
582 0xD18D "HP Total (l)" ;; 35
583 0xD18E "Attack (h)" ;; 36
584 0xD18F "Attack (l)" ;; 37
585 0xD190 "Defense (h)" ;; 38
586 0xD191 "Defense (l)" ;; 39
587 0xD192 "Speed (h)" ;; 40
588 0xD193 "Speed (l)" ;; 41
589 0xD194 "Special (h)" ;; 42
590 0xD195 "Special (l)" ;; 43
591 })
593 (defn pokemon-data
594 ([^SaveState state pokemon-num]
595 (assert (<= 0 pokemon-num 5))
596 (let [base (+ (* pokemon-num pokemon-record-width) 0xD16A)]
597 (subvec (vec (memory state)) base
598 (+ base pokemon-record-width))))
599 ([pokemon-num] (pokemon-data @current-state pokemon-num)))
601 (defn set-pokemon-data
602 ([^SaveState state pokemon-num new-data]
603 (assert (<= 0 pokemon-num 5))
604 (let [base (+ (* pokemon-num pokemon-record-width) 0xD16A)]
605 (set-memory-range state base new-data)))
606 ([pokemon-num new-data]
607 (set-pokemon-data @current-state pokemon-num new-data)))
609 (defn print-pokemon-data
610 ([^SaveState state pokemon-num]
611 (assert (<= 0 pokemon-num 5))
612 (let [poke-data (pokemon-data state pokemon-num)
613 backbone (sort (keys pokemon-1-info))]
614 (println "Pokemon " pokemon-num " -- "
615 (nth (party-names state)
616 pokemon-num) \newline)
618 (println " Desc. | Hex | Dec | Binary |")
619 (println "-------------------+------+-----+----------+")
620 (dorun
621 (map
622 (comp println
623 (fn [desc data]
624 (format "%-16s | 0x%02X | %3d | %s |"
625 desc data data
626 (let [s (Integer/toBinaryString data)]
627 (apply
628 str
629 (concat (repeat (- 8 (count s)) "0" )
630 s)))
633 )))
635 (map pokemon-1-info backbone)
636 poke-data))))
637 ([pokemon-num]
638 (print-pokemon-data @current-state pokemon-num)))
645 (defn pika-lvl-100-DV-0 []
646 (read-state "at-pc-lv-100-pikachu"))
648 ;; Performed following experiment:
649 ;; Raised Pikachu to Lvl 100 with rare-candies,
650 ;; then put it at the head of the party and
651 ;; set 0xD185 and 0xD186 to zero.
653 ;; then, for each pattern, deposited pikachu into
654 ;; Box 1 and immediately widthdrew it and observed the
655 ;; stats.
658 ;; Pikachu L:100 Base Stats with DVs = 0
659 ;; HP : 187
660 ;; Attack : 123
661 ;; Defense : 73
662 ;; Speed : 194
663 ;; Special : 112
665 ;; 0xD185:
667 ;; 00000001
668 ;; Defense => 75 (+2)
669 ;; HP => 195 (+8)
671 ;; 00000010
672 ;; Defense => 77 (+4)
674 ;; 00000100
675 ;; Defense => 81 (+8)
677 ;; 00001000
678 ;; Defense => 89 (+16)
680 ;; 00010000
681 ;; HP => 203 (+16)
682 ;; Attack => 125 (+2)
684 ;; 00100000
685 ;; Attack => 127 (+4)
687 ;; 01000000
688 ;; Attack -> 131 (+8)
690 ;; 10000000
691 ;; Attack -> 139 (+16)
693 ;; 0xD186
695 ;; 00000001
696 ;; HP => 189 (+2)
697 ;; Special => (+2)
699 ;; 00000010
700 ;; Special => 116 (+4)
702 ;; 00000100
703 ;; Special => 120 (+8)
705 ;; 00001000
706 ;; Special => 128 (+16)
708 ;; 00010000
709 ;; HP => 191 (+4)
710 ;; Speed => 196 (+2)
712 ;; 00100000
713 ;; Speed => 198 (+4)
715 ;; 01000000
716 ;; Speed => 202 (+8)
718 ;; 10000000
719 ;; Speed => 210 (+16)
722 ;; investigating status effects
724 ;; status of pokemon 1 appears to be
725 ;; 0xD16E
727 ;; with pidgeot
728 ;; 00000000 -- normal
729 ;; 00000001 -- sleep (wake-immediately)
730 ;; 00000010 -- sleep
731 ;; 00000100 -- sleep
732 ;; 00001000 -- poisoned
733 ;; 00010000 -- burned
734 ;; 00100000 -- frozen
735 ;; 01000000 -- paralyzed
736 ;; 10000000 -- ball is dark, but no status
738 ;; with pikachu
739 ;; 00000000 -- normal
740 ;; 00000001 -- sleep (1 turn wasted) \
741 ;; 00000010 -- sleep (2 turns wasted) |-- additive
742 ;; 00000100 -- sleep (3 turns wasted) /
743 ;; 00001000 -- poisoned
744 ;; 00010000 -- burned
745 ;; 00100000 -- frozen
746 ;; 01000000 -- paralyzed
747 ;; 10000000 -- ball is dark, but no status