Class Turret

All Implemented Interfaces:
DamageableEntity, DamageDealingEntity, Entity

public class Turret extends AbstractEntity implements DamageableEntity, DamageDealingEntity
A stationary defensive structure deployed by a colony via the OrbitalCallInCommand.DEPLOY_TURRET call-in.

Turrets act autonomously at the start of each turn, before player actions are resolved, automatically attacking the closest living entity within range that does not belong to the owning colony. A colony may have at most maxTurrets (MissionControl.maxTurrets()) concurrently deployed.

  • Constructor Details

    • Turret

      public Turret()
    • Turret

      public Turret(String id, Location location, String colonyId, 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