# HG changeset patch # User Robert McIntyre # Date 1332495376 18000 # Node ID 32ac21c9a30d9bd192dd287f3f15c1b34ba230bb # Parent 28d35c9e3ab6ff8205cb239f17c8e8d1d8581c58 augmented print-pokemon to report inconsistent types; fixed error in give-type diff -r 28d35c9e3ab6 -r 32ac21c9a30d clojure/com/aurellem/gb/pokemon.clj --- a/clojure/com/aurellem/gb/pokemon.clj Fri Mar 23 04:25:17 2012 -0500 +++ b/clojure/com/aurellem/gb/pokemon.clj Fri Mar 23 04:36:16 2012 -0500 @@ -333,7 +333,13 @@ (str "(" (.substring (str (:species2 info)) 1) ")\n") - " that does not match its primary species.")))) + " that does not match its primary species.")) + (if (not= (:type info) (pokemon->type (:species info))) + (println "\n* This pokemon has a type" + (str (:type info)) + "which \n" + " is inconsistent with the default type for its" + "species.")))) ([poke-num] (print-pokemon @current-state poke-num))) @@ -416,9 +422,16 @@ [(first move) (merge {:pp (max-pp (first move)) :pp-up 0} (second move))])))))) - + ;; The game stores the pokemon's type redundantly + ;; along with the species. If it's not specified + ;; then it should default to that species default type. + ((fn [pokemon] + (if (nil? (:type pokemon)) + (assoc pokemon :type + (pokemon->type (:species pokemon))) + pokemon))) + - )) \ No newline at end of file diff -r 28d35c9e3ab6 -r 32ac21c9a30d clojure/com/aurellem/gb/types.clj --- a/clojure/com/aurellem/gb/types.clj Fri Mar 23 04:25:17 2012 -0500 +++ b/clojure/com/aurellem/gb/types.clj Fri Mar 23 04:36:16 2012 -0500 @@ -39,7 +39,7 @@ (set-memory-range state (pokemon-type-start-address poke-num) - (map type-name->type-code types)))) + (map type-name->type-code types*)))) ([poke-num types] (give-type @current-state poke-num types)))