コード例 #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;
      }
    }
  }
コード例 #2
0
  @Override
  public void shatter(int cell) {
    for (Mob mob : Dungeon.level.mobs) {
      if (mob.pos == cell) {
        mob.atkSkill += (Dungeon.depth / 4);
        mob.defenseSkill += (Dungeon.depth / 3);
        mob.HT += Dungeon.depth;
        mob.HP += Dungeon.depth;
        GLog.w("The " + mob.description() + " looks tougher!");
      }
    }

    super.shatter(cell);
  }
コード例 #3
0
	public Item upgrade( boolean enchant ) {
		if (enchantment != null) {
			if (!enchant && Random.Int( level ) > 0 && (enchantment.getClass() != Ancient.class)) {
				GLog.w( TXT_INCOMPATIBLE );
				enchant( null );
			}
		} else {
			if (enchant) {
				enchant( );
			}
		}

		return super.upgrade();
	}
コード例 #4
0
	@Override
	public void proc( Char attacker, Char defender, int damage ) {
		
		if (enchantment != null) {
			enchantment.proc( this, attacker, defender, damage );
		}
		
		if (!levelKnown) {
			if (--hitsToKnow <= 0) {
				levelKnown = true;
				GLog.i( TXT_IDENTIFY, name(), toString() );
				Badges.validateItemLevelAquired( this );
			}
		}
	}
コード例 #5
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) {
        ((AirElementalSprite) sprite).zap(enemy.pos);
      }

      spend(TIME_TO_ZAP);

      if (hit(this, enemy, true)) {
        int dmg = Random.Int(2, (dmgMax / 3));
        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;
    }
  }