# HG changeset patch # User Robert McIntyre # Date 1332493242 18000 # Node ID 85a2c2e2d318572ffdb4a2cf0bd1007401172bd0 # Parent 1ce54929bc0c1a74a4e070724123cc916564faf3 have to add default types for all pokemon. diff -r 1ce54929bc0c -r 85a2c2e2d318 clojure/com/aurellem/gb/pokemon.clj --- a/clojure/com/aurellem/gb/pokemon.clj Fri Mar 23 03:31:49 2012 -0500 +++ b/clojure/com/aurellem/gb/pokemon.clj Fri Mar 23 04:00:42 2012 -0500 @@ -349,3 +349,76 @@ (range (party-number state)))) ([status] (give-status-all @current-state status))) + + +(def pokemon-base + {:dv {:attack 15 :hp 15 :defense 15 + :special 15 :speed 15} + :species :ditto + :original-trainer "RLM" + :ID 5195 + :status :normal + :experience + {:main-exp 500 + :attack-exp 0xFF + :defense-exp 0xFF + :speed-exp 0xFF + :special-exp 0xFF + :hp-exp 0xFF} + + :stats + ;; TODO recalculate these from a real ditto + {:level 7 + :current-hp 50 + :hp 50 + :attack 50 + :defense 50 + :speed 50 + :special 50} + + + :moves [[:transform {:pp-up 3 :pp 5}]]}) + +(defn expand-pokemon + "Given a map describing a pokemon, fill in any missing + values based on the ones already present." + [pokemon] + (-> (merge pokemon-base pokemon) + ;; if no nickname is supplied, default to the + ;; uppercase name of the species, as r/b/y do + ;; when a pokemon is captured. + ((fn [pokemon] + (if (nil? (:name pokemon)) + (assoc pokemon :name (.toUpperCase + (.substring + (str (:species pokemon)) 1))) + pokemon))) + ;; species2 should almost always just be the + ;; same as species. + ((fn [pokemon] + (if (nil? (:species2 pokemon)) + (assoc pokemon :species2 (:species pokemon))))) + + ;; enable the date in :moves to be any combo of + ;; [:move-1 :move-2] + ;; [[:move-1 {:pp 20}] :move-2] + ;; [[:move-1 {:pp 20 :pp-up 3}] :move-2] + ;; default to full pp for the move, with no + ;; pp-ups. + ((fn [pokemon] + (let [moves (:moves pokemon)] + (assoc pokemon :moves + (for [move moves] + (cond + (keyword? move) + [move {:pp (max-pp move) :pp-up 0}] + (vector? move) + [(first move) + (merge {:pp (max-pp (first move)) + :pp-up 0} (second move))])))))) + + + + + )) + \ No newline at end of file diff -r 1ce54929bc0c -r 85a2c2e2d318 clojure/com/aurellem/gb/species.clj --- a/clojure/com/aurellem/gb/species.clj Fri Mar 23 03:31:49 2012 -0500 +++ b/clojure/com/aurellem/gb/species.clj Fri Mar 23 04:00:42 2012 -0500 @@ -211,4 +211,6 @@ ([poke-num new-species] (set-species2 @current-state poke-num new-species))) - \ No newline at end of file + + + diff -r 1ce54929bc0c -r 85a2c2e2d318 clojure/com/aurellem/gb/types.clj --- a/clojure/com/aurellem/gb/types.clj Fri Mar 23 03:31:49 2012 -0500 +++ b/clojure/com/aurellem/gb/types.clj Fri Mar 23 04:00:42 2012 -0500 @@ -55,4 +55,157 @@ (mapv type-code->type-name [type-1 type-2])))) ([poke-num] (read-type @current-state poke-num))) - \ No newline at end of file + + +(def pokemon->type + {:rhydon + :kangaskhan + :nidoran-male + :clefairy + :spearow + :voltorb + :nidoking + :slowbro + :ivysaur + :exeggutor + :lickitung + :exeggcute + :grimer + :gengar + :nidoran-female + :nidoqueen + :cubone + :rhyhorn + :lapras + :arcanine + :mew + :gyarados + :shellder + :tentacool + :gastly + :scyther + :staryu + :blastoise + :pinsir + :tangela + :growlithe + :onix + :fearow + :pidgey + :slowpoke + :kadabra + :graveler + :chansey + :machoke + :mr-mime + :hitmonlee + :hitmonchan + :arbok + :parasect + :psyduck + :drowzee + :golem + :magmar + :electabuzz + :magneton + :koffing + :mankey + :seel + :diglett + :tauros + :farfetch'd + :venonat + :dragonite + :doduo + :poliwag + :jynx + :moltres + :articuno + :zapdos + :ditto + :meowth + :krabby + :vulpix + :ninetails + :pikachu + :riachu + :dratini + :dragonair + :kabuto + :kabutops + :horsea + :sedra + :sandshrew + :sandslash + :omanyte + :omastar + :jigglypuff + :wigglytuff + :eevee + :flareon + :jolteon + :vaporeon + :machop + :zubat + :ekans + :paras + :poliwhirl + :poliwrath + :weedle + :kakuna + :beedrill + :dodrio + :primeape + :dugtrio + :venomoth + :dewgong + :caterpie + :metapod + :butterfree + :machamp + :golduck + :hypno + :golbat + :mewtwo + :snorlax + :magikarp + :muk + :kingler + :cloyster + :electrode + :clefable + :wheezing + :persian + :marowak + :haunter + :abra + :alakazam + :pidgeotto + :pidgeot + :starmie + :bulbasaur + :venusaur + :tentacruel + :goldeen + :seaking + :ponyta + :rapidash + :rattata + :raticate + :nidorino + :nidorina + :geodude + :porygon + :aerodactyl + :magnemite + :charmander + :squirtle + :charmeleon + :wartortle + :charizard + :oddish + :gloom + :vileplume + :bellsprout + :weepenbell + :victreebel \ No newline at end of file