From bd797e60be5a0e72e4345cbd7a1adbe968bc34dd Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Tue, 28 Jun 2016 08:36:23 -0700 Subject: [PATCH] solved issue with crash for using item on itself. --- desktop/src-common/advent/screens/items.clj | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/desktop/src-common/advent/screens/items.clj b/desktop/src-common/advent/screens/items.clj index 748155ed..933850e8 100644 --- a/desktop/src-common/advent/screens/items.clj +++ b/desktop/src-common/advent/screens/items.clj @@ -82,20 +82,24 @@ (declare items) (defn mix-ingredients [base] (fn [other] - (let [is-using-flask? (seq (filter (comp :flask? items) [base other]))] - (if is-using-flask? - (actions/get-script entities - (if (actions/has-item? entities :note-1) - (condp = #{base other} - #{:ash :flask-water} (make-water-and-ash entities) - #{:flies :flask-water} (make-water-and-flies entities) - #{:flies :flask-water-ash} (make-flies-ash entities) - #{:ash :flask-water-flies} (make-flies-ash entities) - #{:feather :flask-flies-ash} (make-finished-component entities) - (actions/talk entities :ego "I'm not sure if that goes in there.")) + (let [is-using-flask? (seq (filter (comp :flask? items) [base other])) + items-used (set [base other])] + (cond (= 1 (count items-used)) + nil + is-using-flask? + (actions/get-script entities + (if (actions/has-item? entities :note-1) + (condp = items-used + #{:ash :flask-water} (make-water-and-ash entities) + #{:flies :flask-water} (make-water-and-flies entities) + #{:flies :flask-water-ash} (make-flies-ash entities) + #{:ash :flask-water-flies} (make-flies-ash entities) + #{:feather :flask-flies-ash} (make-finished-component entities) + (actions/talk entities :ego "I'm not sure if that goes in there.")) - (actions/talk entities :ego "I should really find out from Gandarf before I put anything in there."))) - nil)))) + (actions/talk entities :ego "I should really find out from Gandarf before I put anything in there."))) + :else + nil)))) (def items {:wool {:name "Wool" :value :wool :cursor :wool :scripts {:stick make-cat-toy}}