# HG changeset patch # User Dylan Holmes # Date 1332745017 18000 # Node ID 921d2277bb5722e176a3cc0128bd419cd173a9d2 # Parent a50faba43967203d54dadf02c5a3305fc1b9391d Got hardcoded move effect data, put it into a map hxc-move-data. Since descriptions are handwritten, they may be buggy. diff -r a50faba43967 -r 921d2277bb57 clojure/com/aurellem/gb/hxc.clj --- a/clojure/com/aurellem/gb/hxc.clj Sun Mar 25 23:04:01 2012 -0500 +++ b/clojure/com/aurellem/gb/hxc.clj Mon Mar 26 01:56:57 2012 -0500 @@ -5,84 +5,6 @@ (:import [com.aurellem.gb.gb_driver SaveState])) -(def hxc-pokenames - "The hardcoded names of the 190 species in memory. List begins at ROM@E8000." - (let [count-species 190 - name-length 10] - (map character-codes->str - (partition name-length - (take (* count-species name-length) - (drop 0xE8000 - (rom(root)))))))) - -(def hxc-items - "The hardcoded names of the items in memory. List begins at ROM@45B7 " - (map character-codes->str - (take-nth 2 - (partition-by #(= % 0x50) - (take 1200 - (drop 0x45B7 (rom (root)))))))) - -(def hxc-types - "The hardcoded type names in memory. List begins at ROM@27D99, - shortly before hxc-titles." - (map character-codes->str - (take-nth 2 - (partition-by #(= 0x50 %) - (take 102 - (drop 0x27D99 - (rom (root)))))))) - -(def hxc-titles - "The hardcoded names of the trainer titles in memory. List begins at -ROM@27E77" - (map character-codes->str - (take-nth 2 - (partition-by #(= 0x50 %) - (take 196 - (drop 0x27E77 - (rom (root)))))))) - - -(def hxc-pokedex - "The hardcoded pokedex entries in memory. List begins at -ROM@B8000, shortly before move names." - (map character-codes->str - (take-nth 2 - (partition-by #(= % 0x50) - (take 14754 - (drop 0xB8000 - (rom (root)))))))) -(def hxc-moves - "The hardcoded move names in memory. List begins at ROM@BC000" - (map character-codes->str - (take-nth 2 - (partition-by #(= % 0x50) - (take 1551 - (drop 0xBC000 - (rom (root)))))))) - - - -(def hxc-places - "The hardcoded place names in memory. List begins at -ROM@71500. Cinnabar Mansion is dynamically calculated." - (map character-codes->str - (take-nth 2 - (partition-by #(= % 0x50) - (take 560 - (drop 0x71500 - (rom (root)))))))) - - -(def hxc-dialog - "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000." -(character-codes->str(take 0x0F728 - (drop (+ 0x98000) - (rom (root)))))) - - - (def pkmn-types [:normal @@ -115,6 +37,218 @@ ]) +;; question: when status effects claim to take +;; their accuracy from the move accuracy, does +;; this mean that the move always "hits" but the +;; status effect may not? + +(def move-effects + ["normal damage" + "no damage, just opponent sleep" ;; how many turns? is atk power ignored? + "0x4C chance of poison" + "leech half of inflicted damage" + "0x19 chance of burn" + "0x19 chance of freeze" + "0x19 chance of paralyze" + "user faints; opponent defense halved." + "leech half of inflicted damage ONLY if sleeping opponent." + "imitate last attack" + "user atk +1" + "user def +1" + "user spd +1" + "user spc +1" + "user acr +1" ;; unused?! + "user evd +1" + "get post-battle $ = 2*level*uses" + "0xFE acr, no matter what." + "opponent atk -1" ;; acr taken from move acr? + "opponent def -1" ;; + "opponent spd -1" ;; + "opponent spc -1" ;; + "opponent acr -1";; + "opponent evd -1" + "converts user's type to opponent's." + "(haze)" + "(bide)" + "(thrash)" + "(teleport)" + "(fury swipes)" + "attacks 2-5 turns" ;; unused? like rollout? + "0x19 chance of flinch" + "opponent sleep for 1-7 turns" + "0x66 chance of poison" + "0x4D chance of burn" + "0x4D chance of freeze" + "0x4D chance of paralyze" + "0x4D chance of flinch" + "one-hit KO" + "charge one turn, atk next." + "fixed damage, leaves 1HP." ;; how is dmg determined? + "fixed damage." ;; cf seismic toss, dragon rage, psywave. + "atk 2-5 turns; opponent can't attack" ;; unnormalized? (0 0x60 0x60 0x20 0x20) + "charge one turn, atk next. (can't be hit when charging)" + "atk hits twice." + "user takes 1 damage if misses." + "evade status-lowering effects" ;;caused by you or also your opponent? + "(broken) if user is slower than opponent, makes critical hit impossible, otherwise has no effect" + "atk causes recoil dmg = 1/4 dmg dealt" + "confuses opponent" ;; acr taken from move acr + "user atk +2" + "user def +2" + "user spd +2" + "user spc +2" + "user acr +2" ;; unused! + "user evd +2" ;; unused! + "restores up to half of user's max hp." ;; broken: fails if the difference + ;; b/w max and current hp is one less than a multiple of 256. + "(transform)" + "opponent atk -2" + "opponent def -2" + "opponent spd -2" + "opponent spc -2" + "opponent acr -2" + "opponent evd -2" + "doubles user spc when attacked" + "doubles user def when attacked" + "poisons opponent" ;;acr taken from move acr + "paralyzes opponent" ;; + "0x19 chance opponent atk -1" + "0x19 chance opponent def -1" + "0x19 chance opponent spd -1" + "0x4C chance opponent spc -1" ;; context suggest chance is 0x19 + "0x19 chance opponent acr -1" + "0x19 chance opponent evd -1" + "???" ;; unused? no effect? + "???" ;; unused? no effect? + "0x19 chance opponent confused" + "atk hits twice. 0x33 chance opponent poisioned." + "broken. crash the game after attack." + "(substitute)" + "unless opponent faints, user must recharge after atk. some + exceptions apply." + "(rage)" + "(mimic)" + "(metronome)" + "(leech seed)" + "does nothing (splash)" + "(disable)" + ]) + + + + + +(def hxc-items + "The hardcoded names of the items in memory. List begins at ROM@045B7 " + (map character-codes->str + (take-nth 2 + (partition-by #(= % 0x50) + (take 1200 + (drop 0x45B7 (rom (root)))))))) + +(def hxc-types + "The hardcoded type names in memory. List begins at ROM@27D99, + shortly before hxc-titles." + (map character-codes->str + (take-nth 2 + (partition-by #(= 0x50 %) + (take 102 + (drop 0x27D99 + (rom (root)))))))) + +(def hxc-titles + "The hardcoded names of the trainer titles in memory. List begins at +ROM@27E77" + (map character-codes->str + (take-nth 2 + (partition-by #(= 0x50 %) + (take 196 + (drop 0x27E77 + (rom (root)))))))) + + +(def hxc-places + "The hardcoded place names in memory. List begins at +ROM@71500. Cinnabar Mansion is dynamically calculated." + (map character-codes->str + (take-nth 2 + (partition-by #(= % 0x50) + (take 560 + (drop 0x71500 + (rom (root)))))))) + + +(def hxc-dialog + "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000." +(character-codes->str(take 0x0F728 + (drop (+ 0x98000) + (rom (root)))))) + +(def hxc-pokedex + "The hardcoded pokedex entries in memory. List begins at +ROM@B8000, shortly before move names." + (map character-codes->str + (take-nth 2 + (partition-by #(= % 0x50) + (take 14754 + (drop 0xB8000 + (rom (root)))))))) +(def hxc-move-names + "The hardcoded move names in memory. List begins at ROM@BC000" + (map character-codes->str + (take-nth 2 + (partition-by #(= % 0x50) + (take 1551 + (drop 0xBC000 + (rom (root)))))))) + +(def hxc-move-data + "The hardcoded (basic (move effects)) in memory. List begins at +0x38000. Effect descriptions were handwritten and aren't hardcoded." + (let [names (vec hxc-move-names) + move-count (count names) + move-size 6 + format-name (fn [s] + (keyword (.toLowerCase + (apply str + (map #(if (= % \space) "-" %) s))))) + ] + (zipmap (map format-name names) + (map + (fn [[idx effect power type accuracy pp]] + {:name (names (dec idx)) + :power power + :accuracy (hex accuracy) + :pp pp + :fx-id (hex effect) + :fx-txt (get move-effects effect) + } + ) + + (partition move-size + (take (* move-size move-count) + (drop 0x38000 (rom(root))))))))) + + + +(def hxc-pokenames + "The hardcoded names of the 190 species in memory. List begins at ROM@E8000." + (let [count-species 190 + name-length 10] + (map character-codes->str + (partition name-length + (take (* count-species name-length) + (drop 0xE8000 + (rom(root)))))))) + + + + + + + + + (def hxc-advantage "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." (map @@ -139,11 +273,11 @@ +;; note for later: credits start at F1290 - - +(comment (def hxc-later "Running this code produces, e.g. hardcoded names NPCs give @@ -161,3 +295,4 @@ (def hxc-species (map character-codes->str (take-nth 4 dex)))) +) \ No newline at end of file