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

Explicit reveals #7873

Merged
merged 5 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
track the last set of revealed cards
  • Loading branch information
NBKelly committed Nov 6, 2024
commit 678124f4f4ef6884c47c7aa2c020fb86a3b0dc57
1 change: 1 addition & 0 deletions src/clj/game/core/diffs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@
:encounters
:end-turn
:gameid
:last-revealed
:log
:mark
:options
Expand Down
4 changes: 3 additions & 1 deletion src/clj/game/core/revealing.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
(defn reveal
"Trigger the event for revealing one or more cards."
[state side eid & targets]
(apply trigger-event-sync state side eid (if (= :corp side) :corp-reveal :runner-reveal) (flatten targets)))
(let [cards (flatten targets)]
(swap! state assoc :last-revealed cards)
(apply trigger-event-sync state side eid (if (= :corp side) :corp-reveal :runner-reveal) cards)))

(defn reveal-loud
"Trigger the event for revealing one or more cards, and also handle the log printout"
Expand Down
6 changes: 4 additions & 2 deletions src/cljs/nr/gameboard/board.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2152,7 +2152,7 @@
:reagent-render
(fn []
(when (and @corp @runner @side true)
(let [me-side (if (= :spectator @side)
(let [me-side (if (= :spectator @side)
(or (spectate-side) :corp)
@side)
op-side (utils/other-side me-side)
Expand Down Expand Up @@ -2248,6 +2248,7 @@
op-set-aside (r/cursor game-state [op-side :set-aside])
op-current (r/cursor game-state [op-side :current])
op-play-area (r/cursor game-state [op-side :play-area])
last-revealed (r/cursor game-state [:last-revealed])
me-rfg (r/cursor game-state [me-side :rfg])
me-set-aside (r/cursor game-state [me-side :set-aside])
me-current (r/cursor game-state [me-side :current])
Expand All @@ -2262,7 +2263,8 @@
[play-area-view op-user (tr [:game.play-area "Play Area"]) op-play-area]
[play-area-view me-user (tr [:game.play-area "Play Area"]) me-play-area]
[rfg-view op-current (tr [:game.current "Current"]) false]
[rfg-view me-current (tr [:game.current "Current"]) false]])
[rfg-view me-current (tr [:game.current "Current"]) false]
[rfg-view last-revealed (tr [:game.last-revealed "Last Revealed"]) false]])
(when (or (not= @side :spectator)
(and (spectator-view-hidden?) (spectate-side)))
[button-pane {:side me-side :active-player active-player :run run :encounters encounters
Expand Down