Skip to content

Commit 50a837e

Browse files
authored
Merge pull request #8458 from NBKelly/enumerate-cards
Enumerate cards simplified/info management
2 parents 715d676 + 0d0665a commit 50a837e

File tree

18 files changed

+161
-157
lines changed

18 files changed

+161
-157
lines changed

src/clj/game/cards/agendas.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
(resolve-ability state side
186186
{:async true
187187
:prompt (str "The top cards of R&D are (top->bottom): "
188-
(enumerate-str (map get-title choices)))
188+
(enumerate-cards choices))
189189
:choices ["OK"]}
190190
card nil)
191191
(continue-ability state side (abt choices) card nil))))}}}}))
@@ -258,7 +258,7 @@
258258
:effect (req (continue-ability
259259
state side
260260
{:prompt (msg "The top cards of R&D are (top->bottom): "
261-
(enumerate-str (map :title (take 5 (:deck corp)))))
261+
(enumerate-cards (take 5 (:deck corp))))
262262
:choices ["OK"]
263263
:async true
264264
:req (req (not-empty (:deck corp)))
@@ -1726,7 +1726,7 @@
17261726
:msg (msg "force the Runner to trash " (trash-count-str (:card context)) " and take 1 bad publicity")
17271727
:async true
17281728
:effect (req (wait-for (trash-cards state side targets {:cause-card card :cause :forced-to-trash})
1729-
(system-msg state side (str "trashes " (enumerate-str (map :title targets))))
1729+
(system-msg state side (str "trashes " (enumerate-cards targets)))
17301730
(gain-bad-publicity state :corp eid 1)))}}))
17311731

17321732
(defcard "Project Atlas"
@@ -1949,7 +1949,7 @@
19491949

19501950
(defcard "Reeducation"
19511951
(letfn [(corp-final [chosen original]
1952-
{:prompt (str "The bottom cards of R&D will be " (enumerate-str (map :title chosen)))
1952+
{:prompt (str "The bottom cards of R&D will be " (enumerate-cards chosen))
19531953
:choices ["Done" "Start over"]
19541954
:async true
19551955
:msg (req (let [n (count chosen)]
@@ -2499,7 +2499,7 @@
24992499
:req (req (same-card? card (:card context)))
25002500
:msg (msg (if (pos? (count (:deck runner)))
25012501
(str "trash "
2502-
(enumerate-str (map :title (take (adv4? state card) (:deck runner))))
2502+
(enumerate-cards (take (adv4? state card) (:deck runner)))
25032503
" from the stack")
25042504
"trash no cards from the stack (it is empty)"))
25052505
:effect (effect (mill :corp eid :runner (adv4? state card)))}]}))

src/clj/game/cards/assets.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
:prompt (msg "Choose " (quantify (get-counters (get-card state card) :advancement) "program") " to trash")
170170
:choices {:max (req (get-counters (get-card state card) :advancement))
171171
:card (every-pred installed? program?)}
172-
:msg (msg "trash " (enumerate-str (map :title targets)))
172+
:msg (msg "trash " (enumerate-cards targets))
173173
:async true
174174
:effect (effect (trash-cards eid targets {:cause-card card}))}))
175175

@@ -1974,7 +1974,7 @@
19741974
(in-discard? %)
19751975
(not (faceup? %)))
19761976
:max 2}
1977-
:msg (msg "reveal " (enumerate-str (map :title targets)) " from Archives and shuffle them into R&D")
1977+
:msg (msg "reveal " (enumerate-cards targets :sorted) " from Archives and shuffle them into R&D")
19781978
:effect (req (wait-for (reveal state side targets)
19791979
(doseq [c targets]
19801980
(move state side c :deck))
@@ -2083,7 +2083,7 @@
20832083
:msg (msg "shuffle "
20842084
(let [seen (filter :seen targets)
20852085
n (count (filter #(not (:seen %)) targets))]
2086-
(str (enumerate-str (map :title seen))
2086+
(str (enumerate-cards seen :sorted)
20872087
(when (pos? n)
20882088
(str (when-not (empty? seen) " and ")
20892089
(quantify n "card")))))
@@ -2168,7 +2168,7 @@
21682168
:choices {:card #(and (installed? %)
21692169
(runner? %))
21702170
:max (req (get-counters (get-card state card) :advancement))}
2171-
:msg (msg "shuffle " (enumerate-str (map :title targets)) " into the stack")
2171+
:msg (msg "shuffle " (enumerate-cards targets) " into the stack")
21722172
:effect (req (doseq [c targets]
21732173
(move state :runner c :deck {:shuffled true}))
21742174
(shuffle! state :runner :deck)
@@ -2888,7 +2888,7 @@
28882888
:waiting-prompt true
28892889
:req (req (pos? (get-counters (get-card state card) :advancement)))
28902890
:prompt (msg "Choose " (quantify (get-counters (get-card state card) :advancement) "piece") " of hardware to trash")
2891-
:msg (msg "trash " (enumerate-str (map :title targets)))
2891+
:msg (msg "trash " (enumerate-cards targets))
28922892
:choices {:max (req (get-counters (get-card state card) :advancement))
28932893
:card #(and (installed? %)
28942894
(hardware? %))}

src/clj/game/cards/events.clj

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
(move state side c :rfg))
196196
(system-msg state side
197197
(str "removes "
198-
(enumerate-str (map :title top-5))
198+
(enumerate-cards top-5)
199199
" from the game and draws 5 cards"))
200200
(draw state :runner eid 5)))}})
201201

@@ -518,7 +518,7 @@
518518
(defcard "CBI Raid"
519519
(letfn [(cbi-final [chosen original]
520520
{:player :corp
521-
:prompt (str "The top cards of R&D will be " (enumerate-str (map :title chosen)))
521+
:prompt (str "The top cards of R&D will be " (enumerate-cards chosen))
522522
:choices ["Done" "Start over"]
523523
:async true
524524
:effect (req (if (= target "Done")
@@ -624,7 +624,7 @@
624624
(continue-ability
625625
state :runner
626626
{:msg "look at the top 3 cards of R&D"
627-
:prompt (msg "The top cards of R&D are (top->bottom): " (enumerate-str (map :title (take 3 (:deck corp)))))
627+
:prompt (msg "The top cards of R&D are (top->bottom): " (enumerate-cards (take 3 (:deck corp))))
628628
:waiting-prompt true
629629
:choices ["OK"]}
630630
card nil))
@@ -948,13 +948,13 @@
948948
(let [top-8 (sort-by :title (get-set-aside state :corp eid))]
949949
(system-msg state side (str "uses " (get-title card)
950950
" to set aside "
951-
(enumerate-str (map get-title top-8))
951+
(enumerate-cards top-8)
952952
" from the top of R&D"))
953953
(wait-for
954954
(resolve-ability state side
955955
{:async true
956956
:prompt (str "The set aside cards are: "
957-
(enumerate-str (map get-title top-8)))
957+
(enumerate-cards top-8))
958958
:choices ["OK"]}
959959
card nil)
960960
(wait-for
@@ -1075,8 +1075,8 @@
10751075
(if (seq installed-cards)
10761076
(do
10771077
(system-msg state :runner (str "trashes " (quantify (count installed-cards) "card")
1078-
" (" (enumerate-str (map :title installed-cards))
1079-
") at the end of the run from Diana's Hunt"))
1078+
" (" (enumerate-cards installed-cards :sorted)
1079+
") at the end of the run from Diana's Hunt"))
10801080
(trash-cards state :runner eid installed-cards {:unpreventable true
10811081
:cause-card card}))
10821082
(effect-completed state side eid))))}]})
@@ -1194,7 +1194,7 @@
11941194
(do (system-msg
11951195
state side
11961196
(str "uses " (:title card) " to trash "
1197-
(enumerate-str (map :title cards-to-trash))
1197+
(enumerate-cards cards-to-trash :sorted)
11981198
" from HQ and gain "
11991199
credits " [Credits]"))
12001200
(wait-for (trash-cards state :runner (map #(assoc % :seen true) cards-to-trash) {:cause-card card})
@@ -1214,7 +1214,7 @@
12141214
(letfn [(ec [trash-cost to-trash]
12151215
{:async true
12161216
:prompt "Choose a piece of hardware or program to install"
1217-
:msg (msg "trash " (if (empty? to-trash) "no cards" (enumerate-str (map :title to-trash)))
1217+
:msg (msg "trash " (if (empty? to-trash) "no cards" (enumerate-cards to-trash :sorted))
12181218
" and install " (:title target) " from the Stack, "
12191219
" lowering the cost by " trash-cost)
12201220
:choices (req (cancellable (filter #(and (or (program? %)
@@ -1334,7 +1334,7 @@
13341334

13351335
(defcard "Executive Wiretaps"
13361336
{:on-play
1337-
{:msg (msg "reveal " (enumerate-str (sort (map :title (:hand corp)))) " from HQ")
1337+
{:msg (msg "reveal " (enumerate-cards (:hand corp) :sorted) " from HQ")
13381338
:change-in-game-state {:req (req (seq (:hand corp)))}
13391339
:async true
13401340
:effect (effect (reveal eid (:hand corp)))}})
@@ -1542,7 +1542,7 @@
15421542
(effect
15431543
(continue-ability
15441544
(let [top-ten (take 10 (:deck runner))]
1545-
{:prompt (str "The top cards of the stack are (top->bottom): " (enumerate-str (map :title top-ten)))
1545+
{:prompt (str "The top cards of the stack are (top->bottom): " (enumerate-cards top-ten))
15461546
:choices ["OK"]
15471547
:async true
15481548
:effect
@@ -1562,7 +1562,7 @@
15621562
(system-msg state side
15631563
(str "uses " (get-title card)
15641564
" to trash "
1565-
(enumerate-str (map :title cards))
1565+
(enumerate-cards cards)
15661566
" from the top of the stack"))
15671567
(trash-cards state side eid cards {:unpreventable true :cause-card card}))]
15681568
(if (= target "Done")
@@ -1590,7 +1590,7 @@
15901590
:card #(and (program? %)
15911591
(in-hand? %))}
15921592
:change-in-game-state {:req (req (seq (:hand runner)))}
1593-
:msg (msg "trash " (enumerate-str (map :title targets)) " and gain "
1593+
:msg (msg "trash " (enumerate-cards targets :sorted) " and gain "
15941594
(* 2 (count targets)) " [Credits]")
15951595
:async true
15961596
:effect (req (wait-for (trash-cards state side targets {:unpreventable true :cause-card card})
@@ -1624,7 +1624,7 @@
16241624
:msg (msg "move "
16251625
(let [seen (filter :seen targets)
16261626
m (count (remove :seen targets))]
1627-
(str (enumerate-str (map :title seen))
1627+
(str (enumerate-cards seen)
16281628
(when (pos? m)
16291629
(str (when-not (empty? seen) " and ")
16301630
(quantify m "unseen card")))
@@ -1836,7 +1836,7 @@
18361836
:choices {:max 5
18371837
:card #(and (installed? %)
18381838
(runner? %))}
1839-
:msg (msg "trash " (enumerate-str (map :title targets))
1839+
:msg (msg "trash " (enumerate-cards targets)
18401840
" and draw " (quantify (cards-to-draw targets) "card"))
18411841
:async true
18421842
:effect (req (wait-for (trash-cards state side targets {:cause-card card})
@@ -1930,7 +1930,7 @@
19301930
(wait-for (trash-cards state side programs {:unpreventable true
19311931
:cause-card card})
19321932
(system-msg state side (str "reveals "
1933-
(enumerate-str (map :title programs))
1933+
(enumerate-cards programs)
19341934
" from the top of the stack,"
19351935
" trashes them, and gains "
19361936
(count programs) " [Credits]"))
@@ -1981,7 +1981,7 @@
19811981
(resolve-ability state :corp (reorder-choice :corp (take 4 (:deck corp))) card targets)
19821982
(let [top-4 (take 4 (get-in @state [:corp :deck]))]
19831983
(system-msg state :runner (str "reveals "
1984-
(enumerate-str (map :title top-4))
1984+
(enumerate-cards top-4)
19851985
" from the top of R&D (top->bottom)"))
19861986
(reveal state :runner eid top-4))))}})
19871987

@@ -2143,7 +2143,7 @@
21432143
(first async-result)
21442144
" [Credit] and reveals "
21452145
(if revealed
2146-
(str (enumerate-str (map :title revealed))
2146+
(str (enumerate-cards revealed)
21472147
" from the top of R&D (top->bottom)")
21482148
"no cards")))
21492149
(wait-for
@@ -2203,7 +2203,7 @@
22032203
top-n-msg (seq (take mill-count (:deck runner)))]
22042204
(wait-for (mill state :runner :runner mill-count)
22052205
(system-msg state :runner (if top-n-msg
2206-
(str "trashes " (enumerate-str (map :title top-n-msg))
2206+
(str "trashes " (enumerate-cards top-n-msg)
22072207
" from the top of the stack")
22082208
"trashes no cards from the top of the stack"))
22092209
(let [heap-count (min 3 (count (get-in @state [:runner :discard])))]
@@ -2220,7 +2220,7 @@
22202220
(in-discard? %))}
22212221
:effect (req (doseq [c targets]
22222222
(move state side c :deck))
2223-
(system-msg state :runner (str "shuffles " (enumerate-str (map :title targets))
2223+
(system-msg state :runner (str "shuffles " (enumerate-cards targets)
22242224
" from the heap into the stack, and draws 1 card"))
22252225
(shuffle! state :runner :deck)
22262226
(draw state :runner eid 1))}
@@ -2443,7 +2443,7 @@
24432443
(in-hand? %)
24442444
(has-subtype? % type))}
24452445
:prompt (msg "Choose any number of " (decapitalize type) " resources to reveal")
2446-
:msg (msg "reveal " (enumerate-str (map :title (sort-by :title targets))) " from the Grip and gain " (count targets) " [Credits]")
2446+
:msg (msg "reveal " (enumerate-cards targets :sorted) " from the Grip and gain " (count targets) " [Credits]")
24472447
:async true
24482448
:effect (req (wait-for
24492449
(reveal state side targets)
@@ -3247,7 +3247,7 @@
32473247
:show-discard true
32483248
:prompt (str "Choose " (quantify cards-to-move "card")
32493249
" to add from the heap to the grip")
3250-
:msg (msg "add " (enumerate-str (map :title targets))
3250+
:msg (msg "add " (enumerate-cards targets :sorted)
32513251
" from the heap to the grip")
32523252
:choices {:max cards-to-move
32533253
:all true
@@ -3842,7 +3842,7 @@
38423842
(let [trashed-cards async-result]
38433843
(system-msg state side
38443844
(str "uses " (:title card) " to trash "
3845-
(enumerate-str (map :title trashed-cards))
3845+
(enumerate-cards trashed-cards)
38463846
" from the top of the stack"))
38473847
(continue-ability
38483848
state side
@@ -4084,7 +4084,7 @@
40844084
:choices {:req (req (and (corp? target)
40854085
(in-hand? target)))
40864086
:max (req (min 2 (count (:hand corp))))}
4087-
:msg (msg "shuffle " (enumerate-str (map :title targets)) " into R&D")
4087+
:msg (msg "shuffle " (enumerate-cards targets :sorted) " into R&D")
40884088
:effect (req (doseq [t targets]
40894089
(move state :corp t :deck))
40904090
(shuffle! state :corp :deck))})}}})

0 commit comments

Comments
 (0)