Skip to content

Localization Phase 1: stop reading the combat roll message (1-5c) - #6311

Open
wholton wants to merge 1 commit into
l10n/phase1-combat-buttonsfrom
l10n/phase1-combat-rolls
Open

wholton wants to merge 1 commit into
l10n/phase1-combat-buttonsfrom
l10n/phase1-combat-rolls

Conversation

@wholton

@wholton wholton commented Dec 6, 2026

Copy link
Copy Markdown
Collaborator

Row 1-5c of the localization plan (docs/LOCALIZATION_PLAN.md §5.0): stop logic reading the combat roll message, so the roll output can be translated next. Stacked on #6310 (1-5b); this PR targets the 1-5b branch, so the diff shows 1-5c only.

TextAsLogicGuardTest looks for label and content comparisons, so it missed these: they read the roll text with indexOf, regexes and substringAfter.

What changed

  • CombatRollService.CombatRollResult keeps the parts apart: modifier lines, body, total line and after-total notes. message() joins them as before.
    • Roll notes (Power Word: Wish, unit upgrades) no longer splice in after the text "With modifiers: \n".
    • Mass Hypnosis and Leviathan replace the total line directly instead of regex-replacing **Total hits N** (the pattern constant is gone).
    • The Crown of Thalnos offer is a thalnosRerollOffered flag instead of message.contains("adding +1, at the risk of your").
    • The disaster-watch excerpt picks the total line by comparing with the line it built, not startsWith("**Total hits").
  • CombatMessageHelper.rollHeading returns the combat name, the subject (name plus dice emoji) and the summary line. displayCombatSummary still returns the line.
    • Fog of War mirroring (FOWCombatThreadMirroring.mirrorCombatMessage / combatRollResult) takes the subject and hit count instead of regex-reading rolls for and Total hits.
    • The replay roll header takes RollHeading.name() instead of substringBetween(summary, "rolls for ", ...).
  • rollForUnitsResult (public) returns the result; ButtonHelper, ButtonHelperFactionSpecific and BastionTechService (twice) read totalHits() instead of substringAfter(message, "Total hits ").

Visible changes

None in English. One edge improves: a Fog of War mirror of a BOMBARDMENT roll aimed at a planet used to be cut at the first > of the planet's emoji; it now shows the whole subject.

Tests

  • CombatRollResultTest: the joined message against the old splice for every mix of notes and modifiers, the total-line replacement against the old regex, the Fog of War mirror text against the old parse, and the replay header name against the old substringBetween for every roll type.
  • CombatRollPayloadRendererParityTest (replay renderer vs Discord text) still passes.
  • Full mvn verify with the Postgres tests: 3951 tests, 0 failures.

🤖 Generated with Claude Code

CombatRollResult keeps the modifier lines, body, total line and
after-total notes apart, so roll notes and the Mass Hypnosis and
Leviathan totals no longer splice or regex-replace the text; the
Thalnos offer is a flag. CombatMessageHelper.rollHeading gives the
combat name and subject, so Fog of War mirroring and the replay
header no longer regex the summary, and the "Total hits" substring
callers read totalHits(). English output is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant