Package com.csse3200.game.effects
Class HealthEffect
java.lang.Object
com.csse3200.game.effects.Effect
com.csse3200.game.effects.HealthEffect
An
Effect
that modifies an entity's health by applying
damage or healing.
The effect decreases the target entity's health by the specified
damage
amount when applied. A negative damage value can
be used to heal the entity instead.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
HealthEffect
public HealthEffect(int damage) Creates a new health effect.- Parameters:
damage
- the amount of health to subtract from the target entity; use negative values to heal
-
-
Method Details
-
apply
Applies the health effect to the given entity.If the entity has a
CombatStatsComponent
, its health is reduced bydamage
. Otherwise, the effect has no impact.
-