From 7d78f754089336cf4e9e87d24f8966ae28e402ae Mon Sep 17 00:00:00 2001 From: Remington Covert Date: Fri, 31 Oct 2014 14:40:30 -0700 Subject: [PATCH] made it so you have to do things in order. --- .../advent/screens/rooms/inside_castle.clj | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index db47452c..effc3ef7 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -50,7 +50,8 @@ :game-player "I guess I'm pretty wise." :game-player "And with my sharp intellect, I'm guessing you want my trophy?") :choices ["Yes." - {:run #(do (actions/respond entities % + {:run #(do (actions/update-state entities (fn [state] (assoc state :current-riddle :wool))) + (actions/respond entities % :game-player "Well, if you want my trophy, you'll have to earn it." :game-player "There are a few riddles that even I, the wisest in all of Remington, cannot solve." :game-player "How about you help me?" @@ -81,24 +82,34 @@ :entities {:game-player (assoc (texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191 :script (actions/get-script entities (do-game-player-dialogue entities)) :scripts {:wool (actions/get-script entities - (actions/remove-item entities items/wool) - (actions/do-dialogue entities - :game-player "That's right! Now for your second riddle:" - :game-player "Filled with air, light as a feather," - :game-player "If you want to keep it, best have a tether.")) + (if (= :wool (get-in @entities [:state :current-riddle])) + (do (actions/update-state entities #(assoc % :current-riddle :balloon)) + (actions/remove-item entities items/wool) + (actions/do-dialogue entities + :game-player "That's right! Now for your second riddle:" + :game-player "Filled with air, light as a feather," + :game-player "If you want to keep it, best have a tether.")) + (actions/talk entities :ego "He doesn't need it."))) :balloon (actions/get-script entities - (actions/remove-item entities items/balloon) - (actions/do-dialogue entities - :game-player "That's right! Now for your third riddle:" - :game-player "Hippity-hop, I jump really far," - :game-player "Now I'm dead, or at least a have a scar.")) + (if (= :balloon (get-in @entities [:state :current-riddle])) + (do (actions/update-state entities #(assoc % :current-riddle :frog-legs)) + (actions/remove-item entities items/balloon) + (actions/do-dialogue entities + :game-player "That's right! Now for your third riddle:" + :game-player "Hippity-hop, I jump really far," + :game-player "Now I'm dead, or at least a have a scar.")) + (actions/talk entities :ego "He doesn't need it."))) :frog-legs (actions/get-script entities - (actions/remove-item entities items/frog-legs) - (actions/do-dialogue entities - :game-player "Wow! That's right!" - :game-player "I guess I'm not the wisest person in Remington." - :game-player "You have earned my trophy.") - (actions/give entities items/trophy))} + (if (= :frog-legs (get-in @entities [:state :current-riddle])) + (do (actions/update-state entities #(assoc % :current-riddle :done)) + + (actions/remove-item entities items/frog-legs) + (actions/do-dialogue entities + :game-player "Wow! That's right!" + :game-player "I guess I'm not the wisest person in Remington." + :game-player "You have earned my trophy.") + (actions/give entities items/trophy)) + (actions/talk entities :ego "He doesn't need it.")))} :anim nil :talk game-player-talk)} :collision "inside-castle/collision.png"