Class Effect

java.lang.Object
com.csse3200.game.effects.Effect
Direct Known Subclasses:
AreaEffect, HealthEffect, RapidFireEffect

public abstract class Effect extends Object
Base class for all gameplay effects that can be applied to entities.

Effects represent changes to an entity's state (e.g., health, stats, buffs, debuffs, or area-of-effect behavior). Subclasses must implement apply(Entity) to define how the effect modifies the target entity.

  • Constructor Details

    • Effect

      public Effect()
      Creates a new effect.

      This base constructor exists so subclasses can extend Effect without requiring their own explicit constructor if no initialization is needed.

  • Method Details

    • apply

      public abstract boolean apply(Entity entity)
      Applies this effect to the given entity.

      Implementations should define what happens when the effect is applied. If the effect cannot be applied (e.g., the entity is missing required components), the method should return false.

      Parameters:
      entity - the target entity
      Returns:
      true if the effect was successfully applied, false otherwise