adding more detail.

This commit is contained in:
2014-12-10 18:05:35 -08:00
parent 04bac2afb9
commit e7c2acead2
5 changed files with 94 additions and 41 deletions

View File

@@ -4,6 +4,8 @@
[advent.screens.items :as items]
[advent.utils :as utils]
[clojure.zip :as zip]
[clojure.set :as set]
[clojure.string :as str]
[play-clj.core :refer :all]
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
@@ -26,8 +28,7 @@
(defn nice-trophy-dialogue [entities]
{: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."
:game-player "Thanks. I'm the reigning champ in the annual Town of Remington Junior Smarty Pants Derby."
:game-player "And with my sharp intellect, I'm guessing you want my trophy?")
:choices ["Yes."
{:run #(do (actions/update-state entities (fn [state] (assoc state :current-riddle :wool)))
@@ -41,8 +42,7 @@
:ego "Okay."))}
"No."
{:run #(actions/respond entities %
:game-player "That's exactly what I'd expect a dummy like you to say.")
}]})
:game-player "That's exactly what I'd expect a dummy like you to say.")}]})
(defn walk-to-player [entities]
(actions/walk-to entities :ego [210 73] :face :right))
@@ -55,16 +55,19 @@
{:run #(actions/respond entities %
:game-player "It is said that only he who is worthy in wisdom can pull the sword!"
:game-player "I, of course have such wisdom, but I'm still unable to pull it myself.")
:choices ["Can you teach me your ways?"
:choices ["How'd you get to be so wise?"
{:run #(actions/respond entities %
:game-player "Ha! My intellect has only been achieved with years of precise training!"
:game-player "You're out of luck, friend. Unless you are willing to spend hours and hours in careful study, you will always be a dunce."
:ego "...")
:game-player "Ever heard of the annual Town of Remington Junior Smarty Pants Derby?"
:ego "I don't think so..."
:game-player "I'm the three times town champ!"
:game-player "My intellect has only been achieved with years of precise training!"
:ego "..."
:game-player "It would take years of careful honing of your skills to be as wise as I am.")
:choices actions/previous-choices}
"How come?"
"Why don't you pull the sword?"
{:run #(actions/respond entities %
:game-player "You must be mighty in strength to pull the sword."
:game-player "And I spend all of my time either playing my game, or at the library.")
:game-player "And I spend all my time studying!")
:choices actions/previous-choices}
"Something else."
{:choices actions/something-else}]}
@@ -95,6 +98,32 @@
"Nevermind."
{:run #(actions/respond entities % :game-player "See you around.")}]}))
(defn pull-sword [entities]
(actions/play-animation entities :ego :reach)
(actions/talk entities :ego "I got it! I will become the greatest knight Remington has ever known!"))
(defn try-to-pull-sword [entities missing-items obtained-items]
(actions/give entities :certificate)
(actions/give entities :medal)
(let [item->proof {:trophy "wisdom" :medal "strength" :certificate "courage"}]
(actions/play-animation entities :ego :reach)
(actions/do-dialogue entities
:ego "I can't pull it out!"
:ego "It looks like there's an enscription here.")
(actions/play-animation entities :ego :squat)
(actions/do-dialogue entities
:ego "The Sword of Blergh with magic sting,"
:ego "shall yield to no earthly king."
:ego "Worthy in wisdom, courage, and might,"
:ego "only then with sword he'll fight.")
(if (= 3 (count missing-items))
(actions/do-dialogue entities :ego "I have to prove myself worthy in wisdom, courage, and might!")
(actions/do-dialogue entities :ego (str "I've proven myself in "
(str/join " and " (map item->proof obtained-items))
", but still have to prove myself in "
(str/join " and " (map item->proof missing-items))
".")))))
(defn make [screen]
(let [game-player-talk-sheet (texture! (texture "inside-castle/game-player-talk.png") :split 40 44)
game-player-talk (animation 0.15 (for [i [0 2 0 2 0 2 0 3 0 2 0 1 0 0 0 0 2 0 2 0 3 0 1 0 1 0 0 1 0 2 0 3 0]]
@@ -127,20 +156,35 @@
:script (actions/get-script entities
(actions/talk entities :ego "That's the coolest sword I've ever seen!!")
(actions/walk-to entities :ego [37 134] :face :left)
(actions/talk entities :ego "Maybe I can pull it out.")
(actions/play-animation entities :ego :reach)
(actions/do-dialogue entities
:ego "I can't pull it out!"
:ego "It looks like there's an enscription here.")
(actions/play-animation entities :ego :squat)
(actions/do-dialogue entities
:ego "The Sword of Blergh with magic sting,"
:ego "shall yield to no earthly king."
:ego "Worthy in wisdom, courage, and might,"
:ego "only then with sword he'll fight."))}
(actions/talk entities :ego "If I pull it out I can become a great knight!")
(let [missing-items (set/difference #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items]))
obtained-items (set/intersection #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items]))]
(if (= #{} missing-items)
(pull-sword entities)
(try-to-pull-sword entities missing-items obtained-items))
))}
:sign {:box [125 140 165 155]
:script (actions/get-script entities
(actions/talk entities :ego "Ye Ol' Antique Shoppe."))}}
(actions/talk entities :ego "Ye Ol' Antique Shoppe."))}
:background-houses {:box [84 145 126 180]
:script (actions/get-script entities
(actions/walk-to entities :ego [79 145] :face :right)
(actions/talk entities :ego "Those are just a bunch of townsfolk houses."))}
:mid-house {:box [217 125 250 180]
:script (actions/get-script entities
(actions/do-dialogue entities
:ego "That's Billy Billigan's house."
:ego "He's probably still angry from when I put his dog in the dryer."))}
:frankie-house {:box [251 140 266 160]
:script (actions/get-script entities
(actions/do-dialogue entities
:ego "That's Frankie Rockfist's house."
:ego "The last time I saw him, he socked me one, right in the kisser."))}
:georgia-house {:box [271 150 286 170]
:script (actions/get-script entities
(actions/do-dialogue entities
:ego "That's Georgia McGorgeous' house."
:ego "One day, when I'm a knight, I'll ask her to be my girlfriend."))}}
:layers [(assoc (texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-castle/pedestal-overlay.png") :x 0 :y 0 :baseline 135)]
:entities {:bird-1 (utils/make-bird screen (as-> [[185 235]
@@ -194,7 +238,10 @@
:game-player "You have earned my trophy.")
(actions/give entities :trophy)
(actions/remove-entity entities :trophy))
(actions/talk entities :ego "He doesn't need it.")))}
(actions/talk entities :ego "He doesn't need it.")))
:trophy (actions/get-script entities
(walk-to-player entities)
(actions/talk entities :game-player "You can keep the trophy. You've earned it."))}
:anim game-player-stand
:anim-start 0
:stand game-player-stand