From 581b61a0142ccb3dda217d30132fc0782fd7065d Mon Sep 17 00:00:00 2001 From: NB Kelly Date: Sat, 26 Oct 2024 14:23:39 +1300 Subject: [PATCH 1/3] commands to enable/disable playing with open info --- src/clj/game/core/commands.clj | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/clj/game/core/commands.clj b/src/clj/game/core/commands.clj index c53b3f596d..fe80e8073e 100644 --- a/src/clj/game/core/commands.clj +++ b/src/clj/game/core/commands.clj @@ -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 #" ") @@ -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" @@ -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) From 89d7f33501716bdbce00c72c71adcaf2fcf2fbc0 Mon Sep 17 00:00:00 2001 From: NB Kelly Date: Sat, 26 Oct 2024 14:23:59 +1300 Subject: [PATCH 2/3] show hands when playing with open info --- src/clj/game/core/diffs.clj | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/clj/game/core/diffs.clj b/src/clj/game/core/diffs.clj index 4cd7977ad3..2b86cee666 100644 --- a/src/clj/game/core/diffs.clj +++ b/src/clj/game/core/diffs.clj @@ -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]] @@ -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)) @@ -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) [])) From 63e2965aff6f62792e75b417b55d64ae5fa63f6d Mon Sep 17 00:00:00 2001 From: NB Kelly Date: Sat, 26 Oct 2024 14:24:16 +1300 Subject: [PATCH 3/3] installed cards visible on mouseover with open info --- src/cljs/nr/gameboard/board.cljs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cljs/nr/gameboard/board.cljs b/src/cljs/nr/gameboard/board.cljs index d7e5f5e4e3..5705358fa8 100644 --- a/src/cljs/nr/gameboard/board.cljs +++ b/src/cljs/nr/gameboard/board.cljs @@ -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))