Class Inventory

java.lang.Object
com.takenoko.inventory.Inventory

public class Inventory extends Object
Inventory contains elements stored by player
  • Field Details

  • Constructor Details

    • Inventory

      public Inventory(Map<TileColor,InventoryBambooStack> bambooStacks, InventoryImprovements inventoryImprovements)
      Constructor
      Parameters:
      bambooStacks - bamboo stacks
      inventoryImprovements - improvements
    • Inventory

      public Inventory(Map<TileColor,InventoryBambooStack> bambooStacks)
      Constructor
      Parameters:
      bambooStacks - bamboo stacks
    • Inventory

      public Inventory()
      Constructor
    • Inventory

      public Inventory(Inventory inventory)
      Constructor
      Parameters:
      inventory - inventory
  • Method Details

    • collectBamboo

      public void collectBamboo(TileColor tileColor)
      add 1 bamboo to the inventory
    • storeImprovement

      public void storeImprovement(ImprovementType improvementType)
      Parameters:
      improvementType - store an improvement in order to use it later on
    • useImprovement

      public void useImprovement(ImprovementType improvementType)
      Parameters:
      improvementType - use improvement previously stored
    • getBambooCount

      public int getBambooCount()
      Returns:
      number of bamboos in Inventory
    • getBambooCount

      public int getBambooCount(TileColor tileColor)
      Return the number of bamboo of a specific color
      Parameters:
      tileColor - color of bamboo
      Returns:
      number of bamboos in Inventory
    • getBambooStack

      public InventoryBambooStack getBambooStack(TileColor tileColor)
      Returns:
      the bambooStack
    • getInventoryImprovements

      public InventoryImprovements getInventoryImprovements()
      Returns:
      the list of stored improvements
    • collectIrrigationChannel

      public void collectIrrigationChannel()
    • getIrrigationChannelsCount

      public int getIrrigationChannelsCount()
    • useIrrigationChannel

      public void useIrrigationChannel()
    • clear

      public void clear()
      reset inventory
    • copy

      public Inventory copy()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • hasImprovement

      public boolean hasImprovement(ImprovementType improvementType)
      Method to verify whether the inventory contains the improvement type specified or not
      Parameters:
      improvementType - improvement type
    • hasImprovement

      public boolean hasImprovement()
      Method to verify whether the inventory contains any improvement or not
      Returns:
      true if the inventory contains any improvement, false otherwise
    • useBamboo

      public void useBamboo(Map<TileColor,Integer> bambooTarget)
      Remove bamboo from the player's inventory when an objective is redeemed
      Parameters:
      bambooTarget - how many bamboo to use
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getImprovementCount

      public int getImprovementCount(ImprovementType improvementType)