FOG guard cleanup - #5463
Draft
Stabar-ti wants to merge 11 commits into
Draft
Conversation
Stabar-ti
marked this pull request as draft
July 25, 2026 23:30
Contributor
Author
|
spotless failed on a double call that pre existed. Not a bug but a redundant call. I'll fix it in the code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fog-of-war guard cleanup: shared helpers for Action Cards, Faction Abilities & Explore
Discussion on Discord prompted to continue me doing this:
Fog-of-war hiding (faction, color, emoji, identity) is currently hand-rolled as
game.isFowMode() ? … : …at hundreds of call sites. The same few patterns are copy-pastedeverywhere, they've quietly drifted apart, and a couple already hid bugs. This PR pulls the
common shapes into a handful of
FoWHelpermethods and moves those spoecific ifFow code snippets into them for most Action Cards, Faction Abilities, and Explore.GOAL: only change fog behavior. Non-fog output stays byte-identical unless called
out.
Method:
Automated greb lists
Manual Clssifications
Manual API design
Automated API fix and suggestions
Manual set one fix for each type
Automated find similar and apply
Automated search for more that might have missed standard greb
Manual decision to leave some specific ones alone as they are multi faceted
manual check of git diff
Small live tests
Automated review with claude 4.8, 5 and codex
Current phase:
Waiting for early approval for extensive live testing (time consuming)
The helpers
Helper -> What it does
actorOrAnon(game, player, fogPhrase)-> Actor name when unfogged; your placeholder ("someone","", …) when fogged.factionEmojiOrAnon(game, player, fogPhrase)-> Faction emoji/color when unfogged; placeholder when fogged.identityOrColorIfCanSeeStats(game, target, viewer, unfogged)->| Per-viewer: fogged shows color or"???"based on whatviewermay see.fogSafeTargetButton(id, style, target[, viewer])-> Target-select button that never leaks identity (short name + emoji unfogged; color chip fogged).actionsChannelOrLocal/announcePublicOrLocal-> "Post publicly in the Actions channel, or keep it local" routing for Explore announcements.notifyPlayerAndAffectedInFog/notifyActorAndAffectedElsePublic-> The 2-party and 3-way "message each player privately in fog, one public message otherwise" sends.AgendaHelper.listVoteCountIfUnfogged(game)-> Theif (!fow) listVoteCount(...)one-liner that was copy-pasted 3×.What changed
fogSafeTargetButtonacross Action Cards, theacd2/*handlers,Faction Abilities, and Heroes. Plus a fog-only chip fix on Bounty/Heist/Defectors (fog gets a
color chip; non-fog untouched).
non-fog text is preserved.
straight identity leak. Now uses color/faction name like its siblings.
string-strip it back out under fog. If the strip ever missed, the name leaked to the public
channel. Rebuilt so the fog path never contains the name in the first placw, it can't leak now.
Deliberately left alone
Not everything fits a helper, and forcing it would change non-fog behavior or real game logic. Left
(with reasons in
fog-left-sites-catalog.md): blind-selection button loops, buttons whose veryexistence differs by fog (Seize Artifact), per-viewer sites already correct, and, importantly,
PublicSupportand the Mirage deep-space trigger, whereisFowMode()gates game rules, notdisplay. Those must not be swept into a display helper.
Why
AgendaHelper.javais in the diff: the only change to that file is the pure addition oflistVoteCountIfUnfogged(game)(a 7-line method right after the existinglistVoteCount). It lives inAgendaHelperrather thanFoWHelperbecause it wrapsAgendaHelper.listVoteCount(...)-> keeping it here avoidsFoWHelperreaching into agenda logic. It replaces the verbatim one-linerif (!game.isFowMode()) AgendaHelper.listVoteCount(game, game.getMainGameChannel());atButtonHelperAgents:1784/:1830. No existing agenda code is touched.Testing
FoWHelperTestcovers the identity/button/routing helpers.git diffagainstmaster; non-fog output confirmed unchanged exceptthe two intentional fixes above. checked all of them manually as well as through codex and claude review.
"red"-,"Red"+ color chip), there's noautomated way to see how they render in a real FoW game.