Skip to content

feat: usurp an overlord through a movement, and preview war goals before the code - #198

Merged
Drefvelin merged 2 commits into
mainfrom
feat/wargoal-preview-usurp-movement
Oct 20, 2026
Merged

Drefvelin merged 2 commits into
mainfrom
feat/wargoal-preview-usurp-movement

Conversation

@Drefvelin

@Drefvelin Drefvelin commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Usurp by a vassal is now a movement. A vassal can no longer declare a Usurp war on its own overlord (the goal is hidden, and the validator says to start a movement instead). Instead there is a new usurp political action:

  • Only a direct vassal leader who could take the title (overlord has a title, rank check same as the war goal) can propose it; only vassals can join the cause.
  • The overlord can cave in, or it escalates like any movement into a civil war with the Usurp goal (CivilWarGoalMapper).
  • On a win (or acceptance) the cause leader's faction usurps the overlord via FactionManager.usurp. If the leader is gone, the first eligible faction in the cause takes it. WarOutcomeService sends a Usurp war with a movement id through the movement, so the civil war untangle restores vassalage first.
  • The usurper's laws must allow vassals (a vassalage law), for the movement and the war goal alike. Without it, FactionManager.usurp handed over the title but left the old overlord independent and its subjects in place (found on Dev).
  • Usurping foreign realms by war is otherwise unchanged.
  • political-actions.yml gets a usurp entry. The loader adds a vassal-only default if a server's copy predates it, so live configs work without editing.

Browse war goals before the staff code. The declare war button now opens the goal picker straight away, even when a code is required. The code is asked for when the leader confirms, and the confirmation reopens once the code is accepted. The menus now show what each goal wins:

  • An overview item: reparations if you win (the defender and its subjects, % of trade income, about X a day and in total) and what you pay if you lose.
  • Pillage: best loot among eligible settlements, and per settlement the loot, the guild count and the trade-income hit.
  • Tributary and subjugate types: the modifiers each side gets.
  • Usurp: the title, how many subjects change hands. Open market: the law.
  • The confirmation summary repeats the reparations and pillage numbers and says the code will be asked for.

Test plan

  • Full mvn verify locally (only the two known local-only failures); jacoco shows no new fully-missed lines.
  • New UsurpMovementTest, WarGoalPreviewTest; updated declare/validator/outcome/prompt tests.
  • Dev (bots, non-admin leader): declare button opens the goal picker with no code; overview, tributary effects, open-market law and usurp details shown; confirm asks for the code; a minted Dev code reopens the confirmation; confirming declared FIG vs Rat Hill.
  • Dev: The Sanctuary's leader (vassal of The Holy Order) sees Usurp the Title in the Holy Order's political proposals, starts the movement; staff reject → civil war with goal usurp tied to the movement; attacker victory → The Sanctuary holds the duchy, The Holy Order is its subject, and Sporetopia moved under it.
  • Dev data and the 4.12.0 jar were restored afterwards.

🤖 Generated with Claude Code

…ore the code

A vassal no longer declares a usurp war on its own overlord. It starts a Usurp
movement in the overlord's government instead: only direct vassal leaders who
could take the title may lead it, the overlord can cave in, and otherwise it
becomes a civil war with the Usurp goal. Winning lets the cause leader's
faction take the overlord's highest title.

The declare war button now opens the goal picker straight away. Leaders can
see every available goal and what it wins (reparations at today's income,
pillage loot per settlement, subject effects, usurped title and subjects)
before asking staff for a code. The code is asked for when they confirm,
and the confirmation reopens once it is accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ec034556-8276-4809-8c0c-a5474427f7fb
📥 Commits

Reviewing files that changed from the base of the PR and between 2158704 and 15be51d.

📒 Files selected for processing: 33
  • src/main/java/net/tfminecraft/simplefactions/government/Government.java
  • src/main/java/net/tfminecraft/simplefactions/government/movement/Action.java
  • src/main/java/net/tfminecraft/simplefactions/government/movement/PoliticalAction.java
  • src/main/java/net/tfminecraft/simplefactions/government/movement/UsurpCause.java
  • src/main/java/net/tfminecraft/simplefactions/government/proposal/Proposal.java
  • src/main/java/net/tfminecraft/simplefactions/loaders/PoliticalActionLoader.java
  • src/main/java/net/tfminecraft/simplefactions/managers/InventoryManager.java
  • src/main/java/net/tfminecraft/simplefactions/managers/inventory/DeclareWarCreator.java
  • src/main/java/net/tfminecraft/simplefactions/managers/inventory/DeclareWarView.java
  • src/main/java/net/tfminecraft/simplefactions/managers/inventory/RelationView.java
  • src/main/java/net/tfminecraft/simplefactions/objects/Faction.java
  • src/main/java/net/tfminecraft/simplefactions/utils/LoreWriter.java
  • src/main/java/net/tfminecraft/simplefactions/war/civilwar/CivilWarGoalMapper.java
  • src/main/java/net/tfminecraft/simplefactions/war/core/WarDeclareHelper.java
  • src/main/java/net/tfminecraft/simplefactions/war/declare/DeclareCodePrompt.java
  • src/main/java/net/tfminecraft/simplefactions/war/declare/WarGoalPreview.java
  • src/main/java/net/tfminecraft/simplefactions/war/declare/WarGoalValidator.java
  • src/main/java/net/tfminecraft/simplefactions/war/resolution/PillageApplyService.java
  • src/main/java/net/tfminecraft/simplefactions/war/resolution/WarOutcomeService.java
  • src/main/resources/political-actions.yml
  • src/main/resources/war.yml
  • src/test/java/net/tfminecraft/simplefactions/diplomacy/coalition/CoalitionViewTest.java
  • src/test/java/net/tfminecraft/simplefactions/government/UsurpMovementTest.java
  • src/test/java/net/tfminecraft/simplefactions/loaders/CatalogReloadCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/managers/InventoryManagerCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/managers/inventory/RelationMenusCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/managers/inventory/WarMenusCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/utils/LoreWriterCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/war/core/WarDeclareHelperTest.java
  • src/test/java/net/tfminecraft/simplefactions/war/declare/DeclareCodePromptCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/war/declare/WarGoalPreviewTest.java
  • src/test/java/net/tfminecraft/simplefactions/war/declare/WarGoalValidatorTest.java
  • src/test/java/net/tfminecraft/simplefactions/war/resolution/WarOutcomeServiceTest.java
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size:L 100-499 effective changed lines (tests excluded in mixed PRs). label Oct 20, 2026
Usurping makes the old overlord the usurper's subject and hands over its
subjects. A usurper whose laws forbid vassals took the title but left the
old overlord independent and kept its subjects in place, found while
testing on Dev. The movement, the war goal and its validator now require
a vassalage law. The default Usurp action carries its description for
servers whose political-actions.yml predates it, and the usurp preview
line no longer loses a space in the client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Drefvelin
Drefvelin merged commit af268f6 into main Oct 20, 2026
3 of 4 checks passed
@Drefvelin
Drefvelin deleted the feat/wargoal-preview-usurp-movement branch October 20, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant