コード例 #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
  public int attackProc(Char enemy, int damage) {
    if (Random.Int(2) == 0) {
      Buff.affect(enemy, Poison.class).set(Random.Int(7, 9) * Poison.durationFactor(enemy));
      state = FLEEING;
    }

    return damage;
  }
コード例 #3
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));
   }
 }
コード例 #4
0
  @Override
  public void damage(int dmg, Object src) {
    restoreHealth = false;
    super.damage(dmg, src);

    if (subClass == HeroSubClass.BERSERKER && 0 < HP && HP <= HT * Fury.LEVEL) {
      Buff.affect(this, Fury.class);
    }
  }
コード例 #5
0
  public void activate(Char ch) {

    if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN) {
      Buff.affect(ch, Barkskin.class).level(ch.ht() / 3);
    }

    effect(pos, ch);

    wither();
  }
コード例 #6
0
    @Override
    public void execute(Hero hero, String action) {

      super.execute(hero, action);

      if (action.equals(Food.AC_EAT)) {
        ScrollOfTeleportation.teleportHero(hero);
        hero.spendAndNext(1);
        hero.curAction = null;
        Buff.affect(hero, Vertigo.class, Vertigo.DURATION * 2);
      }
    }
コード例 #7
0
  @Override
  public int attackProc(Char enemy, int damage) {
    KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
    if (wep != null) {

      wep.proc(this, enemy, damage);

      switch (subClass) {
        case GLADIATOR:
          if (wep instanceof MeleeWeapon) {
            damage += Buff.affect(this, Combo.class).hit(enemy, damage);
          }
          break;
        case BATTLEMAGE:
          if (wep instanceof Wand) {
            Wand wand = (Wand) wep;
            if (wand.curCharges < wand.maxCharges && damage > 0) {

              wand.curCharges++;
              if (Dungeon.quickslot == wand) {
                QuickSlot.refresh();
              }

              ScrollOfRecharging.charge(this);
            }
            damage += wand.curCharges;
          }
        case SNIPER:
          if (rangedWeapon != null) {
            Buff.prolong(enemy, SnipersMark.class, attackDelay() * 1.1f);
          }
          break;
        default:
      }
    }

    return damage;
  }
コード例 #8
0
 public void live() {
   Buff.affect(this, Regeneration.class);
   Buff.affect(this, Hunger.class);
 }