Skip to content

FOG guard cleanup - #5463

Draft
Stabar-ti wants to merge 11 commits into
AsyncTI4:masterfrom
Stabar-ti:fog-guarding
Draft

FOG guard cleanup#5463
Stabar-ti wants to merge 11 commits into
AsyncTI4:masterfrom
Stabar-ti:fog-guarding

Conversation

@Stabar-ti

@Stabar-ti Stabar-ti commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

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-pasted
everywhere, they've quietly drifted apart, and a couple already hid bugs. This PR pulls the
common shapes into a handful of FoWHelper methods 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 what viewer may 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) -> The if (!fow) listVoteCount(...) one-liner that was copy-pasted 3×.

What changed

  • Buttons — 30 migrated to fogSafeTargetButton across Action Cards, the acd2/* handlers,
    Faction Abilities, and Heroes. Plus a fog-only chip fix on Bounty/Heist/Defectors (fog gets a
    color chip; non-fog untouched).
  • Messages — ~30 migrated to the notify/identity helpers. All pure refactors: the exact fog and
    non-fog text is preserved.
  • Explore — 8 sites moved onto the channel-routing helpers.
  • Two real bugs fixed along the way:
    • Manipulate was labeling target buttons with players' Discord usernames even in fog, a
      straight identity leak. Now uses color/faction name like its siblings.
    • The main-channel resolve prompt built the player's name into the message and then tried to
      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 very
existence differs by fog (Seize Artifact), per-viewer sites already correct, and, importantly,
PublicSupport and the Mirage deep-space trigger, where isFowMode() gates game rules, not
display. Those must not be swept into a display helper.

Why AgendaHelper.java is in the diff: the only change to that file is the pure addition of listVoteCountIfUnfogged(game) (a 7-line method right after the existing listVoteCount). It lives in AgendaHelper rather than FoWHelper because it wraps AgendaHelper.listVoteCount(...) -> keeping it here avoids FoWHelper reaching into agenda logic. It replaces the verbatim one-liner if (!game.isFowMode()) AgendaHelper.listVoteCount(game, game.getMainGameChannel()); at ButtonHelperAgents:1784/:1830. No existing agenda code is touched.

Testing

  • Full suite maven: 538 tests, 0 failures. Spotless clean.
  • FoWHelperTest covers the identity/button/routing helpers.
  • Every change reviewed via git diff against master; non-fog output confirmed unchanged except
    the two intentional fixes above. checked all of them manually as well as through codex and claude review.
  • TO DO: live extensive check: the relabeled fog buttons ("red" -, "Red" + color chip), there's no
    automated way to see how they render in a real FoW game.

@Stabar-ti
Stabar-ti marked this pull request as draft July 25, 2026 23:30
@Stabar-ti

Stabar-ti commented Jul 27, 2026

Copy link
Copy Markdown
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants