comparison clojure/com/aurellem/gb/moves.clj @ 163:9c3769060201

fixed gb.moves
author Robert McIntyre <rlm@mit.edu>
date Tue, 20 Mar 2012 17:20:41 -0500
parents 34b518fc7404
children 9a7a46c4aa1b
comparison
equal deleted inserted replaced
162:34b518fc7404 163:9c3769060201
168 0xA2 :super-fang 168 0xA2 :super-fang
169 0xA3 :slash 169 0xA3 :slash
170 0xA4 :substitute 170 0xA4 :substitute
171 0xA5 :struggle}) 171 0xA5 :struggle})
172 172
173 (def moves-codes-pokemon-1 0xD172)
174
175 (defn moves-codes-start [pokemon-num]
176 (assert (<= 0 pokemon-num 5))
177 (+ moves-codes-pokemon-1
178 (* pokemon-num pokemon-record-width)))
179
173 (def move-name->move-code 180 (def move-name->move-code
174 (zipmap (vals move-code->move-name) 181 (zipmap (vals move-code->move-name)
175 (keys move-code->move-name))) 182 (keys move-code->move-name)))
176 183
177 (defn give-moves 184 (defn give-moves
236 (bit-shift-left pp-ups 6) 243 (bit-shift-left pp-ups 6)
237 (bit-and (Integer/parseInt 244 (bit-and (Integer/parseInt
238 "00111111" 2) 245 "00111111" 2)
239 current-pp)))) 246 current-pp))))
240 ([pokemon-num move-num pp-ups current-pp] 247 ([pokemon-num move-num pp-ups current-pp]
241 (set-pp @current-state 248 (give-pp @current-state
242 pokemon-num move-num pp-ups current-pp))) 249 pokemon-num move-num pp-ups current-pp)))