Skip to content

Annex titles the defender holds; declare wars and set demands from the console - #260

Merged
Drefvelin merged 2 commits into
mainfrom
feat/annex-held-titles-console-declare
Nov 30, 2026
Merged

Drefvelin merged 2 commits into
mainfrom
feat/annex-held-titles-console-declare

Conversation

@Drefvelin

Copy link
Copy Markdown
Contributor

Why

Staff want the Brotherhood of Alms at war with Sunsora, with Heorot (COUNTY_21) and Essencia (COUNTY_25) as annex targets. Two things stood in the way:

  • Sunsora holds Heorot. A de jure annex only accepted a title the attacker holds or one nobody holds (Let de jure annex target an unowned title the realm borders #258), so Heorot was refused with "You do not own this title."
  • /war admin declare only worked for a player in game, and a second demand could only be set in the war's demands menu. Staff with console access couldn't do either.

Change

De jure annex of a held title (DeJureAnnexEligibility, WarOutcomeService)

  • A title held in the defender's realm (the defender or a vassal on its overlord path) can be targeted when the attacker holds a province in it or borders it by land or sea, the same reach rule as an unowned title.
  • A title held by anyone outside the defender's realm is still refused, and the message names the holder.
  • On victory the land moves as before: holders keep their settlements, capitals and the road between them. The holder's title is then re-checked with Title.destroy. If the holder has no land left in it, the title goes to the attacker, provided the attacker can hold it (same canBeHeld rule, including the county limit). A holder that kept a settlement there keeps the title.
  • The declare menu's goal description now mentions titles the defender holds.

Console commands (WarCommandManager, WarTabCompletion)

  • /war admin declare <attacker> <defender> [goal] [args] now runs from the console too. It still calls WarManager.declareWar, so the declaration sends the same titles, horn, war notices and war history as a declare from the menu.
  • New /war admin demand <warId> attacker|defender <goal> [args] sets a side's second demand, in game or from the console. The side leader demands it of the enemy side leader, through WarDemandRules.editBlock and validate, the same checks as the demands menu: locked once the first battle starts, first demand required, goal rules. The side leader is told in game.
  • /war admin buildup <warId> status|end|setday also runs from the console, so a buildup can be checked there.
  • Goal-argument parsing is shared between declare and demand.
  • Any other /war subcommand from the console now prints which ones are available, instead of doing nothing.

Tests

  • WarGoalValidatorTest: a held title is allowed when in reach, refused when out of reach or when held outside the defender's realm.
  • WarOutcomeServiceTest: the title moves to the attacker once the holder has no land left in it, and stays with a holder that kept land there.
  • WarCommandsCoverageTest: console declare, console and staff demand, demand errors, console refusal of other subcommands.

Locally, WarGoalValidatorTest, WarOutcomeServiceTest, DeJureAnnexEligibilityTest and WarAdminRisksTest pass. WarCommandsCoverageTest needs SQLite, which can't run on this host, so CI covers it.

🤖 Generated with Claude Code

…e console

A de jure annex may now target a title held in the defender's realm, as long
as the attacker holds a province in it or borders it. A title held by anyone
else is still refused, with the holder named. When the war is won and the
holder has no land left in the title, the title goes to the attacker.

/war admin declare runs from the console as well as for staff in game, through
the same declare path and announcements. The new /war admin demand sets a
side's second demand under the same rules as the war's demands menu, from the
console or in game.

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

coderabbitai Bot commented Nov 30, 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 49 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf7aa4a9-7526-4b6b-9811-e000a98ec146
Commits

Reviewing files that changed from the base of the PR and between 8383aba and 5497a69.

Files selected for processing: 8

  • src/main/java/net/tfminecraft/simplefactions/managers/inventory/DeclareWarCreator.java
  • src/main/java/net/tfminecraft/simplefactions/war/core/WarCommandManager.java
  • src/main/java/net/tfminecraft/simplefactions/war/core/WarTabCompletion.java
  • src/main/java/net/tfminecraft/simplefactions/war/declare/DeJureAnnexEligibility.java
  • src/main/java/net/tfminecraft/simplefactions/war/resolution/WarOutcomeService.java
  • src/test/java/net/tfminecraft/simplefactions/war/core/WarCommandsCoverageTest.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

@github-actions github-actions Bot added the size:L 100-499 effective changed lines (tests excluded in mixed PRs). label Nov 30, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Drefvelin

Copy link
Copy Markdown
Contributor Author

Self-reviewed because CodeRabbit is rate-limited. Dev test (TFMCDev01, build of this PR merged with #259): from the console, war admin declare TheHolyOrder Thalendor de_jure_annex COUNTY_25 with Thalendor holding Essencia declared war #1 ("In its buildup; the first battle can be on 2026-12-07"), and both sides' members got the normal declare notice. war admin demand 1 attacker open_market set the second demand, war admin buildup 1 status answered from the console, and war admin end 1 from the console was refused with the list of console subcommands.

@Drefvelin
Drefvelin merged commit 7124e88 into main Nov 30, 2026
3 checks passed
@Drefvelin
Drefvelin deleted the feat/annex-held-titles-console-declare branch November 30, 2026 06:01
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