Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.58 KB

README.md

File metadata and controls

31 lines (23 loc) · 1.58 KB

core-unit

Contains the core models relating to Units.

The primary model, Unit, stores related state objects (Player, City, Tile, Yields, Actions) and convenience methods for accessing and modifying these.

A key component of a Unit is its ability to perform Actions. This package includes a DelayedAction class which can easily wrap any Actions that take time to be carried out (BuildIrrigation, Fortify, etc.).

There's also a UnitRegistry which can be used to retrieve Units by City, Player or Tile.

Various base Yields are included to represent the values of the Unit.

When this package is included in your build of civ-clone, it will automatically provide the AdditionalData key units for City, Player and Tileobjects as a convenience method.

Includes the following Rules:

  • Action for controlling which Actions are available to the Unit.
  • Activate triggers actions when a Unit is Unit.activated.
  • Busy for tracking if DelayedActions are complete.
  • CannotSupportUnit triggered when a City cannot support a Unit for whatever reason.
  • Created when Units are created.
  • Defeated " " defeated.
  • Destroyed " " destroyed.
  • Moved " " moved.
  • MovementCost which controls the cost of moving the Unit.
  • ValidateMove to confirm if the Action was successful or not.
  • Visibility for applying the results of the Units Visibility Yield to the PlayerWorld.
  • Yield controls the various Yields applicable for the Unit (Attack, Defence, Movement, Visibility).