Example #1
0
  public int discharge() {

    int count = 0;

    for (Item item : this) {
      if (item instanceof Wand) {
        Wand wand = (Wand) item;
        if (wand.curCharges > 0) {
          wand.curCharges--;
          count++;

          wand.updateQuickslot();
        }
      }
    }

    return count;
  }
Example #2
0
  public int charge(boolean full) {

    int count = 0;

    for (Item item : this) {
      if (item instanceof Wand) {
        Wand wand = (Wand) item;
        if (wand.curCharges < wand.maxCharges) {
          wand.curCharges = full ? wand.maxCharges : wand.curCharges + 1;
          count++;

          wand.updateQuickslot();
        }
      }
    }

    return count;
  }