Class Memento

java.lang.Object
com.deco2800.game.memento.Memento

public class Memento extends Object
the object that is maintaining the state of the originator. Memento can only be created, not changed, this is to ensure the states of the player is properly saved and have no possibility of being altered, any changes to the player state should be saved into another memento
  • Constructor Details

    • Memento

      public Memento(int state, int gold, int stone, int wood, int currentHealth, HashMap<Artefact,Integer> items, HashMap<ShopBuilding,Integer> buildings, int attack, int defense, Equipments weapon, Equipments armor, List<Equipments> equipmentsList)
      constructor for a new memento
      Parameters:
      state - - the id of the saved memento
      gold - - amount of gold that the player currently holds
      stone - - amount of stone that the player currently holds
      wood - - amount of wood that the player currently holds
      currentHealth - - amount of health that the player currently has
      items - - list of items the player have
      attack - - base attack value of the player (including weapon boost)
      defense - - defense multiplier from armor
      weapon - - current weapon
      armor - - current armor
  • Method Details

    • getState

      public int getState()
      retrieve id of the memento
      Returns:
      - id of the memento
    • getGold

      public int getGold()
      retrieve the gold amount saved in the memento
      Returns:
      - gold amount
    • getStone

      public int getStone()
      retrieve the stone amount saved in the memento
      Returns:
      - stone amount
    • getWood

      public int getWood()
      retrieve the wood amount saved in the memento
      Returns:
      - wood amount
    • getCurrentHealth

      public int getCurrentHealth()
      retrieve the health value saved in the memento
      Returns:
      - health value
    • getAttack

      public int getAttack()
      retrieve the attack value saved in the memento
      Returns:
      - base attack value
    • getDefense

      public int getDefense()
      retrieve the defense multiplier in the memento
      Returns:
      - defense multiplier
    • getWeapon

      public Equipments getWeapon()
      retrieve the weapon that the player currently has
      Returns:
      - currently held weapon
    • getArmor

      public Equipments getArmor()
      retrieve the armor that the player currently has
      Returns:
      - current armor
    • getItemList

      public HashMap<Artefact,Integer> getItemList()
      retrieve the list of artefact items saved in the memento
      Returns:
      - list of artefact items
    • getEquipmentsList

      public List<Equipments> getEquipmentsList()
    • getBuildings

      public HashMap<ShopBuilding,Integer> getBuildings()