Class PlantImpl

java.lang.Object
pvzclone.model.impl.PlantImpl
All Implemented Interfaces:
ActiveEntities, Entities, Plant

public final class PlantImpl extends Object implements Plant
class that implements Plant interface.
  • Field Details

    • PLANT_COST

      public static final int PLANT_COST
      is the cost of the plant.
      See Also:
  • Constructor Details

    • PlantImpl

      public PlantImpl(double damage, double remainingLife, String entityName, Pair<Integer,Integer> position, long cooldown)
      Parameters:
      damage - is the damage that the plant do
      remainingLife - is the remaining life of the plant
      entityName - is the name of the entity, for the plant is "plant"
      position - is the position of the plant
      cooldown - is the time between two attack of the plant
  • Method Details

    • getDamage

      public double getDamage()
      Specified by:
      getDamage in interface ActiveEntities
      Returns:
      entity's Attack Damage.
    • getRemainingLife

      public double getRemainingLife()
      Specified by:
      getRemainingLife in interface ActiveEntities
      Returns:
      entity's Health Points.
    • getPosition

      public Pair<Integer,Integer> getPosition()
      Specified by:
      getPosition in interface Entities
      Returns:
      position of the entity.
    • isAlive

      public boolean isAlive()
      Specified by:
      isAlive in interface Entities
      Returns:
      life state of the entity.
    • getEntityName

      public String getEntityName()
      Specified by:
      getEntityName in interface Entities
      Returns:
      name of the entity.
    • receiveDamage

      public void receiveDamage(double damageReceived)
      Description copied from interface: ActiveEntities
      This method decreases Health Points.
      Specified by:
      receiveDamage in interface ActiveEntities
      Parameters:
      damageReceived - Attack Damage that entity has received.
    • getCooldown

      public long getCooldown()
      Specified by:
      getCooldown in interface ActiveEntities
      Returns:
      time needed to start and finish an attack.
    • setLastTimeAttack

      public void setLastTimeAttack(long lastTimeAttack)
      Description copied from interface: ActiveEntities
      Sets the respective field.
      Specified by:
      setLastTimeAttack in interface ActiveEntities
      Parameters:
      lastTimeAttack - time since the last attack.
    • getLastTimeAttack

      public long getLastTimeAttack()
      Specified by:
      getLastTimeAttack in interface ActiveEntities
      Returns:
      time since the last attack.
    • getPlantCost

      public int getPlantCost()
      Description copied from interface: Plant
      Returns the cost of the plant.
      Specified by:
      getPlantCost in interface Plant
      Returns:
      cost to buy the plant.