예제 #1
0
  @Override
  protected void doRead() {

    new Flare(5, 32).color(0xFF0000, true).show(curUser.sprite, 2f);
    Sample.INSTANCE.play(Assets.SND_READ);
    Invisibility.dispel();

    int count = 0;
    Mob affected = null;
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
      if (Level.fieldOfView[mob.pos]) {
        Buff.affect(mob, Terror.class, Terror.DURATION).object = curUser.id();

        count++;
        affected = mob;
      }
    }

    switch (count) {
      case 0:
        GLog.i("The scroll emits a brilliant flash of red light");
        break;
      case 1:
        GLog.i(
            "The scroll emits a brilliant flash of red light and the " + affected.name + " flees!");
        break;
      default:
        GLog.i("The scroll emits a brilliant flash of red light and the monsters flee!");
    }
    setKnown();

    readAnimation();
  }
예제 #2
0
 @Override
 protected void onZap(int cell) {
   Char ch = Actor.findChar(cell);
   if (ch != null) {
     Buff.affect(ch, Poison.class).set(Poison.durationFactor(ch) * (5 + level()));
   } else {
     GLog.i(Game.getVar(R.string.WandOfPoison_Info1));
   }
 }
예제 #3
0
  private boolean actPickUp(HeroAction.PickUp action) {
    int dst = action.dst;
    if (pos == dst) {

      Heap heap = Dungeon.level.heaps.get(pos);
      if (heap != null) {
        Item item = heap.pickUp();
        if (item.doPickUp(this)) {

          if (item instanceof Dewdrop) {

          } else {
            if ((item instanceof ScrollOfUpgrade && ((ScrollOfUpgrade) item).isKnown())
                || (item instanceof PotionOfStrength && ((PotionOfStrength) item).isKnown())) {
              GLog.p(TXT_YOU_NOW_HAVE, item.name());
            } else {
              GLog.i(TXT_YOU_NOW_HAVE, item.name());
            }
          }

          if (!heap.isEmpty()) {
            GLog.i(TXT_SOMETHING_ELSE);
          }
          curAction = null;
        } else {
          Dungeon.level.drop(item, pos).sprite.drop();
          ready();
        }
      } else {
        ready();
      }

      return false;

    } else if (getCloser(dst)) {

      return true;

    } else {
      ready();
      return false;
    }
  }
예제 #4
0
  @Override
  public void proc(Char attacker, Char defender, int damage) {

    if (enchantment != null) {
      enchantment.proc(this, attacker, defender, damage);
    }

    if (!levelKnown) {
      if (--hitsToKnow <= 0) {
        levelKnown = true;
        GLog.i(TXT_IDENTIFY, name(), toString());
        Badges.validateItemLevelAquired(this);
      }
    }
  }
예제 #5
0
        @Override
        public void onSelect(Integer target) {

          if (target != null) {

            if (target == getCurUser().getPos()) {
              GLog.i(TXT_SELF_TARGET);
              return;
            }

            final Wand curWand = (Wand) Wand.curItem;

            final int cell = Ballistica.cast(getCurUser().getPos(), target, true, curWand.hitChars);
            getCurUser().getSprite().zap(cell);

            curWand.wandEffect(cell);
          }
        }
예제 #6
0
 public static String uiLanguage() {
   String deviceLocale = Locale.getDefault().getLanguage();
   GLog.i("Device locale: %s", deviceLocale);
   return Preferences.INSTANCE.getString(Preferences.KEY_LOCALE, deviceLocale);
 }
  @Override
  public void shatter(int cell) {

    PathFinder.buildDistanceMap(cell, BArray.not(Level.losBlocking, null), DISTANCE);

    boolean procd = false;

    Blob[] blobs = {
      Dungeon.level.blobs.get(ToxicGas.class), Dungeon.level.blobs.get(ParalyticGas.class)
    };

    for (int j = 0; j < blobs.length; j++) {

      Blob blob = blobs[j];
      if (blob == null) {
        continue;
      }

      for (int i = 0; i < Level.LENGTH; i++) {
        if (PathFinder.distance[i] < Integer.MAX_VALUE) {

          int value = blob.cur[i];
          if (value > 0) {

            blob.cur[i] = 0;
            blob.volume -= value;
            procd = true;

            if (Dungeon.visible[i]) {
              CellEmitter.get(i).burst(Speck.factory(Speck.DISCOVER), 1);
            }
          }
        }
      }
    }

    boolean heroAffected = PathFinder.distance[Dungeon.hero.pos] < Integer.MAX_VALUE;

    if (procd) {

      if (Dungeon.visible[cell]) {
        splash(cell);
        Sample.INSTANCE.play(Assets.SND_SHATTER);
      }

      setKnown();

      if (heroAffected) {
        GLog.p(TXT_FRESHNESS);
      }

    } else {

      super.shatter(cell);

      if (heroAffected) {
        GLog.i(TXT_FRESHNESS);
        setKnown();
      }
    }
  }