Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marilyn no longer interrupts regenisis working #7477

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/clj/game/cards/assets.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[game.core.effects :refer [register-lingering-effect]]
[game.core.eid :refer [complete-with-result effect-completed is-basic-advance-action? make-eid get-ability-targets]]
[game.core.engine :refer [pay register-events resolve-ability]]
[game.core.events :refer [first-event? no-event? turn-events event-count]]
[game.core.events :refer [first-event? no-event? truncate-turn-event turn-events event-count]]
[game.core.expose :refer [expose-prevent]]
[game.core.flags :refer [lock-zone prevent-current
prevent-draw
Expand Down Expand Up @@ -1645,8 +1645,20 @@
:autoresolve (get-autoresolve :auto-reshuffle)
:player :corp
:yes-ability {:msg "shuffle itself back into R&D"
:effect (effect (move :corp card :deck)
(shuffle! :corp :deck))}}}}))
:effect (req
;; we're replacing actually moving into the discard
;; but we have no way to do that in engine, so we can just truncate away the event
;; if we ever do another major rework of how trashing works, we can add some sort
;; of interrupt: location replacement event. That's just as much of a hack as this
;; happens to be though.
(truncate-turn-event
state :corp
:card-moved (fn [[context]]
(and (in-discard? (:moved-card context))
(= (:title card) (:title (:moved-card context)))
(corp? (:moved-card context)))))
(move state :corp card :deck)
(shuffle! state :corp :deck))}}}}))

(defcard "Mark Yale"
{:events [{:event :agenda-counter-spent
Expand Down
10 changes: 10 additions & 0 deletions src/clj/game/core/events.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
[state _ ev]
(mapcat rest (filter #(= ev (first %)) (:turn-events @state))))

(defn truncate-turn-event
"Truncates the last occurance of an event, if possible."
([state _ ev] truncate-turn-event state nil ev (constantly true))
([state _ ev pred]
(when-let [matching (first (filter pred (turn-events state nil ev)))]
(let [converted-ev [ev matching]
[pre post] (split-with #(not= converted-ev %) (reverse (:turn-events @state)))
updated-turn-events (reverse (concat pre (rest post)))]
(swap! state assoc :turn-events updated-turn-events)))))

(defn last-turn?
[state side event]
(get-in @state [side :register-last-turn event]))
Expand Down
17 changes: 17 additions & 0 deletions test/clj/game/cards/agendas_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3533,6 +3533,23 @@
(click-card state :corp "Obokata Protocol")
(is (= 5 (:agenda-point (get-corp))) "3+1+1 agenda points from obo + regen + regen")))

(deftest regenesis-vs-marilyn-campaign-trash-replacement
;; Regenesis - if no cards have been added to discard, reveal a face-down agenda
;; and add it to score area
(do-game
(new-game {:corp {:deck ["Regenesis" "Marilyn Campaign"]
:discard ["Obokata Protocol"]}})
(play-from-hand state :corp "Marilyn Campaign" "New remote")
(rez state :corp (get-content state :remote1 0))
(dotimes [_ 4]
(take-credits state :corp)
(take-credits state :runner))
;; marilyn should pop now
(click-prompt state :corp "Yes")
(play-and-score state "Regenesis")
(click-card state :corp "Obokata Protocol")
(is (= 4 (:agenda-point (get-corp))) "3+1 agenda points from obo + regen")))

(deftest regenesis-not-affected-by-subliminal-messaging
;; Regenesis - Leaving Subliminal Messaging in Archives doesn't interfere
(do-game
Expand Down
Loading