Class PotionEffectComponent

java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.player.PotionEffectComponent

public class PotionEffectComponent extends Component
  • Constructor Details

    • PotionEffectComponent

      public PotionEffectComponent(short targetLayer, String effectType)
      Component that affects entities on collision.
      Parameters:
      targetLayer - The physics layer of the target's collider.
  • Method Details

    • create

      public void create()
      Creates component attached to potion entity
      Overrides:
      create in class Component
    • getPotionEffect

      public String getPotionEffect()
      Returns component effect
    • equals

      public boolean equals(Entity other)
      Returns if the two potion has the same effect
      Parameters:
      other - the potion to be checked
      Returns:
      true if both have the same effect type, false otherwise
      Requires:
      potion.checkEntityType(EntityTypes.POTION) == true
    • equals

      public boolean equals(String effectType)
      Returns if the two potion has the same effect
      Parameters:
      effectType - the potion effect type
      Returns:
      true if the effect type matches, false otherwise
    • applyEffect

      public void applyEffect(Entity target)
      Applies component effect
      Parameters:
      target - - the target entity (player)