Class Player

java.lang.Object
wizardquest.entity.Player
All Implemented Interfaces:
EntityInterface, PlayerInterface

public class Player extends Object implements PlayerInterface
  • Constructor Summary

    Constructors
    Constructor
    Description
    Player(DifficultyEnum difficulty)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    calcDamage(int base, DamageEnum type)
    Calculate the damage inflicted by one entity onto another.
    void
    gainCoins(int amount)
    Increases a player's coin total by a given amount.
    void
    gainMagic(int amount)
    Increases a player's magic points by a given amount.
    List the abilities that are currently usable by the entity.
    int
    Gets the amount of coins a player currently has.
    int
    Gets an entity's current health.
    int
    Gets the remaining lives that a player has in a session.
    int
    Gets the amount of magic points a player currently has.
    int
    Gets the rate at which a player's magic points regenerates between each stage.
    int
    Gets an entity's maximum health.
    int
    Gets the maximum amount of magic points a player can have.
    Get the enumerated type of the entity.
    List the upgrades that have been purchased between encounters by the player.
    void
    loseCoins(int amount)
    Decrements a player's coin total by a given amount.
    void
    loseHealth(int amount, DamageEnum type)
    Decrements an entity's health by a given amount, as a result of a certain damage type being inflicted upon them.
    void
    loseLives(int amount)
    Decrements a player's remaining lives by a given amount.
    void
    loseMagic(int amount)
    Decrements a player's magic total by a given amount.
    void
    Reset an entity's health to its starting value.
    void
    Resets the player's magic to 0.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • loseHealth

      public void loseHealth(int amount, DamageEnum type) throws IllegalArgumentException
      Description copied from interface: EntityInterface
      Decrements an entity's health by a given amount, as a result of a certain damage type being inflicted upon them.
      Specified by:
      loseHealth in interface EntityInterface
      Parameters:
      amount - the total health that the entity will lose.
      type - the inflicted damage type that has caused this health loss.
      Throws:
      IllegalArgumentException - if amount is not a non-negative number.
    • getHealth

      public int getHealth()
      Description copied from interface: EntityInterface
      Gets an entity's current health.
      Specified by:
      getHealth in interface EntityInterface
      Returns:
      the entity's current health.
    • getMaxHealth

      public int getMaxHealth()
      Description copied from interface: EntityInterface
      Gets an entity's maximum health.
      Specified by:
      getMaxHealth in interface EntityInterface
      Returns:
      the entity's maximum health.
    • calcDamage

      public int calcDamage(int base, DamageEnum type)
      Description copied from interface: EntityInterface
      Calculate the damage inflicted by one entity onto another. Applies damage type modifiers to the base damage to calculate the final amount.
      Specified by:
      calcDamage in interface EntityInterface
      Parameters:
      base - the base damage dealt by the entity's attack.
      type - the damage type of the entity's attack.
      Returns:
      the total damage inflicted by this attack.
    • getAbilities

      public List<AbilityEnum> getAbilities()
      Description copied from interface: EntityInterface
      List the abilities that are currently usable by the entity.
      Specified by:
      getAbilities in interface EntityInterface
      Returns:
      a list of abilities.
    • resetHealth

      public void resetHealth()
      Description copied from interface: EntityInterface
      Reset an entity's health to its starting value.
      Specified by:
      resetHealth in interface EntityInterface
    • getType

      public EntityEnum getType()
      Description copied from interface: EntityInterface
      Get the enumerated type of the entity.
      Specified by:
      getType in interface EntityInterface
      Returns:
      the entity type.
    • getCoins

      public int getCoins()
      Description copied from interface: PlayerInterface
      Gets the amount of coins a player currently has.
      Specified by:
      getCoins in interface PlayerInterface
      Returns:
      the player's current coin total.
    • loseCoins

      public void loseCoins(int amount) throws IllegalArgumentException
      Description copied from interface: PlayerInterface
      Decrements a player's coin total by a given amount.
      Specified by:
      loseCoins in interface PlayerInterface
      Parameters:
      amount - the total coins that the player will lose.
      Throws:
      IllegalArgumentException - if amount is not a non-negative number.
    • gainCoins

      public void gainCoins(int amount) throws IllegalArgumentException
      Description copied from interface: PlayerInterface
      Increases a player's coin total by a given amount.
      Specified by:
      gainCoins in interface PlayerInterface
      Parameters:
      amount - the total coins that the player will gain.
      Throws:
      IllegalArgumentException - if amount is not a non-negative number.
    • getMagic

      public int getMagic()
      Description copied from interface: PlayerInterface
      Gets the amount of magic points a player currently has.
      Specified by:
      getMagic in interface PlayerInterface
      Returns:
      the player's current magic total.
    • getMaxMagic

      public int getMaxMagic()
      Description copied from interface: PlayerInterface
      Gets the maximum amount of magic points a player can have.
      Specified by:
      getMaxMagic in interface PlayerInterface
      Returns:
      the player's maximum magic total.
    • getMagicRegenRate

      public int getMagicRegenRate()
      Description copied from interface: PlayerInterface
      Gets the rate at which a player's magic points regenerates between each stage.
      Specified by:
      getMagicRegenRate in interface PlayerInterface
      Returns:
      the player's magic regeneration rate per stage.
    • gainMagic

      public void gainMagic(int amount) throws IllegalArgumentException
      Description copied from interface: PlayerInterface
      Increases a player's magic points by a given amount.
      Specified by:
      gainMagic in interface PlayerInterface
      Parameters:
      amount - the total magic points that the player will gain.
      Throws:
      IllegalArgumentException - if amount is not a non-negative number.
    • loseMagic

      public void loseMagic(int amount) throws IllegalArgumentException
      Description copied from interface: PlayerInterface
      Decrements a player's magic total by a given amount.
      Specified by:
      loseMagic in interface PlayerInterface
      Parameters:
      amount - the total magic points that the player will lose.
      Throws:
      IllegalArgumentException - if amount is not a non-negative number.
    • getLives

      public int getLives()
      Description copied from interface: PlayerInterface
      Gets the remaining lives that a player has in a session.
      Specified by:
      getLives in interface PlayerInterface
      Returns:
      the player's total remaining lives.
    • loseLives

      public void loseLives(int amount) throws IllegalArgumentException
      Description copied from interface: PlayerInterface
      Decrements a player's remaining lives by a given amount.
      Specified by:
      loseLives in interface PlayerInterface
      Parameters:
      amount - the total lives that the player will lose.
      Throws:
      IllegalArgumentException - if amount is not a non-negative number.
    • getUpgrades

      public List<UpgradeEnum> getUpgrades()
      Description copied from interface: PlayerInterface
      List the upgrades that have been purchased between encounters by the player.
      Specified by:
      getUpgrades in interface PlayerInterface
      Returns:
      a list of purchased upgrades.
    • resetMagic

      public void resetMagic()
      Description copied from interface: PlayerInterface
      Resets the player's magic to 0.
      Specified by:
      resetMagic in interface PlayerInterface