changeset 354:4141489d1406

script: bought TMs on second floor.
author Robert McIntyre <rlm@mit.edu>
date Mon, 09 Apr 2012 06:09:49 -0500
parents a9e7507379e9
children 639db56f2670
files clojure/com/aurellem/run/bootstrap_1.clj
diffstat 1 files changed, 48 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/bootstrap_1.clj	Mon Apr 09 05:36:56 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/bootstrap_1.clj	Mon Apr 09 06:09:49 2012 -0500
     1.3 @@ -261,6 +261,11 @@
     1.4           (scroll-text)
     1.5           )))
     1.6  
     1.7 +(defn buy-item [n quantity [moves state :as script]]
     1.8 +  (->> script
     1.9 +       (set-cursor n)
    1.10 +       (purchase-item quantity)))
    1.11 +
    1.12  
    1.13  (def desired-zero-quantities
    1.14    (map second (filter (comp (partial = 0) first)
    1.15 @@ -270,7 +275,7 @@
    1.16    ([] (initial-deposits (begin-initial-deposits)))
    1.17    ([script]
    1.18       (->> script
    1.19 -          (deposit-held-item 1 0x2)
    1.20 +          (deposit-held-item 0 0x1)
    1.21            ((fn [script]
    1.22               (reduce 
    1.23                (fn [script item] (deposit-held-item item 0xFF script))
    1.24 @@ -303,21 +308,9 @@
    1.25            (scroll-text)
    1.26            (select-menu-entry)
    1.27            (widthdraw-pc-item 0 1)
    1.28 -          (widthdraw-pc-item 0 99)
    1.29 -          (widthdraw-pc-item 1 1)
    1.30 +          ;;(widthdraw-pc-item 0 99)
    1.31 +          ;;(widthdraw-pc-item 1 1)
    1.32            (widthdraw-pc-item 2 5)
    1.33 -          ;; (widthdraw-pc-item 3 99)
    1.34 -          ;; (widthdraw-pc-item 3 99)
    1.35 -          ;; (widthdraw-pc-item 3 57)  ;; take all
    1.36 -          ;; (widthdraw-pc-item 2 99)
    1.37 -          ;; (widthdraw-pc-item 2 99)
    1.38 -          ;; (widthdraw-pc-item 2 56)  ;; take all
    1.39 -          ;; (widthdraw-pc-item 1 99)
    1.40 -          ;; (widthdraw-pc-item 1 99)
    1.41 -          ;; (widthdraw-pc-item 1 55)  ;; leave one
    1.42 -          ;; (widthdraw-pc-item 0 99)
    1.43 -          ;; (widthdraw-pc-item 0 99)
    1.44 -          ;; (widthdraw-pc-item 0 57)  ;; leave one
    1.45            (close-all-menus))))
    1.46  
    1.47  (defn-memo to-celadon
    1.48 @@ -393,32 +386,56 @@
    1.49                        script))
    1.50    
    1.51  
    1.52 -(defn get-money-floor-two
    1.53 +(defn-memo get-money-floor-two
    1.54    ([] (get-money-floor-two (go-to-floor-two)))
    1.55    ([script]
    1.56       (->> script
    1.57            talk
    1.58            (set-cursor 1)
    1.59            (select-menu-entry)
    1.60 -          (sell-held-item 2 1)
    1.61 -          (sell-held-item 2 1)
    1.62 -          
    1.63 -          ;; (sell-held-item 11)
    1.64 -          ;; (sell-held-item 10)
    1.65 -          ;; (sell-held-item 9)
    1.66 -          ;; (sell-held-item 8)
    1.67 -          ;; (sell-held-item 7)
    1.68 -          ;; (sell-held-item 6)
    1.69 -          (do-nothing 40))))
    1.70 -          
    1.71 -          
    1.72 -     
    1.73 +          (sell-held-item 0 1)
    1.74 +          (sell-held-item 0 1)
    1.75 +          (close-menu))))
    1.76  
    1.77 -(defn floor-two-TMs
    1.78 -  [])
    1.79 +(defn-memo floor-two-TMs
    1.80 +  ([] (floor-two-TMs (get-money-floor-two)))
    1.81 +  ([script]
    1.82 +     (->> script
    1.83 +          (wait-for-cursor)
    1.84 +          (select-menu-entry)
    1.85 +          (buy-item 2 98)  ;; TM02 (razor-wind)
    1.86 +          (buy-item 4 71)  ;; TM37 (doubleteam)
    1.87 +          (buy-item 5 63)  ;; TM01 (mega-punch)
    1.88 +          (buy-item 6 1)   ;; TM05 (mega-kick)
    1.89 +          (buy-item 7 56)  ;; TM09 (take-down)
    1.90 +          (close-menu))))
    1.91 +
    1.92 +(defn end-shop-conversation
    1.93 +  [script]
    1.94 +  (->> script
    1.95 +       (wait-until scroll-text [:b])
    1.96 +       (play-moves [[] [:b]])
    1.97 +       close-menu))
    1.98 +
    1.99 +(defn-memo floor-two-more-money
   1.100 +  ([] (floor-two-more-money (floor-two-TMs)))
   1.101 +  ([script]
   1.102 +     (->> script
   1.103 +          (wait-for-cursor)
   1.104 +          (set-cursor 1)
   1.105 +          (select-menu-entry)
   1.106 +          (sell-held-item 0 1)
   1.107 +          (sell-held-item 0 1)
   1.108 +          close-menu
   1.109 +          end-shop-conversation)))
   1.110 +
   1.111 +(defn turn [direction script]
   1.112 +  (->> script
   1.113 +       (first-difference [] direction AF)))
   1.114  
   1.115  (defn floor-two-items
   1.116    [])
   1.117 +  
   1.118  
   1.119  (defn go-to-floor-three
   1.120    [])