@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;
      }
    }
  }
Пример #2
0
  @Override
  public void die(Object cause) {

    GameScene.bossSlain();
    Dungeon.level.drop(new ArmorKit(), pos).sprite.drop();

    if (Dungeon.gamemode == GameMode.REGULAR) {
      Dungeon.level.drop(new SkeletonKey(Dungeon.depth), pos).sprite.drop();
    } else if (Dungeon.gamemode == GameMode.ARENA) {
      // Level up
      Dungeon.hero.earnExp(Dungeon.hero.maxExp());

      ArenaShopKey key = new ArenaShopKey();
      key.identify();
      Dungeon.level.drop(key, pos).sprite.drop();
    }

    super.die(cause);

    Badges.validateBossSlain();

    LloydsBeacon beacon = Dungeon.hero.belongings.getItem(LloydsBeacon.class);
    if (beacon != null) {
      beacon.upgrade();
      GLog.p("Your beacon grows stronger!");
    }

    yell("You cannot kill me, " + Dungeon.hero.givenName() + "... I am... immortal...");
  }
  @Override
  public boolean attachTo(Char target) {
    if (super.attachTo(target) && !target.immunities().contains(Sleep.class)) {

      if (target instanceof Hero)
        if (target.HP == target.HT) {
          GLog.i("You are too healthy, and resist the urge to sleep.");
          detach();
          return true;
        } else {
          GLog.i("You fall into a deep magical sleep.");
        }
      else if (target instanceof Mob) ((Mob) target).state = ((Mob) target).SLEEPING;

      target.paralysed = true;

      return true;
    } else {
      return false;
    }
  }
 @Override
 public boolean act() {
   if (target instanceof Hero) {
     target.HP = Math.min(target.HP + 1, target.HT);
     ((Hero) target).restoreHealth = true;
     if (target.HP == target.HT) {
       GLog.p("You wake up feeling refreshed and healthy.");
       detach();
     }
   }
   spend(STEP);
   return true;
 }