From b865761bd7b1eff52dad9194c450cf4903a7d15b Mon Sep 17 00:00:00 2001 From: Remington Covert Date: Fri, 31 Oct 2014 15:44:09 -0700 Subject: [PATCH] made reminders --- desktop/src-common/advent/actions.clj | 4 ++-- .../advent/screens/rooms/inside_castle.clj | 24 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 977aa4d2..2019b8b1 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -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 %)) diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index effc3ef7..34ac8a9e 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -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.")}]}))