Mercurial > vba-clojure
view clojure/com/aurellem/gb/hxc.clj @ 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 | 99227bec1123 |
line wrap: on
line source
1 (ns com.aurellem.gb.hxc2 (:use (com.aurellem.gb assembly characters gb-driver util3 constants))4 (:use (com.aurellem.world practice))5 (:import [com.aurellem.gb.gb_driver SaveState]))9 (def pkmn-types10 [:normal11 :fighting12 :flying13 :poison14 :ground15 :rock16 :bird17 :bug18 :ghost19 :A20 :B21 :C22 :D23 :E24 :F25 :G26 :H27 :I28 :J29 :K30 :fire31 :water32 :grass33 :electric34 :psychic35 :ice36 :dragon37 ])40 ;; question: when status effects claim to take41 ;; their accuracy from the move accuracy, does42 ;; this mean that the move always "hits" but the43 ;; status effect may not?45 (def move-effects46 ["normal damage"47 "no damage, just opponent sleep" ;; how many turns? is atk power ignored?48 "0x4C chance of poison"49 "leech half of inflicted damage"50 "0x19 chance of burn"51 "0x19 chance of freeze"52 "0x19 chance of paralyze"53 "user faints; opponent defense halved."54 "leech half of inflicted damage ONLY if sleeping opponent."55 "imitate last attack"56 "user atk +1"57 "user def +1"58 "user spd +1"59 "user spc +1"60 "user acr +1" ;; unused?!61 "user evd +1"62 "get post-battle $ = 2*level*uses"63 "0xFE acr, no matter what."64 "opponent atk -1" ;; acr taken from move acr?65 "opponent def -1" ;;66 "opponent spd -1" ;;67 "opponent spc -1" ;;68 "opponent acr -1";;69 "opponent evd -1"70 "converts user's type to opponent's."71 "(haze)"72 "(bide)"73 "(thrash)"74 "(teleport)"75 "(fury swipes)"76 "attacks 2-5 turns" ;; unused? like rollout?77 "0x19 chance of flinch"78 "opponent sleep for 1-7 turns"79 "0x66 chance of poison"80 "0x4D chance of burn"81 "0x4D chance of freeze"82 "0x4D chance of paralyze"83 "0x4D chance of flinch"84 "one-hit KO"85 "charge one turn, atk next."86 "fixed damage, leaves 1HP." ;; how is dmg determined?87 "fixed damage." ;; cf seismic toss, dragon rage, psywave.88 "atk 2-5 turns; opponent can't attack" ;; unnormalized? (0 0x60 0x60 0x20 0x20)89 "charge one turn, atk next. (can't be hit when charging)"90 "atk hits twice."91 "user takes 1 damage if misses."92 "evade status-lowering effects" ;;caused by you or also your opponent?93 "(broken) if user is slower than opponent, makes critical hit impossible, otherwise has no effect"94 "atk causes recoil dmg = 1/4 dmg dealt"95 "confuses opponent" ;; acr taken from move acr96 "user atk +2"97 "user def +2"98 "user spd +2"99 "user spc +2"100 "user acr +2" ;; unused!101 "user evd +2" ;; unused!102 "restores up to half of user's max hp." ;; broken: fails if the difference103 ;; b/w max and current hp is one less than a multiple of 256.104 "(transform)"105 "opponent atk -2"106 "opponent def -2"107 "opponent spd -2"108 "opponent spc -2"109 "opponent acr -2"110 "opponent evd -2"111 "doubles user spc when attacked"112 "doubles user def when attacked"113 "poisons opponent" ;;acr taken from move acr114 "paralyzes opponent" ;;115 "0x19 chance opponent atk -1"116 "0x19 chance opponent def -1"117 "0x19 chance opponent spd -1"118 "0x4C chance opponent spc -1" ;; context suggest chance is 0x19119 "0x19 chance opponent acr -1"120 "0x19 chance opponent evd -1"121 "???" ;; unused? no effect?122 "???" ;; unused? no effect?123 "0x19 chance opponent confused"124 "atk hits twice. 0x33 chance opponent poisioned."125 "broken. crash the game after attack."126 "(substitute)"127 "unless opponent faints, user must recharge after atk. some128 exceptions apply."129 "(rage)"130 "(mimic)"131 "(metronome)"132 "(leech seed)"133 "does nothing (splash)"134 "(disable)"135 ])141 (def hxc-items142 "The hardcoded names of the items in memory. List begins at ROM@045B7 "143 (map character-codes->str144 (take-nth 2145 (partition-by #(= % 0x50)146 (take 1200147 (drop 0x45B7 (rom (root))))))))149 (def hxc-types150 "The hardcoded type names in memory. List begins at ROM@27D99,151 shortly before hxc-titles."152 (map character-codes->str153 (take-nth 2154 (partition-by #(= 0x50 %)155 (take 102156 (drop 0x27D99157 (rom (root))))))))159 (def hxc-titles160 "The hardcoded names of the trainer titles in memory. List begins at161 ROM@27E77"162 (map character-codes->str163 (take-nth 2164 (partition-by #(= 0x50 %)165 (take 196166 (drop 0x27E77167 (rom (root))))))))170 (def hxc-places171 "The hardcoded place names in memory. List begins at172 ROM@71500. Cinnabar Mansion is dynamically calculated."173 (map character-codes->str174 (take-nth 2175 (partition-by #(= % 0x50)176 (take 560177 (drop 0x71500178 (rom (root))))))))181 (def hxc-dialog182 "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."183 (character-codes->str(take 0x0F728184 (drop (+ 0x98000)185 (rom (root))))))187 (def hxc-pokedex188 "The hardcoded pokedex entries in memory. List begins at189 ROM@B8000, shortly before move names."190 (map character-codes->str191 (take-nth 2192 (partition-by #(= % 0x50)193 (take 14754194 (drop 0xB8000195 (rom (root))))))))196 (def hxc-move-names197 "The hardcoded move names in memory. List begins at ROM@BC000"198 (map character-codes->str199 (take-nth 2200 (partition-by #(= % 0x50)201 (take 1551202 (drop 0xBC000203 (rom (root))))))))205 (def hxc-move-data206 "The hardcoded (basic (move effects)) in memory. List begins at207 0x38000. Effect descriptions were handwritten and aren't hardcoded."208 (let [names (vec hxc-move-names)209 move-count (count names)210 move-size 6211 format-name (fn [s]212 (keyword (.toLowerCase213 (apply str214 (map #(if (= % \space) "-" %) s)))))215 ]216 (zipmap (map format-name names)217 (map218 (fn [[idx effect power type accuracy pp]]219 {:name (names (dec idx))220 :power power221 :accuracy (hex accuracy)222 :pp pp223 :fx-id (hex effect)224 :fx-txt (get move-effects effect)225 }226 )228 (partition move-size229 (take (* move-size move-count)230 (drop 0x38000 (rom(root)))))))))234 (def hxc-pokenames235 "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."236 (let [count-species 190237 name-length 10]238 (map character-codes->str239 (partition name-length240 (take (* count-species name-length)241 (drop 0xE8000242 (rom(root))))))))252 (def hxc-advantage253 "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."254 (map255 (fn [[atk def mult]] [(get pkmn-types atk (hex atk))256 (get pkmn-types def (hex def))257 (/ mult 10)])258 (partition 3259 (take-while (partial not= 0xFF)260 (drop 0x3E62D (rom(root)))))))276 ;; note for later: credits start at F1290280 (comment282 (def hxc-later283 "Running this code produces, e.g. hardcoded names NPCs give284 their pokemon. Will sort through it later."285 (print (character-codes->str(take 10000286 (drop 0x71597287 (rom (root)))))))289 (let [dex290 (partition-by #(= 0x50 %)291 (take 2540292 (drop 0x40687293 (rom (root)))))]294 (def dex dex)295 (def hxc-species296 (map character-codes->str297 (take-nth 4 dex))))298 )