Mercurial > vba-clojure
view clojure/com/aurellem/gb/types.clj @ 204:43bb461a7419
constructing default types....
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 23 Mar 2012 04:19:38 -0500 |
parents | 85a2c2e2d318 |
children | 28d35c9e3ab6 |
line wrap: on
line source
1 (ns com.aurellem.gb.types2 (:use (com.aurellem.gb gb-driver util constants))3 (:import [com.aurellem.gb.gb_driver SaveState]))5 (def type-code->type-name6 {0x00 :normal7 0x01 :fighting8 0x02 :flying9 0x03 :poision10 0x04 :ground11 0x05 :rock12 0x07 :bug13 0x08 :ghost14 0x14 :fire15 0x15 :water16 0x16 :grass17 0x17 :electric18 0x18 :psychic19 0x19 :ice20 0x1A :dragon })22 (def type-name->type-code23 (zipmap (vals type-code->type-name)24 (keys type-code->type-name)))26 (def pokemon-1-type-start-address 0xD16F)28 (defn pokemon-type-start-address [poke-num]29 (+ pokemon-1-type-start-address30 (* pokemon-record-width poke-num)))32 (defn give-type33 ([^SaveState state poke-num types]34 (assert (<= 0 poke-num 5))35 (let [types*36 (if (= (count types) 1)37 [(first types) (first types)]38 types)]39 (set-memory-range40 state41 (pokemon-type-start-address poke-num)42 (map type-name->type-code types))))43 ([poke-num types]44 (give-type @current-state poke-num types)))46 (defn read-type47 ([^SaveState state poke-num]48 (assert (<= 0 poke-num 5))49 (let [types-start (pokemon-type-start-address poke-num)50 [type-1 type-2]51 (subvec (vec (memory state))52 types-start (+ 2 types-start))]53 (if (= type-1 type-2)54 [(type-code->type-name type-1)]55 (mapv type-code->type-name [type-1 type-2]))))56 ([poke-num]57 (read-type @current-state poke-num)))61 :normal nor62 :fighting fig63 :flying fly64 :poision poi65 :ground gro66 :rock roc67 :bug bug68 :ghost gho69 :fire fir70 :water wat71 :grass gra72 :electric ele73 :psychic psy74 :ice ice75 :dragon dra79 (def pokemon->type80 {81 :abra psy82 :aerodactyl rck fly83 :alakazam psy84 :arbok poi85 :arcanine fir86 :articuno ice fly87 :beedrill bug poi88 :bellsprout gra poi89 :blastoise wat90 :bulbasaur gra poi91 :butterfree bug fly92 :caterpie bug93 :chansey nor94 :charizard fir fly95 :charmander fir96 :charmeleon fir97 :clefable nor98 :clefairy nor99 :cloyster wat ice100 :cubone gro101 :dewgong wat ice102 :diglett gro103 :ditto nor104 :dodrio nor fly105 :doduo nor fly106 :dragonair drg107 :dragonite drg fly108 :dratini drg109 :drowzee psy110 :dugtrio gro111 :eevee nor112 :ekans poi113 :electabuzz ele114 :electrode ele115 :exeggcute gra psy116 :exeggutor gra psy117 :farfetchd nor fly118 :fearow nor fly119 :flareon fir120 :gastly gho poi121 :gengar gho poi122 :geodude rck gro123 :gloom gra poi124 :golbat poi fly125 :goldeen wat126 :golduck wat127 :golem rck gro128 :graveler rck gro129 :grimer poi130 :growlithe fir131 :gyarados wat fly132 :haunter gho poi133 :hitmonchan fgt134 :hitmonlee fgt135 :horsea wat136 :hypno psy137 :ivysaur gra poi138 :jigglypuff nor139 :jolteon ele140 :jynx ice psy141 :kabuto rck wat142 :kabutops rck wat143 :kadabra psy144 :kakuna bug poi145 :kangaskhan nor146 :kingler wat147 :koffing poi148 :krabby wat149 :lapras wat ice150 :lickitung nor151 :machamp fgt152 :machoke fgt153 :machop fgt154 :magikarp wat155 :magmar fir156 :magnemite ele157 :magneton ele158 :mankey fgt159 :marowak gro160 :meowth nor161 :metapod bug162 :mew psy163 :mewtwo psy164 :moltres fir fly165 :mr-mime psy166 :muk poi167 :nidoking poi gro168 :nidoqueen poi gro169 :nidoran-female poi170 :nidoran-male poi171 :nidorina poi172 :nidorino poi173 :ninetails fir174 :oddish gra poi175 :omanyte rck wat176 :omastar rck wat177 :onix rck gro178 :paras bug gra179 :parasect bug gra180 :persian nor181 :pidgeot nor fly182 :pidgeotto nor fly183 :pidgey nor fly184 :pikachu ele185 :pinsir bug186 :poliwag wat187 :poliwhirl wat188 :poliwrath wat fgt189 :ponyta fir190 :porygon nor191 :primeape fgt192 :psyduck wat193 :raichu ele194 :rapidash fir195 :raticate nor196 :rattata nor197 :rhydon gro rck198 :rhyhorn gro rck199 :sandshrew gro200 :sandslash gro201 :scyther bug fly202 :seaking wat203 :sedra wat204 :seel wat205 :shellder wat206 :slowbro wat psy207 :slowpoke wat psy208 :snorlax nor209 :spearow nor fly210 :squirtle wat211 :starmie wat psy212 :staryu wat213 :tangela gra214 :tauros nor215 :tentacool wat poi216 :tentacruel wat poi217 :vaporeon wat218 :venomoth bug poi219 :venonat bug poi220 :venusaur gra poi221 :victreebel gra poi222 :vileplume gra poi223 :voltorb ele224 :vulpix fir225 :wartortle wat226 :weedle bug poi227 :weepenbell gra poi228 :wheezing poi229 :wigglytuff nor230 :zapdos ele fly231 :zubat poi fly