Class DamageReductionComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.boss.DamageReductionComponent

public class DamageReductionComponent extends Component
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.
  • Constructor Details

    • DamageReductionComponent

      public DamageReductionComponent()
  • Method Details

    • start

      public void start(float reduction, float durationSec)
      Enable damage reduction reduction ∈ [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.
      Overrides:
      update in class Component
    • apply

      public int apply(int incoming)
      Applies a reduction to incoming damage returns unchanged if not active or incoming <= 0. The return value is the rounded damage.
    • isActive

      public boolean isActive()