Mercurial > vba-clojure
view clojure/com/aurellem/gb/experience.clj @ 289:df9cad9909d2
Fixed missing delimiter in gb.moves; preparing to play with type effectiveness.
author | Dylan Holmes <ocsenave@gmail.com> |
---|---|
date | Thu, 29 Mar 2012 13:49:40 -0500 |
parents | fd549c8f42ae |
children |
line wrap: on
line source
1 (ns com.aurellem.gb.experience2 (:use (com.aurellem.gb gb-driver util constants))3 (:import [com.aurellem.gb.gb_driver SaveState]))5 (def experience-pokemon-1 0xD178)7 (defn experience-start-address [poke-num]8 (+ experience-pokemon-19 (* pokemon-record-width poke-num)))11 (def experience-record-width 13)13 (defn read-experience14 ([^SaveState state poke-num]15 (let [start (experience-start-address poke-num)16 [exp-h17 exp-m18 exp-l19 hp-exp-h20 hp-exp-l21 attack-exp-h22 attack-exp-l23 defense-exp-h24 defense-exp-l25 speed-exp-h26 speed-exp-l27 special-exp-h28 special-exp-l]29 (subvec (vec (memory state))30 start (+ experience-record-width start))]31 {:main-exp (glue-bytes exp-h exp-m exp-l)32 :hp-exp (glue-bytes hp-exp-h hp-exp-l)33 :attack-exp (glue-bytes attack-exp-h attack-exp-l)34 :defense-exp (glue-bytes defense-exp-h defense-exp-l)35 :speed-exp (glue-bytes speed-exp-h speed-exp-l)36 :special-exp (glue-bytes special-exp-h special-exp-l)}))37 ([poke-num]38 (read-experience @current-state poke-num)))40 (defn give-experience41 ([^SaveState state poke-num exp]42 (let [exp* (merge (read-experience state poke-num) exp)43 raw-exp-data44 (flatten45 [(disect-bytes-3 (:main-exp exp*))46 (disect-bytes-2 (:hp-exp exp*))47 (disect-bytes-2 (:attack-exp exp*))48 (disect-bytes-2 (:defense-exp exp*))49 (disect-bytes-2 (:speed-exp exp*))50 (disect-bytes-2 (:special-exp exp*))])]51 (set-memory-range state52 (experience-start-address poke-num)53 raw-exp-data)))54 ([poke-num exp]55 (give-experience @current-state poke-num exp)))