Package com.deco2800.game.components
Class CombatStatsComponent
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.CombatStatsComponent
Component used to store information related to combat such as health, attack, etc. Any entities
 which engage it combat should have an instance of this class registered. This class can be
 extended for more specific combat needs.
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddHealth(int health) Adds to the player's health.voidaddMana(int mana) Adds to the player's mana.voidaddStamina(int stamina) Adds to the player's stamina.booleancheckMana(int mana) check whether the mana is enoughbooleancheckStamina(int stamina) check whether the stamina is enoughvoidcreate()Called when the entity is created and registered.voidMethod that picks a random material on the map to drop once an enemy is killed.voidIf the current entity is a player, then the function is called on a key press and drops a weapon on the map only if the player is equipped with a weapon.intReturns the entity's base attack damage.floatReturns the current damageReduction stat.floatReturns the current damageReturn stat.intReturns the entity's health.intgetMana()Returns the entity's mana.intGets the entity's mana regeneration rate.intGets the player's maximum manaintGets the player's maximum stamina.intReturns the entity's stamina.intGets the entity's stamina regeneration rate.voidhit(CombatStatsComponent attacker) Reduce entity health due to an attack.isDead()Returns true if the entity's has 0 health, otherwise false.voidreduceHealth(int health) voidsetBaseAttack(int attack) Sets the entity's attack damage.voidsetDamageReduction(float damageReduction) Sets the entity's damage reduction.voidsetDamageReturn(float damageReturn) Sets the entity's damage return.voidsetHealth(int health) Sets the entity's health.voidsetMana(int mana) Sets the entity's mana.voidsetManaRegenerationRate(int manaRegenerationRate) Sets the entity's RegenerationRate regeneration rate.voidsetMaxMana(int maxMana) Sets the entity's maximum mana.voidsetMaxStamina(int maxStamina) Sets the entity's maximum stamina.voidsetStamina(int stamina) Sets the entity's stamina.voidsetStaminaRegenerationRate(int staminaRegenerationRate) Sets the entity's stamina regeneration rate.Methods inherited from class com.deco2800.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update 
- 
Field Details
- 
playerWeapon
 
 - 
 - 
Constructor Details
- 
CombatStatsComponent
public CombatStatsComponent(int health, int baseAttack, int stamina, int mana)  
 - 
 - 
Method Details
- 
create
public void create()Description copied from class:ComponentCalled when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished. - 
isDead
Returns true if the entity's has 0 health, otherwise false.- Returns:
 - is player dead
 
 - 
getHealth
public int getHealth()Returns the entity's health.- Returns:
 - entity's health
 
 - 
setHealth
public void setHealth(int health) Sets the entity's health. Health has a minimum bound of 0.- Parameters:
 health- health
 - 
addHealth
public void addHealth(int health) Adds to the player's health. The amount added can be negative.- Parameters:
 health- health to add
 - 
reduceHealth
public void reduceHealth(int health)  - 
getBaseAttack
public int getBaseAttack()Returns the entity's base attack damage.- Returns:
 - base attack damage
 
 - 
setBaseAttack
public void setBaseAttack(int attack) Sets the entity's attack damage. Attack damage has a minimum bound of 0.- Parameters:
 attack- Attack damage
 - 
hit
Reduce entity health due to an attack. Decreases by the damage reduction multiplier. If the attacker is a player, checks if the player has any weapon equipped, and use the damage of the weapon instead of the player's base attack damage.- Parameters:
 attacker- Attacking entity combatstats component
 - 
getStamina
public int getStamina()Returns the entity's stamina.- Returns:
 - entity's stamina
 
 - 
setStamina
public void setStamina(int stamina) Sets the entity's stamina. Stamina has a minimum bound of 0 and a maximum bound of the max stamina.- Parameters:
 stamina- stamina
 - 
addStamina
public void addStamina(int stamina) Adds to the player's stamina. The amount added can be negative.- Parameters:
 stamina- stamina to add
 - 
getMaxStamina
public int getMaxStamina()Gets the player's maximum stamina.- Returns:
 - maxStamina player's maximum stamina.
 
 - 
setMaxStamina
public void setMaxStamina(int maxStamina) Sets the entity's maximum stamina. Max stamina has a minimum bound of 0.- Parameters:
 maxStamina- player's maximum stamina.
 - 
setStaminaRegenerationRate
public void setStaminaRegenerationRate(int staminaRegenerationRate) Sets the entity's stamina regeneration rate.- Parameters:
 staminaRegenerationRate- entity's stamina regeneration rate
 - 
getStaminaRegenerationRate
public int getStaminaRegenerationRate()Gets the entity's stamina regeneration rate.- Returns:
 - staminaRegenerationRate entity's stamina regeneration rate
 
 - 
getMana
public int getMana()Returns the entity's mana.- Returns:
 - entity's mana
 
 - 
setMana
public void setMana(int mana) Sets the entity's mana. Stamina has a minimum bound of 0 and a maximum bound of the max mana.- Parameters:
 mana- mana
 - 
addMana
public void addMana(int mana) Adds to the player's mana. The amount added can be negative.- Parameters:
 mana- mana to add
 - 
getMaxMana
public int getMaxMana()Gets the player's maximum mana- Returns:
 - maxMana player's maximum mana.
 
 - 
setMaxMana
public void setMaxMana(int maxMana) Sets the entity's maximum mana. Max mana has a minimum bound of 0.- Parameters:
 maxMana- player's maximum mana.
 - 
setManaRegenerationRate
public void setManaRegenerationRate(int manaRegenerationRate) Sets the entity's RegenerationRate regeneration rate.- Parameters:
 manaRegenerationRate- entity's stamina regeneration rate
 - 
getManaRegenerationRate
public int getManaRegenerationRate()Gets the entity's mana regeneration rate.- Returns:
 - manaRegenerationRate entity's mana regeneration rate
 
 - 
checkMana
public boolean checkMana(int mana) check whether the mana is enough- Parameters:
 mana-- Returns:
 
 - 
checkStamina
public boolean checkStamina(int stamina) check whether the stamina is enough- Parameters:
 stamina-- Returns:
 
 - 
setDamageReduction
public void setDamageReduction(float damageReduction) Sets the entity's damage reduction. Damage reduction damage has a minimum bound of 0.- Parameters:
 damageReduction- Attack damage
 - 
getDamageReduction
public float getDamageReduction()Returns the current damageReduction stat.- Returns:
 - The float value of damageReduction.
 
 - 
getDamageReturn
public float getDamageReturn()Returns the current damageReturn stat.- Returns:
 - The float value of damageReturn.
 
 - 
setDamageReturn
public void setDamageReturn(float damageReturn) Sets the entity's damage return. Damage reduction damage has a minimum bound of 0.- Parameters:
 damageReturn-
 - 
dropWeapon
public void dropWeapon()If the current entity is a player, then the function is called on a key press and drops a weapon on the map only if the player is equipped with a weapon. If the current entity is an enemy, then the function is called when the enemy is dead and a weapon is dropped below the enemy. - 
dropMaterial
public void dropMaterial()Method that picks a random material on the map to drop once an enemy is killed. 20% change of gold 10% chance of silver 10% chance of rubber 10% chance of platinum 10% chance of iron 10% chance of wood 10% chance of steel 
 -