swap flask for milk.

This commit is contained in:
2014-10-16 20:04:02 -07:00
parent ec87413084
commit d06fe98465
4 changed files with 24 additions and 5 deletions

View File

@@ -255,6 +255,20 @@
(can-skip? [this screen entities]
false)))
(defn remove-item [entities item]
(run-action entities
(begin [this screen entities]
(update-in entities [:state :inventory] #(remove (partial = item) %)))
(continue [this screen entities] entities)
(done? [this screen entities] true)
(terminate [this screen entities]
entities)
(can-skip? [this screen entities]
false)))
(defn give [entities item]
(run-action entities
(begin [this screen entities]

View File

@@ -3,5 +3,9 @@
(def wool {:name "Wool" :value :wool :cursor :wool})
(def mushrooms {:name "Mushrooms" :value :mushrooms :cursor :mushrooms})
(def carrot {:name "Carrot" :value :carrot :cursor :carrot})
(def flask {:name "Flask" :value [:flask] :cursor :flask})
(def flask-with-milk {:name "Flask with milk" :value :flask-with-milk :cursor :flask-with-contents})
(def flask-1 {:name "Flask" :value :flask-1 :cursor :flask})
(def flask-1-with-milk {:name "Flask with milk" :value :flask-1-with-milk :cursor :flask-with-contents})
(def flask-1-with-mushrooms {:name "Flask with mushrooms" :value :flask-1-with-mushrooms :cursor :flask-with-contents})
(def flask-1-with-milk-mushrooms {:name "Flask with cream of mushrooms soup" :value :flask-1-with-milk-mushrooms :cursor :flask-with-contents})
(def flask-1-strength {:name "Strength potion" :value :flask-1-strength :cursor :flask-with-contents})

View File

@@ -35,7 +35,7 @@
:x 265 :y 80 :baseline 240
:script (actions/get-script entities
(actions/remove-entity entities :flask)
(actions/give entities items/flask)
(actions/give entities items/flask-1)
(actions/do-dialogue entities :ego "Hey you think I could have this flask?"
:wizard "Sure.")))}
:collision "inside-house/collision.png"

View File

@@ -178,10 +178,11 @@
(actions/walk-to entities :ego ego-sheep-loc)
(actions/talk entities :ego "Come on girl, get the carrot!")
(actions/walk-straight-to entities :sheep [95 150]))
items/flask (actions/get-script entities
items/flask-1 (actions/get-script entities
(if (is-sheep-close? @entities)
(do (actions/walk-to entities :ego ego-sheep-loc)
(actions/give entities items/flask-with-milk)
(actions/remove-item entities items/flask-1)
(actions/give entities items/flask-1-with-milk)
(actions/talk entities :ego "Sheeps milk."))
(actions/talk entities :ego "She's too far away.")))}
:left {:walk (utils/flip sheep-walk)