comparison clojure/com/aurellem/gb/pokemon.clj @ 191:893c753f8088

added function to set ROM
author Robert McIntyre <rlm@mit.edu>
date Thu, 22 Mar 2012 20:10:09 -0500
parents 9a7a46c4aa1b
children fd549c8f42ae
comparison
equal deleted inserted replaced
190:9a7a46c4aa1b 191:893c753f8088
1 (ns com.aurellem.gb.pokemon 1 (ns com.aurellem.gb.pokemon
2 (:use (com.aurellem.gb gb-driver util constants characters 2 (:use (com.aurellem.gb gb-driver util constants characters
3 moves types items status dv species 3 moves types items status dv species
4 4 experience
5 )) 5 ))
6 (:import [com.aurellem.gb.gb_driver SaveState])) 6 (:import [com.aurellem.gb.gb_driver SaveState]))
7 7
8 (def pokemon-names-start 0xD2B4) 8 (def pokemon-names-start 0xD2B4)
9 9
32 (take 32 (take
33 (party-number state) 33 (party-number state)
34 (partition name-width 34 (partition name-width
35 raw-names))))) 35 raw-names)))))
36 ([] (party-names @current-state))) 36 ([] (party-names @current-state)))
37
38 (defn pokemon-nickname
39 ([^SaveState state poke-num]
40 (nth (party-names state) poke-num))
41 ([poke-num]
42 (pokemon-nickname @current-state poke-num)))
37 43
38 (defn rename-pokemon 44 (defn rename-pokemon
39 ([^SaveState state n new-name] 45 ([^SaveState state n new-name]
40 (assert (<= 0 n (dec (party-number state)))) 46 (assert (<= 0 n (dec (party-number state))))
41 (assert (<= (count new-name) max-name-length)) 47 (assert (<= (count new-name) max-name-length))
183 ([pokemon-num] 189 ([pokemon-num]
184 (print-pokemon-record @current-state pokemon-num))) 190 (print-pokemon-record @current-state pokemon-num)))
185 191
186 (def mint-berry-item-code-gsc 0x54) 192 (def mint-berry-item-code-gsc 0x54)
187 193
188 (defn pokemon-info [^SaveState state poke-num] 194 (defn pokemon-info
189 (assert (<= 0 poke-num 5)) 195 ([^SaveState state poke-num]
190 (let [dv-values (read-DV state poke-num) 196 (assert (<= 0 poke-num 5))
191 type (read-type state poke-num) 197 (let [dv-values (read-DV state poke-num)
192 species (read-species state poke-num) 198 type (read-type state poke-num)
193 199 species (read-species state poke-num)
194 ] 200 species2 (read-species2 state poke-num)
195 201 moves (read-moves state poke-num)
196 202 moves-pp (mapv (partial read-pp state
197 203 poke-num)
198 204 (range (count moves)))
199 )) 205 nickname (pokemon-nickname state poke-num)
206 status (read-status state poke-num)
207 experience (read-experience state poke-num)
208 ]
209
210 {:name nickname
211 :species species
212 :species2 species2
213 :type type
214 :dv dv-values
215 :moves (zipmap moves moves-pp)
216
217 :satus status
218 :experience experience
219 }
220 ))
221 ([poke-num]
222 (pokemon-info @current-state poke-num)))
223