comparison 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
comparison
equal deleted inserted replaced
245:a50faba43967 246:921d2277bb57
1 (ns com.aurellem.gb.hxc 1 (ns com.aurellem.gb.hxc
2 (:use (com.aurellem.gb assembly characters gb-driver util 2 (:use (com.aurellem.gb assembly characters gb-driver util
3 constants)) 3 constants))
4 (:use (com.aurellem.world practice)) 4 (:use (com.aurellem.world practice))
5 (:import [com.aurellem.gb.gb_driver SaveState])) 5 (:import [com.aurellem.gb.gb_driver SaveState]))
6
7
8 (def hxc-pokenames
9 "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
10 (let [count-species 190
11 name-length 10]
12 (map character-codes->str
13 (partition name-length
14 (take (* count-species name-length)
15 (drop 0xE8000
16 (rom(root))))))))
17
18 (def hxc-items
19 "The hardcoded names of the items in memory. List begins at ROM@45B7 "
20 (map character-codes->str
21 (take-nth 2
22 (partition-by #(= % 0x50)
23 (take 1200
24 (drop 0x45B7 (rom (root))))))))
25
26 (def hxc-types
27 "The hardcoded type names in memory. List begins at ROM@27D99,
28 shortly before hxc-titles."
29 (map character-codes->str
30 (take-nth 2
31 (partition-by #(= 0x50 %)
32 (take 102
33 (drop 0x27D99
34 (rom (root))))))))
35
36 (def hxc-titles
37 "The hardcoded names of the trainer titles in memory. List begins at
38 ROM@27E77"
39 (map character-codes->str
40 (take-nth 2
41 (partition-by #(= 0x50 %)
42 (take 196
43 (drop 0x27E77
44 (rom (root))))))))
45
46
47 (def hxc-pokedex
48 "The hardcoded pokedex entries in memory. List begins at
49 ROM@B8000, shortly before move names."
50 (map character-codes->str
51 (take-nth 2
52 (partition-by #(= % 0x50)
53 (take 14754
54 (drop 0xB8000
55 (rom (root))))))))
56 (def hxc-moves
57 "The hardcoded move names in memory. List begins at ROM@BC000"
58 (map character-codes->str
59 (take-nth 2
60 (partition-by #(= % 0x50)
61 (take 1551
62 (drop 0xBC000
63 (rom (root))))))))
64
65
66
67 (def hxc-places
68 "The hardcoded place names in memory. List begins at
69 ROM@71500. Cinnabar Mansion is dynamically calculated."
70 (map character-codes->str
71 (take-nth 2
72 (partition-by #(= % 0x50)
73 (take 560
74 (drop 0x71500
75 (rom (root))))))))
76
77
78 (def hxc-dialog
79 "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
80 (character-codes->str(take 0x0F728
81 (drop (+ 0x98000)
82 (rom (root))))))
83
84 6
85 7
86 8
87 (def pkmn-types 9 (def pkmn-types
88 [:normal 10 [:normal
113 :ice 35 :ice
114 :dragon 36 :dragon
115 ]) 37 ])
116 38
117 39
40 ;; question: when status effects claim to take
41 ;; their accuracy from the move accuracy, does
42 ;; this mean that the move always "hits" but the
43 ;; status effect may not?
44
45 (def move-effects
46 ["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 acr
96 "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 difference
103 ;; 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 acr
114 "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 0x19
119 "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. some
128 exceptions apply."
129 "(rage)"
130 "(mimic)"
131 "(metronome)"
132 "(leech seed)"
133 "does nothing (splash)"
134 "(disable)"
135 ])
136
137
138
139
140
141 (def hxc-items
142 "The hardcoded names of the items in memory. List begins at ROM@045B7 "
143 (map character-codes->str
144 (take-nth 2
145 (partition-by #(= % 0x50)
146 (take 1200
147 (drop 0x45B7 (rom (root))))))))
148
149 (def hxc-types
150 "The hardcoded type names in memory. List begins at ROM@27D99,
151 shortly before hxc-titles."
152 (map character-codes->str
153 (take-nth 2
154 (partition-by #(= 0x50 %)
155 (take 102
156 (drop 0x27D99
157 (rom (root))))))))
158
159 (def hxc-titles
160 "The hardcoded names of the trainer titles in memory. List begins at
161 ROM@27E77"
162 (map character-codes->str
163 (take-nth 2
164 (partition-by #(= 0x50 %)
165 (take 196
166 (drop 0x27E77
167 (rom (root))))))))
168
169
170 (def hxc-places
171 "The hardcoded place names in memory. List begins at
172 ROM@71500. Cinnabar Mansion is dynamically calculated."
173 (map character-codes->str
174 (take-nth 2
175 (partition-by #(= % 0x50)
176 (take 560
177 (drop 0x71500
178 (rom (root))))))))
179
180
181 (def hxc-dialog
182 "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
183 (character-codes->str(take 0x0F728
184 (drop (+ 0x98000)
185 (rom (root))))))
186
187 (def hxc-pokedex
188 "The hardcoded pokedex entries in memory. List begins at
189 ROM@B8000, shortly before move names."
190 (map character-codes->str
191 (take-nth 2
192 (partition-by #(= % 0x50)
193 (take 14754
194 (drop 0xB8000
195 (rom (root))))))))
196 (def hxc-move-names
197 "The hardcoded move names in memory. List begins at ROM@BC000"
198 (map character-codes->str
199 (take-nth 2
200 (partition-by #(= % 0x50)
201 (take 1551
202 (drop 0xBC000
203 (rom (root))))))))
204
205 (def hxc-move-data
206 "The hardcoded (basic (move effects)) in memory. List begins at
207 0x38000. Effect descriptions were handwritten and aren't hardcoded."
208 (let [names (vec hxc-move-names)
209 move-count (count names)
210 move-size 6
211 format-name (fn [s]
212 (keyword (.toLowerCase
213 (apply str
214 (map #(if (= % \space) "-" %) s)))))
215 ]
216 (zipmap (map format-name names)
217 (map
218 (fn [[idx effect power type accuracy pp]]
219 {:name (names (dec idx))
220 :power power
221 :accuracy (hex accuracy)
222 :pp pp
223 :fx-id (hex effect)
224 :fx-txt (get move-effects effect)
225 }
226 )
227
228 (partition move-size
229 (take (* move-size move-count)
230 (drop 0x38000 (rom(root)))))))))
231
232
233
234 (def hxc-pokenames
235 "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
236 (let [count-species 190
237 name-length 10]
238 (map character-codes->str
239 (partition name-length
240 (take (* count-species name-length)
241 (drop 0xE8000
242 (rom(root))))))))
243
244
245
246
247
248
249
250
251
118 (def hxc-advantage 252 (def hxc-advantage
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." 253 "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."
120 (map 254 (map
121 (fn [[atk def mult]] [(get pkmn-types atk (hex atk)) 255 (fn [[atk def mult]] [(get pkmn-types atk (hex atk))
122 (get pkmn-types def (hex def)) 256 (get pkmn-types def (hex def))
137 271
138 272
139 273
140 274
141 275
142 276 ;; note for later: credits start at F1290
143 277
144 278
145 279
146 280 (comment
147 281
148 (def hxc-later 282 (def hxc-later
149 "Running this code produces, e.g. hardcoded names NPCs give 283 "Running this code produces, e.g. hardcoded names NPCs give
150 their pokemon. Will sort through it later." 284 their pokemon. Will sort through it later."
151 (print (character-codes->str(take 10000 285 (print (character-codes->str(take 10000
159 (rom (root)))))] 293 (rom (root)))))]
160 (def dex dex) 294 (def dex dex)
161 (def hxc-species 295 (def hxc-species
162 (map character-codes->str 296 (map character-codes->str
163 (take-nth 4 dex)))) 297 (take-nth 4 dex))))
298 )