Skip to content

Commit

Permalink
checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
garbados committed Nov 16, 2023
1 parent c872838 commit e88ab33
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 59 deletions.
File renamed without changes.
38 changes: 36 additions & 2 deletions src/the_longtime_game/meta_text.cljc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns the-longtime-game.meta-text
(:require [clojure.string :as string]
[the-longtime-game.text :as text]))
[the-longtime-game.core :as core]
[the-longtime-game.text :as text]))

(def intro-text
(text/join-text
Expand Down Expand Up @@ -135,4 +136,37 @@
Rimworld, Kitten Game, Frostpunk, Dwarf Fortress, and Stellaris,
but especial thanks go to my partner Lucia Brody
for developing with me the whole universe of *The Shepherd*,
of which Minots are only a part.")]))
of which Minots are only a part.")]))

(def syndicate-remarks
{:athletics
["rigorous exertion"
"strenuous feats"]
:craftwork
["strange inventions"
"curious designs"]
:geology
["beautiful stonework"
"earthen foresight"]
:herbalism
["advanced greenlore"
"keen pathfinding"]
:medicine
["enlightening panaceas"
"gourmet dining"]
:organizing
["meticulous planning"
"historical consideration"]})

(defn announce-syndicate [syndicate]
(let [remarks (map syndicate-remarks syndicate)
[r1 r2] (map rand-nth remarks)]
(text/join-text
"Record-keepers and rhetoricians rejoice!"
"Enthusiasts have joined together in debate and duel."
"They bicker and bother, sussing with susurrus"
"the finer points of some greater ethos."
(str "Through " r1 " and " r2 ",")
"a potent consensus emerges,"
"a bright and capable vision!"
(str "So is founded " (core/syndicate-name syndicate) "."))))
39 changes: 6 additions & 33 deletions src/the_longtime_game/repl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
[the-longtime-game.project :as project]
[the-longtime-game.remark :as remark]
[the-longtime-game.text :refer [join-text match-prefix quote-text
wrap-options wrap-quote-text]]))
wrap-options wrap-quote-text]]
[the-longtime-game.meta-text :as meta-text]))

(defn exit-game [& _] (System/exit 0))

Expand Down Expand Up @@ -438,41 +439,13 @@
(println (quote-text "The herd rushes unfettered across the steppe.")))
(await-confirmation herd)))

(def syndicate-remarks
{:athletics
["rigorous exertion"
"strenuous feats"]
:craftwork
["strange inventions"
"curious designs"]
:geology
["beautiful stonework"
"earthen foresight"]
:herbalism
["advanced greenlore"
"keen pathfinding"]
:medicine
["enlightening panaceas"
"gourmet dining"]
:organizing
["meticulous planning"
"historical consideration"]})


(defn announce-new-syndicate
[candidate]
(let [remarks (map syndicate-remarks candidate)
[r1 r2] (map rand-nth remarks)]
(println
(wrap-quote-text
(join-text
"Record-keepers and rhetoricians rejoice!"
"Enthusiasts have joined together in debate and duel."
"They bicker and bother, sussing with susurrus"
"the finer points of some greater ethos."
(str "Through " r1 " and " r2 ",")
"a potent consensus emerges,"
"a bright and capable vision!"
(str "So is founded " (core/syndicate-name candidate) "."))))))
(println
(wrap-quote-text
(meta-text/announce-syndicate candidate))))

(defn maybe-add-syndicate
[herd]
Expand Down
67 changes: 43 additions & 24 deletions src/the_longtime_game/web.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[clojure.string :as string]
[reagent.core :as r]
[reagent.dom :as rd]
[the-longtime-game.contact-text :as contact-text]
[the-longtime-game.core :as core]
[the-longtime-game.dream :as dream]
[the-longtime-game.event :as event]
Expand Down Expand Up @@ -417,9 +418,6 @@
^{:key (:terrain location)}
(print-location location))]]))])

#_(defn- apply-upkeep []
(swap! herd core/apply-herd-upkeep))

(defn- handle-event []
(let [herd* (core/begin-month @herd)
location (core/current-location herd*)
Expand Down Expand Up @@ -479,32 +477,53 @@
{:on-click #(enact-project proj)}
name]])])))

(defn- handle-dream-choices [choice choices]
)

(defn- handle-dream []
(let [herd* @herd
dream (dream/pick-dream herd*)
[choices text-fn post-text-fn effect]
(dream/marshal-dream herd* dream)
choice (r/atom nil)
blurb (text-fn)]
(defn- handle-dream [choice]
(if-let [dream (and (zero? (rand-int 3))
(dream/pick-dream @herd))]
(let [[options text-fn post-text-fn effect]
(dream/marshal-dream @herd dream)
blurb (text-fn)]
[:div.box>div.content
[:h3 "A dreamer visits you..."]
[:p blurb]
(when (and (nil? @choice)
(seq options))
[:p [:strong "How do you counsel?"]]
(for [option options]
^{:key option}
[:button.button.is-fullwidth.is-primary.is-light
{:on-click #(reset! choice option)}
(text/normalize-name option)]))
(when (or (some? @choice) (nil? (seq options)))
(when-let [post-blurb (post-text-fn @choice)]
[:p post-blurb])
[:button.button.is-fullwidth.is-primary
{:on-click #(do (reset! herd (effect))
(reset! monthstep :upkeep))}
"The dreamer returns to their rest..."])])
(reset! monthstep :upkeep)))

(defn- handle-upkeep []
(let [herd* @herd]
[:div.box>div.content
[:h3 "A dreamer visits you..."]
(if (seq choices)
[handle-dream-choices choice choices]
)]
))

[:h3 "End of the month"]
(when-let [contact (and (core/new-contact? herd*)
(core/get-next-contact herd*))]
(swap! herd update :contacts conj contact)
[:p (contact-text/contact->blurb contact)])
(when (core/should-add-syndicate? herd*)
(let [votes (core/tally-votes (:individuals herd*))
candidates (core/rank-candidates votes)]
(when-let [candidate (core/select-candidate (:syndicates herd*) candidates)]
(swap! herd update :syndicates conj candidate)
[:p (meta-text/announce-syndicate candidate)])))]))

(defn- playing []
(case @monthstep
:event [handle-event]
:event [handle-event]
:projects [handle-projects]
:dream
[:p "TODO"]
:upkeep
[:p "TODO"]))
:dream [handle-dream (r/atom nil)]
:upkeep [:p "TODO"]))

(defn- app []
[:section.section
Expand Down

0 comments on commit e88ab33

Please sign in to comment.