made reminders
This commit is contained in:
@@ -242,13 +242,13 @@
|
|||||||
(recur (inc so-far) (zip/right zipper)))))
|
(recur (inc so-far) (zip/right zipper)))))
|
||||||
|
|
||||||
(defn make-zipper [tree]
|
(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]
|
(defn present-choices [entities choices]
|
||||||
(loop [zipper (make-zipper choices)]
|
(loop [zipper (make-zipper choices)]
|
||||||
(let [selected-index (atom nil)
|
(let [selected-index (atom nil)
|
||||||
node (zip/node zipper)
|
node (zip/node zipper)
|
||||||
dialogue-choices (partition 2 (:choices node))]
|
dialogue-choices (filter first (partition 2 (:choices node)))]
|
||||||
(run-action entities
|
(run-action entities
|
||||||
(begin [this screen entities]
|
(begin [this screen entities]
|
||||||
(run! dialogue/choice-screen :on-present-choices :choices dialogue-choices :callback #(reset! selected-index %))
|
(run! dialogue/choice-screen :on-present-choices :choices dialogue-choices :callback #(reset! selected-index %))
|
||||||
|
|||||||
@@ -44,7 +44,8 @@
|
|||||||
:choices actions/previous-choices}
|
:choices actions/previous-choices}
|
||||||
"Something else."
|
"Something else."
|
||||||
{:choices actions/something-else}]}
|
{:choices actions/something-else}]}
|
||||||
"Nice trophy."
|
(when (= nil (get-in @entities [:state :current-riddle]))
|
||||||
|
"Nice trophy.")
|
||||||
{:run #(actions/respond entities %
|
{:run #(actions/respond entities %
|
||||||
:game-player "Thanks. I was nominated the Riddlemaster of Remington for the 7th straight year!"
|
:game-player "Thanks. I was nominated the Riddlemaster of Remington for the 7th straight year!"
|
||||||
:game-player "I guess I'm pretty wise."
|
:game-player "I guess I'm pretty wise."
|
||||||
@@ -63,6 +64,27 @@
|
|||||||
{:run #(actions/respond entities %
|
{:run #(actions/respond entities %
|
||||||
:game-player "That's exactly what I'd expect a dummy like you to say."
|
:game-player "That's exactly what I'd expect a dummy like you to say."
|
||||||
:choices actions/previous-choices)}]}
|
: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."
|
"Nevermind."
|
||||||
{:run #(actions/respond entities % :game-player "See you around.")}]}))
|
{:run #(actions/respond entities % :game-player "See you around.")}]}))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user