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.
-
Field Summary
Fields inherited from class AbstractEntity
colonyId, id, location -
Constructor Summary
ConstructorsConstructorDescriptionHostileOrganism(String id, Location location, int healthPoints, int attackDamage, int attackRange, int maxHealthPoints) -
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
-
HostileOrganism
public HostileOrganism() -
HostileOrganism
-
-
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
-