@Override
  public boolean doEquip(Hero hero) {

    detachAll(hero.belongings.backpack);

    if (hero.belongings.weapon == null || hero.belongings.weapon.doUnequip(hero, true)) {

      hero.belongings.weapon = this;
      activate(hero);

      QuickSlot.refresh();

      cursedKnown = true;
      if (cursed) {
        equipCursed(hero);
        GLog.n(TXT_EQUIP_CURSED, name());
      }

      hero.spendAndNext(TIME_TO_EQUIP);
      return true;

    } else {

      collect(hero.belongings.backpack);
      return false;
    }
  }
  @Override
  public boolean doEquip(Hero hero) {

    if (hero.belongings.ring1 != null && hero.belongings.ring2 != null) {

      GLog.w(Game.getVar(R.string.Ring_Info1));
      return false;

    } else {

      if (hero.belongings.ring1 == null) {
        hero.belongings.ring1 = this;
      } else {
        hero.belongings.ring2 = this;
      }

      detach(hero.belongings.backpack);

      activate(hero);

      cursedKnown = true;
      if (cursed) {
        equipCursed(hero);
        GLog.n(String.format(Game.getVar(R.string.Ring_Info2), this));
      }

      hero.spendAndNext(Artifact.TIME_TO_EQUIP);
      return true;
    }
  }
Esempio n. 3
0
  @Override
  public boolean attack(Char enemy) {

    for (int i = 1; i < Ballistica.distance; i++) {

      int pos = Ballistica.trace[i];

      Char ch = Actor.findChar(pos);
      if (ch == null) {
        continue;
      }

      if (hit(this, ch, true)) {
        ch.damage(Random.NormalIntRange(14, 20), this);

        if (Dungeon.visible[pos]) {
          ch.getSprite().flash();
          CellEmitter.center(pos).burst(PurpleParticle.BURST, Random.IntRange(1, 2));
        }

        if (!ch.isAlive() && ch == Dungeon.hero) {
          Dungeon.fail(
              Utils.format(ResultDescriptions.MOB, Utils.indefinite(getName()), Dungeon.depth));
          GLog.n(TXT_DEATHGAZE_KILLED, getName());
        }
      } else {
        ch.getSprite().showStatus(CharSprite.NEUTRAL, ch.defenseVerb());
      }
    }

    return true;
  }