wizard extended dialogue.

This commit is contained in:
2014-12-08 18:02:52 -08:00
parent 17121a0481
commit 9619742f35
2 changed files with 45 additions and 6 deletions

View File

@@ -28,15 +28,56 @@
(defn do-wizard-dialogue [entities]
(actions/do-dialogue entities :wizard "What can I do for you boy?")
(actions/present-choices entities
{:choices [(when (= 3 (get-in @entities [:state :mints-eaten]))
{:choices ["What's with the safe?"
{:run #(actions/respond entities %
:wizard "That's my MagiSafe 5000."
:wizard "It's used to keep whipper-snappers like you out of my precious belongings."
:wizard "It's a magical safe only opened when the correct musical password is entered."
:ego "What's the password?"
:wizard "That's for me to know.")
:choices actions/previous-choices}
"Will you help me become a knight?"
{:run #(actions/respond entities %
:wizard "To become a knight you will need to be worthy in courage, wisdom, and might."
:wizard "Only then can you become worthy to pull the Sword of Blergh, and become a knight.")
:choices ["How can I prove that I'm worthy in wisdom?"
{:run #(actions/respond entities %
:wizard "Every year we have the annual Town of Remington Junior Smarty Pants Derby."
:wizard "The whole town gets together to vote on who is the wisest in town, by a game of riddles."
:wizard "Last year's winner was a young man named Stan, in town."
:wizard "Maybe you can ask him.")
:choices actions/previous-choices}
"Can you make some kind of potion to make me strong?"
{:run #(actions/respond entities %
:wizard "Of course I could."
:wizard "I keep all sorts of potion recipes in my MagiSafe 5000."
:wizard "I can turn a weakling into an olympic lifter."
:wizard "But that would be cheating wouldn't it?"
:wizard "Unfortunately, you're on your own.")
:choices actions/previous-choices}
"Aren't I already courageous enough?"
{:run #(actions/respond entities %
:wizard "When was the last time you rescued a damsel in distress?"
:ego "Erm..."
:wizard "Fought a firebreathing dragon?"
:ego "Umm..."
:wizard "Saved an old lady from a burning building?"
:wizard "Stave off zombies from the eternal graveyard?"
:wizard "Rescued a stranded cat?"
:ego "I haven't done any of those things!"
:wizard "Seems to me you have to go do some heroic deeds!")
:choices actions/previous-choices}
"Something else."
{:choices actions/something-else}]}
(when (= 3 (get-in @entities [:state :mints-eaten]))
"The antique shopkeeper needs more fire mints.")
{:run #(do (actions/respond entities %
:wizard "Already?"
:wizard "Ok, I'll deliver them myself. Don't touch anything while I'm gone.")
(actions/update-state entities (fn [s] (assoc s :mints-eaten 0)))
(actions/remove-entity entities :wizard))}
"Goodbye, Gandarf."
{:run #(actions/respond entities % :wizard "Goodbye, boy.")}]}))
"Nevermind."
{:run #(actions/do-dialogue entities :ego %)}]}))
(defn make [screen]
(let [wizard-sheet (texture! (texture "wizard/talk.png") :split 20 46)

View File

@@ -203,7 +203,6 @@
(music! snd :play))
(defn stop-sound [snd]
(println "here")
(music! snd :stop))
(defn make-music [r]
@@ -278,8 +277,7 @@
(size! screen 320 240))
:on-hide (fn [screen [entities]]
(println (keys entities))
(doseq [snd (->> (doto (get-in entities [:musics]) println)
(doseq [snd (->> (get-in entities [:musics])
vals
(filter identity))]
(stop-sound snd)))