annotate clojure/com/aurellem/gb/hxc.clj @ 245:a50faba43967

forgot to include Bird type with the list of available type names for type advantage data. now hxc-advantage is correct.
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 25 Mar 2012 23:04:01 -0500
parents 27ca947084cf
children 921d2277bb57
rev   line source
rlm@218 1 (ns com.aurellem.gb.hxc
rlm@218 2 (:use (com.aurellem.gb assembly characters gb-driver util
rlm@218 3 constants))
rlm@218 4 (:use (com.aurellem.world practice))
rlm@218 5 (:import [com.aurellem.gb.gb_driver SaveState]))
rlm@218 6
rlm@218 7
rlm@218 8 (def hxc-pokenames
rlm@218 9 "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
rlm@218 10 (let [count-species 190
rlm@218 11 name-length 10]
rlm@218 12 (map character-codes->str
rlm@218 13 (partition name-length
rlm@218 14 (take (* count-species name-length)
rlm@218 15 (drop 0xE8000
rlm@218 16 (rom(root))))))))
rlm@218 17
rlm@218 18 (def hxc-items
rlm@218 19 "The hardcoded names of the items in memory. List begins at ROM@45B7 "
rlm@218 20 (map character-codes->str
rlm@218 21 (take-nth 2
rlm@218 22 (partition-by #(= % 0x50)
rlm@218 23 (take 1200
rlm@218 24 (drop 0x45B7 (rom (root))))))))
ocsenave@244 25
ocsenave@244 26 (def hxc-types
ocsenave@244 27 "The hardcoded type names in memory. List begins at ROM@27D99,
ocsenave@244 28 shortly before hxc-titles."
ocsenave@244 29 (map character-codes->str
ocsenave@244 30 (take-nth 2
ocsenave@244 31 (partition-by #(= 0x50 %)
ocsenave@244 32 (take 102
ocsenave@244 33 (drop 0x27D99
ocsenave@244 34 (rom (root))))))))
ocsenave@244 35
rlm@218 36 (def hxc-titles
rlm@218 37 "The hardcoded names of the trainer titles in memory. List begins at
rlm@218 38 ROM@27E77"
rlm@218 39 (map character-codes->str
rlm@218 40 (take-nth 2
rlm@218 41 (partition-by #(= 0x50 %)
rlm@218 42 (take 196
rlm@218 43 (drop 0x27E77
rlm@218 44 (rom (root))))))))
rlm@218 45
rlm@218 46
rlm@218 47 (def hxc-pokedex
rlm@218 48 "The hardcoded pokedex entries in memory. List begins at
rlm@218 49 ROM@B8000, shortly before move names."
rlm@218 50 (map character-codes->str
rlm@218 51 (take-nth 2
rlm@218 52 (partition-by #(= % 0x50)
rlm@218 53 (take 14754
rlm@218 54 (drop 0xB8000
rlm@218 55 (rom (root))))))))
rlm@218 56 (def hxc-moves
rlm@218 57 "The hardcoded move names in memory. List begins at ROM@BC000"
rlm@218 58 (map character-codes->str
rlm@218 59 (take-nth 2
rlm@218 60 (partition-by #(= % 0x50)
rlm@218 61 (take 1551
rlm@218 62 (drop 0xBC000
rlm@218 63 (rom (root))))))))
rlm@218 64
rlm@218 65
rlm@218 66
rlm@218 67 (def hxc-places
rlm@218 68 "The hardcoded place names in memory. List begins at
rlm@218 69 ROM@71500. Cinnabar Mansion is dynamically calculated."
rlm@218 70 (map character-codes->str
ocsenave@243 71 (take-nth 2
ocsenave@243 72 (partition-by #(= % 0x50)
rlm@218 73 (take 560
rlm@218 74 (drop 0x71500
rlm@218 75 (rom (root))))))))
rlm@218 76
rlm@218 77
rlm@218 78 (def hxc-dialog
rlm@218 79 "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
rlm@218 80 (character-codes->str(take 0x0F728
rlm@218 81 (drop (+ 0x98000)
rlm@218 82 (rom (root))))))
rlm@218 83
ocsenave@243 84
ocsenave@243 85
ocsenave@243 86
ocsenave@243 87 (def pkmn-types
ocsenave@244 88 [:normal
ocsenave@244 89 :fighting
ocsenave@244 90 :flying
ocsenave@244 91 :poison
ocsenave@244 92 :ground
ocsenave@244 93 :rock
ocsenave@245 94 :bird
ocsenave@244 95 :bug
ocsenave@244 96 :ghost
ocsenave@244 97 :A
ocsenave@244 98 :B
ocsenave@244 99 :C
ocsenave@244 100 :D
ocsenave@244 101 :E
ocsenave@244 102 :F
ocsenave@244 103 :G
ocsenave@244 104 :H
ocsenave@244 105 :I
ocsenave@244 106 :J
ocsenave@244 107 :K
ocsenave@244 108 :fire
ocsenave@244 109 :water
ocsenave@244 110 :grass
ocsenave@244 111 :electric
ocsenave@244 112 :psychic
ocsenave@244 113 :ice
ocsenave@244 114 :dragon
ocsenave@244 115 ])
ocsenave@243 116
ocsenave@243 117
ocsenave@243 118 (def hxc-advantage
ocsenave@245 119 "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."
ocsenave@243 120 (map
ocsenave@243 121 (fn [[atk def mult]] [(get pkmn-types atk (hex atk))
ocsenave@243 122 (get pkmn-types def (hex def))
ocsenave@243 123 (/ mult 10)])
ocsenave@243 124 (partition 3
ocsenave@243 125 (take-while (partial not= 0xFF)
ocsenave@243 126 (drop 0x3E62D (rom(root)))))))
ocsenave@243 127
ocsenave@243 128
ocsenave@243 129
ocsenave@243 130
ocsenave@243 131
ocsenave@243 132
ocsenave@243 133
ocsenave@243 134
ocsenave@243 135
ocsenave@243 136
ocsenave@243 137
ocsenave@243 138
ocsenave@243 139
ocsenave@243 140
ocsenave@243 141
ocsenave@243 142
ocsenave@243 143
ocsenave@243 144
ocsenave@243 145
ocsenave@243 146
ocsenave@243 147
rlm@218 148 (def hxc-later
rlm@218 149 "Running this code produces, e.g. hardcoded names NPCs give
rlm@218 150 their pokemon. Will sort through it later."
rlm@218 151 (print (character-codes->str(take 10000
rlm@218 152 (drop 0x71597
rlm@218 153 (rom (root)))))))
rlm@218 154
rlm@218 155 (let [dex
rlm@218 156 (partition-by #(= 0x50 %)
rlm@218 157 (take 2540
rlm@218 158 (drop 0x40687
rlm@218 159 (rom (root)))))]
rlm@218 160 (def dex dex)
rlm@218 161 (def hxc-species
rlm@218 162 (map character-codes->str
rlm@218 163 (take-nth 4 dex))))