diff 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
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/pokemon.clj	Fri Mar 23 04:25:17 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/pokemon.clj	Fri Mar 23 04:36:16 2012 -0500
     1.3 @@ -333,7 +333,13 @@
     1.4                    (str
     1.5                     "("
     1.6                     (.substring (str (:species2 info)) 1) ")\n")
     1.7 -                  "  that does not match its primary species."))))
     1.8 +                  "  that does not match its primary species."))
     1.9 +       (if (not= (:type info) (pokemon->type (:species info)))
    1.10 +         (println "\n* This pokemon has a type"
    1.11 +                  (str (:type info))
    1.12 +                  "which \n"
    1.13 +                  "  is inconsistent with the default type for its"
    1.14 +                  "species."))))
    1.15    ([poke-num]
    1.16       (print-pokemon @current-state poke-num)))
    1.17  
    1.18 @@ -416,9 +422,16 @@
    1.19                        [(first move)
    1.20                         (merge {:pp (max-pp (first move))
    1.21                                 :pp-up 0} (second move))]))))))
    1.22 -
    1.23 +      ;; The game stores the pokemon's type redundantly
    1.24 +      ;; along with the species.  If it's not specified
    1.25 +      ;; then it should default to that species default type.
    1.26 +      ((fn [pokemon]
    1.27 +         (if (nil? (:type pokemon))
    1.28 +           (assoc pokemon :type
    1.29 +                  (pokemon->type (:species pokemon)))
    1.30 +           pokemon)))
    1.31 +             
    1.32        
    1.33 -
    1.34        
    1.35        ))
    1.36        
    1.37 \ No newline at end of file