diff --git a/desktop/src-common/advent/screens/rooms/#outside_house.clj# b/desktop/src-common/advent/screens/rooms/#outside_house.clj# deleted file mode 100644 index 8c84ddf7..00000000 --- a/desktop/src-common/advent/screens/rooms/#outside_house.clj# +++ /dev/null @@ -1,752 +0,0 @@ -(ns advent.screens.rooms.outside-house - (:require [advent.screens.items :as items] - [advent.screens.rooms :as rooms] - [advent.screens.rooms.common :as common] - [advent.screens.rooms.outside-castle :as outside-castle] - [advent.screens.rooms.inside-castle :as inside-castle] - [advent.actions :as actions] - [advent.tween :as tween] - [advent.utils :as utils] - [clojure.zip :as zip] - [play-clj.core :refer :all] - [play-clj.ui :refer :all] - [play-clj.math :refer :all] - [play-clj.utils :refer :all] - [play-clj.g2d :refer :all])) - - - -(defn dawn-fade [entities] - (actions/run-action entities - (begin [this screen entities] - (-> entities - (assoc-in [:tweens :dawn-r] (tween/tween :dawn-r screen [:time-profiles :default :r] :current 0.63 50.0 :entities entities)) - (assoc-in [:tweens :dawn-g] (tween/tween :dawn-g screen [:time-profiles :default :g] :current 0.36 50.0 :entities entities)) - (assoc-in [:tweens :dawn-b] (tween/tween :dawn-b screen [:time-profiles :default :b] :current 0.23 50.0 :entities entities)) - (assoc-in [:tweens :hue-amount-v] (tween/tween :hue-amount-v screen [:time-profiles :default :hue-amount] :current 0.0 50.0 :entities entities)) - (assoc-in [:tweens :multiply-amount-v] (tween/tween :multiply-amount-v screen [:time-profiles :default :multiply-amount] :current 0.0 50.0 :entities entities)) - - (assoc-in [:tweens :dawn-r-s] (tween/tween :dawn-r-s screen [:time-profiles :sprite :r] :current 0.63 50.0 :entities entities)) - (assoc-in [:tweens :dawn-g-s] (tween/tween :dawn-g-s screen [:time-profiles :sprite :g] :current 0.36 50.0 :entities entities)) - (assoc-in [:tweens :dawn-b-s] (tween/tween :dawn-b-s screen [:time-profiles :sprite :b] :current 0.23 50.0 :entities entities)) - (assoc-in [:tweens :hue-amount-v-s] (tween/tween :hue-amount-v-s screen [:time-profiles :sprite :hue-amount] :current 0.0 50.0 :entities entities)) - (assoc-in [:tweens :multiply-amount-v-s] (tween/tween :multiply-amount-v-s screen [:time-profiles :sprite :multiply-amount] :current 0.0 50.0 :entities entities))) - ) - (continue [this screen entities] - entities) - (done? [this screen entities] - true) - (terminate [this screen entities] - entities) - (skip-type [this screen entities] - :none))) - - - - -(defn walk-to-castle [entities & {:keys [skip-type stop?] :or {skip-type :end stop? true}}] - (actions/walk-to entities :ego [0 80] :skip-type skip-type) - (actions/walk-straight-to entities :ego [-20 80]) - (actions/transition-background entities :outside-castle [330 80]) - (actions/walk-straight-to entities :ego [319 80] :stop? false) - (actions/walk-to entities :ego [273 81] :skip-type skip-type :stop? stop?)) - -(def ego-sheep-loc - [132 140]) - -(defn dist-to-sheep [entities] - (apply utils/dist (get-in entities [:room :entities :sheep :x]) (get-in entities [:room :entities :sheep :y]) - ego-sheep-loc)) - -(defn is-sheep-close? [entities] - (< (dist-to-sheep entities) 45)) - -(defn is-ready-for-slingshot [entities] - (and (actions/has-obtained? entities :broken-clock) - (not (actions/has-item? entities :broken-clock)) - (actions/has-obtained? entities :money) - (not (actions/has-item? entities :money)))) - -(defn walk-to-sheep [entities] - (actions/walk-to entities :ego [154 133] :skip-type :end) - (actions/walk-straight-to entities :ego [119 134] :update-baseline? false)) - -(defn leave-sheep [entities] - (actions/walk-straight-to entities :ego [154 133] :update-baseline? false)) - -(defn magic [entities] - (actions/run-action entities - (begin [this screen entities] - (doto (get-in entities [:room :entities :magic]) - (particle-effect! :reset) - (particle-effect! :start)) - entities) - (continue [this screen entities] - entities) - (done? [this screen entities] - (particle-effect! (get-in entities [:room :entities :magic]) :is-complete)) - (terminate [this screen entities] - entities) - (skip-type [this screen entities] - :none))) - -(defn put-something-in-cauldron [item] - (condp = item - :money (actions/get-script entities - (if (actions/has-item? entities :note-2) - (do - (actions/walk-to entities :ego [141 90] :face :right) - (actions/play-animation entities :ego :reach) - (actions/remove-item entities :money) - (actions/talk entities :ego "I guess that's what you could call 'money in the pot'.")) - (actions/talk entities :ego "I don't want to put something in there unless I'm sure I need to."))) - :slingshot (actions/get-script entities - (if (is-ready-for-slingshot entities) - (do - (actions/walk-to entities :ego [141 90] :face :right) - (dawn-fade entities) - (actions/talk entities :ego "Here goes!") - (actions/play-animation entities :ego :reach-start :stop? false) - (magic entities) - (actions/play-animation entities :ego :reach-stop :stop? true) - - (actions/remove-item entities :slingshot) - (actions/give entities :magic-slingshot) - - (actions/do-dialogue entities :ego "It worked!") - - (actions/glad entities) - (actions/do-dialogue entities - :ego "I now have The Slinger's Shot." - :ego "And just in time, too. It's getting light.") - - (actions/update-state entities #(assoc % :next-time :sunrise :seen-bloodclot? false)) - (walk-to-castle entities :skip-type :none :stop? false) - (outside-castle/go-through-gate entities :skip-type :none :stop? false) - (actions/update-state entities #(assoc % :next-time :day)) - (inside-castle/walk-to-blergh entities) - (actions/do-dialogue entities - :ego "Bloodclot!" - :bloodclot-head "Oh, hello again." - :bloodclot-head "I thought I had taken care of you the last time I saw you." - :bloodclot-head "Any final words before I destroy you again?") - (actions/play-animation entities :ego :scared :continue? true) - (Thread/sleep 500) - (actions/walk-straight-to entities :ego [35 45] :override-dir :right :speed 3.0)))) - :broken-clock (actions/get-script entities - (if (actions/has-item? entities :note-2) - (do - (actions/walk-to entities :ego [141 90] :face :right) - (actions/play-animation entities :ego :reach) - (actions/remove-item entities :broken-clock) - (actions/talk entities :ego "Just in the nick of time.")) - (actions/talk entities :ego "I don't want to put something in there unless I'm sure I need to."))) - :recipe (actions/get-script entities - (actions/walk-to entities :ego [151 90] :face :right) - (actions/play-animation entities :ego :squat) - (actions/remove-item entities :recipe) - (actions/give entities :ash) - (actions/talk entities :ego "It burned up into ash.")) - :spell-component (actions/get-script entities - (actions/walk-to entities :ego [141 90] :face :right) - (actions/play-animation entities :ego :reach) - (actions/remove-item entities :spell-component) - (actions/talk entities :ego "I poured it in. Now what?")) - (actions/get-script entities - (actions/talk entities :ego "I don't want to put something in there unless I'm sure I need to.")))) - - -(defn do-frog [entities] - (actions/talk entities :wizard "Grenouille CHALA!!!" :anim :talk-angry :stop? false) - (particle-effect! (get-in @entities [:room :entities :magic-frog-particle]) :reset) - (particle-effect! (get-in @entities [:room :entities :magic-frog-particle]) :start) - (actions/begin-animation entities :ego :frog) - (Thread/sleep 2000) - (actions/begin-animation entities :wizard :stand) - (Thread/sleep 1000) - (actions/do-dialogue entities - :wizard "I warned you, Tick." - :wizard "Now, I will return you to your true state if you leave me in peace." - :wizard "Do you promise?") - (actions/play-animation entities :ego :frog-nod :stop? false) - (actions/talk entities :wizard "Frustatium DISPOSIUM!!!" :anim :talk-angry :stop? false) - (particle-effect! (get-in @entities [:room :entities :magic-frog-particle]) :reset) - (particle-effect! (get-in @entities [:room :entities :magic-frog-particle]) :start) - (Thread/sleep 1500) - (actions/transition-background entities :outside-house [257 90] :face :left)) - -(defn do-prophecy [entities] - {:run #(do (actions/respond entities % - :wizard "Well let me remind you." - :wizard "'On the day when it shall be pulled,\nWith much strength a knight will take hold.'")) - :choices - ["Is this almost over?" - {:run #(do (actions/update-state entities (fn [state] (assoc state :convinced-wizard? true))) - (actions/respond entities % - :wizard "Patience, boy." - :wizard "'Courage will he need,\nWisdom he shall heed.'" - :wizard "'A final test remains, behold!'" - :wizard "If this is truely your quest, then I will help you. " - :ego "So you're my friend now, Gandarf?" - :wizard "No."))} - "*cough* *cough* *ahem*" - {:run #(do (actions/update-state entities (fn [state] (assoc state :convinced-wizard? true))) - (actions/respond entities % - :wizard "Excuse you. Moving on..." - :wizard "'Courage will he need,\nWisdom he shall heed.'" - :wizard "'A final test remains, behold!'" - :wizard "If this is truely your quest, then I will help you. " - :ego "So you're my friend now, Gandarf?" - :wizard "No.") - (utils/save @entities))}]}) - -(defn wizard-dialogue [entities] - (if (get-in @entities [:state :has-met-gandarf?]) - (do (actions/do-dialogue entities :ego "Hello again Gandarf!" - :wizard "Not you again!") - (actions/talk entities :wizard "I command you, leave at once!" :anim :talk-angry :stop? false) - (actions/talk entities :wizard "Don't make me use my powers against you!" :anim :talk-angry :stop? false) - (actions/talk entities :wizard "Leave now, or else!" :anim :talk-angry :stop? false) - (actions/begin-animation entities :wizard :magic-hands)) - (do (actions/do-dialogue entities :ego "Hello there Gandarf!" - :wizard "Oh no, not you!" - :ego "What do you mean, 'not you!'?" - :wizard "I mean, you've wrecked my life!" - :wizard "I never want to see the likes of you again!" - :wizard "Leave!" - :ego "But...") - (actions/talk entities :wizard "I command you, by all the power I can muster..." :anim :talk-angry :stop? false) - (actions/talk entities :wizard "Leave now, or else!" :anim :talk-angry :stop? false) - (actions/begin-animation entities :wizard :magic-hands))) - (actions/update-state entities (fn [s] (assoc s :has-met-gandarf? true))) - (actions/present-choices entities - {:choices ["Surely you can't still be angry with me!" - {:run #(actions/respond entities % :wizard "I can't?" - :wizard "Do you even remember what you did?") - :choices ["You mean the time I set your house on fire with a fire mint?" - {:run #(do - (actions/respond entities % - :wizard "No, of course n...") - (Thread/sleep 500) - (actions/do-dialogue entities :wizard "Wait... that was you!?" :wizard "My house was completely destroyed!") - (Thread/sleep 500) - (actions/talk entities :wizard "I had to move out of town into this shack!" :anim :talk-angry :stop? false) - (actions/talk entities :wizard "Leave, now, or I'll turn you into a ..." :anim :talk-angry :stop? false) - (actions/talk entities :wizard "... a ..." :anim :talk-angry :stop? false) - (actions/talk entities :wizard "... a pack of matches!" :anim :talk-angry) - (actions/begin-animation entities :wizard :magic-hands) - (actions/talk entities :ego "Okay, okay, I'm leaving!") - (actions/transition-background entities :outside-house [257 90] :face :left) - (actions/play-animation entities :ego :sigh) - (actions/do-dialogue entities :ego "It seems like his temper is on fire." - :ego "Sort of like his house was."))} - "You're still cross about my stealing your magic cowboy hat?" - {:run #(do (actions/respond entities % - :wizard "Of course I'm cross! It's irreplaceable!" - :wizard "That cowboy hat accented my facial physique." - :wizard "And complemented my skin color." - :wizard "And you little pipsqueak stole it from me!" - :wizard "That's why I bought my Magi-Safe 5000, to keep out intruders like you." - ) - (actions/talk entities :wizard "Now leave, before I force you out!" :anim :talk-angry :stop? false) - (actions/begin-animation entities :wizard :magic-hands) - (actions/transition-background entities :outside-house [257 90] :face :left) - (actions/do-dialogue entities :ego "I guess he's really upset about that cowboy hat!"))} - "Maybe the time I freed your pet dragon?" - {:run #(do (actions/respond entities % - :wizard "Of course I mean that!" - :wizard "I've raised Snaggletooth from the day he was born." - :wizard "Raised him as my own, I did." - :wizard "47 long years." - :wizard "All for nothing!") - (actions/talk entities :wizard "Give me one reason I shouldn't turn you into a replacement dragon right now!" - :anim :talk-angry :stop? false) - (actions/begin-animation entities :wizard :magic-hands)) - :choices ["Frankie Rockfist and his gang made me do it!" - {:run #(do (actions/respond entities % - :wizard "Frankie Rockfist, eh?" - :wizard "What kind of dumb name is Frankie Rockfist?!" - ) - (Thread/sleep 1000) - (actions/talk entities :wizard "You think I'm stupid enough to fall for that?!" :anim :talk-angry :stop? false) - (actions/talk entities :wizard "It's time to teach you a lesson." :anim :talk-angry :stop? false) - (do-frog entities) - (actions/do-dialogue entities :ego "Phew!" - :ego "I thought I had nearly croaked!"))} - - "I'm on an important quest!" - {:run #(actions/respond entities % :wizard "Eh?" - :wizard "Pray tell, what kind of quest?") - :choices ["To leave this house with some of your belongings." - {:run #(do (actions/respond entities % - :wizard "My belongings!?") - (actions/talk entities :wizard "Why you little!" :anim :talk-angry :stop? false) - (actions/begin-animation entities :wizard :magic-hands) - (do-frog entities) - (actions/talk entities :ego "Gandarf is such a stingy old toad."))} - "To find you a brand new dragon." - {:run #(do (actions/respond entities % - :wizard "Great idea Tick!" - :wizard "You'd make the perfect base for a dragon-bait stew!" - :wizard "Let me just summon my boy-sized cooking pot.") - (actions/talk entities :wizard "Boildrum Ka...." :anim :talk-angry :stop? false) - (actions/begin-animation entities :wizard :magic-hands) - (actions/do-dialogue entities :ego "On second thought..." - :ego "I realized I have a busy schedule this morning." - :ego "Ciao!") - (actions/transition-background entities :outside-house [257 90] :face :left) - (actions/talk entities :ego "That Gandarf can be a real fire under my bum."))} - "To become a knight of the town of Remington." - {:run #(do (actions/respond entities % - :wizard "You are, are you?" - :wizard "And how do you, a mere reckless youth, plan on becoming a knight?")) - :choices ["Well I had this dream..." - {:run #(do (actions/respond entities % - :wizard "I had a dream last night too, Tick." - :ego "You did?" - :wizard "Yes." - :wizard "I dreamed I was an earthworm." - :wizard "And you'd never guess what happened when I woke up." - :ego "What?" - :wizard "I had indigestion." - :wizard "Dreams aren't all they're chocked up to be." - :wizard "Face it boy, it was just a dream. " - :wizard "You'll never be a knight." - :wizard "Now go.") - (actions/transition-background entities :outside-house [257 90] :face :left) - (actions/play-animation entities :ego :sigh))} - "By pulling the Sword of Blergh from its stone!" - {:run #(actions/respond entities % - :wizard "You mean to fulfill the ancient prophecy?" - :wizard "Only one worthy in courage, wisdom, and might can pull it." - :wizard "You'd never measure up!" - :ego "Well maybe you could help me?" - :wizard "I appreciate your spirit, Tick, but why is it so important for you to become a knight?") - :choices ["I want to impress Georgia McGorgeous." - {:run #(do (actions/respond entities % - :ego "You know, win her heart and everything." - :wizard "Well, no man can argue with true love." - :wizard "Me least of all." - :wizard "I'm still a bachelor myself.") - (Thread/sleep 1000) - (actions/do-dialogue entities - :wizard "I have decided." - :wizard "I will help you." - :wizard "Your cause is noble, and your heart is just." - :wizard "Just don't let me catch you stealing my belongings.") - (Thread/sleep 1000) - (actions/do-dialogue entities :wizard "Now Tick, do you know the prophecy of the Sword of Blergh?")) - :choices ["Yes." - (do-prophecy entities) - "No." - (do-prophecy entities)]} - "I want to have the name 'Sir Tick.'" - {:run #(actions/respond entities % - :wizard "'Sir Tick.'" - :ego "It does have a nice ring to it." - :ego "Wouldn't you say?" - :wizard "It does indeed!" - :wizard "But the title comes after the deed, boy." - :wizard "You must have a more noble reason to become a knight." - ) - :choices actions/previous-choices} - "I want to be famous." - {:run #(do (actions/respond entities % - :wizard "Did you ever hear the story of Young Sir Gypsum?" - :ego "I don't think so." - :wizard "Well he went off on many quests, seeking fame and fortune.") - (Thread/sleep 3000) - (actions/do-dialogue entities - :ego "... and?" - :wizard "And what?" - :ego "And what happened to Young Sir Gypsum?" - :wizard "Nobody remembers!" - :wizard "Fame is a fickle friend.")) - :choices actions/previous-choices} - "I wanteth to speaketh like the other knights." - {:run #(actions/respond entities % - :wizard "Oh, dost thou?" - :wizard "Surely thou doth know that thou can speaketh in this manner." - :wizard "Thy tongue requireth neither sword nor title.") - :choices actions/previous-choices}]} - "By besting trap, beast, and long, boring, conversation with old gheezers." - {:run #(do (actions/respond entities % - :wizard "Quite right, quite right.") - (Thread/sleep 1000) - (actions/do-dialogue entities - :wizard "Wait." - :wizard "What 'old gheezer' are you referring to?" - :ego "Umm...") - (actions/talk entities :wizard "You don't happen to be referring to me, do you?" :anim :talk-angry :stop? false) - (actions/begin-animation entities :wizard :magic-hands) - (actions/do-dialogue entities :ego "Well, I..." - :ego "That is to say, I..." - :ego "... Oh boy.") - (do-frog entities) - (actions/play-animation entities :ego :sigh))}]} - "To improve my standing in the community." - {:run #(do (actions/respond entities % - :wizard "Ha! Good standing?" - :wizard "You're the neighborhood cheat and everyone knows it." - :wizard "I'm afraid your standing is irreparable." - :wizard "Now leave me to mourn ol' Snaggletooh.") - (actions/transition-background entities :outside-house [257 90] :face :left) - (actions/play-animation entities :ego :sigh))} - ]} - "Snaggletooth deserved a free life, you old gheezer!" - {:run #(do (actions/respond entities % :wizard "Why, you..." - :wizard "Snaggletooth was my friend!") - (Thread/sleep 1000) - (do-frog entities) - (actions/talk entities :ego "Phew!") - (actions/talk entities :ego "I thought I had ribbit the dust!"))} - - ]} - - ]} - "But I'm your friend, Gandarf!" - {:run #(do (actions/respond entities % :wizard "Friend? " - :wizard "What kind of friend would do what you did to me?") - (Thread/sleep 500) - (actions/talk entities :wizard "You don't even remember what you did, do you?") - ) - :choices #(-> % zip/left)} - "Or else what?" - {:run #(do (actions/talk entities :ego %) - (actions/talk entities :wizard "Or else I'll turn you into a frog!" :anim :talk-angry :stop? false) - (actions/begin-animation entities :wizard :magic-hands)) - :choices ["You don't scare me." - {:run - #(do - (actions/talk entities :ego %) - (actions/talk entities :wizard "You asked for it, boy." :anim :talk-angry :stop? false) - (do-frog entities)) - } - "On second thought..." - {:run #(actions/do-dialogue entities :ego %) - :choices actions/something-else} - "Okay, okay, I'm leaving." - {:run - #(do - (actions/talk entities :ego %) - (actions/transition-background entities :outside-house [257 90] :face :left))}]} - "Okay, okay, I'm leaving." - {:run #(do - (actions/talk entities :ego %) - (actions/talk entities :wizard "Good riddance!" :anim :talk-angry) - (actions/transition-background entities :outside-house [257 90] :face :left))}]})) - - -(defn talk-to-gandarf-outside [entities] - (actions/walk-to entities :ego [120 80] :face :right) - (if (actions/has-item? entities :flask-2) - (actions/do-dialogue entities :wizard "Have you gotten me water from the fountain yet?" - :ego "No, not yet." - :wizard "Hurry, boy! Time's-a-wastin'!") - (do - (actions/do-dialogue entities :ego "Gandarf! Boy am I glad to see you." - :wizard "I'm busy. What is it Tick?") - (actions/present-choices entities - {:choices ["I got put in jail!" - {:run #(actions/respond entities % - :wizard "What for, boy?" - :ego "For borrowing the Duke's ladder." - :wizard "Hoooo boy, you don't 'borrow' from the Duke!" - :wizard "Everyone knows that!" - :wizard "You're lucky he didn't have your head!") - :choices actions/previous-choices} - "I pulled the sword!" - {:run #(actions/respond entities % - :wizard "You did?" - :wizard "Congratulations, Tick!" - :wizard "Meanwhile, my life hasn't been going so great." - :wizard "Someone broken into my MagiSafe 5000 and stole some things from my hut." - :ego "Oh." - :ego "How awful!") - :choices actions/previous-choices} - "Bloodclot is on the loose!" - {:run #(do (actions/respond entities % - :wizard "Bloodclot?" - :wizard "You can't mean the goblin, Bloodclot?" - :wizard "If you did, you'd be burned to a crisp from his lightning gem!" - :ego "Yes, that Bloodclot!" - :wizard "I knew that there would be a 'final test' for the hero who pulled the blade..." - :wizard "But I never imagined this." - :wizard "There's only one way to neutralize his lighting magic:" - :wizard "The Slinger's Shot." - :wizard "It's a magical slingshot that has long lost its power." - :wizard "Here, take it.") - (actions/give entities :slingshot) - (actions/do-dialogue entities - :wizard "Whatever happens, do not lose that slingshot!" - :wizard "You and me, boy, we're going to return it to its powerful state." - :wizard "Then you can beat Bloodclot, come sunrise." - :wizard "Now, time is of the essence." - :wizard "Take this flask. Fill it with water from the fountain." - :wizard "And remember. Don't lose the slingshot.") - (actions/give entities :flask-2))} - "See ya." - {:run #(actions/respond entities % :wizard "See you around.")}]})))) - -(defn add-wizard-if-necessary [entities] - (if (get-in entities [:state :seen-frankie?]) - entities - (update-in entities [:room :entities] #(assoc % :wizard (get-in entities [:room :wizard]))))) - -(defn add-note-if-necessary [entities] - (if (and (get-in entities [:state :seen-frankie?]) - (not (actions/has-obtained? entities :note-1))) - (update-in entities [:room :entities] #(assoc % :note (get-in entities [:room :note]))) - entities)) - -(defn make-night [entities] - (-> entities - (update-in [:room :entities] #(dissoc % :butterfly)) - (update-in [:room :entities] #(assoc % :cauldron (get-in entities [:room :cauldron]))) - add-wizard-if-necessary - add-note-if-necessary)) - -(defn move-toward [screen entities {:keys [x y] :as e} target-x] - (let [delta-x (- target-x x) - speed (* 1.0 - (/ (:delta-time screen) - (/ 1.0 60.0))) - speed (if (< delta-x 0) (- speed) speed) - moved-x (if (< (Math/abs delta-x) speed) - target-x - (* speed (/ delta-x delta-x) ))] - (if (< (Math/abs delta-x) speed) - (actions/start-animation screen - (dissoc e :target-x) - :stand) - - (actions/start-animation screen - (assoc (actions/jump-to screen entities e [(+ moved-x x) y] false) - :facing (cond (< delta-x 0) :left - (> delta-x 0) :right - :else (:facing e))) - :walk)))) - -(defn jump-around [screen entities] - (if-let [target-x (get-in entities [:room :entities :lamb :target-x])] - (update-in entities [:room :entities :lamb] - #(move-toward screen entities % target-x)) - (if (= 1 (rand-int 50)) - (assoc-in entities [:room :entities :lamb :target-x] (rand-nth [30 10 60 70])) - entities))) - - -(defnn) - - - -(defn make [screen] - (let [sheep-stand-sheet (texture! (texture "outsidehouse/sheep-anim.png") :split 33 21) - sheep-walk-sheet (texture! (texture "outsidehouse/sheep-walk.png") :split 33 21) - lamb-walk-sheet (texture! (texture "outsidehouse/lamb-walk.png") :split 27 28) - sheep-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 9 10 (repeat 25 11) (repeat 15 12)])] - (aget sheep-stand-sheet 0 i))) - door (utils/make-anim "outsidehouse/door.png" [22 58] 0.15 (flatten [(range 4) 3 3 3 3 3 3 3])) - sheep-walk (animation 0.05 (for [i (range 6)] - (aget sheep-walk-sheet 0 i))) - butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1]) - cauldron (utils/make-anim "outsidehouse/cauldron.png" [50 38] 0.15 (range 4)) - scaler (utils/scaler-fn-with-baseline 110 0.10 1.00) - lamb-stand (aget lamb-walk-sheet 0 0) - lamb-walk (animation 0.075 (for [i (range 4)] - (aget lamb-walk-sheet 0 i)))] - (rooms/make :music {:day :town-2 :night :night} - :update-fn jump-around - :interactions - {:door {:box [250 100 281 160] - :script - (actions/get-script - entities - (actions/walk-to entities :ego [257 90] :face :right :skip-type :end) - (actions/talk entities :ego (str "Anyone home?")) - (actions/play-animation entities :ego :reach) - (if (= :night (get-in @entities [:state :time])) - (actions/talk entities :ego "It's locked.") - (do (actions/play-animation entities :door :open) - (actions/transition-background entities :inside-house [237 0] :between (fn [s e] - (if (= 1 (rand-int 4)) - (assoc-in e [:room :entities :experiment] (get-in e [:room :experiment])) - e))) - (when (get-in @entities [:room :entities :experiment]) - (actions/play-animation entities :experiment :experiment) - (actions/remove-entity entities :experiment)) - - (if (get-in @entities [:state :convinced-wizard?]) - (do (actions/talk entities :wizard (str "Oh, hello there boy.")) - (utils/save @entities)) - (wizard-dialogue entities))))) - :cursor :right} - - :right-dir {:box [220 141 320 204] - :script (actions/get-script - entities - (actions/walk-to entities :ego [244 150] :skip-type :end) - (actions/transition-background entities :behind-house [122 140]) - (actions/walk-to entities :ego [172 122])) - :cursor :right} - :up-dir {:box [105 180 203 240] - :script (actions/get-script - entities - (actions/walk-to entities :ego [137 204] :skip-type :end) - (actions/transition-background entities :cat-tree [223 -51]) - (actions/walk-straight-to entities :ego [200 10])) - :cursor :up} - :left-dir {:box [0 40 40 140] - :script (actions/get-script - entities - (walk-to-castle entities)) - :cursor :left}} - :layers {:day [(assoc (texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0) - (assoc (texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122) - (assoc (texture "outsidehouse/fence.png") :x 0 :y 0 :baseline 93) - - (assoc (texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44) - (assoc (texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5) - (assoc (texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)] - :night [(assoc (texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0) - (assoc (texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122) - (assoc (texture "outsidehouse/fence.png") :x 0 :y 0 :baseline 93) - - (assoc (texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44) - (assoc (texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5) - (assoc (texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]} - :entities {:sheep (actions/start-animation screen - (assoc (animation->texture screen sheep-stand) :x 38 :y 160 :baseline 80 - :scale-x (scaler [38 160]) - :scale-y (scaler [38 160]) - :box [38 160 71 181] - :script (actions/get-script - entities - - (if (actions/has-item? entities :wool) - (actions/talk entities :ego "The sheep has given me enough wool.") - (if (is-sheep-close? @entities) - (do (walk-to-sheep entities) - (actions/play-animation entities :ego :reach) - (actions/give entities :wool) - (actions/talk entities :ego "I guess her wool is shedding.") - (leave-sheep entities)) - (do - (walk-to-sheep entities) - (actions/talk entities :ego "Come here mama sheep!") - (actions/play-animation entities :ego :sigh) - (actions/talk entities :ego "She's too far away for me to pet her.") - (leave-sheep entities))))) - :scripts #(condp = % - :wool (actions/get-script entities - (actions/talk entities :ego "She doesn't need it back.")) - :grass (actions/get-script entities - (walk-to-sheep entities) - (actions/talk entities :ego "Come on girl, get the grass!") - (actions/play-animation entities :ego :reach) - (actions/talk entities :ego "I think she's not interested.") - (leave-sheep entities)) - :carrot (actions/get-script entities - (walk-to-sheep entities) - (actions/talk entities :ego "Come on girl, get the carrot!") - (actions/walk-straight-to entities :sheep [90 138] :update-baseline? false) - (actions/play-animation entities :ego :reach) - (actions/remove-item entities :carrot) - (actions/update-state entities (fn [s] (assoc s :coaxed-sheep? true))) - (leave-sheep entities)) - :flask-1 (actions/get-script entities - (if (is-sheep-close? @entities) - (do (walk-to-sheep entities) - (actions/play-animation entities :ego :milk) - (actions/remove-item entities :flask-1) - (actions/give entities :flask-1-with-milk) - (actions/talk entities :ego "Sheeps milk.") - (leave-sheep entities)) - (actions/talk entities :ego "She's too far away."))) - :flask-1-with-mushrooms - (actions/get-script entities - (if (is-sheep-close? @entities) - (do (walk-to-sheep entities) - (actions/play-animation entities :ego :milk) - (items/make-cream-of-mushroom entities) - (leave-sheep entities)) - (actions/talk entities :ego "She's too far away."))) - nil) - :left {:walk (utils/flip sheep-walk) - :stand (utils/flip sheep-stand)} - :right {:walk sheep-walk - :stand sheep-stand} - :scaled true) - sheep-stand) - - :outside-particles (common/make-outside-particles) - :magic (assoc (doto (particle-effect "outsidehouse/magic") ) - :x 153 - :y 105 - :baseline 238) - :door (assoc (animation->texture screen door) - :x 253 :y 88 :baseline 122 - :open door - :door-sound (sound "door.ogg") - :anim-sound-frames {door {1 [:door-sound 1.0]}} - ) - :lamb (assoc (texture "outsidehouse/lamb.png") - :x 10 :y 163 :baseline 77 - :right {:stand (animation 0.1 [lamb-stand]) - :walk lamb-walk} - - :left {:stand (utils/flip (animation 0.1 [lamb-stand])) - :walk (utils/flip lamb-walk)} - :scale-x (scaler [10 163]) - :scale-y (scaler [10 163]) - :script (actions/get-script entities - (actions/talk entities :ego "Aww, it's a newborn lamb!") - ) - :scripts {:carrot (actions/get-script entities (actions/talk entities :ego "I think it's still nursing.")) - :grass (actions/get-script entities (actions/talk entities :ego "I think it's still nursing."))} - ) - :butterfly (assoc (animation->texture screen butterfly-stand) - :x 161 - :y 218 - :baseline 240 - :anim butterfly-stand - :anim-start 0 - :path (catmull-rom-spline (map #(apply vector-2* %) (take 10 (repeatedly #(vector (rand-int 320) (rand-int 180))))) true) - :update-fn (fn [screen entities entity] - (let [speed 0.009 - pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed))) - v (vector-2 0 0) - a (catmull-rom-spline! (:path entity) :value-at v pos-f)] - (assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))} - :cauldron (rooms/make-entity :cauldron (assoc (animation->texture screen cauldron) - :x 139 :y 73 :baseline 167 - :anim cauldron - :anim-start 0 - :night-profile :none - :script (actions/get-script entities (examine-cauldron entities)) - :scripts put-something-in-cauldron)) - :wizard (rooms/make-entity :wizard (common/make-wizard screen {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2 - :script (actions/get-script entities (talk-to-gandarf-outside entities)) - :scripts {:default (actions/get-script entities (actions/talk entities :wizard "No time for that!"))}})) - :note (rooms/make-entity :note (assoc (texture "outsidehouse/note.png") - :x 277 :y 74 :baseline 160 - :night-profile :none - :script (actions/get-script entities - (actions/walk-to entities :ego [280 80] :face :right) - (actions/play-animation entities :ego :squat) - (actions/remove-entity entities :note) - (actions/give entities :note-1) - (common/read-note-1 entities)))) - :collision "outsidehouse/collision.png" - :scale-fn scaler - :apply-state (fn [_ entities] - (utils/fast-forward-particle (get-in entities [:room :entities :outside-particles])) - (as-> entities entities - (if (get-in entities [:state :coaxed-sheep?]) - (let [scale ((get-in entities [:room :scale-fn]) [90 138])] - (update-in entities [:room :entities :sheep] #(assoc % :x 90 :y 138 :baseline 40 :scale-x scale :scale-y scale))) - entities) - (if (= :night (get-in entities [:state :time])) - (make-night entities) - entities))) - :start-pos [30 80]))) diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 32a996b2..a47f9fff 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -8,6 +8,7 @@ [advent.tween :as tween] [advent.utils :as utils] [clojure.zip :as zip] + [clojure.string :as str] [play-clj.core :refer :all] [play-clj.ui :refer :all] [play-clj.math :refer :all] @@ -536,6 +537,34 @@ entities))) +(defn examine-cauldron [entities] + (let [put-clock (and (actions/has-obtained? entities :broken-clock) + (not (actions/has-item? entities :broken-clock))) + put-money (and (actions/has-obtained? entities :money) + (not (actions/has-item? entities :money))) + note-2-requirements (filter identity [(when (not put-money) + "the root of all evil") + (when (not put-clock) + "a split second")])] + + (cond (actions/has-item? entities :note-2) + (do (actions/do-dialogue entities :ego "According to Gandarf's note...") + (if (seq note-2-requirements) + (actions/do-dialogue entities :ego (str "I need to add " (str/join " and " note-2-requirements) ".") + :ego "Then dip in the Slinger's Shot.") + (actions/do-dialogue entities :ego "I just need to dip in the Slinger's Shot."))) + + (and (not (actions/has-item? entities :spell-component)) + (actions/has-obtained? entities :spell-component)) + (actions/do-dialogue entities + :ego "I added the contents of the flask." + :ego "But now what?") + + (actions/has-item? entities :note-1) + (actions/do-dialogue entities :ego "According to Gandarf's note..." + :ego "I need to some stuff up in a flask and dump it in here.") + :else + (actions/talk entities :ego "That's a big cauldron!")))) (defn make [screen] @@ -721,7 +750,8 @@ :anim cauldron :anim-start 0 :night-profile :none - :script (actions/get-script entities (actions/talk entities :ego "That's a big cauldron!")) + :script (actions/get-script entities + (examine-cauldron entities)) :scripts put-something-in-cauldron)) :wizard (rooms/make-entity :wizard (common/make-wizard screen {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2 :script (actions/get-script entities (talk-to-gandarf-outside entities)) diff --git a/desktop/src-common/advent/screens/rooms/outside_jail.clj b/desktop/src-common/advent/screens/rooms/outside_jail.clj index ba26783e..07373c5b 100644 --- a/desktop/src-common/advent/screens/rooms/outside_jail.clj +++ b/desktop/src-common/advent/screens/rooms/outside_jail.clj @@ -106,7 +106,7 @@ candle-flame (utils/make-anim "outside-jail/candle.png" [20 25] 0.075 (range 4)) candle-aura (utils/make-anim (texture "outside-jail/candle-aura2.png") [135 135] 0.3 [0 1 2 1] )] (rooms/make :music {:day :town-1 :night :night} - :interactions {:down-dir {:box [30 0 227 20] + :interactions {:down-dir {:box [30 0 227 40] :script (actions/get-script entities (actions/walk-to entities :ego [159 5] :skip-type :end :stop? false) (actions/walk-straight-to entities :ego [159 -20])