Class MazeCombatStatsComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.minigames.maze.components.MazeCombatStatsComponent
Component used to store information related to combat such as health, attack, etc. Any entities
which engage in combat should have an instance of this class registered. This class can be
extended for more specific combat needs.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addHealth
(int health) Adds to the player's health.int
Returns the entity's base attack damage.com.badlogic.gdx.math.Vector2
Get the base speed for this NPCint
Returns the entity's health.void
hit
(MazeCombatStatsComponent attacker) Used when the player is hit by an entity and reduced health based on attackers base attackvoid
setBaseAttack
(int attack) Sets the entity's attack damage.void
setBaseSpeed
(float speed) Sets the base speed for this entityvoid
setHealth
(int health) Sets the entity's health.Methods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
MazeCombatStatsComponent
public MazeCombatStatsComponent(int health, int baseAttack, float baseSpeed)
-
-
Method Details
-
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
-
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
-
getBaseSpeed
public com.badlogic.gdx.math.Vector2 getBaseSpeed()Get the base speed for this NPC- Returns:
- the speed
-
setBaseSpeed
public void setBaseSpeed(float speed) Sets the base speed for this entity- Parameters:
speed
- the speed to set to
-
hit
Used when the player is hit by an entity and reduced health based on attackers base attack- Parameters:
attacker
- the entity attacking the player
-