Mercurial > vba-clojure
changeset 199:d4e673d09181
merge
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 23 Mar 2012 00:32:44 -0500 |
parents | 5055ec9de278 (diff) 67c42608ef9d (current diff) |
children | 1e2aa688e6e4 |
files | |
diffstat | 3 files changed, 254 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/moves.clj Fri Mar 23 00:24:54 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/moves.clj Fri Mar 23 00:32:44 2012 -0500 1.3 @@ -169,7 +169,7 @@ 1.4 0xA2 :super-fang 1.5 0xA3 :slash 1.6 0xA4 :substitute 1.7 - 0xA5 :struggle}) 1.8 + 0xA5 :struggle }) 1.9 1.10 (def move-name->move-code 1.11 (zipmap (vals move-code->move-name) 1.12 @@ -264,3 +264,175 @@ 1.13 (give-pp @current-state 1.14 pokemon-num move-num pp-ups current-pp))) 1.15 1.16 + 1.17 +(def move-name->move-pp 1.18 + { 1.19 + :absorb 20 1.20 + :acid 30 1.21 + :acid-armor 40 ;; WTF happens with 3 PP-UPs??! 1.22 + :agility 30 1.23 + :amnesia 20 1.24 + :aurora-beam 20 1.25 + :barrage 20 1.26 + :barrier 30 1.27 + :bide 10 1.28 + :bind 20 1.29 + :bite 25 1.30 + :blizzard 5 1.31 + :body-slam 15 1.32 + :bone-club 20 1.33 + :bonemerang 10 1.34 + :bubble 30 1.35 + :bubblebeam 20 1.36 + :clamp 10 1.37 + :comet-punch 15 1.38 + :confuse-ray 10 1.39 + :confusion 25 1.40 + :constrict 35 1.41 + :conversion 30 1.42 + :counter 20 1.43 + :crabhammer 10 1.44 + :cut 30 1.45 + :defense-curl 40 1.46 + :dig 10 1.47 + :disable 20 1.48 + :dizzy-punch 10 1.49 + :double-edge 15 1.50 + :double-kick 30 1.51 + :double-team 10 1.52 + :doubleslap 15 1.53 + :dragon-rage 10 1.54 + :dream-eater 15 1.55 + :drill-peck 20 1.56 + :earthquake 10 1.57 + :egg-bomb 10 1.58 + :ember 25 1.59 + :explosion 5 1.60 + :fire-blast 5 1.61 + :fire-punch 15 1.62 + :fire-spin 15 1.63 + :fissure 5 1.64 + :flamethrower 15 1.65 + :flash 20 1.66 + :fly 15 1.67 + :focus-energy 30 1.68 + :fury-attack 20 1.69 + :fury-swipes 15 1.70 + :glare 30 1.71 + :growl 40 1.72 + :growth 40 1.73 + :guillotine 5 1.74 + :gust 35 1.75 + :harden 30 1.76 + :haze 30 1.77 + :headbutt 15 1.78 + :hi-jump-kick 20 1.79 + :horn-attack 25 1.80 + :horn-drill 5 1.81 + :hydro-pump 5 1.82 + :hyper-beam 5 1.83 + :hyper-fang 15 1.84 + :hypnosis 20 1.85 + :ice-beam 10 1.86 + :ice-punch 15 1.87 + :jump-kick 25 1.88 + :karate-chop 25 1.89 + :kinesis 15 1.90 + :leech-life 15 1.91 + :leech-seed 10 1.92 + :leer 30 1.93 + :lick 30 1.94 + :light-screen 30 1.95 + :lovely-kiss 10 1.96 + :low-kick 20 1.97 + :meditate 40 1.98 + :mega-drain 10 1.99 + :mega-kick 5 1.100 + :mega-punch 20 1.101 + :metronome 10 1.102 + :mimic 10 1.103 + :minimize 20 1.104 + :mirror-move 20 1.105 + :mist 30 1.106 + :night-shade 15 1.107 + :pay-day 20 1.108 + :peck 35 1.109 + :petal-dance 20 1.110 + :pin-missle 20 1.111 + :poison-gas 40 1.112 + :poison-sting 35 1.113 + :poisonpowder 35 1.114 + :pound 35 1.115 + :psybeam 20 1.116 + :psychic 10 1.117 + :psywave 15 1.118 + :quick-attack 30 1.119 + :rage 20 1.120 + :razor-leaf 25 1.121 + :razor-wind 10 1.122 + :recover 20 1.123 + :reflect 20 1.124 + :rest 10 1.125 + :roar 20 1.126 + :rock-slide 10 1.127 + :rock-throw 15 1.128 + :rolling-kick 15 1.129 + :sand-attack 15 1.130 + :scratch 30 1.131 + :screech 40 1.132 + :seismic-toss 20 1.133 + :selfdestruct 5 1.134 + :sharpen 30 1.135 + :sing 15 1.136 + :skull-bash 15 1.137 + :sky-attack 5 1.138 + :slam 20 1.139 + :slash 20 1.140 + :sleep-powder 15 1.141 + :sludge 20 1.142 + :smog 20 1.143 + :smokescreen 20 1.144 + :softboiled 10 1.145 + :solarbeam 10 1.146 + :sonicboom 20 1.147 + :spike-cannon 15 1.148 + :splash 40 1.149 + :spore 15 1.150 + :stomp 20 1.151 + :strength 15 1.152 + :string-shot 40 1.153 + :struggle 1 1.154 + :stun-spore 30 1.155 + :submission 25 1.156 + :substitute 10 1.157 + :super-fang 10 1.158 + :supersonic 20 1.159 + :surf 15 1.160 + :swift 20 1.161 + :swords-dance 30 1.162 + :tackle 35 1.163 + :tail-whip 30 1.164 + :take-down 20 1.165 + :teleport 20 1.166 + :thrash 20 1.167 + :thunder 10 1.168 + :thunder-wave 20 1.169 + :thunderbolt 15 1.170 + :thunderpunch 15 1.171 + :thundershock 30 1.172 + :toxic 10 1.173 + :transform 10 1.174 + :tri-attack 10 1.175 + :twinneedle 20 1.176 + :vicegrip 30 1.177 + :vine-whip 10 1.178 + :water-gun 25 1.179 + :waterfall 15 1.180 + :whirlwind 20 1.181 + :wing-attack 35 1.182 + :withdraw 40 1.183 + :wrap 20}) 1.184 + 1.185 +(defn max-pp [name pp-ups] 1.186 + (int (* (+ 1 (* (/ 1 5) pp-ups)) 1.187 + (move-name->move-pp name)))) 1.188 \ No newline at end of file
2.1 --- a/clojure/com/aurellem/gb/pokemon.clj Fri Mar 23 00:24:54 2012 -0500 2.2 +++ b/clojure/com/aurellem/gb/pokemon.clj Fri Mar 23 00:32:44 2012 -0500 2.3 @@ -85,7 +85,7 @@ 2.4 ([n new-name] 2.5 (set-original-trainer @current-state n new-name))) 2.6 2.7 -(def OT-ID-addresses [0xD176 0xD1A2 0xD1CE 0xD1FA 0xD228 0xD252]) 2.8 +(def OT-ID-addresses [0xD176 0xD1A2 0xD1CE 0xD1FA 0xD226 0xD252]) 2.9 2.10 (defn read-OT-id 2.11 ([^SaveState state poke-num] 2.12 @@ -228,7 +228,7 @@ 2.13 :dv dv-values 2.14 :original-trainer OT-name 2.15 :ID ID 2.16 - :moves (zipmap moves moves-pp) 2.17 + :moves (mapv vector moves moves-pp) 2.18 2.19 ;; ephemerial 2.20 :satus status 2.21 @@ -237,7 +237,85 @@ 2.22 })) 2.23 ([poke-num] 2.24 (pokemon-info @current-state poke-num))) 2.25 - 2.26 + 2.27 +(defn print-pokemon 2.28 + ([^SaveState state poke-num] 2.29 + (let [info (pokemon-info state poke-num)] 2.30 + (printf 2.31 + (str 2.32 + "##################################" 2.33 + "##################################\n" 2.34 + "# " 2.35 + " #\n" 2.36 + "# %-44s" 2.37 + "%-20s#\n" 2.38 + "# " 2.39 + " #\n" 2.40 + "##################################" 2.41 + "##################################\n\n") 2.42 + 2.43 + (str 2.44 + (:name info) 2.45 + (str 2.46 + " (" (.substring (str (:species info)) 1) ")") 2.47 + (str " Lvl." (format "%-3d" (:level (:stats info))))) 2.48 + (str (:original-trainer info) " / " (:ID info))) 2.49 + 2.50 + (println 2.51 + (str 2.52 + (str "-----------------------------------" 2.53 + "---------------------------------\n" ) 2.54 + (str "| Stats | HP | Attack " 2.55 + "| Defense | Speed | Special |\n") 2.56 + (str "+-----------+----------+----------" 2.57 + "+----------+----------+----------+"))) 2.58 + 2.59 + (printf 2.60 + (str "|%-11s| %5d | %5d " 2.61 + "| %5d | %5d | %5d |\n") 2.62 + "DV Values" (:hp (:dv info)) (:attack (:dv info)) 2.63 + (:defense (:dv info)) (:speed (:dv info)) 2.64 + (:special (:dv info))) 2.65 + 2.66 + (let [c (:stats info)] 2.67 + (printf 2.68 + (str "|%-11s| %5d | %5d " 2.69 + "| %5d | %5d | %5d |\n") 2.70 + "Current" (:hp c) (:attack c) 2.71 + (:defense c) (:speed c) 2.72 + (:special c))) 2.73 + 2.74 + (let [e (:experience info)] 2.75 + (printf 2.76 + (str "|%-11s| %5d | %5d " 2.77 + "| %5d | %5d | %5d |\n") 2.78 + "Experience" (:hp-exp e) (:attack-exp e) 2.79 + (:defense-exp e) (:speed-exp e) 2.80 + (:special-exp e))) 2.81 + (println 2.82 + (str "+-----------+----------+----------" 2.83 + "+----------+----------+----------+")) 2.84 + 2.85 + (print "\n") 2.86 + (println "+------------------+----+--------+--------+") 2.87 + (println "| Move | PP | Max PP | PP UPs |") 2.88 + (println "+------------------+----+--------+--------+") 2.89 + 2.90 + (dorun 2.91 + (for [[name {:keys [pp-ups current-pp]}] (:moves info)] 2.92 + (printf 2.93 + "| %-17s| %2d | %02d | %02d |\n" 2.94 + (.substring (str name) 1) 2.95 + current-pp (max-pp name pp-ups) pp-ups))) 2.96 + 2.97 + (println "+------------------+----+--------+--------+") 2.98 + 2.99 + 2.100 + 2.101 + 2.102 + )) 2.103 + ([poke-num] 2.104 + (print-pokemon @current-state poke-num))) 2.105 2.106 (defn give-status-all 2.107 ([^SaveState state status]
3.1 Binary file save-states/before-erika.sav has changed