diff --git a/desktop/escaped.edn b/desktop/escaped.edn index 045fff28..36d97989 100644 --- a/desktop/escaped.edn +++ b/desktop/escaped.edn @@ -1 +1 @@ -{:active? true, :convinced-wizard? true, :time :night, :opened-bars? true, :inventory (:key :recipe :crowbar :rope :ladder :grass :medal :kiss :trophy :flask-1-strength :sword), :wizard-left? false, :dropped-ball? true, :hay-searches 4, :clues #{}, :warden-sleeping? true, :current-riddle :wool, :warden-fast-asleep? true, :last-room :outside-house, :wants-toy true, :bent-bars? true, :chest-contents [], :mints-eaten 0, :object nil, :obtained-items #{:key :rope :kiss :medal :sword :flask-1 :grass :ladder :trophy :crowbar :ball-n-chain}} +{:active? true, :convinced-wizard? true, :time :night, :opened-bars? true, :inventory (:key :glass-eye :recipe :crowbar :rope :ladder :grass :medal :kiss :trophy :flask-1-strength :sword), :wizard-left? false, :dropped-ball? true, :hay-searches 4, :clues #{}, :warden-sleeping? true, :current-riddle :wool, :warden-fast-asleep? true, :last-room :outside-house, :wants-toy true, :bent-bars? true, :chest-contents [], :mints-eaten 0, :object nil, :obtained-items #{:key :rope :kiss :medal :sword :flask-1 :grass :ladder :trophy :crowbar :ball-n-chain}} diff --git a/desktop/in-jail.edn b/desktop/in-jail.edn index 17388301..cc634291 100644 --- a/desktop/in-jail.edn +++ b/desktop/in-jail.edn @@ -1 +1 @@ -{:active? true, :convinced-wizard? true, :inventory [] :chest-contents [:ladder :recipe :grass :medal :kiss :trophy :flask-1-strength :sword ], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-jail, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :sword :flask-1 :grass :ladder :trophy} :time :night} +{:active? true, :convinced-wizard? true, :inventory [] :chest-contents [:ladder :glass-eye :recipe :grass :medal :kiss :trophy :flask-1-strength :sword ], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-jail, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :sword :flask-1 :grass :ladder :trophy} :time :night} diff --git a/desktop/ready-to-pull-sword.edn b/desktop/ready-to-pull-sword.edn index 558e471c..ca3f4bff 100644 --- a/desktop/ready-to-pull-sword.edn +++ b/desktop/ready-to-pull-sword.edn @@ -1 +1 @@ -{:active? true, :convinced-wizard? true, :inventory [:ladder :recipe :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy} :time :day} +{:active? true, :convinced-wizard? true, :inventory [:ladder :glass-eye :recipe :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy} :time :day} diff --git a/desktop/resources/castle-gate/background.png b/desktop/resources/castle-gate/background.png new file mode 100644 index 00000000..403ceeb2 Binary files /dev/null and b/desktop/resources/castle-gate/background.png differ diff --git a/desktop/resources/castle-gate/castle-door.psd b/desktop/resources/castle-gate/castle-door.psd new file mode 100644 index 00000000..8cdf6f53 Binary files /dev/null and b/desktop/resources/castle-gate/castle-door.psd differ diff --git a/desktop/resources/castle-gate/collision.png b/desktop/resources/castle-gate/collision.png new file mode 100644 index 00000000..ce8031d5 Binary files /dev/null and b/desktop/resources/castle-gate/collision.png differ diff --git a/desktop/resources/cat-tree/background.psd b/desktop/resources/cat-tree/background.psd index 041b3465..a2d8a5cb 100644 Binary files a/desktop/resources/cat-tree/background.psd and b/desktop/resources/cat-tree/background.psd differ diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index d25491b4..f29e3912 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -41,7 +41,9 @@ (every? (partial has-obtained? entities) items)) (defn has-one-of? [entities items] - (seq (set/intersection (set (get-in entities [:state :inventory])) (set items)))) + (if (map? entities) + (seq (set/intersection (set (get-in entities [:state :inventory])) (set items))) + (seq (set/intersection (set (get-in @entities [:state :inventory])) (set items))))) (defmacro run-action [entities & forms] `(let [c# (chan)] diff --git a/desktop/src-common/advent/screens/rooms/castle_gate.clj b/desktop/src-common/advent/screens/rooms/castle_gate.clj new file mode 100644 index 00000000..0c6249c3 --- /dev/null +++ b/desktop/src-common/advent/screens/rooms/castle_gate.clj @@ -0,0 +1,44 @@ +(ns advent.screens.rooms.castle-gate + (:require [advent.screens.rooms :as rooms] + [advent.actions :as actions] + [advent.screens.items :as items] + [advent.utils :as utils] + [clojure.zip :as zip] + [play-clj.core :refer :all] + [play-clj.ui :refer :all] + [play-clj.utils :refer :all] + [play-clj.g2d :refer :all])) + + +(defn make-night [entities] + entities) + + +(defn make [screen] + (rooms/make :music {:day :town-2 :night :night} + :interactions {:right-dir {:box [300 40 320 83] + :script (actions/get-script entities + (actions/walk-to entities :ego [301 46] :face :right) + (actions/walk-straight-to entities :ego [340 40]) + (actions/transition-background entities :outside-castle [82 180]) + (actions/walk-to entities :ego [129 148])) + :cursor :right} + :left-dir {:box [105 93 169 212] + :script (actions/get-script entities + (actions/walk-straight-to entities :ego [157 83]) + (actions/transition-background entities :inside-castle [280 145]) + (actions/walk-to entities :ego [245 90])) + :cursor :left}} + + :layers {:day [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)] + :night [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)]} + :entities {} + + :collision "castle-gate/collision.png" + :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.30) + :apply-state (fn [entities] + (as-> entities entities + (if (= :night (get-in entities [:state :time])) + (make-night entities) + entities))) + :start-pos [300 45])) diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index 760b08c2..881999c6 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -119,6 +119,21 @@ (get-in @entities [:state :wants-toy]) (do-wants-toy-conversation entities) :else (do-initial-peddler-conversation entities))) +(defn should-block? [entities] + (and (= :night (get-in @entities [:state :time])) + (actions/has-obtained? entities :spell-component) + (actions/has-one-of? entities [:used-earplugs :glass-eye :motivational-tapes]))) + +(defn go-through-gate [entities] + (actions/walk-to entities :ego [82 180]) + (if (should-block? entities) + + (do (actions/transition-background entities :castle-gate [340 40]) + (actions/walk-straight-to entities :ego [300 45])) + (do + (actions/transition-background entities :inside-castle [280 145]) + (actions/walk-to entities :ego [245 90])))) + (defn make-night [entities] (-> entities (update-in [:room :entities] #(dissoc % :peddler)) @@ -152,9 +167,7 @@ :door {:box [66 180 85 195] :script (actions/get-script entities - (actions/walk-to entities :ego [82 180]) - (actions/transition-background entities :inside-castle [280 145]) - (actions/walk-to entities :ego [245 90])) + (go-through-gate entities)) :cursor :left} :castle {:box [0 181 100 240] :script (actions/get-script entities diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 41942120..7d18d3fd 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -15,6 +15,7 @@ [advent.screens.rooms :as rooms] [advent.screens.rooms.common :as common] [advent.screens.items :as items] + [advent.screens.rooms.castle-gate :as rooms.castle-gate] [advent.screens.rooms.outside-house :as rooms.outside-house] [advent.screens.rooms.inside-house :as rooms.inside-house] [advent.screens.rooms.inside-castle :as rooms.inside-castle] @@ -328,6 +329,7 @@ :inside-cafeteria (rooms.inside-cafeteria/make screen) :inside-antique (rooms.inside-antique/make screen) :inside-jail (rooms.inside-jail/make screen) + :castle-gate (rooms.castle-gate/make screen) :outside-jail (rooms.outside-jail/make screen) :outside-castle (rooms.outside-castle/make screen)} entities {:rooms rooms