Class BossDefenseComponent

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

public class BossDefenseComponent extends Component
Trigger for the boss's defense phase (one-time).

When health ≤ triggerHp, activate DamageReductionComponent (lasts durationSec seconds, reducing/avoiding damage by reduction). Optionally disables self-damage during the defense phase (via WeaponsStatsComponent.setDisableDamage(boolean)).

Requires both CombatStatsComponent and DamageReductionComponent to be attached to the entity.

  • Constructor Details

    • BossDefenseComponent

      public BossDefenseComponent(float durationSec, float reduction, int triggerHp, boolean closeAttackWhileDefending)
      Parameters:
      durationSec - Defense duration (seconds)
      reduction - Damage reduction ratio, range [0, 1] (1 represents complete immunity)
      triggerHp - Trigger threshold: Current HP ≤ this value triggers the attack
      closeAttackWhileDefending - Whether to close self-damage during defense
  • Method Details

    • 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