Class InventoryComponent

java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.player.InventoryComponent

public class InventoryComponent extends Component
A component intended to be used by the player to track their inventory. Currently only stores the gold and stone amount but can be extended for more advanced functionality such as storing items. Can also be used as a more generic component for other entities.
  • Constructor Details

    • InventoryComponent

      public InventoryComponent(int gold, int stone, int wood)
  • Method Details

    • setWeapon

      public void setWeapon(Equipments weapon)
    • setArmor

      public void setArmor(Equipments armor)
    • getWeapon

      public Equipments getWeapon()
    • getArmor

      public Equipments getArmor()
    • getGold

      public int getGold()
      Returns the player's gold.
      Returns:
      entity's gold
    • getStone

      public int getStone()
      Returns the player's stone.
      Returns:
      entity's stone
    • getWood

      public int getWood()
      Returns the player's wood.
      Returns:
      entity's wood
    • hasGold

      public Boolean hasGold(int gold)
      Returns if the player has a certain amount of gold.
      Parameters:
      gold - required amount of gold
      Returns:
      player has greater than or equal to the required amount of gold
    • hasStone

      public Boolean hasStone(int stone)
      Returns if the player has a certain amount of stone.
      Parameters:
      stone - required amount of stone
      Returns:
      player has greater than or equal to the required amount of stone
    • hasWood

      public Boolean hasWood(int wood)
      Returns if the player has a certain amount of wood.
      Parameters:
      wood - required amount of stone
      Returns:
      player has greater than or equal to the required amount of wood
    • setGold

      public void setGold(int gold)
      Sets the player's gold. Gold has a minimum bound of 0.
      Parameters:
      gold - gold
    • setStone

      public void setStone(int stone)
      Sets the player's stone. Stone has a minimum bound of 0.
      Parameters:
      stone - currency stone
    • setWood

      public void setWood(int wood)
      Sets the player's wood. Stone has a minimum bound of 0.
      Parameters:
      wood - currency wood
    • addGold

      public void addGold(int gold)
      Adds to the player's gold. The amount added can be negative.
      Parameters:
      gold - gold to add
    • addStone

      public void addStone(int stone)
      Adds to the player's stone. The amount added can be negative.
      Parameters:
      stone - stone to add
    • addWood

      public void addWood(int wood)
      Adds to the player's wood. The amount added can be negative.
      Parameters:
      wood - stone to add
    • addResources

      public void addResources(ResourceType resourceType, int amount)
    • setEquipmentList

      public void setEquipmentList(List<Equipments> equipmentsList)
    • getEquipmentList

      public List<Equipments> getEquipmentList()
    • addEquipmentToList

      public void addEquipmentToList(Equipments equipment)
    • countInEquipmentList

      public int countInEquipmentList(Equipments equipment)
    • setItems

      public void setItems(HashMap<Artefact,Integer> items)
    • setBuildings

      public void setBuildings(HashMap<ShopBuilding,Integer> buildings)
    • addBuilding

      public void addBuilding(ShopBuilding building)
    • removeBuilding

      public void removeBuilding(ShopBuilding building)
    • getBuildingCount

      public int getBuildingCount(ShopBuilding building)
    • getBuildings

      public HashMap<ShopBuilding,Integer> getBuildings()
    • addItems

      public void addItems(Artefact item)
    • useItem

      public Boolean useItem(Artefact item)
    • placeBuilding

      public Boolean placeBuilding(ShopBuilding building)
    • getItems

      public HashMap<Artefact,Integer> getItems()
    • getItemCount

      public int getItemCount(Artefact item)