Example #1
0
  @Override
  public void use(Actor actor, boolean fortify) {
    super.use(actor, fortify);

    if (fortify) {
      actor.equipItem(this);
    }
  }
Example #2
0
 public int use(Item i, boolean destroy) {
   int ans = i.use(this);
   if (i.getUses() <= 0 && destroy) {
     inventory.remove(i);
     if (i == weapon) {
       weapon = null;
       reEquip();
     }
   }
   return ans;
 }
Example #3
0
  public void checkInput() {
    // SwingUtilities.invokeLater(new Runnable() {
    // public void run() {
    String text = inputText.getText();
    if (!text.equals("")) {
      appendToPane(text + "\n\n", Color.blue);
      inputText.setText("");
      if (text.startsWith("use ")) {
        ArrayList<Item> inventory = player.getInventory();
        String key = text.substring(4);
        boolean found = false;
        for (Item i : inventory) {
          if (i.getName().equalsIgnoreCase(key)) {
            found = true;
            i.use();
            break;
          }
        }
        if (!found) {
          appendToPane("Item does not exist in your iventory.\n\n", Color.black);
        } else {

        }
      }
      if (text.startsWith("inventory")) {
        ArrayList<Item> inventory = player.getInventory();
        if (inventory.size() > 0) {
          for (Item i : inventory) {
            appendToPane(i.getName() + "\n", Color.darkGray);
          }
        } else appendToPane("Your iventory is empty.\n\n", Color.black);
        appendToPane("#", Color.blue);
      } else {
        userInput = text;
      }
    }
    // }
    // });
  }
Example #4
0
  @Override
  public void use(Actor actor) {
    super.use(actor);

    actor.equipItem(this);
  }