Class MazeCombatStatsComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.minigames.maze.components.MazeCombatStatsComponent

public class MazeCombatStatsComponent extends Component
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.
  • 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

      public void hit(MazeCombatStatsComponent attacker)
      Used when the player is hit by an entity and reduced health based on attackers base attack
      Parameters:
      attacker - the entity attacking the player