Class HostileOrganism

java.lang.Object
idlab.colonyops.model.entities.AbstractEntity
idlab.colonyops.model.entities.HostileOrganism
All Implemented Interfaces:
DamageableEntity, DamageDealingEntity, Entity

public class HostileOrganism extends AbstractEntity implements DamageableEntity, DamageDealingEntity
An alien creature native to the planet, not affiliated with any colony (AbstractEntity.getColonyId() is always null).

Hostile organisms are stationary and act autonomously at the start of each turn, before player actions are resolved: each attacks the closest squad member or turret within its range, regardless of colony. Strength varies from weak scouts to heavily armoured predators.

  • Constructor Details

    • HostileOrganism

      public HostileOrganism()
    • HostileOrganism

      public HostileOrganism(String id, Location location, int healthPoints, int attackDamage, int attackRange, int maxHealthPoints)
  • Method Details

    • getHealthPoints

      public int getHealthPoints()
      Specified by:
      getHealthPoints in interface DamageableEntity
    • setHealthPoints

      public void setHealthPoints(int healthPoints)
      Specified by:
      setHealthPoints in interface DamageableEntity
    • getAttackDamage

      public int getAttackDamage()
    • setAttackDamage

      public void setAttackDamage(int attackDamage)
    • getAttackRange

      public int getAttackRange()
    • setAttackRange

      public void setAttackRange(int attackRange)
    • getMaxHealthPoints

      public int getMaxHealthPoints()
    • setMaxHealthPoints

      public void setMaxHealthPoints(int maxHealthPoints)
    • calcAttackDamage

      public int calcAttackDamage()
      Specified by:
      calcAttackDamage in interface DamageDealingEntity
      Returns:
      the damage dealt per attack
    • calcMaxAttackRange

      public int calcMaxAttackRange()
      Specified by:
      calcMaxAttackRange in interface DamageDealingEntity
      Returns:
      the maximum Chebyshev distance at which this entity can attack a target
    • attack

      public void attack(DamageableEntity target)
      Description copied from interface: DamageDealingEntity
      Attacks target, applying this entity's attack damage to it.
      Specified by:
      attack in interface DamageDealingEntity
      Parameters:
      target - the entity to attack; expected to be within DamageDealingEntity.calcMaxAttackRange()
    • isAlive

      public boolean isAlive()
      Specified by:
      isAlive in interface DamageableEntity
      Returns:
      true if health points are above zero
    • applyDamage

      public void applyDamage(int damage)
      Description copied from interface: DamageableEntity
      Reduces health points by damage, clamped to zero.
      Specified by:
      applyDamage in interface DamageableEntity
      Parameters:
      damage - the amount of HP to remove