annotate clojure/com/aurellem/run/bootstrap_1.clj @ 372:998702f021e3

merged changes
author Dylan Holmes <ocsenave@gmail.com>
date Mon, 09 Apr 2012 01:44:19 -0500
parents 8d8023057b3c
children 79252378fd22
rev   line source
rlm@345 1 (ns com.aurellem.run.bootstrap-1
rlm@345 2 (:use (com.aurellem.gb saves gb-driver util
rlm@345 3 items vbm characters money))
rlm@345 4 (:use (com.aurellem.run util title save-corruption bootstrap-0))
rlm@345 5 (:use (com.aurellem.exp item-bridge))
rlm@345 6 (:import [com.aurellem.gb.gb_driver SaveState]))
rlm@345 7
rlm@345 8 (defn pc-item-writer-program
rlm@345 9 []
rlm@345 10 (let [limit 201
rlm@345 11 [target-high target-low] (disect-bytes-2 0xD162)]
rlm@345 12 (flatten
rlm@345 13 [[0x00 ;; (item-hack) set increment stack pointer no-op
rlm@345 14 0x1E ;; load limit into E
rlm@345 15 limit
rlm@345 16 0x3F ;; (item-hack) set carry flag no-op
rlm@345 17
rlm@345 18 ;; load 2 into C.
rlm@345 19 0x0E ;; C == 1 means input-first nybble
rlm@345 20 0x04 ;; C == 0 means input-second nybble
rlm@345 21
rlm@345 22 0x21 ;; load target into HL
rlm@345 23 target-low
rlm@345 24 target-high
rlm@345 25 0x37 ;; (item-hack) set carry flag no-op
rlm@345 26
rlm@345 27 0x00 ;; (item-hack) no-op
rlm@345 28 0x37 ;; (item-hack) set carry flag no-op
rlm@345 29
rlm@345 30 0x00 ;; (item-hack) no-op
rlm@345 31 0xF3 ;; disable interrupts
rlm@345 32 ;; Input Section
rlm@345 33
rlm@345 34 0x3E ;; load 0x20 into A, to measure buttons
rlm@345 35 0x10
rlm@345 36
rlm@345 37 0x00 ;; (item-hack) no-op
rlm@345 38 0xE0 ;; load A into [FF00]
rlm@345 39 0x00
rlm@345 40
rlm@345 41 0xF0 ;; load 0xFF00 into A to get
rlm@345 42 0x00 ;; button presses
rlm@345 43
rlm@345 44 0xE6
rlm@345 45 0x0F ;; select bottom four bits of A
rlm@345 46 0x37 ;; (item-hack) set carry flag no-op
rlm@345 47
rlm@345 48 0x00 ;; (item-hack) no-op
rlm@345 49 0xB8 ;; see if input is different (CP A B)
rlm@345 50
rlm@345 51 0x00 ;; (item-hack) (INC SP)
rlm@345 52 0x28 ;; repeat above steps if input is not different
rlm@345 53 ;; (jump relative backwards if B != A)
rlm@345 54 0xED ;; (literal -19) (item-hack) -19 == egg bomb (TM37)
rlm@345 55
rlm@345 56 0x47 ;; load A into B
rlm@345 57
rlm@345 58 0x0D ;; dec C
rlm@345 59 0x37 ;; (item-hack) set-carry flag
rlm@345 60 ;; branch based on C:
rlm@345 61 0x20 ;; JR NZ
rlm@345 62 23 ;; skip "input second nybble" and "jump to target" below
rlm@345 63
rlm@345 64 ;; input second nybble
rlm@345 65
rlm@345 66 0x0C ;; inc C
rlm@345 67 0x0C ;; inc C
rlm@345 68
rlm@345 69 0x00 ;; (item-hack) no-op
rlm@345 70 0xE6 ;; select bottom bits
rlm@345 71 0x0F
rlm@345 72 0x37 ;; (item-hack) set-carry flag no-op
rlm@345 73
rlm@345 74 0x00 ;; (item-hack) no-op
rlm@345 75 0xB2 ;; (OR A D) -> A
rlm@345 76
rlm@345 77 0x22 ;; (do (A -> (HL)) (INC HL))
rlm@345 78
rlm@345 79 0x1D ;; (DEC E)
rlm@345 80
rlm@345 81 0x00 ;; (item-hack)
rlm@345 82 0x20 ;; jump back to input section if not done
rlm@345 83 0xDA ;; literal -36 == TM 18 (counter)
rlm@345 84 0x01 ;; (item-hack) set BC to literal (no-op)
rlm@345 85
rlm@345 86 ;; jump to target
rlm@345 87 0x00 ;; (item-hack) these two bytes can be anything.
rlm@345 88 0x01
rlm@345 89
rlm@345 90 0x00 ;; (item-hack) no-op
rlm@345 91 0xBF ;; (CP A A) ensures Z
rlm@345 92
rlm@345 93 0xCA ;; (item-hack) jump if Z
rlm@345 94 target-low
rlm@345 95 target-high
rlm@345 96 0x01 ;; (item-hack) will never be reached.
rlm@345 97
rlm@345 98 ;; input first nybble
rlm@345 99 0x00
rlm@345 100 0xCB
rlm@345 101 0x37 ;; swap nybbles on A
rlm@345 102
rlm@345 103 0x57 ;; A -> D
rlm@345 104
rlm@345 105 0x37 ;; (item-hack) set carry flag no-op
rlm@345 106 0x18 ;; relative jump backwards
rlm@345 107 0xCD ;; literal -51 == TM05; go back to input section
rlm@345 108 0x01 ;; (item-hack) will never reach this instruction
rlm@345 109
rlm@345 110 ]
rlm@360 111 (repeat 8 [0x00 0x01])
rlm@345 112
rlm@345 113 [;; jump to actual program
rlm@345 114 0x00
rlm@345 115 0x37 ;; (item-hack) set carry flag no-op
rlm@345 116
rlm@345 117 0x2E ;; 0x3A -> L
rlm@345 118 0x3A
rlm@345 119
rlm@345 120
rlm@345 121 0x00 ;; (item-hack) no-op
rlm@345 122 0x26 ;; 0xD5 -> L
rlm@345 123 0xD5
rlm@345 124 0x01 ;; (item-hack) set-carry BC
rlm@345 125
rlm@345 126 0x00 ;; (item-hack) these can be anything
rlm@345 127 0x01
rlm@345 128
rlm@345 129 0x00
rlm@345 130 0xE9 ;; jump to (HL)
rlm@345 131 ]])))
rlm@345 132
rlm@345 133 (defn view-desired-item-layout []
rlm@345 134 (clojure.pprint/pprint
rlm@345 135 (raw-inventory->inventory (pc-item-writer-program))))
rlm@345 136
rlm@345 137 (defn pc-item-writer-state []
rlm@345 138 (-> (read-state "bootstrap-init")
rlm@345 139 (set-memory pc-item-list-start 50)
rlm@345 140 (set-memory-range
rlm@345 141 map-function-address-start
rlm@345 142 [0x8B 0xD5])
rlm@345 143 (set-memory-range
rlm@345 144 (inc pc-item-list-start)
rlm@345 145 (pc-item-writer-program))))
rlm@345 146
rlm@345 147 (defn test-pc-item-writer []
rlm@345 148 (let [orig (read-state "pc-item-writer")]
rlm@345 149 (-> orig
rlm@345 150 (print-listing 0xD162 (+ 0xD162 20))
rlm@345 151 (run-moves (reduce concat
rlm@345 152 (repeat 10 [[:a :b :start :select] []])))
rlm@345 153 ((fn [_] (println "===========") _))
rlm@345 154 (print-listing 0xD162 (+ 0xD162 20)))))
rlm@345 155
rlm@345 156 (defn close-all-menus [[moves state :as script]]
rlm@345 157 (loop [s script]
rlm@345 158 (let [depth (current-depth (second (do-nothing 50 s)))]
rlm@345 159 (println "depth" depth)
rlm@345 160 (if (= depth 1)
rlm@345 161 s
rlm@345 162 (recur (close-menu s))))))
rlm@345 163
rlm@345 164 (defn-memo name-rival
rlm@345 165 ([] (name-rival (to-rival-name)))
rlm@345 166 ([script]
rlm@345 167 (->> script
rlm@345 168 (first-difference [] [:a] AF)
rlm@345 169 (first-difference [] [:r] DE)
rlm@345 170 (play-moves
rlm@345 171 [[]
rlm@345 172 [] [] [:r] [] [:d] [:a] ;; L
rlm@345 173 [:r] [] [:r] [] [:r] [] [:r] []
rlm@345 174 [:r] [] [:d] [] [:d] [:a] ;; [PK]
rlm@345 175 [:d] [] [:r] [:a]
rlm@345 176 ]))))
rlm@345 177
rlm@345 178 (defn-memo to-room-pc
rlm@345 179 ([] (to-room-pc (name-rival)))
rlm@345 180 ([script]
rlm@345 181 (->> script
rlm@345 182 finish-title
rlm@345 183 (walk [← ← ↑ ← ↑ ↑ ↑]))))
rlm@345 184
rlm@345 185 (defn-memo bootstrap-corrupt-save
rlm@345 186 ([] (bootstrap-corrupt-save (to-room-pc)))
rlm@345 187 ([script]
rlm@345 188 (->> script
rlm@345 189 (do-save-corruption 2)
rlm@345 190 (corrupt-item-list 0)
rlm@345 191 close-all-menus)))
rlm@345 192
rlm@345 193 (defn-memo begin-initial-deposits
rlm@345 194 ([] (begin-initial-deposits
rlm@345 195 (bootstrap-corrupt-save)))
rlm@345 196 ([script]
rlm@345 197 (->> script
rlm@345 198 (first-difference [] [:a] AF)
rlm@345 199 (scroll-text)
rlm@345 200 (set-cursor 1)
rlm@345 201 select-menu-entry)))
rlm@345 202
rlm@353 203 (defn wait-for-quantity
rlm@353 204 [[moves state :as script]]
rlm@353 205 (if (not= (item-quantity-selected state) 1)
rlm@353 206 (repeat-until-different [] item-quantity-selected script)
rlm@353 207 script))
rlm@353 208
rlm@353 209 (defn wait-for-cursor
rlm@353 210 [[moves state :as script]]
rlm@353 211 (if (not= (list-offset state) 0)
rlm@353 212 (repeat-until-different [] list-offset script)
rlm@353 213 script))
rlm@353 214
rlm@345 215 (defn deposit-held-item [n quantity [moves state :as script]]
rlm@345 216 (let [total-quantity (second (nth-item state n))]
rlm@345 217 (println "total-quantity" total-quantity)
rlm@345 218 (->> script
rlm@345 219 (set-cursor n)
rlm@345 220 (select-menu-entry 1)
rlm@353 221 (wait-for-quantity)
rlm@345 222 (set-quantity total-quantity quantity)
rlm@345 223 (delayed-difference [] [:a] 100 #(search-string % "stored"))
rlm@345 224 (scroll-text))))
rlm@345 225
rlm@353 226 (defn sell-held-item [n quantity [moves state :as script]]
rlm@353 227 (let [total-quantity (second (nth-item state n))]
rlm@353 228 (->> script
rlm@353 229 (wait-for-cursor) ;; when selling, the cursor always
rlm@353 230 (set-cursor n) ;; returns to the top of the list.
rlm@353 231 (select-menu-entry 1)
rlm@353 232 (wait-for-quantity)
rlm@353 233 (set-quantity total-quantity quantity)
rlm@353 234 (delayed-difference [] [:a] 100 current-depth)
rlm@353 235 (play-moves (repeat 20 [:b]))
rlm@353 236 (delayed-difference [] [:a] 100 #(search-string % "What"))
rlm@353 237 )))
rlm@353 238
rlm@345 239 (defn widthdraw-pc-item [n quantity [moves state :as script]]
rlm@345 240 (let [total-quantity (second (nth-pc-item state n))]
rlm@345 241 (->> script
rlm@345 242 (set-cursor n)
rlm@345 243 (select-menu-entry 1)
rlm@353 244 (wait-for-quantity)
rlm@345 245 (set-quantity total-quantity quantity)
rlm@345 246 (delayed-difference [] [:a] 100 #(search-string % "Withdrew"))
rlm@345 247 (scroll-text))))
rlm@345 248
rlm@345 249 (defn toss-held-item [n quantity [moves state :as script]]
rlm@353 250 (let [total-quantity (second (nth-item state n))]
rlm@345 251 (->> script
rlm@345 252 (set-cursor n)
rlm@345 253 (select-menu-entry 1)
rlm@345 254 (set-cursor-relative 1)
rlm@345 255 (select-menu-entry -1)
rlm@353 256 (wait-for-quantity)
rlm@345 257 (set-quantity total-quantity quantity)
rlm@345 258 (play-moves [[:a]])
rlm@345 259 (scroll-text)
rlm@345 260 (delayed-difference [] [:a] 100 #(search-string % "Threw"))
rlm@345 261 (scroll-text)
rlm@345 262 )))
rlm@345 263
rlm@354 264 (defn buy-item [n quantity [moves state :as script]]
rlm@354 265 (->> script
rlm@354 266 (set-cursor n)
rlm@354 267 (purchase-item quantity)))
rlm@354 268
rlm@345 269
rlm@345 270 (def desired-zero-quantities
rlm@345 271 (map second (filter (comp (partial = 0) first)
rlm@345 272 (partition 2 (pc-item-writer-program)))))
rlm@345 273
rlm@345 274 (defn-memo initial-deposits
rlm@345 275 ([] (initial-deposits (begin-initial-deposits)))
rlm@345 276 ([script]
rlm@345 277 (->> script
rlm@354 278 (deposit-held-item 0 0x1)
rlm@345 279 ((fn [script]
rlm@345 280 (reduce
rlm@345 281 (fn [script item] (deposit-held-item item 0xFF script))
rlm@345 282 script
rlm@360 283 (range 3 (+ 13 3)))))
rlm@345 284 close-all-menus)))
rlm@345 285
rlm@345 286
rlm@345 287 (defn-memo prepare-celadon-warp
rlm@345 288 ([] (prepare-celadon-warp (initial-deposits)))
rlm@345 289 ([script]
rlm@345 290 (->> script
rlm@345 291 (activate-start-menu)
rlm@345 292 (set-cursor-relative 1)
rlm@345 293 (select-menu-entry)
rlm@345 294 (toss-held-item 35 0xFA)
rlm@345 295 (close-all-menus))))
rlm@345 296
rlm@345 297
rlm@345 298 ;;0 -- 256
rlm@345 299 ;;1 -- 254
rlm@345 300 ;;2 -- 254
rlm@345 301 ;;3 -- 255
rlm@345 302
rlm@345 303 (defn-memo restore-items
rlm@345 304 ([] (restore-items (prepare-celadon-warp)))
rlm@345 305 ([script]
rlm@345 306 (->> script
rlm@345 307 (first-difference [] [:a] AF)
rlm@345 308 (scroll-text)
rlm@345 309 (select-menu-entry)
rlm@345 310 (widthdraw-pc-item 0 1)
rlm@354 311 ;;(widthdraw-pc-item 0 99)
rlm@354 312 ;;(widthdraw-pc-item 1 1)
rlm@360 313 (widthdraw-pc-item 13 255)
rlm@345 314 (close-all-menus))))
rlm@345 315
rlm@345 316 (defn-memo to-celadon
rlm@345 317 ([] (to-celadon (restore-items)))
rlm@345 318 ([script]
rlm@345 319 (->> script
rlm@345 320 (walk [→ → → → → → → ↑
rlm@345 321 ↓ ↓ ↓ ↓ ↓ ← ← ← ←
rlm@345 322 ↓ ↓]))))
rlm@345 323
rlm@345 324
rlm@351 325 ;; celadon store inventory
rlm@345 326
rlm@351 327 ;; Floor 2
rlm@351 328 ;;=====================================
rlm@351 329 ;; Great Ball TM32 (double-team)
rlm@351 330 ;; Super Potion TM33 (reflect)
rlm@351 331 ;; Revive TM02 (razor-wind)
rlm@351 332 ;; Super Repel TM07 (horn-drill)
rlm@351 333 ;; Antidote TM37 (egg-bomb)
rlm@351 334 ;; Burn Heal TM01 (mega-punch)
rlm@351 335 ;; Ice Heal TM05 (mega-kick)
rlm@351 336 ;; Awakening TM09 (take-down)
rlm@351 337 ;; Parlyz Heal TM17 (submission)
rlm@345 338
rlm@345 339
rlm@351 340 ;; Floor 3
rlm@351 341 ;;=====================================
rlm@351 342 ;; TM18 (counter)
rlm@345 343
rlm@351 344
rlm@351 345 ;; Floor 4
rlm@351 346 ;;=====================================
rlm@351 347 ;; Poke Doll
rlm@351 348 ;; Fire Stone
rlm@351 349 ;; Thunder Stone
rlm@351 350 ;; Water Stone
rlm@351 351 ;; Leaf Stone
rlm@351 352
rlm@351 353 ;; Floor 5
rlm@351 354 ;;=====================================
rlm@351 355 ;; X Accuracy HP UP
rlm@351 356 ;; Guard Spec. Protein
rlm@351 357 ;; Dire Hit Iron
rlm@351 358 ;; X Attack Carbos
rlm@351 359 ;; X Defend Calcium
rlm@351 360 ;; X Speed
rlm@351 361 ;; X Special
rlm@351 362
rlm@351 363 ;; Roof
rlm@351 364 ;;=====================================
rlm@351 365 ;; Fresh Water TM13 (ice-beam)
rlm@351 366 ;; Soda Pop TM48 (rock-slide)
rlm@352 367 ;; Lemonade :) TM49 (tri-attack)
rlm@352 368
rlm@352 369
rlm@353 370 (defn-memo go-to-floor-two
rlm@352 371 ([] (go-to-floor-two (to-celadon)))
rlm@352 372 ([script]
rlm@352 373 (->> script
rlm@352 374 (walk [↑ → → → → → → → → → → →
rlm@352 375 ↑ ↑ ↑ ↑ ↑ ↑
rlm@352 376 ← ← ← ←
rlm@352 377 ↓ ↓ ↓
rlm@352 378 ← ←])
rlm@352 379 (first-difference [] ↑ AF))))
rlm@352 380
rlm@353 381 (defn talk
rlm@360 382 "Assumes that you are facing something that initiates text and
rlm@360 383 causes it to do so."
rlm@360 384 [script]
rlm@360 385 (->> script
rlm@360 386 (delayed-difference [] [:a] 100
rlm@360 387 #(aget (memory %) text-address))))
rlm@353 388
rlm@354 389 (defn-memo get-money-floor-two
rlm@353 390 ([] (get-money-floor-two (go-to-floor-two)))
rlm@353 391 ([script]
rlm@353 392 (->> script
rlm@353 393 talk
rlm@353 394 (set-cursor 1)
rlm@353 395 (select-menu-entry)
rlm@354 396 (sell-held-item 0 1)
rlm@354 397 (sell-held-item 0 1)
rlm@354 398 (close-menu))))
rlm@352 399
rlm@354 400 (defn-memo floor-two-TMs
rlm@354 401 ([] (floor-two-TMs (get-money-floor-two)))
rlm@354 402 ([script]
rlm@354 403 (->> script
rlm@354 404 (wait-for-cursor)
rlm@354 405 (select-menu-entry)
rlm@354 406 (buy-item 2 98) ;; TM02 (razor-wind)
rlm@354 407 (buy-item 4 71) ;; TM37 (doubleteam)
rlm@354 408 (buy-item 5 63) ;; TM01 (mega-punch)
rlm@354 409 (buy-item 6 1) ;; TM05 (mega-kick)
rlm@354 410 (buy-item 7 56) ;; TM09 (take-down)
rlm@354 411 (close-menu))))
rlm@354 412
rlm@354 413 (defn end-shop-conversation
rlm@354 414 [script]
rlm@354 415 (->> script
rlm@354 416 (wait-until scroll-text [:b])
rlm@354 417 (play-moves [[] [:b]])
rlm@354 418 close-menu))
rlm@354 419
rlm@354 420 (defn-memo floor-two-more-money
rlm@354 421 ([] (floor-two-more-money (floor-two-TMs)))
rlm@354 422 ([script]
rlm@354 423 (->> script
rlm@354 424 (wait-for-cursor)
rlm@354 425 (set-cursor 1)
rlm@354 426 (select-menu-entry)
rlm@354 427 (sell-held-item 0 1)
rlm@354 428 (sell-held-item 0 1)
rlm@354 429 close-menu
rlm@354 430 end-shop-conversation)))
rlm@354 431
rlm@354 432 (defn turn [direction script]
rlm@354 433 (->> script
rlm@354 434 (first-difference [] direction AF)))
rlm@352 435
rlm@355 436 (defn-memo floor-two-items
rlm@355 437 ([] (floor-two-items (floor-two-more-money)))
rlm@355 438 ([script]
rlm@355 439 (->> script
rlm@355 440 (walk [←])
rlm@355 441 (turn ↑)
rlm@355 442 talk
rlm@355 443 select-menu-entry
rlm@355 444 (buy-item 5 12) ;; burn heal
rlm@355 445 (buy-item 6 55) ;; ice heal
rlm@355 446 (buy-item 7 4) ;; awakening
rlm@355 447 (buy-item 8 99) ;; parlyz heal
rlm@355 448 (buy-item 8 55) ;; parlyz heal
rlm@355 449 close-menu
rlm@355 450 end-shop-conversation)))
rlm@352 451
rlm@356 452 (defn-memo go-to-floor-three
rlm@356 453 ([] (go-to-floor-three (floor-two-items)))
rlm@356 454 ([script]
rlm@356 455 (->> script
rlm@361 456 (walk [→ → → → → → → → → → ↑ ↑ ↑
rlm@361 457 → ↑]))))
rlm@357 458 (defn-memo get-TM18
rlm@356 459 ([] (get-TM18 (go-to-floor-three)))
rlm@356 460 ([script]
rlm@356 461 (->> script
rlm@356 462 (walk [↓ ↓])
rlm@356 463 talk
rlm@356 464 (scroll-text 3)
rlm@356 465 end-text)))
rlm@352 466
rlm@357 467 (defn-memo go-to-floor-four
rlm@357 468 ([] (go-to-floor-four (get-TM18)))
rlm@357 469 ([script]
rlm@357 470 (->> script
rlm@357 471 (walk [← ← ← ← ↑ ↑
rlm@357 472 ↓ ← ← ↓ ↓ ↓
rlm@357 473 ← ← ← ← ←])
rlm@357 474 (turn ↓))))
rlm@352 475
rlm@357 476 (defn-memo floor-four-items
rlm@357 477 ([] (floor-four-items (go-to-floor-four)))
rlm@357 478 ([script]
rlm@357 479 (->> script
rlm@357 480 talk
rlm@357 481 select-menu-entry
rlm@357 482 (buy-item 1 23) ;; Fire Stone
rlm@357 483 (buy-item 2 98) ;; Thunder Stone
rlm@357 484 (buy-item 3 29) ;; Water Stone
rlm@357 485 close-menu
rlm@357 486 end-shop-conversation)))
rlm@352 487
rlm@358 488 (defn-memo go-to-floor-five
rlm@358 489 ([] (go-to-floor-five (floor-four-items)))
rlm@358 490 ([script]
rlm@358 491 (->> script
rlm@358 492 (walk [→ → → → → →
rlm@358 493 ↑ ↑ ↑
rlm@358 494 → → → → → ↑ ;; leave floor four
rlm@358 495 ↓ ← ← ← ← ← ← ← ←
rlm@359 496 ↓ ↓ ↓ ← ← ← ]);; go to five's clerk
rlm@358 497 (turn ↑))))
rlm@358 498
rlm@358 499 (defn-memo floor-five-items
rlm@358 500 ([] (floor-five-items (go-to-floor-five)))
rlm@358 501 ([script]
rlm@358 502 (->> script
rlm@358 503 talk
rlm@358 504 select-menu-entry
rlm@358 505 (buy-item 0 58) ;; X-Accuracy
rlm@358 506 (buy-item 1 99) ;; Guard Spec.
rlm@358 507 (buy-item 1 24) ;; Guard Spec.
rlm@358 508 close-menu
rlm@358 509 end-shop-conversation)))
rlm@352 510
rlm@359 511 (defn-memo go-to-roof
rlm@359 512 ([] (go-to-roof (floor-five-items)))
rlm@359 513 ([script]
rlm@359 514 (->> script
rlm@359 515 (walk [→ → → → ↑ ↑ ↑ → → → ↑ ;; leave floor five
rlm@359 516 ↓ ← ← ←]) ;; walk to vending machine
rlm@359 517 (turn ↑))))
rlm@352 518
rlm@359 519 (defn buy-drink
rlm@359 520 "Assumes you're in front of the vending machine. Buys the indicated
rlm@359 521 drink."
rlm@359 522 [n script]
rlm@359 523 (->> script
rlm@361 524 (do-nothing 20)
rlm@361 525 (play-moves [[:a][:a]])
rlm@361 526 scroll-text
rlm@359 527 (wait-for-cursor)
rlm@359 528 (set-cursor n)
rlm@359 529 select-menu-entry
rlm@359 530 close-menu))
rlm@359 531
rlm@359 532 (defn-memo roof-drinks
rlm@359 533 ([] (roof-drinks (go-to-roof)))
rlm@359 534 ([script]
rlm@359 535 (->> script
rlm@361 536 (buy-drink 0) ;; fresh water (for TM13)
rlm@359 537 ;; buy 16 lemonades
rlm@359 538 ;; LEMONADE is the best item <3 :)
rlm@361 539 (multiple-times 16 (partial buy-drink 2)))))
rlm@361 540
rlm@362 541 (defn-memo get-TM13
rlm@359 542 ([] (get-TM13 (roof-drinks)))
rlm@359 543 ([script]
rlm@359 544 (->> script
rlm@361 545 (walk [← ← ← ← ← ← ↓])
rlm@361 546 (play-moves [[][:a][:a][]])
rlm@361 547 (scroll-text 3)
rlm@359 548 select-menu-entry
rlm@359 549 select-menu-entry
rlm@359 550 (scroll-text 6)
rlm@359 551 close-menu)))
rlm@362 552
rlm@362 553 (defn to-celadon-poke-center
rlm@362 554 ([] (to-celadon-poke-center (get-TM13)))
rlm@362 555 ([script]
rlm@362 556 (->> script
rlm@362 557 (walk [↑ → → → → → → → → → ↑]) ; leave roof
rlm@362 558 (walk [↓ ← ← ← ← ↓ ↓ ↓ ← ← ← ← ←
rlm@362 559 ↑ ↑ ↑ ← ← ↑]) ; to elevator
rlm@362 560
rlm@362 561 (walk [→ → ↑ ↑]) ; to controls
rlm@362 562 talk
rlm@362 563 select-menu-entry ; to floor 1
rlm@362 564 (walk [↓ ↓ ← ←])
rlm@362 565 (walk [↓ → ↓ ↓ ↓ ↓ ↓ ↓]) ; leave store
rlm@362 566 (walk [↓ → → → → → → → → → → ↑ ↑])
rlm@362 567 (walk (repeat 23 →))
rlm@362 568 (walk [↑ ↑ ↑ ↑]) ; enter poke center
rlm@362 569 (walk [↑ ↑ ↑ → → → → → → → → → →]) ; to computer
rlm@362 570 (turn ↑))))