Class Turret
java.lang.Object
idlab.colonyops.model.entities.AbstractEntity
idlab.colonyops.model.entities.Turret
- All Implemented Interfaces:
DamageableEntity, DamageDealingEntity, Entity
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.
-
Field Summary
Fields inherited from class AbstractEntity
colonyId, id, location -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyDamage(int damage) Reduces health points bydamage, clamped to zero.voidattack(DamageableEntity target) Attackstarget, applying this entity's attack damage to it.intintintintintintbooleanisAlive()voidsetAttackDamage(int attackDamage) voidsetAttackRange(int attackRange) voidsetHealthPoints(int healthPoints) voidsetMaxHealthPoints(int maxHealthPoints) Methods inherited from class AbstractEntity
equals, getColonyId, getId, getLocation, hashCode, setColonyId, setId, setLocationMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Entity
getColonyId, getId, getLocation, setColonyId, setId, setLocation
-
Constructor Details
-
Turret
public Turret() -
Turret
-
-
Method Details
-
getHealthPoints
public int getHealthPoints()- Specified by:
getHealthPointsin interfaceDamageableEntity
-
setHealthPoints
public void setHealthPoints(int healthPoints) - Specified by:
setHealthPointsin interfaceDamageableEntity
-
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:
calcAttackDamagein interfaceDamageDealingEntity- Returns:
- the damage dealt per attack
-
calcMaxAttackRange
public int calcMaxAttackRange()- Specified by:
calcMaxAttackRangein interfaceDamageDealingEntity- Returns:
- the maximum Chebyshev distance at which this entity can attack a target
-
attack
Description copied from interface:DamageDealingEntityAttackstarget, applying this entity's attack damage to it.- Specified by:
attackin interfaceDamageDealingEntity- Parameters:
target- the entity to attack; expected to be withinDamageDealingEntity.calcMaxAttackRange()
-
isAlive
public boolean isAlive()- Specified by:
isAlivein interfaceDamageableEntity- Returns:
trueif health points are above zero
-
applyDamage
public void applyDamage(int damage) Description copied from interface:DamageableEntityReduces health points bydamage, clamped to zero.- Specified by:
applyDamagein interfaceDamageableEntity- Parameters:
damage- the amount of HP to remove
-