Contains the core models relating to Unit
s.
The primary model, Unit
, stores related state objects (Player
, City
, Tile
, Yield
s, Action
s) and
convenience methods for accessing and modifying these.
A key component of a Unit
is its ability to perform Action
s. This package includes a DelayedAction
class which can
easily wrap any Action
s that take time to be carried out (BuildIrrigation
, Fortify
, etc.).
There's also a UnitRegistry
which can be used to retrieve Unit
s by City
, Player
or Tile
.
Various base Yield
s 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 Tile
objects as a convenience method.
Includes the following Rule
s:
Action
for controlling whichAction
s are available to theUnit
.Activate
triggers actions when aUnit
isUnit.activate
d.Busy
for tracking ifDelayedAction
s are complete.CannotSupportUnit
triggered when aCity
cannot support aUnit
for whatever reason.Created
whenUnit
s are created.Defeated
" " defeated.Destroyed
" " destroyed.Moved
" " moved.MovementCost
which controls the cost of moving theUnit
.ValidateMove
to confirm if theAction
was successful or not.Visibility
for applying the results of theUnit
sVisibility
Yield
to thePlayerWorld
.Yield
controls the variousYield
s applicable for theUnit
(Attack
,Defence
,Movement
,Visibility
).