Esempio n. 1
0
  @Override
  public void onStart() {
    super.onStart();

    if (getEffected().isHealBlocked()) return;

    double hp = calc();
    double newHp =
        hp
            * (!_ignoreHpEff
                ? getEffected().calcStat(Stats.HEAL_EFFECTIVNESS, 100., getEffector(), getSkill())
                : 100.)
            / 100.;
    double addToHp =
        Math.max(
            0,
            Math.min(
                newHp,
                getEffected().calcStat(Stats.HP_LIMIT, null, null) * getEffected().getMaxHp() / 100.
                    - getEffected().getCurrentHp()));

    if (addToHp > 0) {
      if (getEffected() != getEffector())
        getEffected()
            .sendPacket(
                new SystemMessagePacket(SystemMsg.S2_HP_HAS_BEEN_RESTORED_BY_C1)
                    .addName(getEffector())
                    .addInteger(Math.round(addToHp)));
      else
        getEffected()
            .sendPacket(
                new SystemMessagePacket(SystemMsg.S1_HP_HAS_BEEN_RESTORED)
                    .addInteger(Math.round(addToHp)));
      getEffected().setCurrentHp(addToHp + getEffected().getCurrentHp(), false);
    }
  }
Esempio n. 2
0
 @Override
 public void onStart() {
   super.onStart();
   if (_effected.isPlayer() && _effected != _effector)
     ((PlayerAI) _effected.getAI()).lockTarget(_effector);
 }