view clojure/com/aurellem/gb/hxc.clj @ 295:d35683bfc15f

dylan thought of a better program using op 0x70.
author Robert McIntyre <rlm@mit.edu>
date Fri, 30 Mar 2012 18:25:02 -0500
parents c31cb3043087
children 2873f50b7291
line wrap: on
line source
1 (ns com.aurellem.gb.hxc
2 (:use (com.aurellem.gb assembly characters gb-driver util
3 constants species))
4 ;; (:use (com.aurellem.world practice))
5 (:import [com.aurellem.gb.gb_driver SaveState]))
10 ; ************* HANDWRITTEN CONSTANTS
14 (def pkmn-types
15 [:normal ;;0
16 :fighting ;;1
17 :flying ;;2
18 :poison ;;3
19 :ground ;;4
20 :rock ;;5
21 :bird ;;6
22 :bug ;;7
23 :ghost ;;8
24 :A
25 :B
26 :C
27 :D
28 :E
29 :F
30 :G
31 :H
32 :I
33 :J
34 :K
35 :fire ;;20 (0x14)
36 :water ;;21 (0x15)
37 :grass ;;22 (0x16)
38 :electric ;;23 (0x17)
39 :psychic ;;24 (0x18)
40 :ice ;;25 (0x19)
41 :dragon ;;26 (0x1A)
42 ])
45 ;; question: when status effects claim to take
46 ;; their accuracy from the move accuracy, does
47 ;; this mean that the move always "hits" but the
48 ;; status effect may not?
50 (def move-effects
51 ["normal damage"
52 "no damage, just opponent sleep" ;; how many turns? is atk power ignored?
53 "0x4C chance of poison"
54 "leech half of inflicted damage"
55 "0x19 chance of burn"
56 "0x19 chance of freeze"
57 "0x19 chance of paralyze"
58 "user faints; opponent defense halved during attack."
59 "leech half of inflicted damage ONLY if sleeping opponent."
60 "imitate last attack"
61 "user atk +1"
62 "user def +1"
63 "user spd +1"
64 "user spc +1"
65 "user acr +1" ;; unused?!
66 "user evd +1"
67 "get post-battle $ = 2*level*uses"
68 "0xFE acr, no matter what."
69 "opponent atk -1" ;; acr taken from move acr?
70 "opponent def -1" ;;
71 "opponent spd -1" ;;
72 "opponent spc -1" ;;
73 "opponent acr -1";;
74 "opponent evd -1"
75 "converts user's type to opponent's."
76 "(haze)"
77 "(bide)"
78 "(thrash)"
79 "(teleport)"
80 "(fury swipes)"
81 "attacks 2-5 turns" ;; unused? like rollout?
82 "0x19 chance of flinch"
83 "opponent sleep for 1-7 turns"
84 "0x66 chance of poison"
85 "0x4D chance of burn"
86 "0x4D chance of freeze"
87 "0x4D chance of paralyze"
88 "0x4D chance of flinch"
89 "one-hit KO"
90 "charge one turn, atk next."
91 "fixed damage, leaves 1HP." ;; how is dmg determined?
92 "fixed damage." ;; cf seismic toss, dragon rage, psywave.
93 "atk 2-5 turns; opponent can't attack" ;; unnormalized? (0 0x60 0x60 0x20 0x20)
94 "charge one turn, atk next. (can't be hit when charging)"
95 "atk hits twice."
96 "user takes 1 damage if misses."
97 "evade status-lowering effects" ;;caused by you or also your opponent?
98 "(broken) if user is slower than opponent, makes critical hit impossible, otherwise has no effect"
99 "atk causes recoil dmg = 1/4 dmg dealt"
100 "confuses opponent" ;; acr taken from move acr
101 "user atk +2"
102 "user def +2"
103 "user spd +2"
104 "user spc +2"
105 "user acr +2" ;; unused!
106 "user evd +2" ;; unused!
107 "restores up to half of user's max hp." ;; broken: fails if the difference
108 ;; b/w max and current hp is one less than a multiple of 256.
109 "(transform)"
110 "opponent atk -2"
111 "opponent def -2"
112 "opponent spd -2"
113 "opponent spc -2"
114 "opponent acr -2"
115 "opponent evd -2"
116 "doubles user spc when attacked"
117 "doubles user def when attacked"
118 "just poisons opponent" ;;acr taken from move acr
119 "just paralyzes opponent" ;;
120 "0x19 chance opponent atk -1"
121 "0x19 chance opponent def -1"
122 "0x19 chance opponent spd -1"
123 "0x4C chance opponent spc -1" ;; context suggest chance is 0x19
124 "0x19 chance opponent acr -1"
125 "0x19 chance opponent evd -1"
126 "???" ;; unused? no effect?
127 "???" ;; unused? no effect?
128 "0x19 chance opponent confused"
129 "atk hits twice. 0x33 chance opponent poisioned."
130 "broken. crash the game after attack."
131 "(substitute)"
132 "unless opponent faints, user must recharge after atk. some
133 exceptions apply."
134 "(rage)"
135 "(mimic)"
136 "(metronome)"
137 "(leech seed)"
138 "does nothing (splash)"
139 "(disable)"
140 ])
143 ;; ************** HARDCODED DATA
145 (defn hxc-thunk
146 "Creates a thunk (nullary fn) that grabs data in a certain region of rom and
147 splits it into a collection by 0x50. If rom is not supplied, uses the
148 original rom data."
149 [start length]
150 (fn self
151 ([rom]
152 (take-nth 2
153 (partition-by #(= % 0x50)
154 (take length
155 (drop start rom)))))
156 ([]
157 (self com.aurellem.gb.gb-driver/original-rom))))
159 (def hxc-thunk-words
160 "Same as hxc-thunk, except it interprets the rom data as characters,
161 returning a collection of strings."
162 (comp
163 (partial comp (partial map character-codes->str))
164 hxc-thunk))
167 ;; --------------------------------------------------
171 (defn hxc-pokenames-raw
172 "The hardcoded names of the 190 species in memory. List begins at
173 ROM@E8000. Although names in memory are padded with 0x50 to be 10 characters
174 long, these names are stripped of padding. See also, hxc-pokedex-names"
175 ([]
176 (hxc-pokenames-raw com.aurellem.gb.gb-driver/original-rom))
177 ([rom]
178 (let [count-species 190
179 name-length 10]
180 (map character-codes->str
181 (partition name-length
182 (map #(if (= 0x50 %) 0x00 %)
183 (take (* count-species name-length)
184 (drop 0xE8000
185 rom))))))))
186 (def hxc-pokenames
187 (comp
188 (partial map format-name)
189 hxc-pokenames-raw))
194 (defn hxc-pokedex-names
195 "The names of the pokemon in hardcoded pokedex order. List begins at
196 ROM@410B1. See also, hxc-pokenames."
197 ([] (hxc-pokedex-names
198 com.aurellem.gb.gb-driver/original-rom))
199 ([rom]
200 (let [names (hxc-pokenames rom)]
201 (#(mapv %
202 ((comp range count keys) %))
203 (zipmap
204 (take (count names)
205 (drop 0x410b1 rom))
207 names)))))
212 (def hxc-items-raw
213 "The hardcoded names of the items in memory. List begins at
214 ROM@045B7"
215 (hxc-thunk-words 0x45B7 870))
217 (def hxc-types
218 "The hardcoded type names in memory. List begins at ROM@27D99,
219 shortly before hxc-titles."
220 (hxc-thunk-words 0x27D99 102))
222 (def hxc-titles
223 "The hardcoded names of the trainer titles in memory. List begins at
224 ROM@27E77"
225 (hxc-thunk-words 0x27E77 196))
228 (def hxc-pokedex-text-raw
229 "The hardcoded pokedex entries in memory. List begins at
230 ROM@B8000, shortly before move names."
231 (hxc-thunk-words 0xB8000 14754))
235 (def hxc-items
236 "The hardcoded names of the items in memory, presented as
237 keywords. List begins at ROM@045B7. See also, hxc-items-raw."
238 (comp (partial map format-name) hxc-items-raw))
240 (defn hxc-pokedex-text
241 "The hardcoded pokedex entries in memory, presented as an
242 associative hash map. List begins at ROM@B8000."
243 ([] (hxc-pokedex-text com.aurellem.gb.gb-driver/original-rom))
244 ([rom]
245 (zipmap
246 (hxc-pokedex-names rom)
247 (cons nil ;; for missingno.
248 (hxc-pokedex-text-raw rom)))))
250 ;; In red/blue, pokedex stats are in internal order.
251 ;; In yellow, pokedex stats are in pokedex order.
253 (defn hxc-pokedex-stats
254 "The hardcoded pokedex stats (species height weight) in memory. List
255 begins at ROM@40687"
256 ([] (hxc-pokedex-stats com.aurellem.gb.gb-driver/original-rom))
257 ([rom]
258 (let [pokedex-names (zipmap (range) (hxc-pokedex-names rom))
259 pkmn-count (count pokedex-names)
260 ]
261 ((fn capture-stats
262 [n stats data]
263 (if (zero? n) stats
264 (let [[species
265 [_
266 height-ft
267 height-in
268 weight-1
269 weight-2
270 _
271 dex-ptr-1
272 dex-ptr-2
273 dex-bank
274 _
275 & data]]
276 (split-with (partial not= 0x50) data)]
277 (recur (dec n)
278 (assoc stats
279 (pokedex-names (- pkmn-count (dec n)))
280 {:species
281 (format-name (character-codes->str species))
282 :height-ft
283 height-ft
284 :height-in
285 height-in
286 :weight
287 (/ (low-high weight-1 weight-2) 10.)
289 ;; :text
290 ;; (character-codes->str
291 ;; (take-while
292 ;; (partial not= 0x50)
293 ;; (drop
294 ;; (+ 0xB8000
295 ;; -0x4000
296 ;; (low-high dex-ptr-1 dex-ptr-2))
297 ;; rom)))
298 })
300 data)
303 )))
305 pkmn-count
306 {}
307 (drop 0x40687 rom))) ))
315 (def hxc-places
316 "The hardcoded place names in memory. List begins at
317 ROM@71500. [Cinnabar] Mansion seems to be dynamically calculated."
318 (hxc-thunk-words 0x71500 560))
321 (defn hxc-dialog
322 "The hardcoded dialogue in memory, including in-game alerts. Dialog
323 seems to be separated by 0x57 instead of 0x50 (END). Begins at ROM@98000."
324 ([rom]
325 (map character-codes->str
326 (take-nth 2
327 (partition-by #(= % 0x57)
328 (take 0x0F728
329 (drop 0x98000 rom))))))
330 ([]
331 (hxc-dialog com.aurellem.gb.gb-driver/original-rom)))
334 (def hxc-move-names
335 "The hardcoded move names in memory. List begins at ROM@BC000"
336 (hxc-thunk-words 0xBC000 1551))
339 (defn hxc-move-data
340 "The hardcoded (basic (move effects)) in memory. List begins at
341 0x38000. Returns a map of {:name :power :accuracy :pp :fx-id
342 :fx-txt}. The move descriptions are handwritten, not hardcoded."
343 ([]
344 (hxc-move-data com.aurellem.gb.gb-driver/original-rom))
345 ([rom]
346 (let [names (vec (hxc-move-names rom))
347 move-count (count names)
348 move-size 6
349 types pkmn-types ;;; !! hardcoded types
350 ]
351 (zipmap (map format-name names)
352 (map
353 (fn [[idx effect power type-id accuracy pp]]
354 {:name (names (dec idx))
355 :power power
356 :accuracy accuracy
357 :pp pp
358 :type (types type-id)
359 :fx-id effect
360 :fx-txt (get move-effects effect)
361 }
362 )
364 (partition move-size
365 (take (* move-size move-count)
366 (drop 0x38000 rom))))))))
370 (defn hxc-move-data*
371 "Like hxc-move-data, but reports numbers as hexadecimal symbols instead."
372 ([]
373 (hxc-move-data* com.aurellem.gb.gb-driver/original-rom))
374 ([rom]
375 (let [names (vec (hxc-move-names rom))
376 move-count (count names)
377 move-size 6
378 format-name (fn [s]
379 (keyword (.toLowerCase
380 (apply str
381 (map #(if (= % \space) "-" %) s)))))
382 ]
383 (zipmap (map format-name names)
384 (map
385 (fn [[idx effect power type accuracy pp]]
386 {:name (names (dec idx))
387 :power power
388 :accuracy (hex accuracy)
389 :pp pp
390 :fx-id (hex effect)
391 :fx-txt (get move-effects effect)
392 }
393 )
395 (partition move-size
396 (take (* move-size move-count)
397 (drop 0x38000 rom))))))))
400 (defn hxc-machines
401 "The hardcoded moves taught by TMs and HMs. List begins at ROM@0x1232D."
402 ([] (hxc-machines
403 com.aurellem.gb.gb-driver/original-rom))
404 ([rom]
405 (let [moves (hxc-move-names rom)]
406 (zipmap
407 (range)
408 (take-while
409 (comp not nil?)
410 (map (comp
411 format-name
412 (zipmap
413 (range)
414 moves)
415 dec)
416 (take 100
417 (drop 0x1232D rom))))))))
421 (defn internal-id
422 ([rom]
423 (zipmap
424 (hxc-pokenames rom)
425 (range)))
426 ([]
427 (internal-id com.aurellem.gb.gb-driver/original-rom)))
433 ;; nidoran gender change upon levelup
434 ;; (->
435 ;; @current-state
436 ;; rom
437 ;; vec
438 ;; (rewrite-memory
439 ;; (nth (hxc-ptrs-evolve) ((internal-id) :nidoran♂))
440 ;; [1 1 15])
441 ;; (rewrite-memory
442 ;; (nth (hxc-ptrs-evolve) ((internal-id) :nidoran♀))
443 ;; [1 1 3])
444 ;; (write-rom!)
446 ;; )
451 (defn hxc-advantage
452 ;; in-game multipliers are stored as 10x their effective value
453 ;; to allow for fractional multipliers like 1/2
455 "The hardcoded type advantages in memory, returned as tuples of
456 atk-type def-type multiplier. By default (i.e. if not listed here),
457 the multiplier is 1. List begins at 0x3E62D."
458 ([] (hxc-advantage com.aurellem.gb.gb-driver/original-rom))
459 ([rom]
460 (map
461 (fn [[atk def mult]] [(get pkmn-types atk (hex atk))
462 (get pkmn-types def (hex def))
463 (/ mult 10)])
464 (partition 3
465 (take-while (partial not= 0xFF)
466 (drop 0x3E62D rom))))))
470 (defn format-evo
471 [coll]
472 (let [method (first coll)]
473 (cond (empty? coll) []
474 (= 0 method) [] ;; just in case
475 (= 1 method) ;; level-up evolution
476 (conj (format-evo (drop 3 coll))
477 {:method :level-up
478 :min-level (nth coll 1)
479 :into (dec (nth coll 2))})
481 (= 2 method) ;; item evolution
482 (conj (format-evo (drop 4 coll))
483 {:method :item
484 :item (dec (nth coll 1))
485 :min-level (nth coll 2)
486 :into (dec (nth coll 3))})
488 (= 3 method) ;; trade evolution
489 (conj (format-evo (drop 3 coll))
490 {:method :trade
491 :min-level (nth coll 1) ;; always 1 for trade.
492 :into (dec (nth coll 2))}))))
495 (defn hxc-ptrs-evolve
496 "A hardcoded collection of 190 pointers to alternating evolution/learnset data,
497 in internal order."
498 ([]
499 (hxc-ptrs-evolve com.aurellem.gb.gb-driver/original-rom))
500 ([rom]
501 (let [
502 pkmn-count (count (hxc-pokenames-raw)) ;; 190
503 ptrs
504 (map (fn [[a b]] (low-high a b))
505 (partition 2
506 (take (* 2 pkmn-count)
507 (drop 0x3b1e5 rom))))]
508 (map (partial + 0x34000) ptrs)
510 )))
513 (defn hxc-learnsets
514 "Hardcoded map associating pokemon names to lists of pairs [lvl
515 move] of abilities they learn as they level up. The data
516 exists at ROM@3400, sorted by internal order. Pointers to the data
517 exist at ROM@3B1E5; see also, hxc-ptrs-evolve"
518 ([] (hxc-learnsets com.aurellem.gb.gb-driver/original-rom))
519 ([rom]
520 (apply assoc
521 {}
522 (interleave
523 (hxc-pokenames rom)
524 (map (comp
525 (partial map
526 (fn [[lvl mv]] [lvl (dec mv)]))
527 (partial partition 2)
528 ;; keep the learnset data
529 (partial take-while (comp not zero?))
530 ;; skip the evolution data
531 rest
532 (partial drop-while (comp not zero?)))
533 (map #(drop % rom)
534 (hxc-ptrs-evolve rom)))))))
536 (defn hxc-learnsets-pretty
537 "Live hxc-learnsets except it reports the name of each move --- as
538 it appears in rom --- rather than the move index."
539 ([] (hxc-learnsets-pretty com.aurellem.gb.gb-driver/original-rom))
540 ([rom]
541 (let [moves (vec(map format-name (hxc-move-names)))]
542 (into {}
543 (map (fn [[pkmn learnset]]
544 [pkmn (map (fn [[lvl mv]] [lvl (moves mv)])
545 learnset)])
546 (hxc-learnsets rom))))))
551 (defn hxc-evolution
552 "Hardcoded evolution data in memory. The data exists at ROM@34000,
553 sorted by internal order. Pointers to the data exist at ROM@3B1E5; see also, hxc-ptrs-evolve."
554 ([] (hxc-evolution com.aurellem.gb.gb-driver/original-rom))
555 ([rom]
556 (apply assoc {}
557 (interleave
558 (hxc-pokenames rom)
559 (map
560 (comp
561 format-evo
562 (partial take-while (comp not zero?))
563 #(drop % rom))
564 (hxc-ptrs-evolve rom)
565 )))))
567 (defn hxc-evolution-pretty
568 "Like hxc-evolution, except it uses the names of items and pokemon
569 --- grabbed from ROM --- rather than their numerical identifiers."
570 ([] (hxc-evolution-pretty com.aurellem.gb.gb-driver/original-rom))
571 ([rom]
572 (let
573 [poke-names (vec (hxc-pokenames rom))
574 item-names (vec (hxc-items rom))
575 use-names
576 (fn [m]
577 (loop [ks (keys m) new-map m]
578 (let [k (first ks)]
579 (cond (nil? ks) new-map
580 (= k :into)
581 (recur
582 (next ks)
583 (assoc new-map
584 :into
585 (poke-names
586 (:into
587 new-map))))
588 (= k :item)
589 (recur
590 (next ks)
591 (assoc new-map
592 :item
593 (item-names
594 (:item new-map))))
595 :else
596 (recur
597 (next ks)
598 new-map)
599 ))))]
601 (into {}
602 (map (fn [[pkmn evo-coll]]
603 [pkmn (map use-names evo-coll)])
604 (hxc-evolution rom))))))
607 (defn hxc-pokemon-base
608 ([] (hxc-pokemon-base com.aurellem.gb.gb-driver/original-rom))
609 ([rom]
610 (let [entry-size 28
611 pkmn-count (count (hxc-pokedex-text rom))
612 pokemon (rest (hxc-pokedex-names))
613 types (apply assoc {}
614 (interleave
615 (range)
616 pkmn-types)) ;;!! softcoded
617 moves (apply assoc {}
618 (interleave
619 (range)
620 (map format-name
621 (hxc-move-names rom))))
622 machines (hxc-machines)
623 ]
624 (zipmap
625 pokemon
626 (map
627 (fn [[n
628 rating-hp
629 rating-atk
630 rating-def
631 rating-speed
632 rating-special
633 type-1
634 type-2
635 rarity
636 rating-xp
637 pic-dimensions ;; tile_width|tile_height (8px/tile)
638 ptr-pic-obverse-1
639 ptr-pic-obverse-2
640 ptr-pic-reverse-1
641 ptr-pic-reverse-2
642 move-1
643 move-2
644 move-3
645 move-4
646 growth-rate
647 &
648 TMs|HMs]]
649 (let
650 [base-moves
651 (mapv moves
652 ((comp
653 ;; since the game uses zero as a delimiter,
654 ;; it must also increment all move indices by 1.
655 ;; heren we decrement to correct this.
656 (partial map dec)
657 (partial take-while (comp not zero?)))
658 [move-1 move-2 move-3 move-4]))
660 types
661 (set (list (types type-1)
662 (types type-2)))
663 TMs|HMs
664 (map
665 (comp
666 (partial map first)
667 (partial remove (comp zero? second)))
668 (split-at
669 50
670 (map vector
671 (rest(range))
672 (reduce concat
673 (map
674 #(take 8
675 (concat (bit-list %)
676 (repeat 0)))
678 TMs|HMs)))))
680 TMs (vec (first TMs|HMs))
681 HMs (take 5 (map (partial + -50) (vec (second TMs|HMs))))
684 ]
687 {:dex# n
688 :base-moves base-moves
689 :types types
690 :TMs TMs
691 :HMs HMs
692 :base-hp rating-hp
693 :base-atk rating-atk
694 :base-def rating-def
695 :base-speed rating-speed
696 :base-special rating-special
697 }))
699 (partition entry-size
700 (take (* entry-size pkmn-count)
701 (drop 0x383DE
702 rom))))))))
706 (defn hxc-item-prices
707 "The hardcoded list of item prices in memory. List begins at ROM@4495"
708 ([] (hxc-item-prices com.aurellem.gb.gb-driver/original-rom))
709 ([rom]
710 (let [items (hxc-items rom)
711 price-size 3]
712 (zipmap items
713 (map (comp
714 ;; zero-cost items are "priceless"
715 #(if (zero? %) :priceless %)
716 decode-bcd butlast)
717 (partition price-size
718 (take (* price-size (count items))
719 (drop 0x4495 rom))))))))
721 (defn hxc-shops
722 ([] (hxc-shops com.aurellem.gb.gb-driver/original-rom))
723 ([rom]
724 (let [items (zipmap (range) (hxc-items rom))
726 ;; temporarily softcode the TM items
727 items (into
728 items
729 (map (juxt identity
730 (comp keyword
731 (partial str "tm-")
732 (partial + 1 -200)
733 ))
734 (take 200 (drop 200 (range)))))
736 ]
738 ((fn parse-shop [coll [num-items & items-etc]]
739 (let [inventory (take-while
740 (partial not= 0xFF)
741 items-etc)
742 [separator & items-etc] (drop num-items (rest items-etc))]
743 (if (= separator 0x50)
744 (map (partial mapv (comp items dec)) (conj coll inventory))
745 (recur (conj coll inventory) items-etc)
746 )
747 ))
749 '()
750 (drop 0x233C rom))
753 )))
759 (defn hxc-ptrs-wild
760 "A list of the hardcoded wild encounter data in memory. Pointers
761 begin at ROM@0CB95; data begins at ROM@0x04D89"
762 ([] (hxc-ptrs-wild com.aurellem.gb.gb-driver/original-rom))
763 ([rom]
764 (let [ptrs
765 (map (fn [[a b]] (+ a (* 0x100 b)))
766 (take-while (partial not= (list 0xFF 0xFF))
767 (partition 2 (drop 0xCB95 rom))))]
768 ptrs)))
772 (defn hxc-wilds
773 "A list of the hardcoded wild encounter data in memory. Pointers
774 begin at ROM@0CB95; data begins at ROM@0x04D89"
775 ([] (hxc-wilds com.aurellem.gb.gb-driver/original-rom))
776 ([rom]
777 (let [pokenames (zipmap (range) (hxc-pokenames rom))]
778 (map
779 (partial map (fn [[a b]] {:species (pokenames (dec b)) :level
780 a}))
781 (partition 10
783 (take-while (comp (partial not= 1)
784 first)
785 (partition 2
786 (drop 0xCD8C rom))
788 ))))))
803 ;; ********************** MANIPULATION FNS
806 (defn same-type
807 ([pkmn move]
808 (same-type
809 com.aurellem.gb.gb-driver/original-rom pkmn move))
810 ([rom pkmn move]
811 (((comp :types (hxc-pokemon-base rom)) pkmn)
812 ((comp :type (hxc-move-data rom)) move))))
817 (defn submap?
818 "Compares the two maps. Returns true if map-big has the same associations as map-small, otherwise false."
819 [map-small map-big]
820 (cond (empty? map-small) true
821 (and
822 (contains? map-big (ffirst map-small))
823 (= (get map-big (ffirst map-small))
824 (second (first map-small))))
825 (recur (next map-small) map-big)
827 :else false))
830 (defn search-map [proto-map maps]
831 "Returns all the maps that make the same associations as proto-map."
832 (some (partial submap? proto-map) maps))
834 (defn filter-vals
835 "Returns a map consisting of all the pairs [key val] for
836 which (pred key) returns true."
837 [pred map]
838 (reduce (partial apply assoc) {}
839 (filter (fn [[k v]] (pred v)) map)))
842 (defn search-moves
843 "Returns a subcollection of all hardcoded moves with the
844 given attributes. Attributes consist of :name :power
845 :accuracy :pp :fx-id
846 (and also :fx-txt, but it contains the same information
847 as :fx-id)"
848 ([attribute-map]
849 (search-moves
850 com.aurellem.gb.gb-driver/original-rom attribute-map))
851 ([rom attribute-map]
852 (filter-vals (partial submap? attribute-map)
853 (hxc-move-data rom))))
859 ;; note: 0x2f31 contains the names "TM" "HM"?
861 ;; note for later: credits start at F1290
865 (comment
867 (def hxc-later
868 "Running this code produces, e.g. hardcoded names NPCs give
869 their pokemon. Will sort through it later."
870 (print (character-codes->str(take 10000
871 (drop 0x71597
872 (rom (root)))))))
874 (let [dex
875 (partition-by #(= 0x50 %)
876 (take 2540
877 (drop 0x40687
878 (rom (root)))))]
879 (def dex dex)
880 (def hxc-species
881 (map character-codes->str
882 (take-nth 4 dex))))
883 )