|
6 | 6 | [game.core.card-defs :refer [card-def]] |
7 | 7 | [game.core.damage :refer [damage]] |
8 | 8 | [game.core.eid :refer [complete-with-result make-eid]] |
9 | | - [game.core.engine :refer [checkpoint queue-event resolve-ability trigger-event-sync]] |
| 9 | + [game.core.engine :refer [checkpoint queue-event resolve-ability]] |
10 | 10 | [game.core.effects :refer [any-effects is-disabled-reg?]] |
11 | 11 | [game.core.flags :refer [is-scored?]] |
12 | 12 | [game.core.gaining :refer [deduct lose]] |
13 | 13 | [game.core.moving :refer [discard-from-hand flip-facedown forfeit mill move trash trash-cards]] |
14 | 14 | [game.core.payment :refer [handler label payable? value stealth-value]] |
15 | 15 | [game.core.pick-counters :refer [pick-credit-providing-cards pick-credit-reducers pick-virus-counters-to-spend]] |
16 | 16 | [game.core.props :refer [add-counter add-prop]] |
17 | | - [game.core.revealing :refer [reveal]] |
| 17 | + [game.core.revealing :refer [reveal reveal-and-queue-event]] |
18 | 18 | [game.core.rezzing :refer [derez]] |
19 | 19 | [game.core.shuffling :refer [shuffle!]] |
20 | 20 | [game.core.tags :refer [lose-tags gain-tags]] |
|
227 | 227 | (in-hand? (get-card state card))) |
228 | 228 | (defmethod handler :expend |
229 | 229 | [cost state side eid card] |
230 | | - (wait-for (reveal state :corp (make-eid state eid) [card]) |
231 | | - (wait-for (trash state :corp (make-eid state eid) |
232 | | - (assoc (get-card state card) :seen true)) |
233 | | - (complete-with-result state side eid |
234 | | - {:paid/msg (str "trashes " (:title card) " from HQ") |
235 | | - :paid/type :expend |
236 | | - :paid/value 1 |
237 | | - :paid/targets [card]})))) |
| 230 | + (reveal-and-queue-event state side [card]) |
| 231 | + (wait-for (trash state :corp (make-eid state eid) |
| 232 | + (assoc (get-card state card) :seen true) {:cause :ability-cost |
| 233 | + :unpreventable true |
| 234 | + :suppress-checkpoint true}) |
| 235 | + (complete-with-result state side eid |
| 236 | + {:paid/msg (str "trashes " (:title card) " from HQ") |
| 237 | + :paid/type :expend |
| 238 | + :paid/value 1 |
| 239 | + :paid/targets [card]}))) |
238 | 240 |
|
239 | 241 | ;; Trash |
240 | 242 | (defmethod value :trash-can [cost] (:cost/amount cost)) |
|
246 | 248 | (defmethod handler :trash-can |
247 | 249 | [cost state side eid card] |
248 | 250 | (wait-for (trash state side card {:cause :ability-cost |
249 | | - :unpreventable true}) |
| 251 | + :unpreventable true |
| 252 | + :suppress-checkpoint true}) |
250 | 253 | (complete-with-result state side eid {:paid/msg (str "trashes " (:title card)) |
251 | 254 | :paid/type :trash-can |
252 | 255 | :paid/value 1 |
|
274 | 277 | ;; everything is queued, then we perform the actual checkpoint. |
275 | 278 | (forfeit state side (make-eid state eid) agenda {:msg false |
276 | 279 | :suppress-checkpoint true})) |
277 | | - (wait-for (checkpoint state nil (make-eid state eid) {:durations [:game-trash]}) |
278 | | - (complete-with-result |
279 | | - state side eid |
280 | | - {:paid/msg (str "forfeits " (quantify (value cost) "agenda") |
281 | | - " (" (enumerate-str (map :title targets)) ")") |
282 | | - :paid/type :forfeit |
283 | | - :paid/value (value cost) |
284 | | - :paid/targets targets})))} |
| 280 | + (complete-with-result |
| 281 | + state side eid |
| 282 | + {:paid/msg (str "forfeits " (quantify (value cost) "agenda") |
| 283 | + " (" (enumerate-str (map :title targets)) ")") |
| 284 | + :paid/type :forfeit |
| 285 | + :paid/value (value cost) |
| 286 | + :paid/targets targets}))} |
285 | 287 | card nil)) |
286 | 288 |
|
287 | 289 | ;; ForfeitSelf |
|
292 | 294 | (is-scored? state side (get-card state card))) |
293 | 295 | (defmethod handler :forfeit-self |
294 | 296 | [_cost state side eid card] |
295 | | - (wait-for (forfeit state side (make-eid state eid) card {:msg false}) |
| 297 | + (wait-for (forfeit state side (make-eid state eid) card {:msg false |
| 298 | + :suppress-checkpoint true}) |
296 | 299 | (complete-with-result |
297 | 300 | state side eid |
298 | 301 | {:paid/msg (str "forfeits " (:title card)) |
299 | 302 | :paid/type :forfeit-self |
300 | 303 | :paid/value 1 |
301 | 304 | :paid/targets [card]}))) |
302 | 305 |
|
303 | | - |
304 | 306 | ;; Gain tag |
305 | 307 | (defmethod value :gain-tag [cost] (:cost/amount cost)) |
306 | 308 | (defmethod label :gain-tag [cost] (str "take " (quantify (value cost) "tag"))) |
|
311 | 313 | true) |
312 | 314 | (defmethod handler :gain-tag |
313 | 315 | [cost state side eid card] |
314 | | - (wait-for (gain-tags state side (value cost)) |
| 316 | + (wait-for (gain-tags state side (value cost) {:suppress-checkpoint true}) |
315 | 317 | (complete-with-result state side eid {:paid/msg (str "takes " (quantify (value cost) "tag")) |
316 | 318 | :paid/type :gain-tag |
317 | 319 | :paid/value (value cost)}))) |
|
324 | 326 | (<= 0 (- (get-in @state [:runner :tag :base] 0) (value cost)))) |
325 | 327 | (defmethod handler :tag |
326 | 328 | [cost state side eid card] |
327 | | - (wait-for (lose-tags state side (value cost)) |
| 329 | + (wait-for (lose-tags state side (value cost) {:suppress-checkpoint true}) |
328 | 330 | (complete-with-result state side eid {:paid/msg (str "removes " (quantify (value cost) "tag")) |
329 | 331 | :paid/type :tag |
330 | 332 | :paid/value (value cost)}))) |
|
338 | 340 | (defmethod handler :tag-or-bad-pub |
339 | 341 | [cost state side eid card] |
340 | 342 | (if-not (<= 0 (- (get-in @state [:runner :tag :base] 0) (value cost))) |
341 | | - (wait-for (gain-bad-publicity state side (make-eid state eid) (value cost) nil) |
| 343 | + (wait-for (gain-bad-publicity state side (make-eid state eid) (value cost) {:suppress-checkpoint true}) |
342 | 344 | (complete-with-result state side eid {:paid/msg (str "gains " (value cost) " bad publicity") |
343 | 345 | :paid/type :tag-or-bad-pub |
344 | 346 | :paid/value (value cost)})) |
|
349 | 351 | (str "Gain " (value cost) " bad publicity")] |
350 | 352 | :async true |
351 | 353 | :effect (req (if (= target (str "Gain " (value cost) " bad publicity")) |
352 | | - (wait-for (gain-bad-publicity state side (make-eid state eid) (value cost) nil) |
| 354 | + (wait-for (gain-bad-publicity state side (make-eid state eid) (value cost) {:suppress-checkpoint true}) |
353 | 355 | (complete-with-result state side eid {:paid/msg (str "gains " (value cost) " bad publicity") |
354 | 356 | :paid/type :tag-or-bad-pub |
355 | 357 | :paid/value (value cost)})) |
356 | | - (wait-for (lose-tags state side (value cost)) |
| 358 | + (wait-for (lose-tags state side (value cost) {:suppress-checkpoint true}) |
357 | 359 | (complete-with-result state side eid {:paid/msg (str "removes " (quantify (value cost) "tag")) |
358 | 360 | :paid/type :tag-or-bad-pub |
359 | 361 | :paid/value (value cost)}))))} |
|
443 | 445 | (corp? %)))} |
444 | 446 | :async true |
445 | 447 | :effect (req (wait-for (trash-cards state side targets {:cause :ability-cost |
| 448 | + :suppress-checkpoint true |
446 | 449 | :unpreventable true}) |
447 | 450 | (complete-with-result |
448 | 451 | state side eid |
|
473 | 476 | (corp? %)))} |
474 | 477 | :async true |
475 | 478 | :effect (req (wait-for (trash-cards state side targets {:cause :ability-cost |
| 479 | + :suppress-checkpoint true |
476 | 480 | :unpreventable true}) |
477 | 481 | (complete-with-result |
478 | 482 | state side eid |
|
500 | 504 | :card (every-pred installed? hardware? (complement facedown?))} |
501 | 505 | :async true |
502 | 506 | :effect (req (wait-for (trash-cards state side targets {:cause :ability-cost |
| 507 | + :suppress-checkpoint true |
503 | 508 | :unpreventable true}) |
504 | 509 | (complete-with-result |
505 | 510 | state side eid |
|
532 | 537 | (not (same-card? % card)) |
533 | 538 | (has-subtype? % "Harmonic"))} |
534 | 539 | :async true |
| 540 | + ;; TODO - once derez is async, fix this |
535 | 541 | :effect (req (doseq [harmonic targets] |
536 | 542 | (derez state side harmonic)) |
537 | 543 | (complete-with-result |
|
560 | 566 | :card (every-pred installed? program? (complement facedown?))} |
561 | 567 | :async true |
562 | 568 | :effect (req (wait-for (trash-cards state side targets {:cause :ability-cost |
| 569 | + :suppress-checkpoint true |
563 | 570 | :unpreventable true}) |
564 | 571 | (complete-with-result |
565 | 572 | state side eid |
|
587 | 594 | :card (every-pred installed? resource? (complement facedown?))} |
588 | 595 | :async true |
589 | 596 | :effect (req (wait-for (trash-cards state side targets {:cause :ability-cost |
| 597 | + :suppress-checkpoint true |
590 | 598 | :unpreventable true}) |
591 | 599 | (complete-with-result |
592 | 600 | state side eid |
|
617 | 625 | (complement facedown?))} |
618 | 626 | :async true |
619 | 627 | :effect (req (wait-for (trash-cards state side targets {:cause :ability-cost |
| 628 | + :suppress-checkpoint true |
620 | 629 | :unpreventable true}) |
621 | 630 | (complete-with-result |
622 | 631 | state side eid |
|
644 | 653 | :card (every-pred installed? rezzed? ice?)} |
645 | 654 | :async true |
646 | 655 | :effect (req (wait-for (trash-cards state side targets {:cause :ability-cost |
| 656 | + :suppress-checkpoint true |
647 | 657 | :unpreventable true}) |
648 | 658 | (complete-with-result |
649 | 659 | state side eid |
|
663 | 673 | (<= 0 (- (count (get-in @state [side :deck])) (value cost)))) |
664 | 674 | (defmethod handler :trash-from-deck |
665 | 675 | [cost state side eid card] |
666 | | - (wait-for (mill state side side (value cost)) |
| 676 | + (wait-for (mill state side side (value cost) {:suppress-checkpoint true}) |
667 | 677 | (complete-with-result |
668 | 678 | state side eid |
669 | 679 | {:paid/msg (str "trashes " (quantify (count async-result) "card") |
|
692 | 702 | :max (value cost) |
693 | 703 | :card select-fn} |
694 | 704 | :async true |
695 | | - :effect (req (wait-for (trash-cards state side targets {:unpreventable true :seen false}) |
| 705 | + :effect (req (wait-for (trash-cards state side targets {:unpreventable true :seen false :suppress-checkpoint true}) |
696 | 706 | (complete-with-result |
697 | 707 | state side eid |
698 | 708 | {:paid/msg (str "trashes " (quantify (count async-result) "card") |
|
714 | 724 | (<= 0 (- (count (get-in @state [side :hand])) (value cost)))) |
715 | 725 | (defmethod handler :randomly-trash-from-hand |
716 | 726 | [cost state side eid card] |
717 | | - (wait-for (discard-from-hand state side side (value cost)) |
| 727 | + (wait-for (discard-from-hand state side side (value cost) {:suppress-checkpoint true}) |
718 | 728 | (complete-with-result |
719 | 729 | state side eid |
720 | 730 | {:paid/msg (str "trashes " (quantify (count async-result) "card") |
|
732 | 742 | (defmethod handler :trash-entire-hand |
733 | 743 | [cost state side eid card] |
734 | 744 | (let [cards (get-in @state [side :hand])] |
735 | | - (wait-for (trash-cards state side cards {:unpreventable true}) |
| 745 | + (wait-for (trash-cards state side cards {:unpreventable true :suppress-checkpoint true}) |
736 | 746 | (complete-with-result |
737 | 747 | state side eid |
738 | 748 | {:paid/msg (str "trashes all (" (count async-result) ") cards in " |
|
760 | 770 | :choices {:all true |
761 | 771 | :max (value cost) |
762 | 772 | :card (every-pred hardware? in-hand?)} |
763 | | - :effect (req (wait-for (trash-cards state side targets {:unpreventable true}) |
| 773 | + :effect (req (wait-for (trash-cards state side targets {:unpreventable true :suppress-checkpoint true}) |
764 | 774 | (complete-with-result |
765 | 775 | state side eid |
766 | 776 | {:paid/msg (str "trashes " (quantify (count async-result) "piece") |
|
788 | 798 | :choices {:all true |
789 | 799 | :max (value cost) |
790 | 800 | :card (every-pred program? in-hand?)} |
791 | | - :effect (req (wait-for (trash-cards state side targets {:unpreventable true}) |
| 801 | + :effect (req (wait-for (trash-cards state side targets {:unpreventable true :suppress-checkpoint true}) |
792 | 802 | (complete-with-result |
793 | 803 | state side eid |
794 | 804 | {:paid/msg (str "trashes " (quantify (count async-result) "program") |
|
815 | 825 | :choices {:all true |
816 | 826 | :max (value cost) |
817 | 827 | :card (every-pred resource? in-hand?)} |
818 | | - :effect (req (wait-for (trash-cards state side targets {:unpreventable true}) |
| 828 | + :effect (req (wait-for (trash-cards state side targets {:unpreventable true :suppress-checkpoint true}) |
819 | 829 | (complete-with-result |
820 | 830 | state side eid |
821 | 831 | {:paid/msg (str "trashes " (quantify (count async-result) "resource") |
|
834 | 844 | (<= (value cost) (count (get-in @state [:runner :hand])))) |
835 | 845 | (defmethod handler :net |
836 | 846 | [cost state side eid card] |
837 | | - (wait-for (damage state side :net (value cost) {:unpreventable true :card card}) |
| 847 | + (wait-for (damage state side :net (value cost) {:unpreventable true :card card :suppress-checkpoint true}) |
838 | 848 | (complete-with-result |
839 | 849 | state side eid |
840 | 850 | {:paid/msg (str "suffers " (count async-result) " net damage") |
|
850 | 860 | (<= (value cost) (count (get-in @state [:runner :hand])))) |
851 | 861 | (defmethod handler :meat |
852 | 862 | [cost state side eid card] |
853 | | - (wait-for (damage state side :meat (value cost) {:unpreventable true :card card}) |
| 863 | + (wait-for (damage state side :meat (value cost) {:unpreventable true :card card :suppress-checkpoint true}) |
854 | 864 | (complete-with-result |
855 | 865 | state side eid |
856 | 866 | {:paid/msg (str "suffers " (count async-result) " meat damage") |
|
866 | 876 | (<= (value cost) (count (get-in @state [:runner :hand])))) |
867 | 877 | (defmethod handler :brain |
868 | 878 | [cost state side eid card] |
869 | | - (wait-for (damage state side :brain (value cost) {:unpreventable true :card card}) |
| 879 | + (wait-for (damage state side :brain (value cost) {:unpreventable true :card card :suppress-checkpoint true}) |
870 | 880 | (complete-with-result |
871 | 881 | state side eid |
872 | 882 | {:paid/msg (str "suffers " (count async-result) " core damage") |
|
993 | 1003 | (pos? (get-counters % :agenda)))} |
994 | 1004 | :async true |
995 | 1005 | :effect (req (wait-for (add-counter state side target :agenda (- (value cost)) {:suppress-checkpoint true}) |
| 1006 | + (queue-event state :agenda-counter-spent {:value (value cost)}) |
996 | 1007 | (complete-with-result |
997 | 1008 | state side eid |
998 | 1009 | {:paid/msg (str "spends " |
|
1052 | 1063 | (defmethod handler :agenda |
1053 | 1064 | [cost state side eid card] |
1054 | 1065 | (wait-for (add-counter state side card :agenda (- (value cost)) {:suppress-checkpoint true}) |
| 1066 | + (queue-event state :agenda-counter-spent {:value (value cost)}) |
1055 | 1067 | (complete-with-result |
1056 | 1068 | state side eid |
1057 | 1069 | {:paid/msg (str "spends " |
|
0 commit comments