diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index 7bc5e862..1085b983 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -16,64 +16,100 @@ (defn flies-vol [entities] (utils/proximity-volume entities [201 175] :scale 0.20)) -(defn do-initial-peddler-conversation [entities] - (actions/do-dialogue entities - :ego "Hello there, peddler." - :peddler "Good day, sir! Care to see any of my wares?" - :peddler "I have only the choicest of wares." - :ego "What \"wares\" are you selling?" - :peddler "I have the choicest of all types of wares..." - :peddler "...I'm well stocked on used earplugs..." - :peddler "...glass eyes..." - :peddler "... and motivational tapes." - :peddler "And today, I have a one day special!" - :peddler "Every purchase comes with the choicest of balloons!") - (actions/present-choices entities {:choices ["I'm interested in your earplugs." - {:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true))) - (actions/respond entities % - :peddler "A choice choice sir!" - :peddler "These earplugs have been used by the choicest of wearers." - :peddler "I can see a young man like yourself enjoying these choice earplugs for ages to come!" - :peddler "And remember, every purchase comes with the choicest of balloons!" - :peddler "That'll just be 10 sheckels." - :ego "But I haven't got any money!" - :peddler "Well, I'm afraid you won't have the choicest of earplugs." - :ego "Can't I give you something else for them?" - :peddler "I'll tell you what, I don't have any thing for the kids that come to my stand." - :peddler "If you can bring me the choicest of toys..." - :peddler "... and I mean the choicest of toys... " - :peddler "I will give you the earplugs."))} - "I'm interested in a glass eye." - {:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true))) - (actions/respond entities % - :peddler "The choicest choice, young man!" - :peddler "This glass eye is made out of the choicest glass from across the sea." - :peddler "And remember, every purchase comes with the choicest of balloons!" - :peddler "That'll just be 95 sheckels." - :ego "But I haven't got any money!" - :peddler "Well, I'm afraid you won't have the choicest of glass eyes." - :ego "Can't I give you something else for them?" - :peddler "I'll tell you what, I don't have anything for the kids that come to my stand." - :peddler "If you can bring me the choicest of toys..." - :peddler "... and I mean the choicest of toys... " - :peddler "Then I'll give you the glass eye." - ))} - "I'm interested in the motivational tapes." - {:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true))) - (actions/respond entities % - :peddler "Sure thing!" - :peddler "Has your luck got you down? Feeling pathetic?" - :peddler "These choicest of motivation tapes will convince you that life isn't so bad." - :peddler "For only 3 easy payments of 29.99 scheckles, they're yours!" - :ego "But I'm broke!" - :peddler "Well, I'm afraid you won't have the choicest of motivational tapes." - :ego "Is there anything else you'd take instead?" - :peddler "I'll tell you what, I don't have anything for the kids that come to my stand." - :peddler "If you can bring me the choicest of toys..." - :peddler "... and I mean the choicest of toys... " - :peddler "Then I'll give you the motivational tapes." - ))} - "Nevermind." {:run #(actions/respond entities % :peddler "Goodbye, sir.")}]})) +(defn do-peddler-tree [entities] + + + + (actions/present-choices entities {:choices ["What \"wares\" are you selling?" + {:run #(actions/respond entities % + :peddler "The choicest of questions, sir!" + :peddler "I have the choicest of all types of wares..." + :peddler "...I'm well stocked on used earplugs..." + :peddler "...glass eyes..." + :peddler "... and motivational tapes." + :peddler "And today, I have a one day special!" + :peddler "Every purchase comes with the choicest of balloons!") + :choices ["I'm interested in your earplugs." + {:run #(do (actions/respond entities % + :peddler "A choice choice, sir!" + :peddler "These earplugs have been used by the choicest of wearers." + :peddler "I can see a young man like yourself enjoying these choice earplugs for ages to come!" + :peddler "And remember, every purchase comes with the choicest of balloons!" + ) + (if (get-in @entities [:state :wants-toy]) + (actions/do-dialogue entities :peddler "I will give them to you if you bring me the choicest of toys.") + (actions/do-dialogue entities + :peddler "That'll just be 10 sheckels." + :ego "But I haven't got any money!" + :peddler "Well, I'm afraid you won't have the choicest of earplugs." + :ego "Can't I give you something else for them?" + :peddler "I'll tell you what, I don't have any thing for the kids that come to my stand." + :peddler "If you can bring me the choicest of toys..." + :peddler "... and I mean the choicest of toys... " + :peddler "I will give you the earplugs.")) + (actions/update-state entities (fn [state] (assoc state :wants-toy true))) + ) + :choices actions/previous-choices} + "I'm interested in a glass eye." + {:run #(do + (actions/respond entities % + :peddler "The choicest choice, young man!" + :peddler "This glass eye is made out of the choicest glass from across the sea." + :peddler "And remember, every purchase comes with the choicest of balloons!" + + ) + (if (get-in @entities [:state :wants-toy]) + (actions/do-dialogue entities :peddler "I will give it to you if you bring me the choicest of toys.") + (actions/do-dialogue entities + :peddler "That'll just be 95 sheckels." + :ego "But I haven't got any money!" + :peddler "Well, I'm afraid you won't have the choicest of glass eyes." + :ego "Can't I give you something else for them?" + :peddler "I'll tell you what, I don't have anything for the kids that come to my stand." + :peddler "If you can bring me the choicest of toys..." + :peddler "... and I mean the choicest of toys... " + :peddler "Then I'll give you the glass eye.")) + (actions/update-state entities (fn [state] (assoc state :wants-toy true)))) + :choices actions/previous-choices} + "I'm interested in the motivational tapes." + {:run #(do + (actions/respond entities % + :peddler "Sure thing!" + :peddler "Has your luck got you down? Feeling pathetic?" + :peddler "These choicest of motivation tapes will convince you that life isn't so bad.") + (if (get-in @entities [:state :wants-toy]) + (actions/do-dialogue entities :peddler "I will give them to you if you bring me the choicest of toys.") + (actions/do-dialogue entities + :peddler "For only 3 easy payments of 29.99 scheckles, they're yours!" + :ego "But I'm broke!" + :peddler "Well, I'm afraid you won't have the choicest of motivational tapes." + :ego "Is there anything else you'd take instead?" + :peddler "I'll tell you what, I don't have anything for the kids that come to my stand." + :peddler "If you can bring me the choicest of toys..." + :peddler "... and I mean the choicest of toys... " + :peddler "Then I'll give you the motivational tapes.")) + (actions/update-state entities (fn [state] (assoc state :wants-toy true)))) + :choices actions/previous-choices} + "Something else." + {:choices actions/something-else}]} + (when (get-in @entities [:state :wants-toy]) + "Tell me again about the toy you want.") + {:run #(actions/respond entities % + :peddler "But of course, sir!" + :peddler "I want a toy for the children who come by my stand." + :peddler "And I don't mean any toy." + :peddler "I need the choicest of toys!" + :peddler "If you bring me one, I'll give you any of my choicest of wares." + :peddler "And I'll throw in a balloon, free of charge!") + :choices actions/previous-choices} + "How's business?" {:run #(actions/respond entities % + :peddler "Excellent, sir!" + :peddler "This is the choicest location to find schmucks-" + :peddler "Err, customers, for my choicest of wares!") + :choices actions/previous-choices} + "See you later." {:run #(actions/respond entities % + :peddler "Goodbye, sir!" + :peddler "May today be the choicest day!")}]})) (defn give-teddy [entities] (actions/remove-item entities :teddy) @@ -98,14 +134,17 @@ (defn do-completed-peddler-conversation [entities] (actions/do-dialogue entities :ego "Hello there, peddler." - :peddler "Hello again, sir! I trust you are enjoying your goods!" - :ego "I sure am." + :peddler "Well, well!" + :peddler "If it isn't my choicest of customers!" + :peddler "I trust you are enjoying your choicest of wares?" + :ego "... I sure am." :peddler "I thought so!")) (defn do-wants-toy-conversation [entities] (actions/do-dialogue entities :ego "Hello there, peddler." - :peddler "Hello again, sir! Have you found me the choicest jack-in-the box yet?" + :peddler "Hello again, sir!" + :peddler "Have you found me the choicest jack-in-the box yet?" :ego "... erm, no." :peddler "Oh, well how about the choicest bouncy ball?" :ego "... not quite yet." @@ -115,10 +154,9 @@ (actions/do-dialogue entities :ego "Well, I have this teddy bear.") (give-teddy entities)) - (actions/do-dialogue entities :ego "No, no, and no." - :peddler "Well, come back when you have something I'm interested in." - :peddler "Remember, I have a one-day special going." - :peddler "Every purchase comes with a free balloon!"))) + (do + (actions/do-dialogue entities :ego "No, no, and no.") + (do-peddler-tree entities)))) (defn walk-to-peddler [entities] (actions/walk-to entities :ego [191 90] :face :left)) @@ -129,9 +167,14 @@ :peddler "Sorry, no refunds.")) (defn do-peddler-dialogue [entities] + (cond (actions/has-obtained? entities :balloon) (do-completed-peddler-conversation entities) (get-in @entities [:state :wants-toy]) (do-wants-toy-conversation entities) - :else (do-initial-peddler-conversation entities))) + :else (do (actions/do-dialogue entities + :ego "Hello there, peddler." + :peddler "Good day, sir! Care to see any of my wares?" + :peddler "I have only the choicest of wares.") + (do-peddler-tree entities)))) (defn should-block? [entities] (and (= :night (get-in @entities [:state :time]))