comparison clojure/com/aurellem/gb/pokemon.clj @ 206:32ac21c9a30d

augmented print-pokemon to report inconsistent types; fixed error in give-type
author Robert McIntyre <rlm@mit.edu>
date Fri, 23 Mar 2012 04:36:16 -0500
parents 85a2c2e2d318
children 45f1376b578c
comparison
equal deleted inserted replaced
205:28d35c9e3ab6 206:32ac21c9a30d
331 (if (not= (:species info) (:species2 info)) 331 (if (not= (:species info) (:species2 info))
332 (println "\n* This pokemon has a secondary species" 332 (println "\n* This pokemon has a secondary species"
333 (str 333 (str
334 "(" 334 "("
335 (.substring (str (:species2 info)) 1) ")\n") 335 (.substring (str (:species2 info)) 1) ")\n")
336 " that does not match its primary species.")))) 336 " that does not match its primary species."))
337 (if (not= (:type info) (pokemon->type (:species info)))
338 (println "\n* This pokemon has a type"
339 (str (:type info))
340 "which \n"
341 " is inconsistent with the default type for its"
342 "species."))))
337 ([poke-num] 343 ([poke-num]
338 (print-pokemon @current-state poke-num))) 344 (print-pokemon @current-state poke-num)))
339 345
340 (defn print-team [] 346 (defn print-team []
341 (dorun (map print-pokemon (range (party-number))))) 347 (dorun (map print-pokemon (range (party-number)))))
414 [move {:pp (max-pp move) :pp-up 0}] 420 [move {:pp (max-pp move) :pp-up 0}]
415 (vector? move) 421 (vector? move)
416 [(first move) 422 [(first move)
417 (merge {:pp (max-pp (first move)) 423 (merge {:pp (max-pp (first move))
418 :pp-up 0} (second move))])))))) 424 :pp-up 0} (second move))]))))))
419 425 ;; The game stores the pokemon's type redundantly
426 ;; along with the species. If it's not specified
427 ;; then it should default to that species default type.
428 ((fn [pokemon]
429 (if (nil? (:type pokemon))
430 (assoc pokemon :type
431 (pokemon->type (:species pokemon)))
432 pokemon)))
433
420 434
421
422 435
423 )) 436 ))
424 437