Package pvzclone.model.impl
Class PlantImpl
java.lang.Object
pvzclone.model.impl.PlantImpl
- All Implemented Interfaces:
ActiveEntities,Entities,Plant
class that implements Plant interface.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongdoublelongintReturns the cost of the plant.doublebooleanisAlive()voidreceiveDamage(double damageReceived) This method decreases Health Points.voidsetLastTimeAttack(long lastTimeAttack) Sets the respective field.
-
Field Details
-
PLANT_COST
public static final int PLANT_COSTis 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 doremainingLife- is the remaining life of the plantentityName- is the name of the entity, for the plant is "plant"position- is the position of the plantcooldown- is the time between two attack of the plant
-
-
Method Details
-
getDamage
public double getDamage()- Specified by:
getDamagein interfaceActiveEntities- Returns:
- entity's Attack Damage.
-
getRemainingLife
public double getRemainingLife()- Specified by:
getRemainingLifein interfaceActiveEntities- Returns:
- entity's Health Points.
-
getPosition
- Specified by:
getPositionin interfaceEntities- Returns:
- position of the entity.
-
isAlive
public boolean isAlive() -
getEntityName
- Specified by:
getEntityNamein interfaceEntities- Returns:
- name of the entity.
-
receiveDamage
public void receiveDamage(double damageReceived) Description copied from interface:ActiveEntitiesThis method decreases Health Points.- Specified by:
receiveDamagein interfaceActiveEntities- Parameters:
damageReceived- Attack Damage that entity has received.
-
getCooldown
public long getCooldown()- Specified by:
getCooldownin interfaceActiveEntities- Returns:
- time needed to start and finish an attack.
-
setLastTimeAttack
public void setLastTimeAttack(long lastTimeAttack) Description copied from interface:ActiveEntitiesSets the respective field.- Specified by:
setLastTimeAttackin interfaceActiveEntities- Parameters:
lastTimeAttack- time since the last attack.
-
getLastTimeAttack
public long getLastTimeAttack()- Specified by:
getLastTimeAttackin interfaceActiveEntities- Returns:
- time since the last attack.
-
getPlantCost
public int getPlantCost()Description copied from interface:PlantReturns the cost of the plant.- Specified by:
getPlantCostin interfacePlant- Returns:
- cost to buy the plant.
-