diff clojure/com/aurellem/gb/pokemon.clj @ 191:893c753f8088

added function to set ROM
author Robert McIntyre <rlm@mit.edu>
date Thu, 22 Mar 2012 20:10:09 -0500
parents 9a7a46c4aa1b
children fd549c8f42ae
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/pokemon.clj	Thu Mar 22 16:34:10 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/pokemon.clj	Thu Mar 22 20:10:09 2012 -0500
     1.3 @@ -1,7 +1,7 @@
     1.4  (ns com.aurellem.gb.pokemon
     1.5    (:use (com.aurellem.gb gb-driver util constants characters
     1.6                           moves types items status dv species
     1.7 -
     1.8 +                         experience
     1.9                           ))
    1.10    (:import [com.aurellem.gb.gb_driver SaveState]))
    1.11  
    1.12 @@ -35,6 +35,12 @@
    1.13                     raw-names)))))
    1.14    ([] (party-names @current-state)))
    1.15  
    1.16 +(defn pokemon-nickname
    1.17 +  ([^SaveState state poke-num]
    1.18 +     (nth (party-names state) poke-num))
    1.19 +  ([poke-num]
    1.20 +     (pokemon-nickname @current-state poke-num)))
    1.21 +
    1.22  (defn rename-pokemon
    1.23    ([^SaveState state n new-name]
    1.24       (assert (<= 0 n (dec (party-number state))))
    1.25 @@ -185,15 +191,33 @@
    1.26  
    1.27  (def mint-berry-item-code-gsc 0x54)
    1.28  
    1.29 -(defn pokemon-info [^SaveState state poke-num]
    1.30 -  (assert (<= 0 poke-num 5))
    1.31 -  (let [dv-values (read-DV state poke-num)
    1.32 -        type (read-type state poke-num)
    1.33 -        species (read-species state poke-num)
    1.34 -        
    1.35 -        ]
    1.36 +(defn pokemon-info
    1.37 +  ([^SaveState state poke-num]
    1.38 +     (assert (<= 0 poke-num 5))
    1.39 +     (let [dv-values (read-DV state poke-num)
    1.40 +           type (read-type state poke-num)
    1.41 +           species (read-species state poke-num)
    1.42 +           species2 (read-species2 state poke-num)
    1.43 +           moves (read-moves state poke-num)
    1.44 +           moves-pp (mapv (partial read-pp state
    1.45 +                                   poke-num)
    1.46 +                          (range (count moves)))
    1.47 +           nickname (pokemon-nickname state poke-num)
    1.48 +           status (read-status state poke-num)
    1.49 +           experience (read-experience state poke-num)
    1.50 +           ]
    1.51  
    1.52 -       
    1.53 +       {:name nickname
    1.54 +        :species species
    1.55 +        :species2 species2
    1.56 +        :type type
    1.57 +        :dv dv-values
    1.58 +        :moves (zipmap moves moves-pp)
    1.59  
    1.60 -
    1.61 -    ))
    1.62 +        :satus status
    1.63 +        :experience experience
    1.64 +        }
    1.65 +       ))
    1.66 +  ([poke-num]
    1.67 +     (pokemon-info @current-state poke-num)))
    1.68 +