Package lineage2.gameserver.model.instances

Examples of lineage2.gameserver.model.instances.NpcInstance


    return startAttack();
  }

  private boolean startAttack()
  {
    NpcInstance actor = getActor();
    if(target == null)
    {
      List<NpcInstance> around = actor.getAroundNpc(3000, 150);
      if(around != null && !around.isEmpty())
      {
        for(NpcInstance npc : around)
        {
          if(checkTarget(npc))
          {
            if(target == null || actor.getDistance3D(npc) < actor.getDistance3D(target))
              target = npc;
          }
        }
      }
    }

    if(target != null && !actor.isAttackingNow() && !actor.isCastingNow() && !target.isDead() && GeoEngine.canSeeTarget(actor, target, false) && target.isVisible())
    {
      actor.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, target, 1);
      return true;
    }

    if(target != null && (!target.isVisible() || target.isDead() || !GeoEngine.canSeeTarget(actor, target, false)))
    {
View Full Code Here


  /**
   * Method thinkFollow.
   */
  protected void thinkFollow()
  {
    final NpcInstance actor = getActor();
    final Creature target = actor.getFollowTarget();
    if ((target == null) || target.isAlikeDead() || (actor.getDistance(target) > 4000) || actor.isMovementDisabled())
    {
      actor.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
      return;
    }
    if (actor.isFollow && (actor.getFollowTarget().equals(target)))
    {
      clientActionFailed();
      return;
    }
    if (actor.isInRange(target, Config.FOLLOW_RANGE + 20))
    {
      clientActionFailed();
    }
    if (_followTask != null)
    {
      _followTask.cancel(false);
      _followTask = null;
    }
    _followTask = ThreadPoolManager.getInstance().schedule(new ThinkFollow(), 250L);
    final Reflection ref = actor.getReflection();
    if ((ref != null) && (_chatTimer < System.currentTimeMillis()))
    {
      _chatTimer = System.currentTimeMillis() + 5000;
      final Player masterplayer = target.getPlayer();
      final Map<Skill, Integer> d_skill = new HashMap<>();
      final double distance = actor.getDistance(target);
      switch (ref.getInstancedZoneId())
      {
        case 156:
          final QuestState qs = masterplayer.getQuestState(_10293_SevenSignsForbiddenBook.class);
          if ((qs != null) && !qs.isCompleted())
View Full Code Here

  }

  @Override
  protected boolean thinkActive()
  {
    NpcInstance actor = getActor();
   
    if(Rnd.chance(3))
    {
      switch(actor.getNpcId())
      {
        case 33173:
          Functions.npcSay(actor, NpcString.BOOM_HEADSHOT)
          break;
        default:
View Full Code Here

    return startAttack();
  }

  private boolean startAttack()
  {
    NpcInstance actor = getActor();
    if(target == null)
    {
      List<NpcInstance> around = actor.getAroundNpc(3000, 150);
      if(around != null && !around.isEmpty())
      {
        for(NpcInstance npc : around)
        {
          if(checkTarget(npc))
          {
            if(target == null || actor.getDistance3D(npc) < actor.getDistance3D(target))
              target = npc;
          }
        }
      }
    }

    if(target != null && !actor.isAttackingNow() && !actor.isCastingNow() && !target.isDead() && GeoEngine.canSeeTarget(actor, target, false) && target.isVisible())
    {
      actor.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, target, 1);
      return true;
    }

    if(target != null && (!target.isVisible() || target.isDead() || !GeoEngine.canSeeTarget(actor, target, false)))
    {
View Full Code Here

  }

  @Override
  protected boolean thinkActive()
  {
    NpcInstance actor = getActor();
    if(Rnd.chance(8))
    {
      Functions.npcSay(actor, NpcString.MY_SUMMONS_ARE_NOT_AFRAID_OF_SHILENS_MONSTER);
    }
    return false;
View Full Code Here

     * Method runImpl.
     */
    @Override
    public void runImpl()
    {
      final NpcInstance actor = getActor();
      if (actor == null)
      {
        return;
      }
      final Creature target = actor.getFollowTarget();
      if ((target == null) || (actor.getDistance(target) > 4000))
      {
        setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
        actor.teleToLocation(120664, -86968, -3392);
        return;
      }
      if (!actor.isInRange(target, Config.FOLLOW_RANGE + 20) && (!actor.isFollow || (!actor.getFollowTarget().equals(target))))
      {
        final Location loc = new Location(target.getX() + Rnd.get(-60, 60), target.getY() + Rnd.get(-60, 60), target.getZ());
        actor.followToCharacter(loc, target, Config.FOLLOW_RANGE, false);
      }
      _followTask = ThreadPoolManager.getInstance().schedule(this, 250L);
    }
View Full Code Here

  }

  @Override
  protected boolean thinkActive()
  {
    NpcInstance actor = getActor();
    if(Rnd.chance(8))
    {
      Functions.npcSay(actor, NpcString.WHAT_DO_I_FEEL_WHEN_I_KILL_SHILENS_MONSTERS_RECOIL);
    }
    return false;
View Full Code Here

   * Method onEvtSpawn.
   */
  @Override
  protected void onEvtSpawn()
  {
    final NpcInstance actor = getActor();
    actor.setFlying(true);
    actor.setHasChatWindow(false);
    super.onEvtSpawn();
  }
View Full Code Here

   * @return boolean
   */
  @Override
  protected boolean thinkActive()
  {
    final NpcInstance actor = getActor();
    if (actor.isDead())
    {
      return true;
    }
    if (_def_think)
    {
View Full Code Here

   * @return boolean
   */
  @Override
  protected boolean thinkActive()
  {
    final NpcInstance actor = getActor();
    if (actor.isDead())
    {
      return true;
    }
    if (_def_think)
    {
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.instances.NpcInstance

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.