attack

final Unit attack(GameUnit from, GameUnit to)

Calculates and performs an attack from one GameUnit to another.

This method involves three steps:

  • calculating attack parameters based on from's color

  • changing hp of to accordingly

  • sending a HpChanged message to to

If from and to parent entities have the same GameEntity.FightEntity.teamId, no attack is performed.

Note: healing is considered a special kind of attack, where the damage value is negative.

Parameters

from

The unit that attacks to.

to

The unit being attacked by from.