Class PowerUp


  • public class PowerUp
    extends java.lang.Object
    // Assessment 2 requirement // A PowerUp that can modify the value of any Ship for a limited or permanent amount of time.
    • Constructor Summary

      Constructors 
      Constructor Description
      PowerUp​(com.badlogic.gdx.utils.JsonValue settings)
      Create a PowerUp from the settings file
      PowerUp​(java.lang.String key, PowerUpOperation operation, float value, int cost, int duration)
      Create a PowerUp manually, used for testing.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void buyPowerUp()
      Removes plunder from the player in order to apply the power-up to themselves
      boolean CheckPermanent()
      Check whether the PowerUp is permanent or temporary.
      boolean CheckPowerUpDone()
      Check whether a PowerUp is done.
      boolean CheckPowerUpDone​(Pirate pirate)
      Check whether a PowerUp is done, and Disable it if so.
      void DisablePowerUp​(Pirate pirate)
      Remove PowerUp modifiers from a Pirate and reset to default.
      void EnablePowerUp​(Pirate pirate)
      Apply PowerUp modifiers to the Pirate.
      int getCost()  
      java.lang.String getName()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PowerUp

        public PowerUp​(java.lang.String key,
                       PowerUpOperation operation,
                       float value,
                       int cost,
                       int duration)
        Create a PowerUp manually, used for testing.
        Parameters:
        key - The key of the value to affect
        operation - The way the key is applied to the value
        value - The value that is applied to the key
        cost - The cost of the powerup
      • PowerUp

        public PowerUp​(com.badlogic.gdx.utils.JsonValue settings)
        Create a PowerUp from the settings file
        Parameters:
        settings - the json file containing the settings for the power up
    • Method Detail

      • EnablePowerUp

        public void EnablePowerUp​(Pirate pirate)
        Apply PowerUp modifiers to the Pirate.
        Parameters:
        pirate - The Pirate to apply the PowerUp to
      • CheckPermanent

        public boolean CheckPermanent()
        Check whether the PowerUp is permanent or temporary.
        Returns:
        True if the PowerUp is permanent
      • CheckPowerUpDone

        public boolean CheckPowerUpDone()
        Check whether a PowerUp is done.
        Returns:
        Whether the PowerUp is done or not
      • CheckPowerUpDone

        public boolean CheckPowerUpDone​(Pirate pirate)
        Check whether a PowerUp is done, and Disable it if so.
        Parameters:
        pirate - The Pirate class to disable the PowerUp for
        Returns:
        Whether the PowerUp is done or not
      • DisablePowerUp

        public void DisablePowerUp​(Pirate pirate)
        Remove PowerUp modifiers from a Pirate and reset to default.
        Parameters:
        pirate - The Pirate to return to normal
      • buyPowerUp

        public void buyPowerUp()
        Removes plunder from the player in order to apply the power-up to themselves
      • getName

        public java.lang.String getName()
        Returns:
        the name of the power-up
      • getCost

        public int getCost()
        Returns:
        the name of the power-up