diff clojure/com/aurellem/gb/pokemon.clj @ 237:ff37bc3004a7

continuing work on map-function-addresses.
author Robert McIntyre <rlm@mit.edu>
date Sat, 24 Mar 2012 23:38:21 -0500
parents 1af1a279895b
children 8484e6f6db2c
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/pokemon.clj	Sat Mar 24 20:06:25 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/pokemon.clj	Sat Mar 24 23:38:21 2012 -0500
     1.3 @@ -9,7 +9,9 @@
     1.4  
     1.5  (defn set-party-number
     1.6    ([^SaveState state new-party-num]
     1.7 -     (set-memory state 0xD162 new-party-num))
     1.8 +     (-> state
     1.9 +         (set-memory 0xD162 new-party-num)
    1.10 +         (set-memory (+ 0xD162 new-party-num 1) 0xFF)))
    1.11    ([new-party-num]
    1.12       (set-party-number @current-state new-party-num)))
    1.13  
    1.14 @@ -201,8 +203,6 @@
    1.15    ([pokemon-num]
    1.16       (print-pokemon-record @current-state pokemon-num)))
    1.17  
    1.18 -(def mint-berry-item-code-gsc 0x54)
    1.19 -
    1.20  (defn pokemon
    1.21    ([^SaveState state poke-num]
    1.22       (assert (<= 0 poke-num 5))
    1.23 @@ -429,6 +429,8 @@
    1.24                    (pokemon->type (:species pokemon)))
    1.25             pokemon)))))
    1.26  
    1.27 +(def mint-berry-item-code-gsc 0x54)
    1.28 +
    1.29  (defn give-pokemon
    1.30    ([^SaveState state poke-num pokemon]
    1.31       (let [pokemon* (expand-pokemon pokemon)]
    1.32 @@ -448,11 +450,9 @@
    1.33             (give-status poke-num (:status pokemon*))
    1.34             (give-stats  poke-num (:stats  pokemon*))
    1.35             (give-experience poke-num (:experience pokemon*))
    1.36 -
    1.37 -           ;; this was 11 dec
    1.38             (set-memory (+ 0xD16D
    1.39                            (* pokemon-record-width poke-num))
    1.40 -                          0x00))))
    1.41 +                          mint-berry-item-code-gsc))))
    1.42    ([poke-num pokemon]
    1.43       (give-pokemon @current-state poke-num pokemon)))
    1.44  
    1.45 @@ -463,16 +463,3 @@
    1.46                            new-pokemon-data)))
    1.47    ([poke-num new-pokemon-data]
    1.48       (edit-pokemon @current-state poke-num new-pokemon-data)))
    1.49 -
    1.50 -(def young-jigglypuff
    1.51 -  {:name "JIGGLYPUFF", :species :jigglypuff, :species2 :jigglypuff,
    1.52 -   :status :normal,
    1.53 -   :moves [[:sing {:pp-ups 0, :current-pp 4}]],
    1.54 -   :dv {:attack 8, :defense 7, :speed 4, :special 12, :hp 4},
    1.55 -   :experience {:main-exp 21, :hp-exp 0, :attack-exp 0, :defense-exp
    1.56 -                0, :speed-exp 0, :special-exp 0}, 
    1.57 -   :type [:normal],
    1.58 -   :original-trainer "RLM",
    1.59 -   :stats {:level 3, :current-hp 5, :hp 20, :attack 8, :defense 6,
    1.60 -           :speed 6, :special 7}, 
    1.61 -   :ID 5195})