Skip to content

Refactor Force and Monarch to Improve Encapsulation and Game Logic - #153

Open
JaskRendix wants to merge 1 commit into
FreeCol:sf-auto-mergefrom
JaskRendix:monarch
Open

JaskRendix wants to merge 1 commit into
FreeCol:sf-auto-mergefrom
JaskRendix:monarch

Conversation

@JaskRendix

Copy link
Copy Markdown

Changes:

  • moved several calculations from Monarch into Force to improve encapsulation
  • added isUnderprovisioned() to Force to determine whether naval capacity is sufficient for land units
  • added downsizeToLimit(double) to handle strength‑based downsizing of forces
  • added getCustomPrice(...) to compute mercenary pricing based on player‑specific purchase costs
  • added downsizeToPrice(...) to reduce a force until it fits within a player’s available gold
  • added scaleLandUnits(int) to support incremental growth of the Intervention Force
  • added copy() to allow safe simulation of force adjustments without modifying the original
  • simplified prepareToBoard(UnitType) to more cleanly ensure adequate naval transport capacity
  • updated Monarch to use high‑level Force methods instead of manually iterating over unit lists
  • simplified Intervention Force growth logic using new Force helpers
  • improved war support logic by using downsizeToLimit to avoid overpowered assistance
  • reduced duplication and clarified responsibilities: Monarch now decides when to act, while Force handles how to adjust units and capacity

@JaskRendix JaskRendix closed this Feb 1, 2026
@JaskRendix JaskRendix reopened this Aug 23, 2026
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