Package com.deco2800.game.memento
Class Memento
java.lang.Object
com.deco2800.game.memento.Memento
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 Summary
ConstructorsConstructorDescriptionMemento
(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 -
Method Summary
Modifier and TypeMethodDescriptiongetArmor()
retrieve the armor that the player currently hasint
retrieve the attack value saved in the mementoint
retrieve the health value saved in the mementoint
retrieve the defense multiplier in the mementoint
getGold()
retrieve the gold amount saved in the mementoretrieve the list of artefact items saved in the mementoint
getState()
retrieve id of the mementoint
getStone()
retrieve the stone amount saved in the mementoretrieve the weapon that the player currently hasint
getWood()
retrieve the wood amount saved in the 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 mementogold
- - amount of gold that the player currently holdsstone
- - amount of stone that the player currently holdswood
- - amount of wood that the player currently holdscurrentHealth
- - amount of health that the player currently hasitems
- - list of items the player haveattack
- - base attack value of the player (including weapon boost)defense
- - defense multiplier from armorweapon
- - current weaponarmor
- - 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
retrieve the weapon that the player currently has- Returns:
- - currently held weapon
-
getArmor
retrieve the armor that the player currently has- Returns:
- - current armor
-
getItemList
retrieve the list of artefact items saved in the memento- Returns:
- - list of artefact items
-
getEquipmentsList
-
getBuildings
-