changeset 246:921d2277bb57

Got hardcoded move effect data, put it into a map hxc-move-data. Since descriptions are handwritten, they may be buggy.
author Dylan Holmes <ocsenave@gmail.com>
date Mon, 26 Mar 2012 01:56:57 -0500
parents a50faba43967
children e94d20ad853e
files clojure/com/aurellem/gb/hxc.clj
diffstat 1 files changed, 215 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/hxc.clj	Sun Mar 25 23:04:01 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/hxc.clj	Mon Mar 26 01:56:57 2012 -0500
     1.3 @@ -5,84 +5,6 @@
     1.4    (:import [com.aurellem.gb.gb_driver SaveState]))
     1.5  
     1.6  
     1.7 -(def hxc-pokenames
     1.8 -  "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
     1.9 -  (let [count-species 190
    1.10 -        name-length 10]
    1.11 -    (map character-codes->str
    1.12 -         (partition name-length
    1.13 -                    (take (* count-species name-length)
    1.14 -                          (drop 0xE8000
    1.15 -                                (rom(root))))))))
    1.16 -
    1.17 -(def hxc-items
    1.18 -  "The hardcoded names of the items in memory. List begins at ROM@45B7 "
    1.19 -  (map character-codes->str
    1.20 -       (take-nth 2
    1.21 -                 (partition-by #(= % 0x50)
    1.22 -                               (take 1200
    1.23 -                                     (drop 0x45B7 (rom (root))))))))
    1.24 -
    1.25 -(def hxc-types
    1.26 -  "The hardcoded type names in memory. List begins at ROM@27D99,
    1.27 -  shortly before hxc-titles."
    1.28 -  (map character-codes->str
    1.29 -       (take-nth 2
    1.30 -                 (partition-by #(= 0x50 %)
    1.31 -                               (take 102
    1.32 -                                     (drop 0x27D99
    1.33 -                                           (rom (root))))))))
    1.34 -
    1.35 -(def hxc-titles
    1.36 -  "The hardcoded names of the trainer titles in memory. List begins at
    1.37 -ROM@27E77"
    1.38 -  (map character-codes->str
    1.39 -       (take-nth 2
    1.40 -                 (partition-by #(= 0x50 %)
    1.41 -                               (take 196
    1.42 -                                     (drop 0x27E77
    1.43 -                                           (rom (root))))))))
    1.44 -
    1.45 -
    1.46 -(def hxc-pokedex
    1.47 -  "The hardcoded pokedex entries in memory. List begins at
    1.48 -ROM@B8000, shortly before move names."
    1.49 -  (map character-codes->str
    1.50 -       (take-nth 2
    1.51 -                 (partition-by #(= % 0x50)
    1.52 -                               (take 14754
    1.53 -                                     (drop 0xB8000
    1.54 -                                           (rom (root))))))))
    1.55 -(def hxc-moves
    1.56 -  "The hardcoded move names in memory. List begins at ROM@BC000"
    1.57 -  (map character-codes->str
    1.58 -       (take-nth 2
    1.59 -                 (partition-by #(= % 0x50)
    1.60 -                               (take 1551
    1.61 -                                     (drop 0xBC000
    1.62 -                                           (rom (root))))))))   
    1.63 -
    1.64 -
    1.65 -
    1.66 -(def hxc-places
    1.67 -  "The hardcoded place names in memory. List begins at
    1.68 -ROM@71500. Cinnabar Mansion is dynamically calculated."
    1.69 -  (map character-codes->str
    1.70 -       (take-nth 2 
    1.71 -                (partition-by #(= % 0x50)
    1.72 -                               (take 560
    1.73 -                                     (drop 0x71500
    1.74 -                                           (rom (root))))))))
    1.75 -
    1.76 -
    1.77 -(def hxc-dialog
    1.78 -  "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
    1.79 -(character-codes->str(take 0x0F728
    1.80 -                          (drop (+ 0x98000)
    1.81 -                                (rom (root))))))
    1.82 -
    1.83 -
    1.84 -
    1.85  
    1.86  (def pkmn-types
    1.87    [:normal
    1.88 @@ -115,6 +37,218 @@
    1.89     ])
    1.90  
    1.91  
    1.92 +;; question: when status effects claim to take
    1.93 +;; their accuracy from the move accuracy, does
    1.94 +;; this mean that the move always "hits" but the
    1.95 +;; status effect may not?
    1.96 +
    1.97 +(def move-effects
    1.98 +  ["normal damage"
    1.99 +   "no damage, just opponent sleep" ;; how many turns? is atk power ignored?
   1.100 +   "0x4C chance of poison"
   1.101 +   "leech half of inflicted damage"
   1.102 +   "0x19 chance of burn"
   1.103 +   "0x19 chance of freeze"
   1.104 +   "0x19 chance of paralyze"
   1.105 +   "user faints; opponent defense halved."
   1.106 +   "leech half of inflicted damage ONLY if sleeping opponent."
   1.107 +   "imitate last attack"
   1.108 +   "user atk +1"
   1.109 +   "user def +1"
   1.110 +   "user spd +1"
   1.111 +   "user spc +1"
   1.112 +   "user acr +1" ;; unused?!
   1.113 +   "user evd +1"
   1.114 +   "get post-battle $ = 2*level*uses"
   1.115 +   "0xFE acr, no matter what."
   1.116 +   "opponent atk -1"     ;; acr taken from move acr?
   1.117 +   "opponent def -1"     ;;
   1.118 +   "opponent spd -1"   ;;
   1.119 +   "opponent spc -1" ;;
   1.120 +   "opponent acr -1";;
   1.121 +   "opponent evd -1"
   1.122 +   "converts user's type to opponent's."
   1.123 +   "(haze)"
   1.124 +   "(bide)"
   1.125 +   "(thrash)"
   1.126 +   "(teleport)"
   1.127 +   "(fury swipes)"
   1.128 +   "attacks 2-5 turns" ;; unused? like rollout?
   1.129 +   "0x19 chance of flinch"
   1.130 +   "opponent sleep for 1-7 turns"
   1.131 +   "0x66 chance of poison"
   1.132 +   "0x4D chance of burn"
   1.133 +   "0x4D chance of freeze"
   1.134 +   "0x4D chance of paralyze"
   1.135 +   "0x4D chance of flinch"
   1.136 +   "one-hit KO"
   1.137 +   "charge one turn, atk next."
   1.138 +   "fixed damage, leaves 1HP." ;; how is dmg determined?
   1.139 +   "fixed damage."             ;; cf seismic toss, dragon rage, psywave.
   1.140 +   "atk 2-5 turns; opponent can't attack" ;; unnormalized? (0 0x60 0x60 0x20 0x20)
   1.141 +   "charge one turn, atk next. (can't be hit when charging)"
   1.142 +   "atk hits twice."
   1.143 +   "user takes 1 damage if misses."
   1.144 +   "evade status-lowering effects" ;;caused by you or also your opponent?
   1.145 +   "(broken) if user is slower than opponent, makes critical hit impossible, otherwise has no effect"
   1.146 +   "atk causes recoil dmg = 1/4 dmg dealt"
   1.147 +   "confuses opponent" ;; acr taken from move acr
   1.148 +   "user atk +2"
   1.149 +   "user def +2"
   1.150 +   "user spd +2"
   1.151 +   "user spc +2"
   1.152 +   "user acr +2" ;; unused!
   1.153 +   "user evd +2" ;; unused!
   1.154 +   "restores up to half of user's max hp." ;; broken: fails if the difference
   1.155 +   ;; b/w max and current hp is one less than a multiple of 256.
   1.156 +   "(transform)"
   1.157 +   "opponent atk -2"
   1.158 +   "opponent def -2"
   1.159 +   "opponent spd -2"
   1.160 +   "opponent spc -2"
   1.161 +   "opponent acr -2"
   1.162 +   "opponent evd -2"
   1.163 +   "doubles user spc when attacked"
   1.164 +   "doubles user def when attacked"
   1.165 +   "poisons opponent"   ;;acr taken from move acr
   1.166 +   "paralyzes opponent" ;;
   1.167 +   "0x19 chance opponent atk -1"
   1.168 +   "0x19 chance opponent def -1"
   1.169 +   "0x19 chance opponent spd -1"
   1.170 +   "0x4C chance opponent spc -1" ;; context suggest chance is 0x19
   1.171 +   "0x19 chance opponent acr -1"
   1.172 +   "0x19 chance opponent evd -1"
   1.173 +   "???" ;; unused? no effect?
   1.174 +   "???" ;; unused? no effect?
   1.175 +   "0x19 chance opponent confused"
   1.176 +   "atk hits twice. 0x33 chance opponent poisioned."
   1.177 +   "broken. crash the game after attack."
   1.178 +   "(substitute)"
   1.179 +   "unless opponent faints, user must recharge after atk. some
   1.180 +  exceptions apply."
   1.181 +   "(rage)"
   1.182 +   "(mimic)"
   1.183 +   "(metronome)"
   1.184 +   "(leech seed)"
   1.185 +   "does nothing (splash)"
   1.186 +   "(disable)"
   1.187 +   ])
   1.188 +
   1.189 +
   1.190 +
   1.191 +
   1.192 +
   1.193 +(def hxc-items
   1.194 +  "The hardcoded names of the items in memory. List begins at ROM@045B7 "
   1.195 +  (map character-codes->str
   1.196 +       (take-nth 2
   1.197 +                 (partition-by #(= % 0x50)
   1.198 +                               (take 1200
   1.199 +                                     (drop 0x45B7 (rom (root))))))))
   1.200 +
   1.201 +(def hxc-types
   1.202 +  "The hardcoded type names in memory. List begins at ROM@27D99,
   1.203 +  shortly before hxc-titles."
   1.204 +  (map character-codes->str
   1.205 +       (take-nth 2
   1.206 +                 (partition-by #(= 0x50 %)
   1.207 +                               (take 102
   1.208 +                                     (drop 0x27D99
   1.209 +                                           (rom (root))))))))
   1.210 +
   1.211 +(def hxc-titles
   1.212 +  "The hardcoded names of the trainer titles in memory. List begins at
   1.213 +ROM@27E77"
   1.214 +  (map character-codes->str
   1.215 +       (take-nth 2
   1.216 +                 (partition-by #(= 0x50 %)
   1.217 +                               (take 196
   1.218 +                                     (drop 0x27E77
   1.219 +                                           (rom (root))))))))
   1.220 +
   1.221 +
   1.222 +(def hxc-places
   1.223 +  "The hardcoded place names in memory. List begins at
   1.224 +ROM@71500. Cinnabar Mansion is dynamically calculated."
   1.225 +  (map character-codes->str
   1.226 +       (take-nth 2 
   1.227 +                (partition-by #(= % 0x50)
   1.228 +                               (take 560
   1.229 +                                     (drop 0x71500
   1.230 +                                           (rom (root))))))))
   1.231 +
   1.232 +
   1.233 +(def hxc-dialog
   1.234 +  "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
   1.235 +(character-codes->str(take 0x0F728
   1.236 +                          (drop (+ 0x98000)
   1.237 +                                (rom (root))))))
   1.238 +
   1.239 +(def hxc-pokedex
   1.240 +  "The hardcoded pokedex entries in memory. List begins at
   1.241 +ROM@B8000, shortly before move names."
   1.242 +  (map character-codes->str
   1.243 +       (take-nth 2
   1.244 +                 (partition-by #(= % 0x50)
   1.245 +                               (take 14754
   1.246 +                                     (drop 0xB8000
   1.247 +                                           (rom (root))))))))
   1.248 +(def hxc-move-names
   1.249 +  "The hardcoded move names in memory. List begins at ROM@BC000"
   1.250 +  (map character-codes->str
   1.251 +       (take-nth 2
   1.252 +                 (partition-by #(= % 0x50)
   1.253 +                               (take 1551
   1.254 +                                     (drop 0xBC000
   1.255 +                                           (rom (root))))))))   
   1.256 +
   1.257 +(def hxc-move-data
   1.258 +  "The hardcoded (basic (move effects)) in memory. List begins at
   1.259 +0x38000. Effect descriptions were handwritten and aren't hardcoded."
   1.260 +  (let [names (vec hxc-move-names)
   1.261 +        move-count (count names)
   1.262 +        move-size 6
   1.263 +        format-name (fn [s]
   1.264 +                      (keyword (.toLowerCase
   1.265 +                       (apply str
   1.266 +                              (map #(if (= % \space) "-" %) s)))))
   1.267 +        ]
   1.268 +    (zipmap (map format-name names)
   1.269 +            (map
   1.270 +             (fn [[idx effect power type accuracy pp]]
   1.271 +               {:name (names (dec idx))
   1.272 +                :power power
   1.273 +                :accuracy (hex accuracy)
   1.274 +                :pp pp
   1.275 +                :fx-id (hex effect)
   1.276 +                :fx-txt (get move-effects effect) 
   1.277 +                }
   1.278 +               )
   1.279 +    
   1.280 +             (partition move-size
   1.281 +                        (take (* move-size move-count)
   1.282 +                              (drop 0x38000 (rom(root)))))))))
   1.283 +  
   1.284 +
   1.285 +
   1.286 +(def hxc-pokenames
   1.287 +  "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
   1.288 +  (let [count-species 190
   1.289 +        name-length 10]
   1.290 +    (map character-codes->str
   1.291 +         (partition name-length
   1.292 +                    (take (* count-species name-length)
   1.293 +                          (drop 0xE8000
   1.294 +                                (rom(root))))))))
   1.295 +
   1.296 +
   1.297 +
   1.298 +
   1.299 +
   1.300 +
   1.301 +
   1.302 +
   1.303 +
   1.304  (def hxc-advantage
   1.305    "The hardcoded type advantages in memory, returned as tuples of [atk-type def-type multiplier]. By default (i.e. if not listed here), the multiplier is 1."
   1.306    (map
   1.307 @@ -139,11 +273,11 @@
   1.308  
   1.309  
   1.310  
   1.311 +;; note for later: credits start at F1290
   1.312  
   1.313  
   1.314  
   1.315 -
   1.316 -
   1.317 +(comment 
   1.318  
   1.319  (def hxc-later
   1.320    "Running this code produces, e.g. hardcoded names NPCs give
   1.321 @@ -161,3 +295,4 @@
   1.322    (def hxc-species
   1.323      (map character-codes->str
   1.324           (take-nth 4 dex))))
   1.325 +)
   1.326 \ No newline at end of file