Class SquadMember
java.lang.Object
idlab.colonyops.model.entities.AbstractEntity
idlab.colonyops.model.entities.SquadMember
- All Implemented Interfaces:
DamageableEntity, DamageDealingEntity, Entity
A member of a colony's extraction squad — the only entity type directly controlled by the
player's logic, via
Actions returned from
POST /missions/{missionId}/request-action.
A squad member carries at most one Weapon and one Consumable at a time, and
gathers resources into its ResourceCrate. When getHealthPoints() reaches zero
the member is killed and becomes a lootable corpse for a limited number of turns.
-
Field Summary
Fields inherited from class AbstractEntity
colonyId, id, location -
Constructor Summary
ConstructorsConstructorDescriptionSquadMember(String id, Location location, String colonyId, String name, ResourceCrate resourceCrate, int healthPoints, int armourRating, Weapon weaponSlot, Consumable consumableSlot, int maxHealthPoints) -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyDamage(int damage) Reduces health points bydamage, clamped to zero.voidattack(DamageableEntity target) Attackstargetwith the equipped weapon, consuming one use unless the weapon has unlimited uses.intintintintintgetName()intbooleanisAlive()voidsetArmourRating(int armourRating) voidsetConsumableSlot(Consumable consumableSlot) voidsetHealthPoints(int healthPoints) voidsetMaxHealthPoints(int maxHealthPoints) voidvoidsetResourceCrate(ResourceCrate resourceCrate) voidsetTurnDied(int turnDied) voidsetWeaponSlot(Weapon weaponSlot) 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
-
SquadMember
public SquadMember() -
SquadMember
public SquadMember(String id, Location location, String colonyId, String name, ResourceCrate resourceCrate, int healthPoints, int armourRating, Weapon weaponSlot, Consumable consumableSlot, int maxHealthPoints)
-
-
Method Details
-
getName
-
setName
-
getResourceCrate
-
setResourceCrate
-
getHealthPoints
public int getHealthPoints()- Specified by:
getHealthPointsin interfaceDamageableEntity
-
setHealthPoints
public void setHealthPoints(int healthPoints) - Specified by:
setHealthPointsin interfaceDamageableEntity
-
getArmourRating
public int getArmourRating()- Returns:
- the percentage by which incoming damage is reduced
-
setArmourRating
public void setArmourRating(int armourRating) -
getWeaponSlot
- Returns:
- the currently equipped weapon, or
nullif the weapon slot is empty
-
setWeaponSlot
-
getConsumableSlot
- Returns:
- the currently active consumable, or
nullif none is active
-
setConsumableSlot
-
getMaxHealthPoints
public int getMaxHealthPoints() -
setMaxHealthPoints
public void setMaxHealthPoints(int maxHealthPoints) -
getTurnDied
public int getTurnDied()- Returns:
- the turn number on which this member died, or
-1if still alive
-
setTurnDied
public void setTurnDied(int turnDied) -
calcAttackDamage
public int calcAttackDamage()- Specified by:
calcAttackDamagein interfaceDamageDealingEntity- Returns:
- the equipped weapon's damage, or
0if no weapon is equipped
-
calcMaxAttackRange
public int calcMaxAttackRange()- Specified by:
calcMaxAttackRangein interfaceDamageDealingEntity- Returns:
- the equipped weapon's range, or
0if no weapon is equipped
-
attack
Attackstargetwith the equipped weapon, consuming one use unless the weapon has unlimited uses. Does nothing if no weapon is equipped or it has no uses left.- 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
-