Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Attackable$RewardItem


   * @param aggro
   *            The value of hate to add to the actor against the target
   */
  @Override
  protected void onEvtAggression(L2Character target, int aggro) {
    L2Attackable me = (L2Attackable) _actor;

    // To avoid lag issue
    if (me.isDead())
      return;

    if (target != null) {
      // Add the target to the actor _aggroList or update hate if already
      // present
      me.addDamageHate(target, 0, aggro);

      // Set the actor AI Intention to AI_INTENTION_ATTACK
      if (getIntention() != CtrlIntention.AI_INTENTION_ATTACK) {
        // Set the L2Character movement type to run and send
        // Server->Client packet ChangeMoveType to all others
View Full Code Here


    if(intention == AI_INTENTION_IDLE /*|| intention == AI_INTENTION_ACTIVE*/) // active becomes idle if only a summon is present
    {
      // Check if actor is not dead
      if(!_actor.isAlikeDead())
      {
        L2Attackable npc = (L2Attackable) _actor;

        // If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
        if(npc.getKnownList().getKnownPlayers().size() > 0)
        {
          intention = AI_INTENTION_ACTIVE;
        }
        else
        {
View Full Code Here

   * attack, add all autoAttackable L2Character in its Aggro Range to its _aggroList, chose a target and order to
   * attack it</li> <li>If the actor can't attack, order to it to return to its home location</li>
   */
  private void thinkActive()
  {
    L2Attackable npc = (L2Attackable) _actor;

    // Update every 1s the _globalAggro counter to come close to 0
    if(_globalAggro != 0)
    {
      if(_globalAggro < 0)
      {
        _globalAggro++;
      }
      else
      {
        _globalAggro--;
      }
    }

    // Add all autoAttackable L2Character in L2Attackable Aggro Range to its _aggroList with 0 damage and 1 hate
    // A L2Attackable isn't aggressive during 10s after its spawn because _globalAggro is set to -10
    if(_globalAggro >= 0)
    {
      for(L2Character target : npc.getKnownList().getKnownCharactersInRadius(_attackRange))
      {
        if(target == null)
        {
          continue;
        }
        if(autoAttackCondition(target)) // check aggression
        {
          // Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
          int hating = npc.getHating(target);

          // Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
          if(hating == 0)
          {
            npc.addDamageHate(target, 0, 1);
          }
        }
      }

      // Chose a target from its aggroList
      L2Character hated;
      if(_actor.isConfused())
      {
        hated = getAttackTarget(); // Force mobs to attack anybody if confused
      }
      else
      {
        hated = npc.getMostHated();
        //_mostHatedAnalysis.Update(hated);
      }

      // Order to the L2Attackable to attack the target
      if(hated != null)
      {
        // Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
        int aggro = npc.getHating(hated);

        if(aggro + _globalAggro > 0)
        {
          // Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
          if(!_actor.isRunning())
View Full Code Here

    if(attackTarget == null || attackTarget.isAlikeDead() || _attackTimeout < GameTimeController.getGameTicks())
    {
      // Stop hating this target after the attack timeout or if target is dead
      if(attackTarget != null)
      {
        L2Attackable npc = (L2Attackable) _actor;
        npc.stopHating(attackTarget);
      }

      // Cancel target and timeout
      _attackTimeout = Integer.MAX_VALUE;
      setAttackTarget(null);
View Full Code Here

  @Override
  protected void onEvtAggression(L2Character target, int aggro)
  {
    if(_actor == null)
      return;
    L2Attackable me = (L2Attackable) _actor;

    if(target != null)
    {
      // Add the target to the actor _aggroList or update hate if already present
      me.addDamageHate(target, 0, aggro);

      // Get the hate of the actor against the target
      aggro = me.getHating(target);

      if(aggro <= 0)
      {
        if(me.getMostHated() == null)
        {
          _globalAggro = -25;
          me.clearAggroList();
          setIntention(AI_INTENTION_IDLE, null, null);
        }
        return;
      }

      // Set the actor AI Intention to AI_INTENTION_ATTACK
      if(getIntention() != CtrlIntention.AI_INTENTION_ATTACK)
      {
        // Set the L2Character movement type to run and send Server->Client packet ChangeMoveType to all others L2PcInstance
        if(!_actor.isRunning())
        {
          _actor.setRunning();
        }

        L2FortSiegeGuardInstance sGuard;
        sGuard = (L2FortSiegeGuardInstance) _actor;
        double homeX = target.getX() - sGuard.getSpawn().getLocx();
        double homeY = target.getY() - sGuard.getSpawn().getLocy();

        // Check if the L2SiegeGuardInstance is not too far from its home location
        if(homeX * homeX + homeY * homeY < 3240000)
        {
          setIntention(CtrlIntention.AI_INTENTION_ATTACK, target, null);
        }
      }
    }
    else
    {
      // currently only for setting lower general aggro
      if(aggro >= 0)
        return;

      L2Character mostHated = me.getMostHated();
      if(mostHated == null)
      {
        _globalAggro = -25;
        return;
      }
     
      for(L2Character aggroed : me.getAggroListRP().keySet())
      {
        me.addDamageHate(aggroed, 0, aggro);
      }

      aggro = me.getHating(mostHated);
      if(aggro <= 0)
      {
        _globalAggro = -25;
        me.clearAggroList();
        setIntention(AI_INTENTION_IDLE, null, null);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.L2Attackable$RewardItem

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.