Skip to content

Commit ee70f98

Browse files
authored
Merge pull request #7933 from NBKelly/rewrite-grammar-properly
Rewrite grammar properly
2 parents 30249af + 1dd7327 commit ee70f98

File tree

14 files changed

+348
-227
lines changed

14 files changed

+348
-227
lines changed

src/clj/game/cards/assets.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@
304304

305305
(defcard "B-1001"
306306
{:abilities [{:req (req (not this-server))
307+
:async true
307308
:cost [(->c :tag 1)]
308309
:msg "end the run"
309310
:label "End the run on another server"

src/clj/game/cards/hardware.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,7 @@
12531253

12541254
(defcard "Lemuria Codecracker"
12551255
{:abilities [{:action true
1256+
:async true
12561257
:cost [(->c :click 1) (->c :credit 1)]
12571258
:req (req (some #{:hq} (:successful-run runner-reg)))
12581259
:choices {:card installed?}

src/clj/game/cards/ice.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,7 @@
12411241

12421242
(defcard "Clairvoyant Monitor"
12431243
{:subroutines [(do-psi {:label "Place 1 advancement token and end the run"
1244+
:async true
12441245
:player :corp
12451246
:prompt "Choose an installed card to place 1 advancement token on"
12461247
:msg (msg "place 1 advancement token on "

src/clj/game/cards/operations.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,7 @@
16321632
(has-subtype? % "Connection")
16331633
(installed? %))}
16341634
:msg (msg "host itself on " (card-str state target) ". The Runner has an additional tag")
1635+
:async true
16351636
:effect (effect (install-as-condition-counter eid card target))}
16361637
:static-abilities [{:type :tags
16371638
:value 1}]

src/clj/game/cards/programs.clj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,6 @@
20812081
:once :per-turn
20822082
:cost [(->c :x-credits)]
20832083
:req (req (:runner-phase-12 @state))
2084-
:async true
20852084
:effect (effect (add-counter card :power (cost-value eid :x-credits)))
20862085
:msg (msg "place " (quantify (cost-value eid :x-credits) "power counter") " on itself")}
20872086
(break-sub [(->c :power 1)] 1)

src/clj/game/cards/upgrades.clj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
{:events [{:event :pass-all-ice
398398
:psi {:req (req this-server)
399399
:not-equal {:msg "end the run"
400+
:async true
400401
:effect (effect (end-run eid card))}}}]})
401402

402403
(defcard "Cayambe Grid"
@@ -493,8 +494,7 @@
493494
:effect (effect (add-counter card :power 1))}]})
494495

495496
(defcard "Corporate Troubleshooter"
496-
{:abilities [{:async true
497-
:label "Add strength to a rezzed piece of ice protecting this server"
497+
{:abilities [{:label "Add strength to a rezzed piece of ice protecting this server"
498498
:cost [(->c :trash-can) (->c :x-credits)]
499499
:choices {:all true
500500
:req (req (and (ice? target)
@@ -678,6 +678,7 @@
678678
etr {:req (req this-server)
679679
:cost [(->c :power 1)]
680680
:msg "end the run"
681+
:async true
681682
:effect (effect (end-run eid card))}]
682683
{:derezzed-events [(assoc corp-rez-toast :event :runner-turn-ends)]
683684
:events [(assoc maybe-gain-counter :event :corp-turn-begins)
@@ -1707,6 +1708,7 @@
17071708
:choices {:req (req (same-server? card target))}
17081709
:msg (msg "place " (if (is-boosted-fn? state side) 3 2) " advancement counters on "
17091710
(card-str state target))
1711+
:async true
17101712
:effect
17111713
(req (let [n (if (is-boosted-fn? state side) 3 2)]
17121714
(add-prop state side eid target :advance-counter n {:placed true})))}]
@@ -1752,7 +1754,7 @@
17521754
{:async true
17531755
:msg "do 1 core damage instead of net damage"
17541756
:effect (req (swap! state update :damage dissoc :damage-replace :defer-damage)
1755-
(wait-for (pay state :corp (make-eid state eid) card (->c :credit 2))
1757+
(wait-for (pay state :corp card (->c :credit 2))
17561758
(system-msg state side (:msg async-result))
17571759
(wait-for (damage state side :brain 1 {:card card})
17581760
(swap! state assoc-in [:damage :damage-replace] true)

src/clj/game/core/commands.clj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@
324324
(or (installed? target)
325325
(in-hand? target))))}
326326
:msg (msg "score " (card-str state target {:visible true}) ", ignoring all restrictions")
327+
:async true
327328
:effect (effect (score eid target {:no-req true :ignore-turn true}))}
328329
(make-card {:title "the '/score' command"}) nil)))
329330

@@ -408,6 +409,7 @@
408409
state side
409410
{:prompt "Choose a card to trash"
410411
:choices {:card #(f %)}
412+
:async true
411413
:effect (effect (trash eid target {:unpreventable true}))}
412414
nil nil)))
413415

src/clj/game/core/costs.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,7 @@
10001000
:choices {:card #(and (agenda? %)
10011001
(is-scored? state side %)
10021002
(pos? (get-counters % :agenda)))}
1003+
:async true
10031004
:effect (req (let [title (:title target)
10041005
target (update! state side (update-in target [:counter :agenda] - (value cost)))]
10051006
(wait-for (trigger-event-sync state side :agenda-counter-spent target)

src/clj/game/core/pick_counters.clj

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@
111111
pay-function (if (= :custom pay-credits-type)
112112
(-> target card-def :interactions :pay-credits :custom)
113113
(take-counters-of-type pay-credits-type))
114-
custom-ability {:async true
115-
:effect pay-function}
114+
custom-ability ^:ignore-async-check {:async true
115+
:effect pay-function}
116116
neweid (make-eid state outereid)
117117
providing-card target]
118118
(wait-for (resolve-ability state side neweid custom-ability providing-card [card])
@@ -141,59 +141,59 @@
141141
pay-rest (req
142142
(if (and (<= (- target-count counter-count) (get-in @state [side :credit]))
143143
(<= stealth-target stealth-count))
144-
(let [remainder (max 0 (- target-count counter-count))
145-
remainder-str (when (pos? remainder)
146-
(str remainder " [Credits]"))
147-
card-strs (when (pos? (count selected-cards))
148-
(str (enumerate-str (map #(let [{:keys [card number]} %
149-
title (:title card)]
150-
(str number " [Credits] from " title))
151-
(vals selected-cards)))))
152-
message (str card-strs
153-
(when (and card-strs remainder-str)
154-
" and ")
155-
remainder-str
156-
(when (and card-strs remainder-str)
157-
" from [their] credit pool"))]
158-
(lose state side :credit remainder)
159-
(let [cards (->> (vals selected-cards)
160-
(map :card)
161-
(remove #(-> (card-def %) :interactions :pay-credits :cost-reduction)))]
162-
(wait-for (trigger-spend-credits-from-cards state side cards)
163-
; Now we trigger all of the :counter-added events we'd neglected previously
164-
(pick-counter-triggers state side eid selected-cards selected-cards target-count message))))
165-
(continue-ability
166-
state side
167-
(pick-credit-providing-cards provider-func eid target-count stealth-target selected-cards)
168-
card nil)))]
144+
(let [remainder (max 0 (- target-count counter-count))
145+
remainder-str (when (pos? remainder)
146+
(str remainder " [Credits]"))
147+
card-strs (when (pos? (count selected-cards))
148+
(str (enumerate-str (map #(let [{:keys [card number]} %
149+
title (:title card)]
150+
(str number " [Credits] from " title))
151+
(vals selected-cards)))))
152+
message (str card-strs
153+
(when (and card-strs remainder-str)
154+
" and ")
155+
remainder-str
156+
(when (and card-strs remainder-str)
157+
" from [their] credit pool"))]
158+
(lose state side :credit remainder)
159+
(let [cards (->> (vals selected-cards)
160+
(map :card)
161+
(remove #(-> (card-def %) :interactions :pay-credits :cost-reduction)))]
162+
(wait-for (trigger-spend-credits-from-cards state side cards)
163+
; Now we trigger all of the :counter-added events we'd neglected previously
164+
(pick-counter-triggers state side eid selected-cards selected-cards target-count message))))
165+
(continue-ability
166+
state side
167+
(pick-credit-providing-cards provider-func eid target-count stealth-target selected-cards)
168+
card nil)))]
169169
(if (or (not (pos? target-count)) ; there is a limit
170170
(<= target-count counter-count) ; paid everything
171171
(zero? (count provider-cards))) ; no more additional credit sources found
172-
{:async true
173-
:effect pay-rest}
174-
{:async true
175-
:prompt (str "Choose a credit providing card ("
176-
counter-count (when (and target-count (pos? target-count))
177-
(str " of " target-count))
178-
" [Credits]"
179-
(if (pos? stealth-target)
180-
(str ", " (min stealth-count stealth-target) " of " stealth-target " stealth")
181-
"")
182-
")")
183-
:choices {:card #(in-coll? (map :cid provider-cards) (:cid %))}
184-
:effect (req (let [pay-credits-type (-> target card-def :interactions :pay-credits :type)
185-
pay-function (if (= :custom pay-credits-type)
186-
(-> target card-def :interactions :pay-credits :custom)
187-
(take-counters-of-type pay-credits-type))
188-
custom-ability {:async true
189-
:effect pay-function}
190-
neweid (make-eid state outereid)
191-
providing-card target]
192-
(wait-for (resolve-ability state side neweid custom-ability providing-card [card])
193-
(continue-ability state side
194-
(pick-credit-providing-cards
195-
provider-func eid target-count stealth-target
196-
(update selected-cards (:cid providing-card)
197-
#(assoc % :card providing-card :number (+ (:number % 0) async-result))))
198-
card targets))))
199-
:cancel-effect pay-rest}))))
172+
{:async true
173+
:effect pay-rest}
174+
{:async true
175+
:prompt (str "Choose a credit providing card ("
176+
counter-count (when (and target-count (pos? target-count))
177+
(str " of " target-count))
178+
" [Credits]"
179+
(if (pos? stealth-target)
180+
(str ", " (min stealth-count stealth-target) " of " stealth-target " stealth")
181+
"")
182+
")")
183+
:choices {:card #(in-coll? (map :cid provider-cards) (:cid %))}
184+
:effect (req (let [pay-credits-type (-> target card-def :interactions :pay-credits :type)
185+
pay-function (if (= :custom pay-credits-type)
186+
(-> target card-def :interactions :pay-credits :custom)
187+
(take-counters-of-type pay-credits-type))
188+
custom-ability ^:ignore-async-check {:async true
189+
:effect pay-function}
190+
neweid (make-eid state outereid)
191+
providing-card target]
192+
(wait-for (resolve-ability state side neweid custom-ability providing-card [card])
193+
(continue-ability state side
194+
(pick-credit-providing-cards
195+
provider-func eid target-count stealth-target
196+
(update selected-cards (:cid providing-card)
197+
#(assoc % :card providing-card :number (+ (:number % 0) async-result))))
198+
card targets))))
199+
:cancel-effect pay-rest}))))

src/clj/game/core/prompts.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
{:keys [waiting-prompt prompt-type show-discard cancel-effect end-effect targets]}]
2929
(let [prompt (if (string? message) message (message state side eid card targets))
3030
choices (choice-parser choices)
31-
newitem {:eid eid
31+
newitem ^:ignore-async-check
32+
{:eid eid
3233
:msg prompt
3334
:choices choices
3435
:effect f

0 commit comments

Comments
 (0)