コード例 #1
0
  @Override
  protected void doRead() {

    GameScene.flash(0xFFFFFF);

    Sample.INSTANCE.play(Assets.SND_BLAST);
    Invisibility.dispel();

    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
      if (Level.fieldOfView[mob.pos]) {
        mob.damage(mob.HT, this);
      }
    }

    curUser.damage(Math.max(curUser.HT / 5, curUser.HP / 2), this);
    Buff.prolong(curUser, Paralysis.class, Random.Int(4, 6));
    Buff.prolong(curUser, Blindness.class, Random.Int(6, 9));
    Dungeon.observe();

    setKnown();

    curUser.spendAndNext(TIME_TO_READ); // no animation here, the flash interrupts it anyway.

    if (!curUser.isAlive()) {
      Dungeon.fail(Utils.format(ResultDescriptions.ITEM, name));
      GLog.n("The Psionic Blast tears your mind apart...");
    }
  }
コード例 #2
0
  @Override
  public boolean attack(Char enemy) {

    for (int pos : beam.subPath(1, beam.dist)) {

      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.sprite.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(name)));
          GLog.n(TXT_DEATHGAZE_KILLED, name);
        }
      } else {
        ch.sprite.showStatus(CharSprite.NEUTRAL, ch.defenseVerb());
      }
    }

    return true;
  }