Mercurial > vba-clojure
changeset 195:1844bdd56314
working on printing pokemon in a nicely formatted way.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 22 Mar 2012 23:39:02 -0500 |
parents | da1a5ed61a8d |
children | 8dd17081829f |
files | clojure/com/aurellem/gb/pokemon.clj |
diffstat | 1 files changed, 72 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/pokemon.clj Thu Mar 22 22:37:35 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/pokemon.clj Thu Mar 22 23:39:02 2012 -0500 1.3 @@ -237,7 +237,78 @@ 1.4 })) 1.5 ([poke-num] 1.6 (pokemon-info @current-state poke-num))) 1.7 - 1.8 + 1.9 +(defn print-pokemon 1.10 + ([^SaveState state poke-num] 1.11 + (let [info (pokemon-info state poke-num)] 1.12 + (printf 1.13 + (str 1.14 + "##################################" 1.15 + "##################################\n" 1.16 + "# " 1.17 + " #\n" 1.18 + "# %-44s" 1.19 + "%-20s#\n" 1.20 + "# " 1.21 + " #\n" 1.22 + "##################################" 1.23 + "##################################\n\n") 1.24 + 1.25 + (str 1.26 + (:name info) 1.27 + (str 1.28 + " (" (.substring (str (:species info)) 1) ")") 1.29 + (str " Lvl." (format "%-3d" (:level (:stats info))))) 1.30 + (str (:original-trainer info) " / " (:ID info))) 1.31 + 1.32 + (println 1.33 + (str 1.34 + (str "-----------------------------------" 1.35 + "---------------------------------\n" ) 1.36 + (str "| Stats | HP | Attack " 1.37 + "| Defense | Speed | Special |\n") 1.38 + (str "+-----------+----------+----------" 1.39 + "+----------+----------+----------+"))) 1.40 + 1.41 + (printf 1.42 + (str "|%-11s| %5d | %5d " 1.43 + "| %5d | %5d | %5d |\n") 1.44 + "DV Values" (:hp (:dv info)) (:attack (:dv info)) 1.45 + (:defense (:dv info)) (:speed (:dv info)) 1.46 + (:special (:dv info))) 1.47 + 1.48 + (let [c (:stats info)] 1.49 + (printf 1.50 + (str "|%-11s| %5d | %5d " 1.51 + "| %5d | %5d | %5d |\n") 1.52 + "Current" (:hp c) (:attack c) 1.53 + (:defense c) (:speed c) 1.54 + (:special c))) 1.55 + 1.56 + (let [e (:experience info)] 1.57 + (printf 1.58 + (str "|%-11s| %5d | %5d " 1.59 + "| %5d | %5d | %5d |\n") 1.60 + "Experience" (:hp-exp e) (:attack-exp e) 1.61 + (:defense-exp e) (:speed-exp e) 1.62 + (:special-exp e))) 1.63 + (println 1.64 + (str "+-----------+----------+----------" 1.65 + "+----------+----------+----------+")) 1.66 + 1.67 + (print "\n") 1.68 + (println "+------------------+----+--------+--------+") 1.69 + (println "| Move | PP | Max PP | PP UPs |") 1.70 + 1.71 + 1.72 + (println "+------------------+----+--------+--------+") 1.73 + 1.74 + 1.75 + 1.76 + 1.77 + )) 1.78 + ([poke-num] 1.79 + (print-pokemon @current-state poke-num))) 1.80 1.81 (defn give-status-all 1.82 ([^SaveState state status]