(ns advent.screens.rooms.inside-jail (: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 do-warden-dialogue [entities] (actions/do-dialogue entities :ego "Hey, who are you? Why am I in this cell?" :warden "You're under arrest for theft of public property." :ego "Under arrest? But I'm the good guy!\nThe game is named after me!" :warden "Sorry chap. The law's the law.") (actions/present-choices entities {:choices ["But I'm just a kid." {:run #(actions/respond entities % :warden "The Duke of Remington is a very stern chap." :warden "He doesn't bend the rules, even for young thieves.") :choices actions/previous-choices} "But I was going to teach Blergh a lesson!" {:run #(actions/respond entities % :warden "Sure you were. If he even exists." :ego "He does! He's going to come destroy the town first thing in the morning!" :warden "Uh huh." :warden "As if I have heard the 'bad guy is coming to destroy the town' 1000 times already." :warden "You could try coming up with something creative, chap." :ego "Creative?" :warden "Yeah, like, 'My mother is in the hospital.'" :warden "Or, 'I have a highly contagious case of the lizard-pox.'") :choices actions/previous-choices} "But the whole town will die if I don't do something!" {:run #(actions/respond entities % :warden "The whole town will have a thief on the loose if I don't keep you here." :warden "We don't want that either, do we?" :ego "This is life and death we're talking about here!" :warden "And this is my job. A chap's got to do his job, am I right?" :warden "You've got to steal, and I've got to lock you up." :warden "It's how it works.") :choices actions/previous-choices} "Nevermind." {:run #(actions/respond entities % :warden "This conversation has got me very tired." :warden "Be a good chap and let me rest.")}]})) (defn make [screen] (rooms/make :music :inside-antique :interactions { :lock {:box [178 102 184 124] :script (actions/get-script entities (actions/walk-to entities :ego [174 80] :face :right) (actions/play-animation entities :ego :reach) (actions/talk entities :ego "There's no helping it. It's locked."))} :window {:box [98 110 118 140] :script (actions/get-script entities (actions/walk-to entities :ego [102 88] :face :right) (actions/do-dialogue entities :ego "What a peaceful night." :ego "Oh my sweet Georgia McGorgeous. How will I ever save you now?" :ego "I have to find a way out of here!"))} :hay {:box [130 86 177 102] :script (actions/get-script entities (actions/walk-to entities :ego [144 86] :face :right) (actions/talk entities :ego "Maybe there's a needle or something in here.") (actions/play-animation entities :ego :squat) (actions/talk entities :ego "No. Nothing at all!"))}} :layers [(assoc (texture "inside-jail/background.png") :x 0 :y 0 :baseline 0) (assoc (texture "inside-jail/bars.png") :x 0 :y 0 :baseline 165) (assoc (texture "inside-jail/glow.png") :x 0 :y 0 :baseline 240)] :entities {:warden (assoc (texture "inside-jail/warden.png" ) :x 40 :y 60 :baseline 166 :talk-color (color 0.9 0.3 0.9 1.0) :script (actions/get-script entities (do-warden-dialogue entities))) :ball-n-chain (assoc (texture "inside-jail/ball-n-chain.png") :x 80 :y 80 :baseline 160 :script (actions/get-script entities (actions/walk-to entities :ego [103 83] :face :left) (actions/play-animation entities :ego :squat) (actions/remove-entity entities :ball-n-chain) (actions/give entities :ball-n-chain)))} :collision "inside-jail/collision.png" :scale-fn (utils/scaler-fn-with-baseline 0 0.50 1.5) :start-pos [130 85] :apply-state (fn [entities] (if (actions/has-item? entities :ball-n-chain) (update-in entities [:room :entities] #(dissoc % :ball-n-chain)) entities))))