comparison clojure/com/aurellem/gb/pokemon.clj @ 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
comparison
equal deleted inserted replaced
193:da1a5ed61a8d 195:1844bdd56314
235 :stats stats 235 :stats stats
236 :experience experience 236 :experience experience
237 })) 237 }))
238 ([poke-num] 238 ([poke-num]
239 (pokemon-info @current-state poke-num))) 239 (pokemon-info @current-state poke-num)))
240 240
241 (defn print-pokemon
242 ([^SaveState state poke-num]
243 (let [info (pokemon-info state poke-num)]
244 (printf
245 (str
246 "##################################"
247 "##################################\n"
248 "# "
249 " #\n"
250 "# %-44s"
251 "%-20s#\n"
252 "# "
253 " #\n"
254 "##################################"
255 "##################################\n\n")
256
257 (str
258 (:name info)
259 (str
260 " (" (.substring (str (:species info)) 1) ")")
261 (str " Lvl." (format "%-3d" (:level (:stats info)))))
262 (str (:original-trainer info) " / " (:ID info)))
263
264 (println
265 (str
266 (str "-----------------------------------"
267 "---------------------------------\n" )
268 (str "| Stats | HP | Attack "
269 "| Defense | Speed | Special |\n")
270 (str "+-----------+----------+----------"
271 "+----------+----------+----------+")))
272
273 (printf
274 (str "|%-11s| %5d | %5d "
275 "| %5d | %5d | %5d |\n")
276 "DV Values" (:hp (:dv info)) (:attack (:dv info))
277 (:defense (:dv info)) (:speed (:dv info))
278 (:special (:dv info)))
279
280 (let [c (:stats info)]
281 (printf
282 (str "|%-11s| %5d | %5d "
283 "| %5d | %5d | %5d |\n")
284 "Current" (:hp c) (:attack c)
285 (:defense c) (:speed c)
286 (:special c)))
287
288 (let [e (:experience info)]
289 (printf
290 (str "|%-11s| %5d | %5d "
291 "| %5d | %5d | %5d |\n")
292 "Experience" (:hp-exp e) (:attack-exp e)
293 (:defense-exp e) (:speed-exp e)
294 (:special-exp e)))
295 (println
296 (str "+-----------+----------+----------"
297 "+----------+----------+----------+"))
298
299 (print "\n")
300 (println "+------------------+----+--------+--------+")
301 (println "| Move | PP | Max PP | PP UPs |")
302
303
304 (println "+------------------+----+--------+--------+")
305
306
307
308
309 ))
310 ([poke-num]
311 (print-pokemon @current-state poke-num)))
241 312
242 (defn give-status-all 313 (defn give-status-all
243 ([^SaveState state status] 314 ([^SaveState state status]
244 (reduce (fn [state num] 315 (reduce (fn [state num]
245 (give-status state num status)) 316 (give-status state num status))