better ladder dialogue.

This commit is contained in:
2014-12-10 19:48:39 -08:00
parent 65f8b4a828
commit 4283d06728
3 changed files with 34 additions and 17 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -61,7 +61,8 @@
(actions/do-dialogue entities (actions/do-dialogue entities
:ego "Hello." :ego "Hello."
:ladder-guard "'Ello, young sire.") :ladder-guard "'Ello, young sire.")
(actions/present-choices entities {:choices ["Nice ladder." (actions/present-choices entities {:choices [(when (not (actions/has-obtained? entities :ladder))
"Nice ladder.")
{:run #(actions/respond entities % {:run #(actions/respond entities %
:ladder-guard "Tis nice, indeed!" :ladder-guard "Tis nice, indeed!"
:ladder-guard "Belongeth to the Duke of Remington, it doth.") :ladder-guard "Belongeth to the Duke of Remington, it doth.")
@@ -79,7 +80,9 @@
:choices ["Pretty pretty pretty please?" :choices ["Pretty pretty pretty please?"
{:run #(do (actions/respond entities % {:run #(do (actions/respond entities %
:ladder-guard "Well, okay." :ladder-guard "Well, okay."
:ladder-guard "Do not darest telleth a soul, or the Duke will haveth my head!") :ladder-guard "Do not darest telleth a soul, or thou wilst bring my family dishonor!"
:ladder-guard "I will shame the name of my father, Luke, and his father, Puke."
:ladder-guard "Not to mention, the duke will have my head!")
(actions/walk-to entities :ego [245 75] :face :right) (actions/walk-to entities :ego [245 75] :face :right)
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
(actions/remove-entity entities :ladder) (actions/remove-entity entities :ladder)
@@ -95,14 +98,15 @@
"Something else." "Something else."
{:choices actions/something-else}]} {:choices actions/something-else}]}
"Why aren't you sitting and eating?" "Why aren't you sitting and eating?"
{:run #(actions/respond entities % {:run #(do (actions/respond entities % :ladder-guard "I'm on duty, young sire.")
:ladder-guard "I'm oneth duty, young sire." (when (not (actions/has-obtained? :ladder))
:ladder-guard "Dost thou seeth this ladder?" (actions/do-dialogue entities
:ladder-guard "Tis my duty to guardeth it." :ladder-guard "Dost thou seeth this ladder?"
:ladder-guard "Why, if I didst sit and dineth with my friends, a hoodlum wouldst steal it.") :ladder-guard "Tis my duty to guardeth it."
:ladder-guard "Why, if I didst sit and dineth with my friends, a hoodlum wouldst steal it.")))
:choices actions/previous-choices} :choices actions/previous-choices}
"What's your name?" "What's your name?"
{:run #(actions/respond entities % :ladder-guard "Tim.") {:run #(actions/respond entities % :ladder-guard "I am Took, son of Luke, son of Puke.")
:choices actions/previous-choices} :choices actions/previous-choices}
"Goodbye." "Goodbye."
{:run #(actions/respond entities % "Goodbye.")}]}) {:run #(actions/respond entities % "Goodbye.")}]})

View File

@@ -102,6 +102,7 @@
(defn pull-sword [entities] (defn pull-sword [entities]
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
(actions/give entities :sword) (actions/give entities :sword)
(actions/remove-entity entities :sword)
(actions/talk entities :ego "I got it! I will become the greatest knight Remington has ever known!")) (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] (defn try-to-pull-sword [entities missing-items obtained-items]
@@ -153,15 +154,17 @@
(actions/transition-background entities :inside-antique [222 15]))} (actions/transition-background entities :inside-antique [222 15]))}
:sword {:box [0 130 39 165] :sword {:box [0 130 39 165]
:script (actions/get-script entities :script (actions/get-script entities
(actions/talk entities :ego "That's the coolest sword I've ever seen!!") (if (actions/has-item? entities :sword)
(actions/walk-to entities :ego [37 134] :face :left) (actions/talk entities :ego "I already have the Sword of Blergh!")
(actions/talk entities :ego "If I pull it out I can become a great knight!") (do (actions/talk entities :ego "That's the coolest sword I've ever seen!!")
(let [missing-items (set/difference #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items])) (actions/walk-to entities :ego [37 134] :face :left)
obtained-items (set/intersection #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items]))] (actions/talk entities :ego "If I pull it out I can become a great knight!")
(if (= #{} missing-items) (let [missing-items (set/difference #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items]))
(pull-sword entities) obtained-items (set/intersection #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items]))]
(try-to-pull-sword entities missing-items obtained-items)) (if (= #{} missing-items)
))} (pull-sword entities)
(try-to-pull-sword entities missing-items obtained-items)))))
)}
:sign {:box [125 140 165 155] :sign {:box [125 140 165 155]
:script (actions/get-script entities :script (actions/get-script entities
(actions/talk entities :ego "Ye Ol' Antique Shoppe."))} (actions/talk entities :ego "Ye Ol' Antique Shoppe."))}
@@ -191,11 +194,18 @@
(concat p (reverse p)))) (concat p (reverse p))))
:bird-2 (utils/make-bird screen (as-> [[220 225] [195 235] [210 230] [250 225]] p :bird-2 (utils/make-bird screen (as-> [[220 225] [195 235] [210 230] [250 225]] p
(concat p (reverse p)))) (concat p (reverse p))))
:sword (assoc (texture "inside-castle/sword.png")
:x 16
:y 145
:baseline 95)
:trophy (assoc (animation->texture screen trophy) :trophy (assoc (animation->texture screen trophy)
:x 253 :y 69 :baseline 191 :x 253 :y 69 :baseline 191
:anim trophy :anim trophy
:anim-start 0 :anim-start 0
:script (actions/get-script entities :script (actions/get-script entities
(actions/give entities :trophy)
(actions/give entities :certificate)
(actions/give entities :medal)
(walk-to-player entities) (walk-to-player entities)
(if (= nil (get-in @entities [:state :current-riddle])) (if (= nil (get-in @entities [:state :current-riddle]))
(let [{:keys [run choices]} (nice-trophy-dialogue entities)] (let [{:keys [run choices]} (nice-trophy-dialogue entities)]
@@ -251,5 +261,8 @@
(as-> entities entities (as-> entities entities
(if (actions/has-item? entities :trophy) (if (actions/has-item? entities :trophy)
(update-in entities [:room :entities] #(dissoc % :trophy)) (update-in entities [:room :entities] #(dissoc % :trophy))
entities)
(if (actions/has-item? entities :sword)
(update-in entities [:room :entities] #(dissoc % :sword))
entities))) entities)))
:start-pos [245 90]))) :start-pos [245 90])))