rlm@145
|
1 (ns com.aurellem.exp.items
|
rlm@145
|
2 (:use (com.aurellem.gb gb-driver vbm items))
|
rlm@145
|
3 (:import [com.aurellem.gb.gb_driver SaveState]))
|
rlm@145
|
4
|
rlm@145
|
5 ;; try just buying five potions in sequence and see what changes
|
rlm@145
|
6 ;; each time.
|
rlm@145
|
7
|
rlm@145
|
8 ;; trying to find how items are represented in memory
|
rlm@145
|
9
|
rlm@145
|
10 (def zero-potions (read-state "zero-potions"))
|
rlm@145
|
11
|
rlm@145
|
12 (def one-potion (read-state "one-potion"))
|
rlm@145
|
13
|
rlm@145
|
14 (def two-potions (read-state "two-potions"))
|
rlm@145
|
15
|
rlm@145
|
16 (def three-potions (read-state "three-potions"))
|
rlm@145
|
17
|
rlm@145
|
18 (def four-potions (read-state "four-potions"))
|
rlm@145
|
19
|
rlm@145
|
20 (def five-potions (read-state "five-potions"))
|
rlm@145
|
21
|
rlm@145
|
22
|
rlm@145
|
23 ;; result
|
rlm@145
|
24 (defn item-canidates []
|
rlm@145
|
25 (apply common-differences
|
rlm@145
|
26 (map (comp vec memory)
|
rlm@145
|
27 [zero-potions one-potion two-potions three-potions
|
rlm@145
|
28 four-potions five-potions])))
|
rlm@145
|
29
|
rlm@145
|
30 (comment [55875 (37 15 49 27 14 44)]
|
rlm@145
|
31 [55876 (30 1 49 56 55 23)]
|
rlm@145
|
32 [49158 (154 191 78 135 70 73)]
|
rlm@145
|
33 [54087 (49 40 37 34 25 22)]
|
rlm@145
|
34 [49160 (7 24 59 243 50 217)]
|
rlm@145
|
35 [49704 (31 14 72 33 84 27)]
|
rlm@145
|
36 [49162 (126 159 183 110 176 179)]
|
rlm@145
|
37 [39984 (0 254 251 248 127 252)]
|
rlm@145
|
38 [49904 (29 72 64 78 1 95)]
|
rlm@145
|
39 [65491 (222 127 149 132 226 38)]
|
rlm@145
|
40 [65492 (44 20 89 11 253 163)]
|
rlm@145
|
41 [49335 (52 15 6 14 3 17)]
|
rlm@145
|
42 [49720 (78 152 96 60 83 103)]
|
rlm@145
|
43 [65304 (19 89 214 33 18 113)]
|
rlm@145
|
44 [53561 (132 185 145 162 159 183)]
|
rlm@145
|
45 [54046 (0 1 2 3 4 5)])
|
rlm@145
|
46
|
rlm@145
|
47 ;;; hmmmmmm...... I guess that the potion quantities are at 54046,
|
rlm@145
|
48 ;;;huh?
|
rlm@145
|
49
|
rlm@145
|
50
|
rlm@145
|
51
|
rlm@145
|
52 (defn get-mem []
|
rlm@145
|
53 (subvec (vec (memory @current-state)) 54040 (+ 54046 100)))
|
rlm@145
|
54
|
rlm@145
|
55
|
rlm@145
|
56 ;; potion -- 99
|
rlm@145
|
57 [0 16 0 0 1 20 99 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
|
rlm@145
|
58
|
rlm@145
|
59 ;; potion -- 95
|
rlm@145
|
60 [0 16 0 0 1 20 95 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
|
rlm@145
|
61
|
rlm@145
|
62 ;; potion -- 95
|
rlm@145
|
63 ;; pokeball -- 1
|
rlm@145
|
64 [0 16 0 0 2 20 95 4 1 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
|
rlm@145
|
65
|
rlm@145
|
66 ;; potion -- 95
|
rlm@145
|
67 ;; pokeball -- 10
|
rlm@145
|
68 [0 16 0 0 2 20 95 4 10 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
|
rlm@145
|
69
|
rlm@145
|
70
|
rlm@145
|
71 ;; pokeball -- 10
|
rlm@145
|
72 ;; potion -- 95
|
rlm@145
|
73 [0 16 0 0 2 4 10 20 95 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
|
rlm@145
|
74
|
rlm@145
|
75 ;; pokeball -- 10
|
rlm@145
|
76 ;; potion -- 95
|
rlm@145
|
77 ;; antidote -- 1
|
rlm@145
|
78
|
rlm@145
|
79 ;;prediction
|
rlm@145
|
80 ;;[0 16 0 0 3 4 10 20 95 ?? 1 255 0 0 0 0 0 ....]
|
rlm@145
|
81 [0 16 0 0 3 4 10 20 95 11 1 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
|
rlm@145
|
82
|
rlm@145
|
83
|
rlm@145
|
84
|
rlm@145
|
85 ;; now it's time to learn the item codes
|
rlm@145
|
86
|
rlm@145
|
87 (def inventory-begin
|
rlm@145
|
88 (read-state "inventory-begin"))
|
rlm@145
|
89
|
rlm@145
|
90 (defn show-item
|
rlm@145
|
91 "Run a saved pokemon with the first item replaced by the item named
|
rlm@145
|
92 by n."
|
rlm@145
|
93 [n]
|
rlm@145
|
94 (set-state! inventory-begin)
|
rlm@145
|
95 (let [mem (memory)]
|
rlm@145
|
96 (aset mem 54044 1)
|
rlm@145
|
97 (aset mem 54045 n)
|
rlm@145
|
98 (aset mem 54046 1)
|
rlm@145
|
99 (aset mem 54047 255)
|
rlm@145
|
100 (write-memory! mem))
|
rlm@145
|
101 (step)
|
rlm@145
|
102 (->> [[] @current-state]
|
rlm@145
|
103 (play-moves
|
rlm@145
|
104 [[:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
|
rlm@145
|
105 [] [] [] [] []])))
|
rlm@145
|
106
|
rlm@145
|
107
|
rlm@145
|
108 (defn get-item-names []
|
rlm@145
|
109 (dorun (map (fn [n] (println n)
|
rlm@145
|
110 (show-item n)
|
rlm@145
|
111 (Thread/sleep 5000))
|
rlm@145
|
112 (range 0x00 0xFF))))
|
rlm@145
|
113
|
rlm@145
|
114 ;; results (took about 10 minutes to generate)
|
rlm@145
|
115
|
rlm@145
|
116 ;; 0 garbage
|
rlm@145
|
117 ;; 1 master-ball
|
rlm@145
|
118 ;; 2 ultra-ball
|
rlm@145
|
119 ;; 3 great-ball
|
rlm@145
|
120 ;; 4 poke-ball
|
rlm@145
|
121 ;; 5 town-map
|
rlm@145
|
122 ;; 6 bicycle
|
rlm@145
|
123 ;; 7 ?????
|
rlm@145
|
124 ;; 8 safari-ball
|
rlm@145
|
125 ;; 9 pokedex
|
rlm@145
|
126 ;; 10 moon-stone
|
rlm@145
|
127 ;; 11 antidote
|
rlm@145
|
128 ;; 12 burn-heal
|
rlm@145
|
129 ;; 13 ice-heal
|
rlm@145
|
130 ;; 14 awakening
|
rlm@145
|
131 ;; 15 parlyz-heal
|
rlm@145
|
132 ;; 16 full-restore
|
rlm@145
|
133 ;; 17 max-potion
|
rlm@145
|
134 ;; 18 hyper-potion
|
rlm@145
|
135 ;; 19 super-potion
|
rlm@145
|
136 ;; 20 potion
|
rlm@145
|
137 ;; 21 boulderbadge
|
rlm@145
|
138 ;; 22 cascadebadge
|
rlm@145
|
139 ;; 23 thunderbadge
|
rlm@145
|
140 ;; 24 rainbowbadge
|
rlm@145
|
141 ;; 25 soulbadge
|
rlm@145
|
142 ;; 26 marshbadge
|
rlm@145
|
143 ;; 27 volcanobadge
|
rlm@145
|
144 ;; 28 earthbadge
|
rlm@145
|
145 ;; 29 escape-rope
|
rlm@145
|
146 ;; 30 repel
|
rlm@145
|
147 ;; 31 old amber
|
rlm@145
|
148 ;; 32 fire-stone
|
rlm@145
|
149 ;; 33 thunderstone
|
rlm@145
|
150 ;; 34 water-stone
|
rlm@145
|
151 ;; 35 hp-up
|
rlm@145
|
152 ;; 36 protein
|
rlm@145
|
153 ;; 37 iron
|
rlm@145
|
154 ;; 38 carbos
|
rlm@145
|
155 ;; 39 calcium
|
rlm@145
|
156 ;; 40 rare-candy
|
rlm@145
|
157 ;; 41 dome-fossil
|
rlm@145
|
158 ;; 42 helix-fossil
|
rlm@145
|
159 ;; 43 secret-key
|
rlm@145
|
160 ;; 44 ?????
|
rlm@145
|
161 ;; 45 bike-voucher
|
rlm@145
|
162 ;; 46 x-accuracy
|
rlm@145
|
163 ;; 47 leaf-stone
|
rlm@145
|
164 ;; 48 card-key
|
rlm@145
|
165 ;; 49 nugget
|
rlm@145
|
166 ;; 50 pp-up
|
rlm@145
|
167 ;; 51 poke-doll
|
rlm@145
|
168 ;; 52 full-heal
|
rlm@145
|
169 ;; 53 revive
|
rlm@145
|
170 ;; 54 max-revive
|
rlm@145
|
171 ;; 55 guard-spec.
|
rlm@145
|
172 ;; 56 super-repel
|
rlm@145
|
173 ;; 57 max-repel
|
rlm@145
|
174 ;; 58 dire-hit
|
rlm@145
|
175 ;; 59 coin
|
rlm@145
|
176 ;; 60 fresh-water
|
rlm@145
|
177 ;; 61 soda-pop
|
rlm@145
|
178 ;; 62 lemonade
|
rlm@145
|
179 ;; 63 s.s.ticket
|
rlm@145
|
180 ;; 64 gold-teeth
|
rlm@145
|
181 ;; 65 x-attach
|
rlm@145
|
182 ;; 66 x-defend
|
rlm@145
|
183 ;; 67 x-speed
|
rlm@145
|
184 ;; 68 x-special
|
rlm@145
|
185 ;; 69 coin-case
|
rlm@145
|
186 ;; 70 oak's-parcel
|
rlm@145
|
187 ;; 71 itemfinder
|
rlm@145
|
188 ;; 72 silph-scope
|
rlm@145
|
189 ;; 73 poke-flute
|
rlm@145
|
190 ;; 74 lift-key
|
rlm@145
|
191 ;; 75 exp.all
|
rlm@145
|
192 ;; 76 old-rod
|
rlm@145
|
193 ;; 77 good-rod
|
rlm@145
|
194 ;; 78 super-rod
|
rlm@145
|
195 ;; 79 pp-up
|
rlm@145
|
196 ;; 80 ether
|
rlm@145
|
197 ;; 81 max-ether
|
rlm@145
|
198 ;; 82 elixer
|
rlm@145
|
199 ;; 83 max-elixer
|
rlm@145
|
200 ;; 84 B2F
|
rlm@145
|
201 ;; 85 B1F
|
rlm@145
|
202 ;; 86 1F
|
rlm@145
|
203 ;; 87 2F
|
rlm@145
|
204 ;; 88 3F
|
rlm@145
|
205 ;; 89 4F
|
rlm@145
|
206 ;; 90 5F
|
rlm@145
|
207 ;; 91 6F
|
rlm@145
|
208 ;; 92 7F
|
rlm@145
|
209 ;; 93 8F
|
rlm@145
|
210 ;; 94 9F
|
rlm@145
|
211 ;; 95 10F
|
rlm@145
|
212 ;; 96 11F
|
rlm@145
|
213 ;; 97 B4F
|
rlm@145
|
214 ;; 98 garbage
|
rlm@145
|
215 ;; 99 garbage
|
rlm@145
|
216 ;; 100 garbage
|
rlm@145
|
217 ;; 101 garbage
|
rlm@145
|
218 ;; 102 garbage
|
rlm@145
|
219 ;; 103 garbage
|
rlm@145
|
220 ;; 104 garbage
|
rlm@145
|
221 ;; 105 garbage
|
rlm@145
|
222 ;; 106 garbage
|
rlm@145
|
223 ;; 107 garbage
|
rlm@145
|
224 ;; 108 garbage
|
rlm@145
|
225 ;; 109 garbage
|
rlm@145
|
226 ;; 110 garbage
|
rlm@145
|
227 ;; 111 garbage
|
rlm@145
|
228 ;; 112 garbage
|
rlm@145
|
229 ;; 113 garbage
|
rlm@145
|
230 ;; 114 garbage
|
rlm@145
|
231 ;; 115 garbage
|
rlm@145
|
232 ;; 116 garbage
|
rlm@145
|
233 ;; 117 garbage
|
rlm@145
|
234 ;; 118 garbage
|
rlm@145
|
235 ;; 119 4
|
rlm@145
|
236 ;; 120 garbage
|
rlm@145
|
237 ;; 121 garbage
|
rlm@145
|
238 ;; 122 slow
|
rlm@145
|
239 ;; 123 garbage
|
rlm@145
|
240 ;; 124 garbage
|
rlm@145
|
241 ;; 125 garbage
|
rlm@145
|
242 ;; 126 garbage
|
rlm@145
|
243 ;; 127 garbage
|
rlm@145
|
244 ;; 128 garbage
|
rlm@145
|
245 ;; 129 garbage
|
rlm@145
|
246 ;; 130 garbage
|
rlm@145
|
247 ;; 131 slow
|
rlm@145
|
248 ;; 132 slow
|
rlm@145
|
249 ;; 133 garbage
|
rlm@145
|
250 ;; 134 slow
|
rlm@145
|
251 ;; 135 garbage
|
rlm@145
|
252 ;; 136 garbage
|
rlm@145
|
253 ;; 137 slow
|
rlm@145
|
254 ;; 138 garbage
|
rlm@145
|
255 ;; 139 garbage
|
rlm@145
|
256 ;; 140 garbage
|
rlm@145
|
257 ;; 141 slow
|
rlm@145
|
258 ;; 142 garbage
|
rlm@145
|
259 ;; 143 garbage
|
rlm@145
|
260 ;; 144 garbage
|
rlm@145
|
261 ;; 145 garbage
|
rlm@145
|
262 ;; 146 garbage
|
rlm@145
|
263 ;; 147 garbage
|
rlm@145
|
264 ;; 148 garbage
|
rlm@145
|
265 ;; 149 garbage
|
rlm@145
|
266 ;; 150 slow
|
rlm@145
|
267 ;; 151 garbage
|
rlm@145
|
268 ;; 152 Q
|
rlm@145
|
269 ;; 153 garbage
|
rlm@145
|
270 ;; 154 garbage
|
rlm@145
|
271 ;; 155 garbage
|
rlm@145
|
272 ;; 156 garbage
|
rlm@145
|
273 ;; 157 garbage
|
rlm@145
|
274 ;; 158 garbage
|
rlm@145
|
275 ;; 159 garbage
|
rlm@145
|
276 ;; 160 garbage (alaphabet)
|
rlm@145
|
277 ;; 161 garbage
|
rlm@145
|
278 ;; 162 garbage
|
rlm@145
|
279 ;; 163 garbage
|
rlm@145
|
280 ;; 164 rival's
|
rlm@145
|
281 ;; 165 name?
|
rlm@145
|
282 ;; 166 nickname?
|
rlm@145
|
283 ;; 167 slow
|
rlm@145
|
284 ;; 168 garbage
|
rlm@145
|
285 ;; 169 slow
|
rlm@145
|
286 ;; 170 garbage
|
rlm@145
|
287 ;; 171 garbage
|
rlm@145
|
288 ;; 172 garbage
|
rlm@145
|
289 ;; 173 garbage
|
rlm@145
|
290 ;; 174 garbage
|
rlm@145
|
291 ;; 175 yellow
|
rlm@145
|
292 ;; 176 ash
|
rlm@145
|
293 ;; 177 jack
|
rlm@145
|
294 ;; 178 new-name
|
rlm@145
|
295 ;; 179 blue
|
rlm@145
|
296 ;; 180 gary
|
rlm@145
|
297 ;; 181 john
|
rlm@145
|
298 ;; 182 garbage
|
rlm@145
|
299 ;; 183 garbage
|
rlm@145
|
300 ;; 184 garbage
|
rlm@145
|
301 ;; 185 garbage
|
rlm@145
|
302 ;; 186 slow
|
rlm@145
|
303 ;; 187 garbage
|
rlm@145
|
304 ;; 188 garbage
|
rlm@145
|
305 ;; 189 garbage
|
rlm@145
|
306 ;; 190 garbage
|
rlm@145
|
307 ;; 191 garbage
|
rlm@145
|
308 ;; 192 garbage
|
rlm@145
|
309 ;; 193 garbage
|
rlm@145
|
310 ;; 194 garbage
|
rlm@145
|
311 ;; 195 slow
|
rlm@145
|
312 ;; 196 HM01
|
rlm@145
|
313 ;; 197 HM02
|
rlm@145
|
314 ;; 198 HM03
|
rlm@145
|
315 ;; 199 HM04
|
rlm@145
|
316 ;; 200 HM05
|
rlm@145
|
317 ;; 201 TM01
|
rlm@145
|
318 ;; 202 TM02
|
rlm@145
|
319 ;; 203 TM03
|
rlm@145
|
320 ;; 204 TM04
|
rlm@145
|
321 ;; 205 TM05
|
rlm@145
|
322 ;; 206 TM06
|
rlm@145
|
323 ;; 207 TM07
|
rlm@145
|
324 ;; 208 TM08
|
rlm@145
|
325 ;; 209 TM09
|
rlm@145
|
326 ;; 210 TM10
|
rlm@145
|
327 ;; 211 TM11
|
rlm@145
|
328 ;; 212 TM12
|
rlm@145
|
329 ;; 213 TM13
|
rlm@145
|
330 ;; 214 TM13
|
rlm@145
|
331 ;; 215 TM15
|
rlm@145
|
332 ;; 216 TM16
|
rlm@145
|
333 ;; 217 TM17
|
rlm@145
|
334 ;; 218 TM18
|
rlm@145
|
335 ;; 219 TM19
|
rlm@145
|
336 ;; 220 TM20
|
rlm@145
|
337 ;; 221 TM21
|
rlm@145
|
338 ;; 222 TM22
|
rlm@145
|
339 ;; 223 TM23
|
rlm@145
|
340 ;; 224 TM24
|
rlm@145
|
341 ;; 225 TM25
|
rlm@145
|
342 ;; 226 TM26
|
rlm@145
|
343 ;; 227 TM27
|
rlm@145
|
344 ;; 228 TM28
|
rlm@145
|
345 ;; 229 TM29
|
rlm@145
|
346 ;; 230 TM30
|
rlm@145
|
347 ;; 231 TM31
|
rlm@145
|
348 ;; 232 TM32
|
rlm@145
|
349 ;; 233 TM33
|
rlm@145
|
350 ;; 234 TM34
|
rlm@145
|
351 ;; 235 TM35
|
rlm@145
|
352 ;; 236 TM36
|
rlm@145
|
353 ;; 237 TM37
|
rlm@145
|
354 ;; 238 TM38
|
rlm@145
|
355 ;; 239 TM39
|
rlm@145
|
356 ;; 240 TM40
|
rlm@145
|
357 ;; 241 TM41
|
rlm@145
|
358 ;; 242 TM42
|
rlm@145
|
359 ;; 243 TM43
|
rlm@145
|
360 ;; 244 TM44
|
rlm@145
|
361 ;; 245 TM45
|
rlm@145
|
362 ;; 246 TM46
|
rlm@145
|
363 ;; 247 TM47
|
rlm@145
|
364 ;; 248 TM48
|
rlm@145
|
365 ;; 249 TM49
|
rlm@145
|
366 ;; 250 TM50
|
rlm@145
|
367 ;; 251 TM51
|
rlm@145
|
368 ;; 252 TM52
|
rlm@145
|
369 ;; 253 TM53
|
rlm@145
|
370 ;; 254 TM54
|
rlm@145
|
371 ;; 255 end-of-list-sentinel
|
rlm@145
|
372
|
rlm@145
|
373
|
rlm@145
|
374
|
rlm@145
|
375 (def gliched-tms
|
rlm@145
|
376 [[:TM51 1]
|
rlm@145
|
377 [:TM52 1]
|
rlm@145
|
378 [:TM53 1]
|
rlm@145
|
379 [:TM54 1]])
|
rlm@145
|
380
|
rlm@145
|
381 (def good-items
|
rlm@145
|
382 [[:bicycle 1]
|
rlm@145
|
383 [:ultra-ball 15]
|
rlm@145
|
384 [:pp-up 1]
|
rlm@145
|
385 [:master-ball 5]
|
rlm@145
|
386 [:rare-candy 99]
|
rlm@145
|
387 [:full-restore 25]
|
rlm@145
|
388 [:max-revive 8]
|
rlm@145
|
389 [:max-repel 40]
|
rlm@145
|
390 [:TM25 1]
|
rlm@145
|
391 [:TM11 1]
|
rlm@145
|
392 [:TM15 1]
|
rlm@145
|
393 ])
|
rlm@145
|
394
|
rlm@145
|
395 (def some-badges
|
rlm@145
|
396 [[:cascadebadge 1]
|
rlm@145
|
397 [:thunderbadge 1]
|
rlm@145
|
398 [:rainbowbadge 1]
|
rlm@145
|
399 [:soulbadge 1]
|
rlm@145
|
400 ])
|
rlm@145
|
401
|