Package l2p.gameserver.model

Examples of l2p.gameserver.model.L2Playable


    L2Player player = null;
    L2Player temp = null;
    FastMap<L2Player, Integer> damagemap = new FastMap<L2Player, Integer>().setShared(true);
    for(AggroInfo info : getAggroList())
    {
      L2Playable killer = info.attacker;
      int damage = info.damage;
      if(killer.isPet() || killer.isSummon())
      {
        temp = killer.getPlayer();
      }
      else if(killer.isPlayer())
      {
        temp = (L2Player) killer;
      }
      if(temp == null || temp.getClan() == null)
      {
View Full Code Here


    public void objectLeaved(L2Zone zone, L2Object object)
    {
      L2Player player = object.getPlayer();
      if(Config.SERVICES_GIRAN_HARBOR_ENABLED && player.getReflection().getId() == -2 && player.isVisible())
      {
        L2Playable playable = (L2Playable) object;
        double angle = Util.convertHeadingToDegree(playable.getHeading()); // угол в градусах
        double radian = Math.toRadians(angle - 90); // угол в радианах
        playable.teleToLocation((int) (playable.getX() + 50 * Math.sin(radian)), (int) (playable.getY() - 50 * Math.cos(radian)), playable.getZ());
      }
    }
View Full Code Here

    public void objectLeaved(L2Zone zone, L2Object object)
    {
      L2Player player = object.getPlayer();
      if(Config.SERVICES_PARNASSUS_ENABLED && player.getReflection().getId() == -1 && player.isVisible())
      {
        L2Playable playable = (L2Playable) object;
        double angle = Util.convertHeadingToDegree(playable.getHeading()); // угол в градусах
        double radian = Math.toRadians(angle - 90); // угол в радианах
        playable.teleToLocation((int) (playable.getX() + 50 * Math.sin(radian)), (int) (playable.getY() - 50 * Math.cos(radian)), playable.getZ());
      }
    }
View Full Code Here

        GArray<AggroInfo> aggroList = getAggroList();
        GArray<AggroInfo> activeList = new GArray<AggroInfo>();
        GArray<AggroInfo> passiveList = new GArray<AggroInfo>();
        for (AggroInfo ai : aggroList) {
            if (ai.hate > 0) {
                L2Playable cha = ai.attacker;
                if (cha != null) {
                    if (!cha.isSummon()
                            && (cha.isStunned() || cha.isSleeping() || cha.isParalyzed() || cha.isAfraid() || cha
                                    .isBlocked())) {
                        passiveList.add(ai);
                    } else {
                        activeList.add(ai);
                    }
View Full Code Here

        GArray<AggroInfo> aggroList = getAggroList();
        GArray<AggroInfo> activeList = new GArray<AggroInfo>();
        GArray<AggroInfo> passiveList = new GArray<AggroInfo>();
        for (AggroInfo ai : aggroList) {
            if (ai.hate > 0) {
                L2Playable cha = ai.attacker;
                if (cha != null) {
                    if (cha.isStunned() || cha.isSleeping() || cha.isParalyzed() || cha.isAfraid() || cha.isBlocked()
                            || Math.abs(cha.getZ() - getZ()) > 200) {
                        passiveList.add(ai);
                    } else {
                        activeList.add(ai);
                    }
                }
View Full Code Here

    }
  }

  protected void thinkAttack(boolean checkRange)
  {
    L2Playable actor = getActor();
    if(actor == null)
    {
      return;
    }
    L2Player player = actor.getPlayer();
    if(player == null)
    {
      onAttackFail();
      return;
    }
    if(actor.isActionsDisabled() || actor.isAttackingDisabled())
    {
      actor.sendActionFailed();
      return;
    }
    boolean isPosessed = actor instanceof L2Summon && ((L2Summon) actor).isPosessed();
    L2Character attack_target = getAttackTarget();
    if(attack_target == null || attack_target.isDead() || !isPosessed && !(_forceUse ? attack_target.isAttackable(player) : attack_target.isAutoAttackable(player)))
    {
      onAttackFail();
      actor.sendActionFailed();
      return;
    }
    if(!checkRange)
    {
      clientStopMoving();
      actor.doAttack(attack_target);
      return;
    }
    int range = actor.getPhysicalAttackRange();
    if(range < 10)
    {
      range = 10;
    }
    boolean canSee = GeoEngine.canSeeTarget(actor, attack_target, false);
    if(!canSee && (range > 200 || Math.abs(actor.getZ() - attack_target.getZ()) > 200))
    {
      actor.sendPacket(Msg.CANNOT_SEE_TARGET);
      onAttackFail();
      actor.sendActionFailed();
      return;
    }
    range += actor.getMinDistance(attack_target);
    if(actor.isFakeDeath())
    {
      actor.breakFakeDeath();
    }
    if(actor.isInRangeZ(attack_target, range))
    {
      if(!canSee)
      {
        actor.sendPacket(Msg.CANNOT_SEE_TARGET);
        onAttackFail();
        actor.sendActionFailed();
        return;
      }
      clientStopMoving(false);
      actor.doAttack(attack_target);
    }
    else if(!_dontMove)
    {
      ThreadPoolManager.getInstance().executePathfind(new ExecuteFollow(actor, attack_target, range - 20));
    }
    else
    {
      actor.sendActionFailed();
    }
  }
View Full Code Here

    setIntention(AI_INTENTION_ACTIVE);
  }

  protected void thinkCast(boolean checkRange)
  {
    L2Playable actor = getActor();
    if(actor == null)
    {
      return;
    }
    L2Character attack_target = getAttackTarget();
    if(_skill.getSkillType() == SkillType.CRAFT || _skill.isToggle())
    {
      if(_skill.checkCondition(actor, attack_target, _forceUse, _dontMove, true))
      {
        actor.doCast(_skill, attack_target, _forceUse);
      }
      return;
    }
    if(attack_target == null || attack_target.isDead() != _skill.getCorpse() && !_skill.isNotTargetAoE())
    {
      setIntention(AI_INTENTION_ACTIVE);
      actor.sendActionFailed();
      return;
    }
    if(!checkRange)
    {
      // Если скилл имеет следующее действие, назначим это действие после окончания действия скилла
      if(_skill.getNextAction() == NextAction.ATTACK && !actor.equals(attack_target))
      {
        setNextAction(nextAction.ATTACK, attack_target, null, _forceUse, false);
      }
      else
      {
        clearNextAction();
      }
      clientStopMoving();
      if(_skill.checkCondition(actor, attack_target, _forceUse, _dontMove, true))
      {
        actor.doCast(_skill, attack_target, _forceUse);
      }
      else
      {
        setNextIntention();
        if(getIntention() == CtrlIntention.AI_INTENTION_ATTACK)
        {
          thinkAttack(true);
        }
      }
      return;
    }
    int range = actor.getMagicalAttackRange(_skill);
    if(range < 10)
    {
      range = 10;
    }
    boolean canSee = _skill.getSkillType() == SkillType.TAKECASTLE || _skill.getSkillType() == SkillType.TAKEFORTRESS || GeoEngine.canSeeTarget(actor, attack_target, actor.isFlying());
    boolean noRangeSkill = _skill.getCastRange() == 32767;
    if(!noRangeSkill && !canSee && (range > 200 || Math.abs(actor.getZ() - attack_target.getZ()) > 200))
    {
      actor.sendPacket(Msg.CANNOT_SEE_TARGET);
      setIntention(AI_INTENTION_ACTIVE);
      actor.sendActionFailed();
      return;
    }
    range += actor.getMinDistance(attack_target);
    if(actor.isFakeDeath())
    {
      actor.breakFakeDeath();
    }
    if(actor.isInRangeZ(attack_target, range) || noRangeSkill)
    {
      if(!noRangeSkill && !canSee)
      {
        actor.sendPacket(Msg.CANNOT_SEE_TARGET);
        setIntention(AI_INTENTION_ACTIVE);
        actor.sendActionFailed();
        return;
      }
      // Если скилл имеет следующее действие, назначим это действие после окончания действия скилла
      if(_skill.getNextAction() == NextAction.ATTACK && !actor.equals(attack_target))
      {
        setNextAction(nextAction.ATTACK, attack_target, null, _forceUse, false);
      }
      else
      {
        clearNextAction();
      }
      if(_skill.checkCondition(actor, attack_target, _forceUse, _dontMove, true))
      {
        clientStopMoving(false);
        actor.doCast(_skill, attack_target, _forceUse);
      }
      else
      {
        setNextIntention();
        if(getIntention() == CtrlIntention.AI_INTENTION_ATTACK)
        {
          thinkAttack(true);
        }
      }
    }
    else if(!_dontMove)
    {
      ThreadPoolManager.getInstance().executePathfind(new ExecuteFollow(actor, attack_target, range - 20));
    }
    else
    {
      actor.sendPacket(Msg.YOUR_TARGET_IS_OUT_OF_RANGE);
      setIntention(AI_INTENTION_ACTIVE);
      actor.sendActionFailed();
    }
  }
View Full Code Here

  @Override
  protected void onEvtDead(L2Character killer)
  {
    clearNextAction();
    L2Playable actor = getActor();
    if(actor != null)
    {
      actor.clearHateList(true);
    }
    super.onEvtDead(killer);
  }
View Full Code Here

    super.onEvtFakeDeath();
  }

  public void lockTarget(L2Character target)
  {
    L2Playable actor = getActor();
    if(actor == null)
    {
      return;
    }
    if(target == null)
    {
      actor.setAggressionTarget(null);
    }
    else if(actor.getAggressionTarget() == null)
    {
      L2Object actorStoredTarget = actor.getTarget();
      actor.setAggressionTarget(target);
      actor.setTarget(target);
      clearNextAction();
      switch(getIntention())
      {
        case AI_INTENTION_ATTACK:
          setAttackTarget(target);
          break;
        case AI_INTENTION_CAST:
          L2Skill skill = actor.getCastingSkill();
          if(skill == null)
          {
            skill = _skill;
          }
          if(skill != null && !skill.isUsingWhileCasting())
          {
            switch(skill.getTargetType())
            {
              case TARGET_ONE:
              case TARGET_AREA:
              case TARGET_MULTIFACE:
              case TARGET_TUNNEL:
                setAttackTarget(target);
                actor.setCastingTarget(target);
                break;
            }
          }
          break;
      }
      if(actorStoredTarget != target)
      {
        actor.sendPacket(new MyTargetSelected(target.getObjectId(), 0));
      }
    }
  }
View Full Code Here

  }

  @Override
  public void Attack(L2Object target, boolean forceUse, boolean dontMove)
  {
    L2Playable actor = getActor();
    if(actor == null)
    {
      return;
    }
    if(target.isCharacter() && (actor.isActionsDisabled() || actor.isAttackingDisabled()))
    {
      // Если не можем атаковать, то атаковать позже
      setNextAction(nextAction.ATTACK, target, null, forceUse, false);
      actor.sendActionFailed();
      return;
    }
    _dontMove = dontMove;
    _forceUse = forceUse;
    clearNextAction();
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.L2Playable

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.