コード例 #1
0
  private void pickItem() {
    Output.getInstance()
        .prompt(
            "Enter a number corresponding to the item of your choosing, type -1 to pick nothing.");
    int itemPicked = InputUtil.getInput(-1, _inventory.size() - 1);
    if (itemPicked == -1) return;
    Item pick = _inventory.get(itemPicked);

    if (pick.isEquipable()) equipItem((Equipment) pick);
    else useConsumable((UsableItem) pick);
  }
コード例 #2
0
 public void assignToInventory(Item obj) {
   _inventory.add(obj);
   _currentInventorySize++;
   Output.getInstance().info(obj.getName() + " was added to your inventory.");
   Output.getInstance().separator();
 }