Ejemplo n.º 1
0
  @Override
  public void execute(Hero hero, String action) {

    super.execute(hero, action);

    if (action.equals(AC_EAT)) {

      switch (Random.Int(5)) {
        case 0:
          GLog.w("Oh it's hot!");
          Buff.affect(hero, Burning.class).reignite(hero);
          break;
        case 1:
          GLog.w("You can't feel your legs!");
          Buff.prolong(hero, Roots.class, Paralysis.duration(hero));
          break;
        case 2:
          GLog.w("You are not feeling well.");
          Buff.affect(hero, Poison.class).set(Poison.durationFactor(hero) * hero.HT / 5);
          break;
        case 3:
          GLog.w("You are stuffed.");
          Buff.prolong(hero, Slow.class, Slow.duration(hero));
          break;
      }
    }
  }
Ejemplo n.º 2
0
  @Override
  protected boolean doAttack(Char enemy) {

    if (Level.distance(pos, enemy.pos) <= 1) {

      return super.doAttack(enemy);

    } else {

      boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos];
      if (visible) {
        ((ShamanSprite) sprite).zap(enemy.pos);
      }

      spend(TIME_TO_ZAP);

      if (hit(this, enemy, true)) {
        int dmg = Random.Int(2, 12);
        if (Level.water[enemy.pos] && !enemy.flying) {
          dmg *= 1.5f;
        }
        enemy.damage(dmg, LightningTrap.LIGHTNING);

        enemy.sprite.centerEmitter().burst(SparkParticle.FACTORY, 3);
        enemy.sprite.flash();

        if (enemy == Dungeon.hero) {

          Camera.main.shake(2, 0.3f);

          if (!enemy.isAlive()) {
            Dungeon.fail(Utils.format(ResultDescriptions.MOB, Utils.indefinite(name)));
            GLog.n(TXT_LIGHTNING_KILLED, name);
          }
        }
      } else {
        enemy.sprite.showStatus(CharSprite.NEUTRAL, enemy.defenseVerb());
      }

      return !visible;
    }
  }