java.lang.Object
com.csse3200.game.components.collectables.effects.AddUpgrade
All Implemented Interfaces:
ItemEffectHandler

public class AddUpgrade extends Object implements ItemEffectHandler
Adds an upgrade to the player's inventory and updates stats.
  • Constructor Details

    • AddUpgrade

      public AddUpgrade()
  • Method Details

    • apply

      public boolean apply(Entity player, EffectConfig cfg)
      Applies the upgrade effect to the given player.
      Specified by:
      apply in interface ItemEffectHandler
      Parameters:
      player - the player entity that should receive the upgrade
      cfg - the effect configuration specifying the target upgrade
      Returns:
      true if the upgrade was successfully applied, false if the player lacks an InventoryComponent or parameters were invalid
      Throws:
      IllegalArgumentException - if the cfg.target is null or blank