Class CraftingLogic

java.lang.Object
com.deco2800.game.crafting.CraftingLogic

public class CraftingLogic extends Object
Supporting class containing static methods that can be used to support other classes in using the crafting system. Contains information about possible builds and contains algorithms that determine what items can and can't be build based on the users inventory contents
  • Field Details

  • Method Details

    • getPossibleBuilds

      public static List<WeaponConfig> getPossibleBuilds()
      Returns the list of all possible builds the user can make with their given inventory.
      Returns:
      list
    • setPossibleBuilds

      public static void setPossibleBuilds(List<WeaponConfig> weapons)
      Sets a list of all the possible builds the user can make with the items contained in their inventory
      Parameters:
      weapons - , a list of the items they can craft
    • getPossibleWeapons

      public static List<WeaponConfig> getPossibleWeapons()
      Returns the list of all possible builds the user can make with their given inventory.
      Returns:
      list
    • canBuild

      public static List<WeaponConfig> canBuild(List<Materials> inventoryContents)
      Method that determines what items can be built based on items present in users' inventory. Checks if object first implements buildable interface and then checks if user has required materials to build it. For first sprint user will always have enough materials in their inventory.
      Parameters:
      inventoryContents - , the contents of the users' inventory
      Returns:
      List of the buildable items
    • damageToWeapon

      public static Entity damageToWeapon(WeaponConfig weapon)
      Supporter method that takes a weapon config of any type and converts it to a weapon entity. Helps with reading configs off weapons.json.
      Returns:
      a weapon entity based on the config input