Class SquadMember

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

public class SquadMember extends AbstractEntity implements DamageableEntity, DamageDealingEntity
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.

  • Constructor Details

  • Method Details

    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getResourceCrate

      public ResourceCrate getResourceCrate()
    • setResourceCrate

      public void setResourceCrate(ResourceCrate resourceCrate)
    • getHealthPoints

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

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

      public int getArmourRating()
      Returns:
      the percentage by which incoming damage is reduced
    • setArmourRating

      public void setArmourRating(int armourRating)
    • getWeaponSlot

      public Weapon getWeaponSlot()
      Returns:
      the currently equipped weapon, or null if the weapon slot is empty
    • setWeaponSlot

      public void setWeaponSlot(Weapon weaponSlot)
    • getConsumableSlot

      public Consumable getConsumableSlot()
      Returns:
      the currently active consumable, or null if none is active
    • setConsumableSlot

      public void setConsumableSlot(Consumable consumableSlot)
    • getMaxHealthPoints

      public int getMaxHealthPoints()
    • setMaxHealthPoints

      public void setMaxHealthPoints(int maxHealthPoints)
    • getTurnDied

      public int getTurnDied()
      Returns:
      the turn number on which this member died, or -1 if still alive
    • setTurnDied

      public void setTurnDied(int turnDied)
    • calcAttackDamage

      public int calcAttackDamage()
      Specified by:
      calcAttackDamage in interface DamageDealingEntity
      Returns:
      the equipped weapon's damage, or 0 if no weapon is equipped
    • calcMaxAttackRange

      public int calcMaxAttackRange()
      Specified by:
      calcMaxAttackRange in interface DamageDealingEntity
      Returns:
      the equipped weapon's range, or 0 if no weapon is equipped
    • attack

      public void attack(DamageableEntity target)
      Attacks target with 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:
      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