Exemple #1
0
 @Override
 public boolean checkAggression(Creature target) {
   if (target.isPlayable()) {
     return false;
   }
   return super.checkAggression(target);
 }
Exemple #2
0
 @Override
 protected void onEvtAttacked(Creature attacker, int damage) {
   if ((attacker == null) || (attacker.isPlayable())) {
     return;
   }
   super.onEvtAttacked(attacker, damage);
 }
Exemple #3
0
  /**
   * Method useSkill.
   *
   * @param activeChar Creature
   * @param targets List<Creature>
   */
  @Override
  public void useSkill(Creature activeChar, List<Creature> targets) {
    int effect = _effectPoint;

    if (isSSPossible()
        && (activeChar.getChargedSoulShot() || (activeChar.getChargedSpiritShot() > 0))) {
      effect *= 2;
    }

    for (Creature target : targets) {
      if (target != null) {
        if (!target.isAutoAttackable(activeChar)) {
          continue;
        }

        if (target.isNpc()) {
          if (_unaggring) {
            if (target.isNpc() && activeChar.isPlayable()) {
              ((NpcInstance) target).getAggroList().addDamageHate(activeChar, 0, -effect);
            }
          } else {
            target.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, activeChar, effect);

            if (!_silent) {
              target.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, activeChar, 0);
            }
          }
        } else if (target.isPlayable() && !target.isDebuffImmune()) {
          target.setTarget(activeChar);
        }

        getEffects(activeChar, target, getActivateRate() > 0, false);
      }
    }

    if (isSSPossible()) {
      activeChar.unChargeShots(isMagic());
    }
  }
Exemple #4
0
    /**
     * Method onZoneEnter.
     *
     * @param zone Zone
     * @param cha Creature
     * @see lineage2.gameserver.listener.zone.OnZoneEnterLeaveListener#onZoneEnter(Zone, Creature)
     */
    @Override
    public void onZoneEnter(Zone zone, Creature cha) {
      if ((zone.getParams() == null) || !cha.isPlayable() || cha.getPlayer().isGM()) {
        return;
      }

      if (cha.getLevel() > zone.getParams().getInteger("levelLimit")) {
        if (cha.isPlayer()) {
          cha.getPlayer()
              .sendMessage("Your level is too high to access this zone. You've been banished out.");
        }

        cha.teleToLocation(Location.parseLoc(zone.getParams().getString("tele")));
      }
    }
Exemple #5
0
  /**
   * Method useSkill.
   *
   * @param activeChar Creature
   * @param targets List<Creature>
   */
  @Override
  public void useSkill(Creature activeChar, List<Creature> targets) {
    if (!activeChar.isPlayer()) {
      return;
    }

    boolean ss = activeChar.getChargedSoulShot() && isSSPossible();

    if (ss && (getTargetType() != SkillTargetType.TARGET_SELF)) {
      activeChar.unChargeShots(false);
    }

    Creature realTarget;
    boolean reflected;

    for (Creature target : targets) {
      if (target != null) {
        if (target.isDead()) {
          continue;
        }

        reflected = (target != activeChar) && target.checkReflectSkill(activeChar, this);
        realTarget = reflected ? activeChar : target;

        if (getPower() > 0) {
          AttackInfo info =
              Formulas.calcPhysDam(activeChar, realTarget, this, false, false, ss, false);

          if (info.lethal_dmg > 0) {
            realTarget.reduceCurrentHp(
                info.lethal_dmg,
                info.reflectableDamage,
                activeChar,
                this,
                true,
                true,
                false,
                false,
                false,
                false,
                false);
          }

          realTarget.reduceCurrentHp(
              info.damage,
              info.reflectableDamage,
              activeChar,
              this,
              true,
              true,
              false,
              true,
              false,
              false,
              true);

          if (!reflected) {
            realTarget.doCounterAttack(this, activeChar, false);
          }
        }

        if (realTarget.isPlayable() || realTarget.isMonster()) {
          activeChar.setConsumedSouls(activeChar.getConsumedSouls() + _numSouls, null);
        }

        getEffects(activeChar, target, getActivateRate() > 0, false, reflected);
      }
    }

    if (isSSPossible()) {
      activeChar.unChargeShots(isMagic());
    }
  }