Exemplo n.º 1
0
  @Override
  public boolean act() {
    if (target.isAlive()) {

      if ((level = Random.NormalIntRange(level / 2, level)) > 0) {

        target.damage(level, this);
        if (target.sprite.visible) {
          Splash.at(
              target.sprite.center(),
              -PointF.PI / 2,
              PointF.PI / 6,
              target.sprite.blood(),
              Math.min(10 * level / target.HT, 10));
        }

        if (target == Dungeon.hero && !target.isAlive()) {
          Dungeon.fail(getClass());
          GLog.n(Messages.get(this, "ondeath"));
        }

        spend(TICK);
      } else {
        detach();
      }

    } else {

      detach();
    }

    return true;
  }
Exemplo n.º 2
0
 @Override
 protected boolean getFurther(int target) {
   int step = Dungeon.flee(this, pos, target, Level.water, Level.fieldOfView);
   if (step != -1) {
     move(step);
     return true;
   } else {
     return false;
   }
 }
  @Override
  public void apply(Hero hero) {
    setKnown();
    Buff.affect(hero, MindVision.class, MindVision.DURATION);
    Dungeon.observe();

    if (Dungeon.level.mobs.size() > 0) {
      GLog.i("You can somehow feel the presence of other creatures' minds!");
    } else {
      GLog.i("You can somehow tell that you are alone on this level at the moment.");
    }
  }
Exemplo n.º 4
0
    public boolean checkOwner(Char owner) {
      if (!owner.isAlive() && owner instanceof Hero) {

        Dungeon.fail(Utils.format(ResultDescriptions.GLYPH, name()));
        GLog.n("%s killed you...", name());

        Badges.validateDeathFromGlyph();
        return true;

      } else {
        return false;
      }
    }
Exemplo n.º 5
0
  @Override
  protected boolean getCloser(int target) {

    if (rooted) {
      return false;
    }

    int step = Dungeon.findStep(this, pos, target, Level.water, Level.fieldOfView);
    if (step != -1) {
      move(step);
      return true;
    } else {
      return false;
    }
  }
  public static void teleportHero(Hero hero) {

    int count = 10;
    int pos;
    do {
      pos = Dungeon.level.randomRespawnCell();
      if (count-- <= 0) {
        break;
      }
    } while (pos == -1);

    if (pos == -1) {

      GLog.w(TXT_NO_TELEPORT);

    } else {

      appear(hero, pos);
      Dungeon.level.press(pos, hero);
      Dungeon.observe();

      GLog.i(TXT_TELEPORTED);
    }
  }