From 94d53b6d0153174dd3b4779dff32c4ace3a76d67 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Thu, 7 Jan 2016 22:43:00 -0800 Subject: [PATCH] tweaked owl dialogue. --- .../advent/screens/rooms/cat_tree.clj | 84 +++++++++++-------- 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/desktop/src-common/advent/screens/rooms/cat_tree.clj b/desktop/src-common/advent/screens/rooms/cat_tree.clj index 3cfefad1..6a03d680 100644 --- a/desktop/src-common/advent/screens/rooms/cat_tree.clj +++ b/desktop/src-common/advent/screens/rooms/cat_tree.clj @@ -132,6 +132,45 @@ (update-in [:room :entities] #(assoc % :owl (get-in entities [:room :owl]))) remove-rock-if-necessary)) +(defn get-choices [entities] + ["Can you help me in my quest?" + {:run #(do (actions/respond entities % + :owl "Of course I can help you in your quest." + :owl "Quests are my specialty!" + :owl "I know just what you need." + :owl "But I'm also in some trouble of my own.") + (actions/update-state entities (fn [s] (assoc s :knows-owl-trouble? true)))) + :choice-fn (partial get-choices entities) } + "Catch any mice tonight?" + {:run #(do (actions/respond entities % + :owl "Nothing at all." + :owl "I keep trying to catch them but...") + (do-puke entities) + (actions/do-dialogue entities :owl "Excuse me.") + (actions/update-state entities (fn [s] (assoc s :knows-owl-trouble? true)))) + :choice-fn (partial get-choices entities)} + (when (get-in @entities [:state :knows-owl-trouble?]) + "Is something wrong?") + {:run #(do (actions/respond entities % + :owl "Yes, in fact there is." + :owl "You see, we owls have very strong vision." + :owl "I was born with a birth defect, and only one of my eyes is good." + :owl "I dropped my monocle somewhere around here!" + :owl "Without it, I have severe nausea.") + (do-puke entities) + (actions/do-dialogue entities + :owl "Excuse me." + :owl "I don't suppose you could help me find it?" + :ego "I'll let you know if I find it.") + (actions/update-state entities (fn [s] (assoc s :wants-monocle? true))))} + "Nevermind." + {:run #(do (actions/respond entities % :owl "Goodnight to you."))}] + + ) + +(defn present-owl-choices [entities] + (actions/present-choices entities {:choices (get-choices entities)})) + (defn talk-to-owl [entities] (actions/walk-to entities :ego [141 54] :face :right) @@ -141,12 +180,17 @@ :owl "My nausea has nearly worn off.") (do-puke entities)) - (get-in @entities [:state :talked-to-owl?]) + (get-in @entities [:state :wants-monocle?]) (do (actions/do-dialogue entities :ego "Hello again." :owl "Have you found my glass monocle!?" :owl "I'll have no relief of this nausea until you do.") (do-puke entities)) + (get-in @entities [:state :talked-to-owl?]) + (do (actions/do-dialogue entities :ego "Hello again." + :owl "Hello.") + (present-owl-choices entities)) + :else (do (actions/do-dialogue entities :ego "Hello there, little owl." :owl "Who you calling little?" @@ -157,41 +201,7 @@ :ego "I guess not." :owl "Naw, I'm just pulling your leg." :owl "I'm an owl, and owls are wise.") - (actions/present-choices entities {:choices ["Can you help me in my quest?" - {:run #(actions/respond entities % - :owl "Of course I can help you in your quest." - :owl "I know just what you need." - :owl "But I'm also in some trouble of my own.") - :choices ["What kind of trouble?" - {:run #(do (actions/respond entities % - :owl "You see, we owls have very strong vision." - :owl "I was born with a birth defect, and only one of my eyes is good." - :owl "I dropped my monocle somewhere around here!" - :owl "Without it, I have severe nausea.") - (do-puke entities) - (actions/do-dialogue entities - :owl "Excuse me." - :owl "I don't suppose you could help me find it?" - :ego "I'll let you know if I find it."))} - "Something else." - {:choices actions/something-else}]} - "Catch any mice tonight?" - {:run #(do (actions/respond entities % - :owl "Nothing at all." - :owl "I'm missing my eyepiece, and without it, I get too much motion sickness." - :owl "I've been sitting here sick ever since I dropped it.") - (do-puke entities) - (actions/do-dialogue entities - :owl "Excuse me." - :owl "Could you help me find it?" - :ego "I'll let you know if I see anything." - :owl "Oh, thank you."))} - "Nevermind." - {:run #(do (actions/respond entities % - :owl "Oh, do tell me if you see a glass monocle around." - :owl "I can't see at all without it. On top of that, I have severe nausea!" - :owl "I'll be stranded here for who knows how long without it.") - (do-puke entities))}]}))) + (present-owl-choices entities))) (actions/update-state entities #(assoc % :talked-to-owl? true))) (defn give-monocle [entities] @@ -396,7 +406,7 @@ :scripts #(condp = % :monocle (actions/get-script entities (give-monocle entities)) (actions/get-script entities - (if (get-in @entities [:state :talked-to-owl?]) + (if (get-in @entities [:state :knows-owl-trouble?]) (do (actions/do-dialogue entities :ego "Is this your monocle?") (if (actions/has-obtained? entities :feather) (actions/talk entities :owl "You already gave me my monocle, silly boy!")