changeset 203:85a2c2e2d318

have to add default types for all pokemon.
author Robert McIntyre <rlm@mit.edu>
date Fri, 23 Mar 2012 04:00:42 -0500
parents 1ce54929bc0c
children 43bb461a7419
files clojure/com/aurellem/gb/pokemon.clj clojure/com/aurellem/gb/species.clj clojure/com/aurellem/gb/types.clj
diffstat 3 files changed, 230 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/pokemon.clj	Fri Mar 23 03:31:49 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/pokemon.clj	Fri Mar 23 04:00:42 2012 -0500
     1.3 @@ -349,3 +349,76 @@
     1.4               (range (party-number state))))
     1.5    ([status]
     1.6       (give-status-all @current-state status)))
     1.7 +
     1.8 +
     1.9 +(def pokemon-base
    1.10 +  {:dv {:attack 15 :hp 15 :defense 15
    1.11 +        :special 15 :speed 15}
    1.12 +   :species :ditto
    1.13 +   :original-trainer "RLM"
    1.14 +   :ID 5195
    1.15 +   :status :normal
    1.16 +   :experience
    1.17 +   {:main-exp 500
    1.18 +    :attack-exp 0xFF
    1.19 +    :defense-exp 0xFF
    1.20 +    :speed-exp 0xFF
    1.21 +    :special-exp 0xFF
    1.22 +    :hp-exp 0xFF}
    1.23 +
    1.24 +   :stats
    1.25 +   ;; TODO recalculate these from a real ditto
    1.26 +   {:level 7
    1.27 +    :current-hp 50
    1.28 +    :hp 50
    1.29 +    :attack 50
    1.30 +    :defense 50
    1.31 +    :speed 50
    1.32 +    :special 50}
    1.33 +    
    1.34 +   
    1.35 +  :moves [[:transform {:pp-up 3 :pp 5}]]})
    1.36 +
    1.37 +(defn expand-pokemon
    1.38 +  "Given a map describing a pokemon, fill in any missing
    1.39 +   values based on the ones already present."
    1.40 +  [pokemon]
    1.41 +  (-> (merge pokemon-base pokemon)
    1.42 +      ;; if no nickname is supplied, default to the
    1.43 +      ;; uppercase name of the species, as r/b/y do
    1.44 +      ;; when a pokemon is captured.
    1.45 +      ((fn [pokemon]
    1.46 +         (if (nil? (:name pokemon))
    1.47 +           (assoc pokemon :name (.toUpperCase
    1.48 +                                 (.substring
    1.49 +                                  (str (:species pokemon)) 1)))
    1.50 +           pokemon)))
    1.51 +      ;; species2 should almost always just be the
    1.52 +      ;; same as species.
    1.53 +      ((fn [pokemon]
    1.54 +         (if (nil? (:species2 pokemon))
    1.55 +           (assoc pokemon :species2 (:species pokemon)))))
    1.56 +
    1.57 +      ;; enable the date in :moves to be any combo of 
    1.58 +      ;; [:move-1 :move-2]
    1.59 +      ;; [[:move-1 {:pp 20}] :move-2]
    1.60 +      ;; [[:move-1 {:pp 20 :pp-up 3}] :move-2]
    1.61 +      ;; default to full pp for the move, with no
    1.62 +      ;; pp-ups.
    1.63 +      ((fn [pokemon]
    1.64 +         (let [moves (:moves pokemon)]
    1.65 +           (assoc pokemon :moves
    1.66 +                  (for [move moves]
    1.67 +                    (cond
    1.68 +                      (keyword? move)
    1.69 +                      [move {:pp (max-pp move) :pp-up 0}]
    1.70 +                      (vector? move)
    1.71 +                      [(first move)
    1.72 +                       (merge {:pp (max-pp (first move))
    1.73 +                               :pp-up 0} (second move))]))))))
    1.74 +
    1.75 +      
    1.76 +
    1.77 +      
    1.78 +      ))
    1.79 +      
    1.80 \ No newline at end of file
     2.1 --- a/clojure/com/aurellem/gb/species.clj	Fri Mar 23 03:31:49 2012 -0500
     2.2 +++ b/clojure/com/aurellem/gb/species.clj	Fri Mar 23 04:00:42 2012 -0500
     2.3 @@ -211,4 +211,6 @@
     2.4    ([poke-num new-species]
     2.5       (set-species2 @current-state poke-num new-species)))
     2.6  
     2.7 -     
     2.8 \ No newline at end of file
     2.9 +
    2.10 +
    2.11 +
     3.1 --- a/clojure/com/aurellem/gb/types.clj	Fri Mar 23 03:31:49 2012 -0500
     3.2 +++ b/clojure/com/aurellem/gb/types.clj	Fri Mar 23 04:00:42 2012 -0500
     3.3 @@ -55,4 +55,157 @@
     3.4           (mapv type-code->type-name [type-1 type-2]))))
     3.5    ([poke-num]
     3.6       (read-type @current-state poke-num)))
     3.7 -                   
     3.8 \ No newline at end of file
     3.9 +
    3.10 +
    3.11 +(def pokemon->type
    3.12 +  {:rhydon          
    3.13 +   :kangaskhan      
    3.14 +   :nidoran-male    
    3.15 +   :clefairy        
    3.16 +   :spearow         
    3.17 +   :voltorb         
    3.18 +   :nidoking        
    3.19 +   :slowbro         
    3.20 +   :ivysaur         
    3.21 +   :exeggutor       
    3.22 +   :lickitung       
    3.23 +   :exeggcute       
    3.24 +   :grimer          
    3.25 +   :gengar          
    3.26 +   :nidoran-female  
    3.27 +   :nidoqueen       
    3.28 +   :cubone          
    3.29 +   :rhyhorn         
    3.30 +   :lapras          
    3.31 +   :arcanine        
    3.32 +   :mew             
    3.33 +   :gyarados        
    3.34 +   :shellder        
    3.35 +   :tentacool       
    3.36 +   :gastly          
    3.37 +   :scyther         
    3.38 +   :staryu          
    3.39 +   :blastoise       
    3.40 +   :pinsir          
    3.41 +   :tangela         
    3.42 +   :growlithe       
    3.43 +   :onix            
    3.44 +   :fearow          
    3.45 +   :pidgey          
    3.46 +   :slowpoke        
    3.47 +   :kadabra         
    3.48 +   :graveler        
    3.49 +   :chansey         
    3.50 +   :machoke         
    3.51 +   :mr-mime         
    3.52 +   :hitmonlee       
    3.53 +   :hitmonchan      
    3.54 +   :arbok           
    3.55 +   :parasect        
    3.56 +   :psyduck         
    3.57 +   :drowzee         
    3.58 +   :golem           
    3.59 +   :magmar          
    3.60 +   :electabuzz      
    3.61 +   :magneton        
    3.62 +   :koffing         
    3.63 +   :mankey          
    3.64 +   :seel            
    3.65 +   :diglett         
    3.66 +   :tauros          
    3.67 +   :farfetch'd      
    3.68 +   :venonat         
    3.69 +   :dragonite       
    3.70 +   :doduo           
    3.71 +   :poliwag         
    3.72 +   :jynx            
    3.73 +   :moltres         
    3.74 +   :articuno        
    3.75 +   :zapdos          
    3.76 +   :ditto           
    3.77 +   :meowth          
    3.78 +   :krabby          
    3.79 +   :vulpix          
    3.80 +   :ninetails       
    3.81 +   :pikachu         
    3.82 +   :riachu          
    3.83 +   :dratini         
    3.84 +   :dragonair       
    3.85 +   :kabuto          
    3.86 +   :kabutops        
    3.87 +   :horsea          
    3.88 +   :sedra           
    3.89 +   :sandshrew       
    3.90 +   :sandslash       
    3.91 +   :omanyte         
    3.92 +   :omastar         
    3.93 +   :jigglypuff      
    3.94 +   :wigglytuff      
    3.95 +   :eevee           
    3.96 +   :flareon         
    3.97 +   :jolteon         
    3.98 +   :vaporeon        
    3.99 +   :machop          
   3.100 +   :zubat           
   3.101 +   :ekans           
   3.102 +   :paras           
   3.103 +   :poliwhirl       
   3.104 +   :poliwrath       
   3.105 +   :weedle          
   3.106 +   :kakuna          
   3.107 +   :beedrill        
   3.108 +   :dodrio          
   3.109 +   :primeape        
   3.110 +   :dugtrio         
   3.111 +   :venomoth        
   3.112 +   :dewgong         
   3.113 +   :caterpie        
   3.114 +   :metapod         
   3.115 +   :butterfree      
   3.116 +   :machamp         
   3.117 +   :golduck         
   3.118 +   :hypno           
   3.119 +   :golbat          
   3.120 +   :mewtwo          
   3.121 +   :snorlax         
   3.122 +   :magikarp        
   3.123 +   :muk             
   3.124 +   :kingler         
   3.125 +   :cloyster        
   3.126 +   :electrode       
   3.127 +   :clefable        
   3.128 +   :wheezing        
   3.129 +   :persian         
   3.130 +   :marowak         
   3.131 +   :haunter         
   3.132 +   :abra            
   3.133 +   :alakazam        
   3.134 +   :pidgeotto       
   3.135 +   :pidgeot         
   3.136 +   :starmie         
   3.137 +   :bulbasaur       
   3.138 +   :venusaur        
   3.139 +   :tentacruel      
   3.140 +   :goldeen         
   3.141 +   :seaking         
   3.142 +   :ponyta          
   3.143 +   :rapidash        
   3.144 +   :rattata         
   3.145 +   :raticate        
   3.146 +   :nidorino        
   3.147 +   :nidorina        
   3.148 +   :geodude         
   3.149 +   :porygon         
   3.150 +   :aerodactyl      
   3.151 +   :magnemite       
   3.152 +   :charmander      
   3.153 +   :squirtle        
   3.154 +   :charmeleon      
   3.155 +   :wartortle       
   3.156 +   :charizard       
   3.157 +   :oddish          
   3.158 +   :gloom           
   3.159 +   :vileplume       
   3.160 +   :bellsprout      
   3.161 +   :weepenbell      
   3.162 +   :victreebel      
   3.163 \ No newline at end of file