Class: DefenseArmy

DefenseArmy()

Armies used by the defense manager. An army is a collection of own entities and enemy entities. Types of armies: "default": army to counter an invading army "capturing": army set to capture a gaia building or recover capture points to one of its own structures It must contain only one foe (the building to capture) and never be merged

Constructor

new DefenseArmy()

Source:

Methods

addFoe()

add an entity to the enemy army Will return true if the entity was added and false otherwise. won't recalculate our position but will dirty it. force is true at army creation or when merging armies, so in this case we should add it even if far
Source:

addOwn()

adds a defender but doesn't assign him yet. force is true when merging armies, so in this case we should add it even if no position as it can be in a ship
Source:

clear()

resets the army properly. assumes we already cleared dead units.
Source:

evaluateStrength()

adds or remove the strength of the entity either to the enemy or to our units.
Source:

merge()

merge this army with another properly. assumes units are in only one army. also assumes that all have been properly cleaned up (no dead units).
Source:

recalculatePosition()

if not forced, will only recalculate if on a different turn.
Source:

removeFoe()

returns true if the entity was removed and false otherwise. TODO: when there is a technology update, we should probably recompute the strengths, or weird stuffs will happen.
Source: