Exemplo n.º 1
0
  public void resurrect(int depth) {

    for (Item item : backpack.items.toArray(new Item[0])) {
      if (item instanceof Key) {
        if (((Key) item).depth == depth) {
          item.detachAll(backpack);
        }
      } else if (item.unique) {
        // Keep unique items
      } else if (!item.isEquipped(owner)) {
        item.detachAll(backpack);
      }
    }

    if (weapon != null) {
      weapon.cursed = false;
      weapon.activate(owner);
    }

    if (armor != null) {
      armor.cursed = false;
    }

    if (misc1 != null) {
      misc1.cursed = false;
      misc1.activate(owner);
    }
    if (misc2 != null) {
      misc2.cursed = false;
      misc2.activate(owner);
    }
  }
Exemplo n.º 2
0
  public void countIronKeys() {

    IronKey.curDepthQuantity = 0;

    for (Item item : backpack) {
      if (item instanceof IronKey && ((IronKey) item).depth == Dungeon.depth) {
        IronKey.curDepthQuantity += item.quantity();
      }
    }
  }
Exemplo n.º 3
0
  @SuppressWarnings("unchecked")
  public <T extends Key> T getKey(Class<T> kind, int depth) {

    for (Item item : backpack) {
      if (item.getClass() == kind && ((Key) item).depth == depth) {
        return (T) item;
      }
    }

    return null;
  }
Exemplo n.º 4
0
 public void observe() {
   if (weapon != null) {
     weapon.identify();
     Badges.validateItemLevelAquired(weapon);
   }
   if (armor != null) {
     armor.identify();
     Badges.validateItemLevelAquired(armor);
   }
   if (misc1 != null) {
     misc1.identify();
     Badges.validateItemLevelAquired(misc1);
   }
   if (misc2 != null) {
     misc2.identify();
     Badges.validateItemLevelAquired(misc2);
   }
   for (Item item : backpack) {
     item.cursedKnown = true;
   }
 }
Exemplo n.º 5
0
  @Override
  public void execute(Hero hero, String action) {
    if (action.equals(AC_EAT)) {

      detach(hero.belongings.backpack);

      ((Hunger) hero.buff(Hunger.class)).satisfy(energy);
      GLog.i(message);

      switch (hero.heroClass) {
        case WARRIOR:
          if (hero.HP < hero.HT) {
            hero.HP = Math.min(hero.HP + 5, hero.HT);
            hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
          }
          break;
        case MAGE:
          hero.belongings.charge(false);
          ScrollOfRecharging.charge(hero);
          break;
        case ROGUE:
        case HUNTRESS:
          break;
      }

      hero.sprite.operate(hero.pos);
      hero.busy();
      SpellSprite.show(hero, SpellSprite.FOOD);
      Sample.INSTANCE.play(Assets.SND_EAT);

      hero.spend(TIME_TO_EAT);

      Statistics.foodEaten++;
      Badges.validateFoodEaten();

    } else {

      super.execute(hero, action);
    }
  }
Exemplo n.º 6
0
 public void identify() {
   for (Item item : this) {
     item.identify();
   }
 }