@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;
      }
    }
  }
Example #2
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.i("You see your hands turn invisible!");
          Buff.affect(hero, Invisibility.class, Invisibility.DURATION);
          break;
        case 1:
          GLog.i("You feel your skin hardens!");
          Buff.affect(hero, Barkskin.class).level(hero.HT / 4);
          break;
        case 2:
          GLog.i("Refreshing!");
          Buff.detach(hero, Poison.class);
          Buff.detach(hero, Cripple.class);
          Buff.detach(hero, Weakness.class);
          Buff.detach(hero, Bleeding.class);
          break;
        case 3:
          GLog.i("You feel better!");
          if (hero.HP < hero.HT) {
            hero.HP = Math.min(hero.HP + hero.HT / 4, hero.HT);
            hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
          }
          break;
      }
    }
  }