# HG changeset patch # User Dylan Holmes # Date 1332827983 18000 # Node ID a60ea8632ff4920277c87eb59d2c29942006484d # Parent 3266bd0a6300057cbe2d8034e8a12cfbf6cc56f0 beginning work on hxc-pokemon-base, the collection of base stats, battle sprite data, etc. diff -r 3266bd0a6300 -r a60ea8632ff4 clojure/com/aurellem/gb/hxc.clj --- a/clojure/com/aurellem/gb/hxc.clj Tue Mar 27 00:33:07 2012 -0500 +++ b/clojure/com/aurellem/gb/hxc.clj Tue Mar 27 00:59:43 2012 -0500 @@ -27,15 +27,15 @@ (def pkmn-types - [:normal - :fighting - :flying - :poison - :ground - :rock - :bird - :bug - :ghost + [:normal ;;0 + :fighting ;;1 + :flying ;;2 + :poison ;;3 + :ground ;;4 + :rock ;;5 + :bird ;;6 + :bug ;;7 + :ghost ;;8 :A :B :C @@ -47,13 +47,13 @@ :I :J :K - :fire - :water - :grass - :electric - :psychic - :ice - :dragon + :fire ;;20 (0x14) + :water ;;21 (0x15) + :grass ;;22 (0x16) + :electric ;;23 (0x17) + :psychic ;;24 (0x18) + :ice ;;25 (0x19) + :dragon ;;26 (0x1A) ]) @@ -203,10 +203,73 @@ (hxc-thunk-words 0xB8000 14754)) -;; In red/blue, pokemon are in internal order. -;; In yellow, pokemon are in pokedex order. + +(defn hxc-pokemon-base + ([] (hxc-pokemon-base com.aurellem.gb.gb-driver/original-rom)) + ([rom] + (let [entry-size 28 + pkmn-count (count (hxc-pokedex-text rom)) + types (apply assoc {} + (interleave + (range) + pkmn-types)) ;;!! softcoded + moves (apply assoc {} + (interleave + (range) + (map format-name + (hxc-move-names rom)))) + + ] + (map + + (fn [[n + rating-hp + rating-atk + rating-def + rating-speed + rating-special + type-1 + type-2 + rarity + rating-xp + _ + ptr-pic-obverse-1 + ptr-pic-obverse-2 + ptr-pic-reverse-1 + ptr-pic-reverse-2 + move-1 + move-2 + move-3 + move-4 + & + TMs]] + {:dex# n + :base-moves + (mapv moves + ((comp + ;; since the game uses zero as a delimiter, + ;; it must also increment all move indices by 1. + ;; here we decrement to correct this. + (partial map dec) + (partial take-while (comp not zero?))) + [move-1 move-2 move-3 move-4])) + + :types (set (list (types type-1) + (types type-2)))}) + + (partition entry-size + (take (* entry-size pkmn-count) + (drop 0x383DE + rom))))))) + + + +;; In red/blue, pokedex stats are in internal order. +;; In yellow, pokedex stats are in pokedex order. (defn hxc-pokedex-stats + "The hardcoded pokedex stats (species height weight) in memory. List +begins at ROM@40687" ;; uses hxc-pokedex-text to count pokemon ;; since hxc-pokenames includes several missingno" ([] (hxc-pokedex-stats com.aurellem.gb.gb-driver/original-rom)) diff -r 3266bd0a6300 -r a60ea8632ff4 clojure/com/aurellem/world/practice.clj --- a/clojure/com/aurellem/world/practice.clj Tue Mar 27 00:33:07 2012 -0500 +++ b/clojure/com/aurellem/world/practice.clj Tue Mar 27 00:59:43 2012 -0500 @@ -206,8 +206,8 @@ ([rom str k] (map (fn [[address snip]] - [address (character-codes->str snip)] - (search-rom rom (str->character-codes str) k))))) + [address (character-codes->str snip)]) + (search-rom rom (str->character-codes str) k))))