예제 #1
0
  public static void heal(Hero hero) {

    hero.HP = hero.HT;
    Buff.detach(hero, Poison.class);
    Buff.detach(hero, Cripple.class);
    Buff.detach(hero, Weakness.class);
    Buff.detach(hero, Bleeding.class);

    hero.sprite.emitter().start(Speck.factory(Speck.HEALING), 0.4f, 4);
  }
예제 #2
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();
  }
예제 #3
0
    @Override
    public boolean attachTo(Char target) {
      super.attachTo(target);
      delay();

      return true;
    }
예제 #4
0
  @Override
  public int attackProc(Char enemy, int damage) {
    if (Random.Int(2) == 0) {
      Buff.prolong(enemy, Cripple.class, Cripple.DURATION);
    }

    return damage;
  }
예제 #5
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));
   }
 }
예제 #6
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);
    }
  }
예제 #7
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;
  }
예제 #8
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();
  }
예제 #9
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);
      }
    }
예제 #10
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;
  }
예제 #11
0
  @Override
  protected void layout() {
    clear();

    SparseArray<Image> newIcons = new SparseArray<Image>();

    for (Buff buff : ch.buffs()) {
      int icon = buff.icon();
      if (icon != NONE) {
        Image img = new Image(texture);
        img.frame(film.get(icon));
        img.x = x + members.size() * (SIZE + 2);
        img.y = y;
        add(img);

        newIcons.put(icon, img);
      }
    }

    for (Integer key : icons.keyArray()) {
      if (newIcons.get(key) == null) {
        Image icon = icons.get(key);
        icon.origin.set(SIZE / 2);
        add(icon);
        add(
            new AlphaTweener(icon, 0, 0.6f) {
              @Override
              protected void updateValues(float progress) {
                super.updateValues(progress);
                image.scale.set(1 + 5 * progress);
              };
            });
      }
    }

    icons = newIcons;
  }
예제 #12
0
  @Override
  protected void evolve() {

    for (int i = 0; i < LENGTH; i++) {

      int offv = cur[i] > 0 ? cur[i] - 1 : 0;
      off[i] = offv;

      if (offv > 0) {

        volume += offv;

        Char ch = Actor.findChar(i);
        if (ch != null) {
          Buff.prolong(ch, Roots.class, TICK);
        }
      }
    }
  }
예제 #13
0
  public static void heroLand() {

    Hero hero = Dungeon.hero;

    hero.sprite.burst(hero.sprite.blood(), 10);
    Camera.main.shake(4, 0.2f);

    Buff.prolong(hero, Cripple.class, Cripple.DURATION);
    hero.damage(
        Random.IntRange(hero.HT / 3, hero.HT / 2),
        new Hero.Doom() {
          @Override
          public void onDeath() {
            Badges.validateDeathFromFalling();

            Dungeon.fail(Utils.format(ResultDescriptions.FALL, Dungeon.depth));
            GLog.n("You fell to death...");
          }
        });
  }
예제 #14
0
 @Override
 protected void apply(Hero hero) {
   GLog.w(TXT_NO_SMELL);
   Buff.prolong(hero, GasesImmunity.class, GasesImmunity.DURATION);
   setKnown();
 }
예제 #15
0
 @Override
 public void proc(Char attacker, Char defender, int damage) {
   Buff.prolong(defender, Paralysis.class, DURATION);
   super.proc(attacker, defender, damage);
 }
예제 #16
0
 public void live() {
   Buff.affect(this, Regeneration.class);
   Buff.affect(this, Hunger.class);
 }
예제 #17
0
 public void activate(Char ch) {
   buff = buff();
   if (buff != null) {
     buff.attachTo(ch);
   }
 }