@Ignore @Test public void testCheckActiveAmount() { TestHelper.load(); Inventory inv = new Inventory(); assertTrue(inv.checkActiveAmount(0, false)); assertTrue(inv.checkActiveAmount(1, false)); assertTrue(inv.checkActiveAmount(2, false)); assertTrue(!inv.checkActiveAmount(3, true)); assertTrue(inv.checkActiveAmount(7, true)); inv.placeItem(activeArray, 2, "Gun1", 1); assertTrue(inv.checkActiveAmount(7, false)); assertTrue(inv.checkActiveAmount(11, false)); assertTrue(!inv.checkActiveAmount(7, true)); assertTrue(!inv.checkActiveAmount(14, true)); assertTrue(inv.checkActiveAmount(16, true)); inv.placeItem(activeArray, 3, "Gun1", 1); assertTrue(inv.checkActiveAmount(16, false)); assertTrue(inv.checkActiveAmount(23, false)); assertTrue(!inv.checkActiveAmount(16, true)); assertTrue(!inv.checkActiveAmount(23, true)); assertTrue(inv.checkActiveAmount(28, true)); inv.placeItem(activeArray, 4, "Gun1", 1); assertTrue(!inv.checkActiveAmount(16, false)); assertTrue(inv.checkActiveAmount(29, false)); assertTrue(!inv.checkActiveAmount(16, true)); assertTrue(!inv.checkActiveAmount(23, true)); assertTrue(!inv.checkActiveAmount(28, true)); }
public boolean checkActiveAmount(int playerLevel, boolean equip){ int activeCounter = 0; for (int i = 0; i < ACTIVE_SIZE; i++){ if (getItemType(getItemID(ACTIVE_ARRAY, i)) == ItemType.WEAPON){ activeCounter += 1; } } if (equip){ activeCounter += 1; } return checkLevelRestrictionsActive(playerLevel, activeCounter); }
Inventory { public boolean checkActiveAmount(int playerLevel, boolean equip){ int activeCounter = 0; for (int i = 0; i < ACTIVE_SIZE; i++){ if (getItemType(getItemID(ACTIVE_ARRAY, i)) == ItemType.WEAPON){ activeCounter += 1; } } if (equip){ activeCounter += 1; } return checkLevelRestrictionsActive(playerLevel, activeCounter); } }
Inventory { public boolean checkActiveAmount(int playerLevel, boolean equip){ int activeCounter = 0; for (int i = 0; i < ACTIVE_SIZE; i++){ if (getItemType(getItemID(ACTIVE_ARRAY, i)) == ItemType.WEAPON){ activeCounter += 1; } } if (equip){ activeCounter += 1; } return checkLevelRestrictionsActive(playerLevel, activeCounter); } Inventory(); }
Inventory { public boolean checkActiveAmount(int playerLevel, boolean equip){ int activeCounter = 0; for (int i = 0; i < ACTIVE_SIZE; i++){ if (getItemType(getItemID(ACTIVE_ARRAY, i)) == ItemType.WEAPON){ activeCounter += 1; } } if (equip){ activeCounter += 1; } return checkLevelRestrictionsActive(playerLevel, activeCounter); } Inventory(); int sizeOfActiveArray(); int sizeOfPassiveArray(); int sizeOfGeneralArray(); boolean isFull(String itemArray); boolean addItem(int quantity, String itemID); boolean placeItem(String itemArray, int slotNumber, String itemID, int quantity); boolean removeItem(int quantity, String itemID); boolean clearInvSlot(String itemArray, int slotNumber); boolean itemExists(String itemID); int getAmount(String itemID); String getItemID(String itemArray, int slotNumber); int getItemQuantity(String itemArray, int slotNumber); static String getItemInfo(String id, String request); static ItemType getItemType(String id); static ArmourType getArmourType(String id); Image getSprite(String id); boolean swapItem(String firstArray, int firstSlot, String secondArray, int secondSlot, boolean stack); boolean checkArrayInBounds(InventoryPair[]  array, int slotToCheck); boolean reduceActiveConsumable(int slotNumber); boolean checkActiveAmount(int playerLevel, boolean equip); static boolean checkLevelRestrictionsActive(int playerLevel, int activeAmount); boolean checkItem(String id); }
Inventory { public boolean checkActiveAmount(int playerLevel, boolean equip){ int activeCounter = 0; for (int i = 0; i < ACTIVE_SIZE; i++){ if (getItemType(getItemID(ACTIVE_ARRAY, i)) == ItemType.WEAPON){ activeCounter += 1; } } if (equip){ activeCounter += 1; } return checkLevelRestrictionsActive(playerLevel, activeCounter); } Inventory(); int sizeOfActiveArray(); int sizeOfPassiveArray(); int sizeOfGeneralArray(); boolean isFull(String itemArray); boolean addItem(int quantity, String itemID); boolean placeItem(String itemArray, int slotNumber, String itemID, int quantity); boolean removeItem(int quantity, String itemID); boolean clearInvSlot(String itemArray, int slotNumber); boolean itemExists(String itemID); int getAmount(String itemID); String getItemID(String itemArray, int slotNumber); int getItemQuantity(String itemArray, int slotNumber); static String getItemInfo(String id, String request); static ItemType getItemType(String id); static ArmourType getArmourType(String id); Image getSprite(String id); boolean swapItem(String firstArray, int firstSlot, String secondArray, int secondSlot, boolean stack); boolean checkArrayInBounds(InventoryPair[]  array, int slotToCheck); boolean reduceActiveConsumable(int slotNumber); boolean checkActiveAmount(int playerLevel, boolean equip); static boolean checkLevelRestrictionsActive(int playerLevel, int activeAmount); boolean checkItem(String id); static final String ACTIVE_ARRAY; static final int ACTIVE_SIZE; static final String PASSIVE_ARRAY; static final int PASSIVE_SIZE; static final String GENERAL_ARRAY; static final int GENERAL_SIZE; }