Package com.l2jfrozen.gameserver.model

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


    {
      if(npcId == treeId)
      {
        for(int i = 0; i < 20; i++)
        {
          L2Attackable newNpc = (L2Attackable) addSpawn(27189, npc.getX(), npc.getY(), npc.getZ(), 0, false, 30000);
          L2Character originalKiller = isPet ? killer.getPet() : killer;
          newNpc.setRunning();
          newNpc.addDamageHate(originalKiller, 0, 999);
          newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalKiller);
          if(Rnd.nextBoolean())
          {
            if (originalKiller != null)
            {
              final L2Skill skill = SkillTable.getInstance().getInfo(4243, 1);
View Full Code Here


    else if (event.equalsIgnoreCase("minions_despawn"))
    {
      synchronized(Minions){
        for (int i = 0; i < Minions.size(); i++)
        {
        L2Attackable mob = Minions.get(i);
        if (mob != null)
        mob.decayMe();
        }
        Minions.clear();
      }
    }
    else if (event.equalsIgnoreCase("spawn_minion"))
View Full Code Here

          // these skills needs to be rechecked
          if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
          {
            if(target instanceof L2Attackable)
            {
              L2Attackable targ = (L2Attackable) target;
              targ.stopHating(activeChar);
              if(targ.getMostHated() == null)
              {
                ((L2AttackableAI) targ.getAI()).setGlobalAggro(-25);
                targ.clearAggroList();
                targ.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
                targ.setWalking();
              }
              targ = null;
            }
            skill.getEffects(activeChar, target, ss, sps, bss);
          }
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;

      // Force mobs to attak anybody if confused
      if(_actor.isConfused())
      {
        hated = getAttackTarget();
      }
      else
      {
        hated = npc.getMostHated();
      }

      // 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);

        npc = null;
      }

      // Cancel target and timeout
View Full Code Here

  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();
        }

        L2SiegeGuardInstance sGuard = (L2SiegeGuardInstance) _actor;

        double homeX = target.getX() - sGuard.getHomeX();
        double homeY = target.getY() - sGuard.getHomeY();

        // 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);
        }

        sGuard = 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);
      }
      mostHated = null;
    }
    me = null;
View Full Code Here

    }
    else if(event.equalsIgnoreCase("despawn_minions"))
    {
      for(int i = 0; i < Minions.size(); i++)
      {
        L2Attackable mob = Minions.get(i);
        if(mob != null)
        {
          mob.decayMe();
        }
      }
      Minions.clear();
    }
    return super.onAdvEvent(event, npc, player);
View Full Code Here

          if (monster.getMessage() != 0)
          {
            npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), Message[Rnd.get(monster.getMessage())]));
          }
          npc.onDecay();
          L2Attackable newNpc = (L2Attackable) this.addSpawn(monster.getIdPoly(), npc);
          L2Character originalAttacker = isPet ? attacker.getPet() : attacker;
          newNpc.setRunning();
          newNpc.addDamageHate(originalAttacker, 0, 999);
          newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
         
          // NPC Spawn Effect L2OFF
          NPCSpawnTask spawnEffectTask = new NPCSpawnTask(newNpc, 4000, 800000);
          Thread effectThread = new Thread(spawnEffectTask);
          effectThread.start();
View Full Code Here

      {
        if (monster.getMessage() != 0)
        {
          npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, npc.getName(), Message[Rnd.get(monster.getMessage())]));
        }
        L2Attackable newNpc = (L2Attackable) this.addSpawn(monster.getIdPoly(), npc);
        L2Character originalAttacker = isPet ? killer.getPet() : killer;
        newNpc.setRunning();
        newNpc.addDamageHate(originalAttacker, 0, 999);
        newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
      }
    }
    return super.onKill(npc, killer, isPet);
  }
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.