Class: DefenseManager

DefenseManager()

new DefenseManager()

Source:

Methods

checkEvents()

If our defense structures are attacked, garrison soldiers inside when possible and if a support unit is attacked and has less than 55% health, garrison it inside the nearest healing structure and if a ranged siege unit (not used for defense) is attacked, garrison it in the nearest fortress. If our hero is attacked with regicide victory condition, the victoryManager will handle it.
Source:

garrisonAttackedUnit()

Garrison a hurt unit inside a player-owned or allied structure. If emergency is true, the unit will be garrisoned in the closest possible structure. Otherwise, it will garrison in the closest healing structure.
Source:

garrisonSiegeUnit()

Garrison a attacked siege ranged unit inside the nearest fortress.
Source:

GetCooperationLevel()

Be more inclined to help an ally attacked by several enemies.
Source:

switchToAttack()

Switch a defense army into an attack if needed.
Source: