Package com.deco2800.game.crafting
Class CraftingLogic
java.lang.Object
com.deco2800.game.crafting.CraftingLogic
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic List<WeaponConfig>
Method that determines what items can be built based on items present in users' inventory.static Entity
damageToWeapon
(WeaponConfig weapon) Supporter method that takes a weapon config of any type and converts it to a weapon entity.static List<WeaponConfig>
Returns the list of all possible builds the user can make with their given inventory.static List<WeaponConfig>
Returns the list of all possible builds the user can make with their given inventory.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
-
Field Details
-
configs
-
-
Method Details
-
getPossibleBuilds
Returns the list of all possible builds the user can make with their given inventory.- Returns:
- list
-
setPossibleBuilds
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
Returns the list of all possible builds the user can make with their given inventory.- Returns:
- list
-
canBuild
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
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
-