Package com.mygdx.game.PowerUps
Class PowerUp
- java.lang.Object
-
- com.mygdx.game.PowerUps.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 filePowerUp(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 themselvesboolean
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()
-
-
-
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 affectoperation
- The way the key is applied to the valuevalue
- The value that is applied to the keycost
- 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
-
-