Skip to content
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
15 changes: 15 additions & 0 deletions src/clj/game/core/commands.clj
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,18 @@
:effect (effect (trash eid target {:unpreventable true}))}
nil nil)))

(defn dont-share-information
[state side]
(system-msg state side "stops playing with open information")
(swap! state dissoc-in [side :share-information]))

(defn share-information
[state side]
(if (get-in @state [side :share-information])
(system-msg state side "stops playing with open information")
(system-msg state side "starts playing with open information"))
(swap! state update-in [side :share-information] not))

(defn parse-command
[state text]
(let [[command & args] (safe-split text #" ")
Expand Down Expand Up @@ -437,6 +449,8 @@
(make-card {:title "/disable-card command"}) nil)
"/discard" #(toast %1 %2 "/discard number takes the format #n")
"/discard-random" #(move %1 %2 (rand-nth (get-in @%1 [%2 :hand])) :discard)
"/dont-share-information" dont-share-information
"/don't-share-information" dont-share-information
"/draw" #(draw %1 %2 (make-eid %1) (constrain-value value 0 1000))
"/enable-card" #(resolve-ability %1 %2
{:prompt "Choose a card to enable"
Expand Down Expand Up @@ -520,6 +534,7 @@
"/save-replay" command-save-replay
"/set-mark" #(command-set-mark %1 %2 args)
"/score" command-score
"/share-information" share-information
"/show-hand" #(resolve-ability %1 %2
{:effect (effect (system-msg (str
(if (= :corp %2)
Expand Down
12 changes: 10 additions & 2 deletions src/clj/game/core/diffs.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns game.core.diffs
(:require
[clojure.string :as str]
[cond-plus.core :refer [cond+]]
[differ.core :as differ]
[game.core.board :refer [installable-servers]]
Expand Down Expand Up @@ -177,8 +178,15 @@

(declare cards-summary)

(defn- is-public-or-shared?
[state side card]
(or (is-public? card side)
(let [c-side (keyword (str/lower-case (:side card)))]
(and (installed? card)
(get-in @state [c-side :share-information])))))

(defn card-summary [card state side]
(if (is-public? card side)
(if (is-public-or-shared? state side card)
(-> (cond-> card
(:host card) (-> (dissoc-in [:host :hosted])
(update :host card-summary state side))
Expand Down Expand Up @@ -302,7 +310,7 @@
(defn hand-summary
"Is the player's hand publicly visible?"
[hand state same-side? side player]
(if (or same-side? (:openhand player))
(if (or same-side? (:openhand player) (:share-information player))
(cards-summary hand state side)
[]))

Expand Down
1 change: 1 addition & 0 deletions src/cljs/nr/gameboard/board.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@
:on-drag-start #(handle-dragstart % card)
:on-drag-end #(-> % .-target js/$ (.removeClass "dragged"))
:on-mouse-enter #(when (or (not (or (not code) flipped facedown))
title
(spectator-view-hidden?)
(= (:side @game-state) (keyword (lower-case side))))
(put-game-card-in-channel card zoom-channel))
Expand Down