made reminders

This commit is contained in:
2014-10-31 15:44:09 -07:00
parent 7d78f75408
commit b865761bd7
2 changed files with 25 additions and 3 deletions

View File

@@ -242,13 +242,13 @@
(recur (inc so-far) (zip/right zipper)))))
(defn make-zipper [tree]
(zip/zipper map? (comp #(map second %) #(partition 2 %) :choices) (fn [n c] nil) tree))
(zip/zipper map? (comp #(map second %) #(filter first (partition 2 %)) :choices) (fn [n c] nil) tree))
(defn present-choices [entities choices]
(loop [zipper (make-zipper choices)]
(let [selected-index (atom nil)
node (zip/node zipper)
dialogue-choices (partition 2 (:choices node))]
dialogue-choices (filter first (partition 2 (:choices node)))]
(run-action entities
(begin [this screen entities]
(run! dialogue/choice-screen :on-present-choices :choices dialogue-choices :callback #(reset! selected-index %))

View File

@@ -44,7 +44,8 @@
:choices actions/previous-choices}
"Something else."
{:choices actions/something-else}]}
"Nice trophy."
(when (= nil (get-in @entities [:state :current-riddle]))
"Nice trophy.")
{:run #(actions/respond entities %
:game-player "Thanks. I was nominated the Riddlemaster of Remington for the 7th straight year!"
:game-player "I guess I'm pretty wise."
@@ -63,6 +64,27 @@
{:run #(actions/respond entities %
:game-player "That's exactly what I'd expect a dummy like you to say."
:choices actions/previous-choices)}]}
(when (= :wool (get-in @entities [:state :current-riddle]))
"What was that riddle again?")
{:run #(actions/respond entities %
:game-player "White as snow, but not as cold,"
:game-player "Keeps you warm, or so I'm told.")
:choices actions/previous-choices}
(when (= :balloon (get-in @entities [:state :current-riddle]))
"What was that riddle again?")
{:run #(actions/respond entities %
:game-player "Filled with air, light as a feather,"
:game-player "If you want to keep it, best have a tether.")
:choices actions/previous-choices}
(when (= :frog-legs (get-in @entities [:state :current-riddle]))
"What was that riddle again?")
{:run #(actions/respond entities %
:game-player "Hippity-hop, I jump real far,"
:game-player "Now I'm dead, or at least have a scar.")
:choices actions/previous-choices}
"Nevermind."
{:run #(actions/respond entities % :game-player "See you around.")}]}))