Package l2p.gameserver.model

Examples of l2p.gameserver.model.L2Character


    if(!_def_think)
    {
      return true;
    }
    assert currentTask != null;
    L2Character temp_attack_target = L2ObjectsStorage.getAsCharacter(currentTask.targetStoreId);
    if(actor.isAttackingNow() || actor.isCastingNow())
    {
      return false;
    }
    switch(currentTask.type)
    {
      // Задание "прибежать в заданные координаты"
      case MOVE:
      {
        if(actor.isMovementDisabled() || !getIsMobile())
        {
          return true;
        }
        if(actor.isInRange(currentTask.loc, 100))
        {
          return maybeNextTask(currentTask);
        }
        if(actor.isMoving)
        {
          return false;
        }
        if(!actor.moveToLocation(currentTask.loc, 0, currentTask.pathfind))
        {
          clientStopMoving();
          _pathfind_fails = 0;
          actor.teleToLocation(currentTask.loc);
          //actor.broadcastPacketToOthers(new MagicSkillUse(actor, actor, 2036, 1, 500, 600000));
          //ThreadPoolManager.getInstance().scheduleAi(new Teleport(currentTask.loc), 500, false);
          return maybeNextTask(currentTask);
        }
      }
      break;
      // Задание "добежать - ударить"
      case ATTACK:
      {
        if(checkTarget(temp_attack_target, false, 2000))
        {
          return true;
        }
        setAttackTarget(temp_attack_target);
        if(actor.isMoving)
        {
          return Rnd.chance(25);
        }
        if(actor.getRealDistance(temp_attack_target) <= actor.getPhysicalAttackRange() + 40 && GeoEngine.canSeeTarget(actor, temp_attack_target, false))
        {
          clientStopMoving();
          _pathfind_fails = 0;
          actor.setAttackTimeout(getMaxAttackTimeout() + System.currentTimeMillis());
          actor.doAttack(temp_attack_target);
          return maybeNextTask(currentTask);
        }
        if(actor.isMovementDisabled() || !getIsMobile())
        {
          return true;
        }
        tryMoveToTarget(temp_attack_target);
      }
      break;
      // Задание "добежать - атаковать скиллом"
      case CAST:
      {
        if(actor.isMuted(currentTask.skill) || actor.isSkillDisabled(currentTask.skill.getId()))
        {
          return true;
        }
        boolean isAoE = currentTask.skill.getTargetType() == L2Skill.SkillTargetType.TARGET_AURA;
        if(checkTarget(temp_attack_target, false, 3000))
        {
          return true;
        }
        setAttackTarget(temp_attack_target);
        int castRange = currentTask.skill.getAOECastRange();
        if(actor.getRealDistance(temp_attack_target) <= castRange + 60 && GeoEngine.canSeeTarget(actor, temp_attack_target, false))
        {
          clientStopMoving();
          _pathfind_fails = 0;
          actor.setAttackTimeout(getMaxAttackTimeout() + System.currentTimeMillis());
          actor.doCast(currentTask.skill, isAoE ? actor : temp_attack_target, !temp_attack_target.isPlayable());
          return maybeNextTask(currentTask);
        }
        if(actor.isMoving)
        {
          return Rnd.chance(10);
        }
        if(actor.isMovementDisabled() || !getIsMobile())
        {
          return true;
        }
        tryMoveToTarget(temp_attack_target, castRange);
      }
      break;
      // Задание "добежать - применить скилл"
      case BUFF:
      {
        if(actor.isMuted(currentTask.skill) || actor.isSkillDisabled(currentTask.skill.getId()))
        {
          return true;
        }
        if(temp_attack_target == null || temp_attack_target.isAlikeDead() || !actor.isInRange(temp_attack_target, 2000))
        {
          return true;
        }
        boolean isAoE = currentTask.skill.getTargetType() == L2Skill.SkillTargetType.TARGET_AURA;
        int castRange = currentTask.skill.getAOECastRange();
        if(actor.isMoving)
        {
          return Rnd.chance(10);
        }
        if(actor.getRealDistance(temp_attack_target) <= castRange + 60 && GeoEngine.canSeeTarget(actor, temp_attack_target, false))
        {
          clientStopMoving();
          _pathfind_fails = 0;
          actor.doCast(currentTask.skill, isAoE ? actor : temp_attack_target, !temp_attack_target.isPlayable());
          return maybeNextTask(currentTask);
        }
        if(actor.isMovementDisabled() || !getIsMobile())
        {
          return true;
View Full Code Here


  protected boolean defaultNewTask()
  {
    clearTasks();
    L2NpcInstance actor = getActor();
    L2Character target;
    if(actor == null || (target = prepareTarget()) == null)
    {
      return false;
    }
    double distance = actor.getDistance(target);
View Full Code Here

    if(actor == null)
    {
      return null;
    }
    // Новая цель исходя из агрессивности
    L2Character hated = actor.isConfused() && getAttackTarget() != actor ? getAttackTarget() : actor.getMostHated();
    // Для "двинутых" боссов, иногда, выбираем случайную цель
    if(!actor.isConfused() && Rnd.chance(getInt("isMadness", 1)))
    {
      L2Character randomHated = actor.getRandomHated();
      if(randomHated != null && randomHated != hated && randomHated != actor)
      {
        setAttackTarget(randomHated);
        if(_madnessTask == null && !actor.isConfused())
        {
View Full Code Here

  }

  protected boolean defaultFightTask()
  {
    clearTasks();
    L2Character target;
    if((target = prepareTarget()) == null)
    {
      return false;
    }
    L2NpcInstance actor = getActor();
    if(actor == null || actor.isDead())
    {
      return false;
    }
    double distance = actor.getDistance(target);
    if(!actor.isAMuted() && Rnd.chance(getRatePHYS()))
    {
      return chooseTaskAndTargets(null, target, distance);
    }
    double target_hp_precent = target.getCurrentHpPercents();
    double actor_hp_precent = actor.getCurrentHpPercents();
    // Изначально все дружественные цели живые
    double frendly_target_hp_precent = 100;
    L2MonsterInstance targetToHeal = null;
    if(actor.isMinion())
View Full Code Here

  @Override
  protected void onIntentionFollow(L2Character target, Integer offset)
  {
    changeIntention(CtrlIntention.AI_INTENTION_FOLLOW, target, offset);
    L2Character actor = getActor();
    if(actor != null)
    {
      actor.followToCharacter(target, offset, false);
      clientActionFailed();
    }
  }
View Full Code Here

  }

  @Override
  protected void onEvtArrivedBlocked(Location blocked_at_pos)
  {
    L2Character actor = getActor();
    if(actor != null && actor.isPlayer())
    {
      // Приводит к застреванию в стенах:
      //if(actor.isInRange(blocked_at_pos, 1000))
      //  actor.setLoc(blocked_at_pos, true);
      // Этот способ надежнее:
      Location loc = ((L2Player) actor).getLastServerPosition();
      if(loc != null)
      {
        actor.setLoc(loc, true);
      }
      actor.stopMove();
    }
    onEvtThink();
  }
View Full Code Here

  }

  @Override
  protected void onEvtForgetObject(L2Object object)
  {
    L2Character actor = getActor();
    if(actor == null || object == null)
    {
      return;
    }
    if(actor.isAttackingNow() && getAttackTarget() == object)
    {
      actor.abortAttack(true, true);
    }
    if(actor.isCastingNow() && getAttackTarget() == object)
    {
      actor.abortCast(true);
    }
    if(getAttackTarget() == object)
    {
      setAttackTarget(null);
    }
    if(actor.getTargetId() == object.getObjectId())
    {
      actor.setTarget(null);
    }
  }
View Full Code Here

  }

  @Override
  protected void onEvtDead(L2Character killer)
  {
    L2Character actor = getActor();
    if(actor != null)
    {
      actor.abortAttack(true, true);
      actor.abortCast(true);
      actor.stopMove();
      actor.broadcastPacket(new Die(actor));
    }
    setIntention(CtrlIntention.AI_INTENTION_IDLE);
  }
View Full Code Here

  }

  @Override
  protected void onEvtAttacked(L2Character attacker, int damage)
  {
    L2Character actor = getActor();
    if(actor != null)
    {
      actor.startAttackStanceTask();
    }
    if(attacker != null)
    {
      attacker.startAttackStanceTask();
    }
View Full Code Here

  }

  @Override
  protected void onEvtArrived()
  {
    L2Character actor = getActor();
    if(actor != null && actor.isVehicle())
    {
      ((L2Vehicle) actor).VehicleArrived();
    }
  }
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.L2Character

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.