Class DamageReductionComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.boss.DamageReductionComponent
Adds a damage reduction component
while activated, reduces the "determined damage" by a certain percentage (1 = complete immunity)
over a specified duration.
Does not modify health or affect "damage output"
requires calling
apply(int)
before deducting health.-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
apply
(int incoming) Applies a reduction to incoming damage returns unchanged if not active orincoming <= 0
.boolean
isActive()
void
start
(float reduction, float durationSec) Enable damage reductionreduction
∈ [0,1]durationSec
is the duration in seconds.void
stop()
void
update()
Called once per frame of the game, and should be used for most component logic.Methods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
DamageReductionComponent
public DamageReductionComponent()
-
-
Method Details
-
start
public void start(float reduction, float durationSec) Enable damage reductionreduction
∈ [0,1]durationSec
is the duration in seconds. -
stop
public void stop() -
update
public void update()Description copied from class:Component
Called once per frame of the game, and should be used for most component logic. Not called if component is disabled. -
apply
public int apply(int incoming) Applies a reduction to incoming damage returns unchanged if not active orincoming <= 0
. The return value is the rounded damage. -
isActive
public boolean isActive()
-