more bug fixes.

This commit is contained in:
2014-12-14 12:04:51 -08:00
parent 97e7e433dc
commit 77e7d7f59c
6 changed files with 30 additions and 15 deletions

View File

@@ -35,7 +35,10 @@
((get-in @entities [:state :obtained-items]) item))) ((get-in @entities [:state :obtained-items]) item)))
(defn has-obtained-one-of? [entities items] (defn has-obtained-one-of? [entities items]
(seq (set/intersection (get-in entities [:state :obtained-items]) (set items)))) (some (partial has-obtained? entities) items))
(defn has-obtained-all-of? [entities items]
(every? (partial has-obtained? entities) items))
(defn has-one-of? [entities items] (defn has-one-of? [entities items]
(seq (set/intersection (set (get-in entities [:state :inventory])) (set items)))) (seq (set/intersection (set (get-in entities [:state :inventory])) (set items))))

View File

@@ -37,7 +37,7 @@
{:run #(actions/respond entities % {:run #(actions/respond entities %
:shopkeep "I have no idea what you're talking about, sonny.") :shopkeep "I have no idea what you're talking about, sonny.")
:choices actions/previous-choices} :choices actions/previous-choices}
"Something else" "Something else."
{:choices actions/something-else}]} {:choices actions/something-else}]}
(when (and (get-in @entities [:state :wants-toy]) (when (and (get-in @entities [:state :wants-toy])
(not (get-in @entities [:state :allowed-to-keep-teddy?]))) (not (get-in @entities [:state :allowed-to-keep-teddy?])))

View File

@@ -53,7 +53,7 @@
:warriors "Departeth henceforth and go hitherto, unto the gym.")} :warriors "Departeth henceforth and go hitherto, unto the gym.")}
"I challenge you to a arm wrestling match to prove my strength." "I challenge you to a arm wrestling match to prove my strength."
{:run (fn [msg] {:run (fn [msg]
(actions/respond entities msg :warriors "Prepare thyself, thy task is not for the feint of heart") (actions/respond entities msg :warriors "Prepare thyself, thy task is not for the faint of heart.")
(if (actions/has-item? @entities :flask-1-strength) (if (actions/has-item? @entities :flask-1-strength)
(do (do
(actions/do-dialogue entities :ego "One sec.") (actions/do-dialogue entities :ego "One sec.")

View File

@@ -16,7 +16,8 @@
{:run #(actions/respond entities % {:run #(actions/respond entities %
:game-player "Thanks. I'm the reigning champ in the annual Town of Remington Junior Smarty Pants Derby." :game-player "Thanks. I'm the reigning champ in the annual Town of Remington Junior Smarty Pants Derby."
:game-player "I earned it with my wisdom and sharp intellect." :game-player "I earned it with my wisdom and sharp intellect."
:game-player "Oh, I'm guessing you want it? Perhaps to prove your wisdom and pull the Sword of Blergh?") :game-player "Oh, I'm guessing you want it? Perhaps to prove your wisdom and pull the Sword of Blergh?"
:game-player "Perhaps to become a knight and impress a young lady?")
:choices ["Yes." :choices ["Yes."
{:run #(actions/respond entities % {:run #(actions/respond entities %
:game-player "My trophy is hard-won. You want pry it from my fingers easily." :game-player "My trophy is hard-won. You want pry it from my fingers easily."

View File

@@ -36,18 +36,21 @@
:ego "What's the password?" :ego "What's the password?"
:wizard "That's for me to know.") :wizard "That's for me to know.")
:choices actions/previous-choices} :choices actions/previous-choices}
"Will you help me become a knight?" (when (not (actions/has-obtained-all-of? entities [:trophy :medal :kiss]))
"Will you help me become a knight?")
{:run #(actions/respond entities % {:run #(actions/respond entities %
:wizard "To become a knight you will need to be worthy in courage, wisdom, and might." :wizard "To become a knight you will need to be worthy in courage, wisdom, and might."
:wizard "Only then can you become worthy to pull the Sword of Blergh, and become a knight.") :wizard "Only then can you become worthy to pull the Sword of Blergh, and become a knight.")
:choices ["How can I prove that I'm worthy in wisdom?" :choices [(when (not (actions/has-obtained? entities :trophy))
"How can I prove that I'm worthy in wisdom?")
{:run #(actions/respond entities % {:run #(actions/respond entities %
:wizard "Every year we have the annual Town of Remington Junior Smarty Pants Derby." :wizard "Every year we have the annual Town of Remington Junior Smarty Pants Derby."
:wizard "The whole town gets together to vote on who is the wisest in town, by a game of riddles." :wizard "The whole town gets together to vote on who is the wisest in town, by a game of riddles."
:wizard "Last year's winner was a young man named Stan, in town." :wizard "Last year's winner was a young man named Brian O'Brainy, in town."
:wizard "Maybe you can ask him.") :wizard "Maybe you can ask him.")
:choices actions/previous-choices} :choices actions/previous-choices}
"Can you make some kind of potion to make me strong?" (when (not (actions/has-obtained? entities :medal))
"Can you make some kind of potion to make me strong?")
{:run #(actions/respond entities % {:run #(actions/respond entities %
:wizard "Of course I could." :wizard "Of course I could."
:wizard "I keep all sorts of potion recipes in my MagiSafe 5000." :wizard "I keep all sorts of potion recipes in my MagiSafe 5000."
@@ -55,7 +58,8 @@
:wizard "But that would be cheating wouldn't it?" :wizard "But that would be cheating wouldn't it?"
:wizard "Unfortunately, you're on your own.") :wizard "Unfortunately, you're on your own.")
:choices actions/previous-choices} :choices actions/previous-choices}
"Aren't I already courageous enough?" (when (not (actions/has-obtained? entities :kiss))
"Aren't I already courageous enough?")
{:run #(actions/respond entities % {:run #(actions/respond entities %
:wizard "When was the last time you rescued a damsel in distress?" :wizard "When was the last time you rescued a damsel in distress?"
:ego "Erm..." :ego "Erm..."
@@ -69,6 +73,10 @@
:choices actions/previous-choices} :choices actions/previous-choices}
"Something else." "Something else."
{:choices actions/something-else}]} {:choices actions/something-else}]}
(when (actions/has-obtained-all-of? entities [:trophy :medal :kiss])
"Will you help me become a knight?")
{:run #(actions/respond entities % :wizard "It looks to me as if you are ready to pull the sword, boy!")
:choices actions/previous-choices}
(when (= 3 (get-in @entities [:state :mints-eaten])) (when (= 3 (get-in @entities [:state :mints-eaten]))
"The antique shopkeeper needs more fire mints.") "The antique shopkeeper needs more fire mints.")
{:run #(do (actions/respond entities % {:run #(do (actions/respond entities %

View File

@@ -36,16 +36,19 @@
:wizard "... a frog!" :wizard "... a frog!"
:ego "Okay, okay! I'm leaving.") :ego "Okay, okay! I'm leaving.")
(actions/transition-background entities :outside-house [262 88]) (actions/transition-background entities :outside-house [262 88])
(actions/talk entities :ego "I guess he's really upset with me."))} (actions/do-dialogue entities :ego "I guess he's really upset with me."
:ego "I wonder if I can convince him to like me..."))}
"You're still cross about my stealing your magic cowboy hat?" "You're still cross about my stealing your magic cowboy hat?"
{:run #(do (actions/respond entities % {:run #(do (actions/respond entities %
:wizard "Of course I'm cross! It's irreplaceable!" :wizard "Of course I'm cross! It's irreplaceable!"
:wizard "That cowboy hat accented my facial physique." :wizard "That cowboy hat accented my facial physique."
:wizard "And complemented my skin color." :wizard "And complemented my skin color."
:wizard "And you little cheat stole it from me!" :wizard "And you little pipsqueak stole it from me!"
:wizard "That's why I bought my MagiSafe 5000, to keep out intruders like you." :wizard "That's why I bought my Magi-Safe 5000, to keep out intruders like you."
:wizard "Now leave.") :wizard "Now leave, before I get really angry!.")
(actions/transition-background entities :outside-house [262 88]))} (actions/transition-background entities :outside-house [262 88])
(actions/do-dialogue entities :ego "I guess he's really upset with me."
:ego "I wonder if I can convince him to like me..."))}
"Even an old hoot like you needs a kick in the pants every now and again." "Even an old hoot like you needs a kick in the pants every now and again."
{:run #(actions/respond entities % :wizard "What gives you the right to try to teach me a lesson?") {:run #(actions/respond entities % :wizard "What gives you the right to try to teach me a lesson?")
:choices ["My good looks?" :choices ["My good looks?"
@@ -65,7 +68,7 @@
"I'm going to be a knight! That counts for something doesn't it?" "I'm going to be a knight! That counts for something doesn't it?"
{:run #(do (actions/respond entities % {:run #(do (actions/respond entities %
:wizard "You are, are you?" :wizard "You are, are you?"
:wizard "Pray tell, how do you, a mere wreckless youth, plan on becoming a knight?")) :wizard "Pray tell, how do you, a mere reckless youth, plan on becoming a knight?"))
:choices ["By pulling the Sword of Blergh from its stone!" :choices ["By pulling the Sword of Blergh from its stone!"
{:run #(actions/respond entities % {:run #(actions/respond entities %
:wizard "Well, well. It sounds like you've turned over a new leaf." :wizard "Well, well. It sounds like you've turned over a new leaf."