dialogue tree for peddler.

This commit is contained in:
2014-11-08 14:32:54 -08:00
parent 39cbd94df6
commit 05155d964c

View File

@@ -44,8 +44,8 @@
:peddler {:box [110 90 128 146] :peddler {:box [110 90 128 146]
:script (actions/get-script :script (actions/get-script
entities entities
(actions/walk-to entities :ego [191 90]) (actions/walk-to entities :ego [191 90] :face :left)
(actions/update-state entities (fn [state] (assoc state :wants-toy true)))
(actions/do-dialogue entities (actions/do-dialogue entities
:ego "Hello there, peddler." :ego "Hello there, peddler."
:peddler "Good day sir! Care to see any of my wares?" :peddler "Good day sir! Care to see any of my wares?"
@@ -53,15 +53,50 @@
:ego "What 'wares' are you selling?" :ego "What 'wares' are you selling?"
:peddler "I have the choicest of all types of wares..." :peddler "I have the choicest of all types of wares..."
:peddler "...I'm well stocked on used earplugs..." :peddler "...I'm well stocked on used earplugs..."
:peddler "...glass eyes, motivational tapes... " :peddler "...glass eyes..."
:peddler "... and this nice, big, red balloon." :peddler "... and motivational tapes."
:ego "I sure am interested in that balloon." :peddler "And today, I have a one day special!"
:peddler "An excellent selection! It is the choicest of balloons you'll ever find." :peddler "Every purchase comes with a free balloon!")
:peddler "This bundle of joy will only set you back 75 sheckels." (actions/present-choices entities {:choices ["I'm interested in your earplugs."
:ego "But I haven't got any money!" {:run #(do (actions/update-state entities (fn [state] (assoc state :wants-toy true)))
:peddler "Then you won't have the choicest of balloons." (actions/respond entities %
:peddler "I could, however, give you the balloon if you could procure for me a ware I'm missing." :peddler "A choice choice sir!"
:peddler "A child's toy. And I mean the choicest of children's toys.")) :peddler "These earplugs have been used by the 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 "Well, I am low on choice children's toys."
:peddler "If you can bring me one, and I mean the choicest of toys, I will give you the earplugs."))
:choices actions/previous-choices}
"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 any thing for the kids that come to my stand."
:peddler "If you can bring me the choicest of toys, I will give you the glass eye."))
:choices actions/previous-choices}
"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 glass eyes."
:ego "Is there anything else you'd take instead?"
:peddler "If you can bring me a nice kid's toy, I will give you the tapes."))
:choices actions/previous-choices}
"Nevermind." {:run #(actions/respond entities % :peddler "Goodbye, sir.")}]}))
:scripts {:teddy (actions/get-script entities :scripts {:teddy (actions/get-script entities
(actions/remove-item entities items/teddy) (actions/remove-item entities items/teddy)
(actions/give entities items/balloon) (actions/give entities items/balloon)