Package lineage2.gameserver.model

Examples of lineage2.gameserver.model.Creature


    NpcInstance actor = getActor();
    if (actor.isDead() || actor.isAMuted())
    {
      return false;
    }
    Creature target;
    if ((target = prepareTarget()) == null)
    {
      return false;
    }
    double distance = actor.getDistance(target);
    double targetHp = target.getCurrentHpPercents();
    double actorHp = actor.getCurrentHpPercents();
    Skill[] dam = Rnd.chance(getRateDAM()) ? selectUsableSkills(target, distance, _damSkills) : null;
    Skill[] dot = Rnd.chance(getRateDOT()) ? selectUsableSkills(target, distance, _dotSkills) : null;
    Skill[] debuff = targetHp > 10 ? Rnd.chance(getRateDEBUFF()) ? selectUsableSkills(target, distance, _debuffSkills) : null : null;
    Skill[] stun = Rnd.chance(getRateSTUN()) ? selectUsableSkills(target, distance, _stunSkills) : null;
View Full Code Here


   */
  @Override
  protected boolean thinkActive()
  {
    final NpcInstance actor = getActor();
    final Creature edwin = _edwinRef.get();
    if (edwin == null)
    {
      if (System.currentTimeMillis() > _wait_timeout)
      {
        _wait_timeout = System.currentTimeMillis() + 15000;
        for (NpcInstance npc : World.getAroundNpc(actor))
        {
          if (npc.getNpcId() == EDWIN_ID)
          {
            _edwinRef = npc.getRef();
            return true;
          }
        }
      }
    }
    else if (!actor.isMoving)
    {
      final int x = (edwin.getX() + Rnd.get(2 * DRIFT_DISTANCE)) - DRIFT_DISTANCE;
      final int y = (edwin.getY() + Rnd.get(2 * DRIFT_DISTANCE)) - DRIFT_DISTANCE;
      final int z = edwin.getZ();
      actor.setRunning();
      actor.moveToLocation(x, y, z, 0, true);
      return true;
    }
    return false;
View Full Code Here

   */
  @Override
  protected boolean createNewTask()
  {
    clearTasks();
    Creature target = prepareTarget();
    if (target == null)
    {
      return false;
    }
    final NpcInstance actor = getActor();
View Full Code Here

    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);
      }
View Full Code Here

  {
    super.onEvtScriptEvent(event, arg1, arg2);
    if(event.equalsIgnoreCase("ATTACK_HIM"))
    {
      selected = false;
      Creature attacker = (Creature) arg1;
      getActor().getAggroList().addDamageHate(attacker, 1, 10000000);
      addTaskAttack(attacker);
    }
    else if(event.equalsIgnoreCase("SELECT_ME"))
    {
View Full Code Here

    boolean ss = activeChar.getChargedSoulShot() && isSSPossible();
    if (ss && (getTargetType() != SkillTargetType.TARGET_SELF))
    {
      activeChar.unChargeShots(false);
    }
    Creature realTarget;
    boolean reflected;
    for (Creature target : targets)
    {
      if (target.isDead() || (target == activeChar))
      {
        continue;
      }
      reflected = 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);
        }
      }
      getEffects(activeChar, target, getActivateRate() > 0, false, reflected);
    }
    chargePlayer((Player) activeChar, getId());
View Full Code Here

   * @param targets List<Creature>
   */
  @Override
  public void useSkill(Creature activeChar, List<Creature> targets)
  {
    Creature realTarget;
    boolean reflected;
    for (Creature target : targets)
    {
      if (target != null)
      {
        reflected = target.checkReflectSkill(activeChar, this);
        realTarget = reflected ? activeChar : target;
        if (_skillInterrupt)
        {
          if ((realTarget.getCastingSkill() != null) && !realTarget.getCastingSkill().isMagic() && !realTarget.isRaid())
          {
            realTarget.abortCast(false, true);
          }
          if (!realTarget.isRaid())
          {
            realTarget.abortAttack(true, true);
          }
        }
        getEffects(activeChar, target, getActivateRate() > 0, false, reflected);
      }
    }
View Full Code Here

   */
  @Override
  protected boolean createNewTask()
  {
    clearTasks();
    Creature target = prepareTarget();
    if (target == null)
    {
      return false;
    }
    final NpcInstance actor = getActor();
    if (actor.isDead())
    {
      return false;
    }
    final double distance = actor.getDistance(target);
    final double chp = actor.getCurrentHpPercents();
    if (_hpStage == 0)
    {
      actor.altOnMagicUseTimer(actor, getSkill(4691, 1));
      _hpStage = 1;
    }
    else if ((chp < 80) && (_hpStage == 1))
    {
      actor.altOnMagicUseTimer(actor, getSkill(4691, 2));
      defenceDownTimer = System.currentTimeMillis();
      _hpStage = 2;
    }
    else if ((chp < 50) && (_hpStage == 2))
    {
      actor.altOnMagicUseTimer(actor, getSkill(4691, 3));
      _hpStage = 3;
    }
    else if ((chp < 30) && (_hpStage == 3))
    {
      actor.altOnMagicUseTimer(actor, getSkill(4691, 4));
      _hpStage = 4;
    }
    else if ((chp < 10) && (_hpStage == 4))
    {
      actor.altOnMagicUseTimer(actor, getSkill(4691, 5));
      _hpStage = 5;
    }
    if ((getAliveMinionsCount() < 100) && Rnd.chance(5))
    {
      final NpcInstance minion = Functions.spawn(Location.findPointToStay(actor.getLoc(), 400, 700, actor.getGeoIndex()), 29029);
      minions.add(minion);
      ValakasManager.addValakasMinion(minion);
    }
    if (_counterAttackIndex > 2000)
    {
      ValakasManager.broadcastScreenMessage(NpcString.VALAKAS_HEIGHTENED_BY_COUNTERATTACKS);
      _counterAttackIndex = 0;
      return chooseTaskAndTargets(s_berserk, actor, 0);
    }
    else if (_rangedAttacksIndex > 2000)
    {
      if (Rnd.chance(60))
      {
        final Creature randomHated = actor.getAggroList().getRandomHated();
        if (randomHated != null)
        {
          setAttackTarget(randomHated);
          actor.startConfused();
          ThreadPoolManager.getInstance().schedule(new RunnableImpl()
View Full Code Here

   * @return int
   */
  private int getMaximumHate()
  {
    final NpcInstance actor = getActor();
    final Creature cha = actor.getAggroList().getMostHated();
    if (cha != null)
    {
      final AggroInfo ai = actor.getAggroList().get(cha);
      if (ai != null)
      {
View Full Code Here

    if ((nextAction == null) || actor.isActionsDisabled())
    {
      return false;
    }
    Skill skill;
    Creature target;
    GameObject object;
    switch (nextAction)
    {
      case ATTACK:
        if (nextAction_arg0 == null)
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.Creature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.