Package com.csse3200.game.components
Class DefenderStatsComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.CombatStatsComponent
com.csse3200.game.components.DefenderStatsComponent
An extensions of CombatStatsComponent for defender-type entities.
This component stores additional combat-related stats beyond health and base attack, such as range, attack speed, and critical hit chance.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDefenderStatsComponent
(int health, int baseAttack, int type, int range, int state, int attackSpeed, int critChance) Creates a new DefenceStatsComponent with the given stats. -
Method Summary
Modifier and TypeMethodDescriptionint
int
int
getRange()
int
getState()
int
getType()
void
setAttackSpeed
(int attackSpeed) Sets the defender's attack speed.void
setCritChance
(int critChance) Sets the defender's critical hit chance (as a percentage).void
setRange
(int range) Sets the defender's attack range.void
setState
(int state) Sets the defender's current state.void
setType
(int type) Sets the type of defender.Methods inherited from class com.csse3200.game.components.CombatStatsComponent
addHealth, getBaseAttack, getHealth, handleDeath, hit, isDead, setBaseAttack, setHealth
Methods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, getPriority, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
DefenderStatsComponent
public DefenderStatsComponent(int health, int baseAttack, int type, int range, int state, int attackSpeed, int critChance) Creates a new DefenceStatsComponent with the given stats.- Parameters:
health
- the maximum health of the defenderbaseAttack
- the base attack damagetype
- the type identifier of this defenderrange
- the maximum attack rangestate
- the current combat/behavioural stateattackSpeed
- the speed of attackscritChance
- the critical hit chance
-
-
Method Details
-
setType
public void setType(int type) Sets the type of defender. -
getType
public int getType()- Returns:
- the defender type identifier
-
setRange
public void setRange(int range) Sets the defender's attack range. -
getRange
public int getRange()- Returns:
- the defender's maximum attack range
-
setState
public void setState(int state) Sets the defender's current state. -
getState
public int getState()- Returns:
- the defender's current state
-
setAttackSpeed
public void setAttackSpeed(int attackSpeed) Sets the defender's attack speed. -
getAttackSpeed
public int getAttackSpeed()- Returns:
- the defender's attack speed
-
setCritChance
public void setCritChance(int critChance) Sets the defender's critical hit chance (as a percentage). -
getCritChance
public int getCritChance()- Returns:
- the defender's critical hit chance (percentage)
-