diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 9ab37780..04431040 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -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] diff --git a/desktop/src-common/advent/screens/items.clj b/desktop/src-common/advent/screens/items.clj index 28c239b2..92739c40 100644 --- a/desktop/src-common/advent/screens/items.clj +++ b/desktop/src-common/advent/screens/items.clj @@ -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}) diff --git a/desktop/src-common/advent/screens/rooms/inside_house.clj b/desktop/src-common/advent/screens/rooms/inside_house.clj index 6f1a6d46..312ab594 100644 --- a/desktop/src-common/advent/screens/rooms/inside_house.clj +++ b/desktop/src-common/advent/screens/rooms/inside_house.clj @@ -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" diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index bda096b9..3bd0e46d 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -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)