Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Character


  @Override
  public String onAggroRangeEnter(L2NpcInstance npc, L2PcInstance player, boolean isPet)
  {
    int npcObjId = npc.getObjectId();
   
    L2Character target = isPet ? player.getPet() : player;
   
    L2ItemInstance VisitorsMark = player.getInventory().getItemByItemId(8064);
    L2ItemInstance FadedVisitorsMark = player.getInventory().getItemByItemId(8065);
    L2ItemInstance PagansMark = player.getInventory().getItemByItemId(8067);
   
View Full Code Here


        {
          _ai1 = npc.getX();
          _ai2 = npc.getY();
          _ai3 = npc.getZ();
        }
        L2Character c_ai0 = null;
        if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK && _quest1 == 0)
        {
          if (((L2Attackable) npc).getMostHated() != null)
          {
            c_ai0 = ((L2Attackable) npc).getMostHated();
            _quest1 = 1;
          }
        }
        else if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK && _quest1 != 0)
        {
          if (((L2Attackable) npc).getMostHated() != null)
          {
            if (c_ai0 == ((L2Attackable) npc).getMostHated())
            {
              _quest1 = (_quest1 + 1);
            }
            else
            {
              _quest1 = 1;
              c_ai0 = ((L2Attackable) npc).getMostHated();
            }
          }
        }
        if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
        {
          _quest1 = 0;
        }
        if (_quest1 > 5)
        {
          ((L2Attackable) npc).stopHating(c_ai0);
          L2Character nextTarget = ((L2Attackable) npc).getMostHated();
          if (nextTarget != null)
            npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
          _quest1 = 0;
        }
      }
View Full Code Here

      else if (skillId == 4216)
      {
        int i1 = Rnd.get(15);
        player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
        ((L2Attackable) npc).stopHating(player);
        L2Character nextTarget = ((L2Attackable) npc).getMostHated();
        if (nextTarget != null)
          npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
       
      }
      else if (skillId == 4217)
      {
        int i0 = 0;
        int i1 = Rnd.get(15);
        player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
        ((L2Attackable) npc).stopHating(player);
       
        if (c_quest0 != null && _quest0 > 0 && c_quest0 != player && c_quest0.getZ() > (player.getZ() - 100) && c_quest0.getZ() < (player.getZ() + 100))
        {
          if ((((c_quest0.getX() - player.getX()) * (c_quest0.getX() - player.getX())) + ((c_quest0.getY() - player.getY()) * (c_quest0.getY() - player.getY()))) > (250 * 250))
          {
            i0 = 1;
          }
          else
          {
            i0 = 0;
          }
          if (i0 == 0)
          {
            i1 = Rnd.get(15);
            c_quest0.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest0);
          }
        }
        if (c_quest1 != null && _quest0 > 1 && c_quest1 != player && c_quest1.getZ() > (player.getZ() - 100) && c_quest1.getZ() < (player.getZ() + 100))
        {
          if ((((c_quest1.getX() - player.getX()) * (c_quest1.getX() - player.getX())) + ((c_quest1.getY() - player.getY()) * (c_quest1.getY() - player.getY()))) > (250 * 250))
          {
            i0 = 1;
          }
          else
          {
            i0 = 0;
          }
          if (i0 == 0)
          {
            i1 = Rnd.get(15);
            c_quest1.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest1);
          }
        }
        if (c_quest2 != null && _quest0 > 2 && c_quest2 != player && c_quest2.getZ() > (player.getZ() - 100) && c_quest2.getZ() < (player.getZ() + 100))
        {
          if ((((c_quest2.getX() - player.getX()) * (c_quest2.getX() - player.getX())) + ((c_quest2.getY() - player.getY()) * (c_quest2.getY() - player.getY()))) > (250 * 250))
          {
            i0 = 1;
          }
          else
          {
            i0 = 0;
          }
          if (i0 == 0)
          {
            i1 = Rnd.get(15);
            c_quest2.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest2);
          }
        }
        if (c_quest3 != null && _quest0 > 3 && c_quest3 != player && c_quest3.getZ() > (player.getZ() - 100) && c_quest3.getZ() < (player.getZ() + 100))
        {
          if ((((c_quest3.getX() - player.getX()) * (c_quest3.getX() - player.getX())) + ((c_quest3.getY() - player.getY()) * (c_quest3.getY() - player.getY()))) > (250 * 250))
          {
            i0 = 1;
          }
          else
          {
            i0 = 0;
          }
          if (i0 == 0)
          {
            i1 = Rnd.get(15);
            c_quest3.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest3);
          }
        }
        if (c_quest4 != null && _quest0 > 4 && c_quest4 != player && c_quest4.getZ() > (player.getZ() - 100) && c_quest4.getZ() < (player.getZ() + 100))
        {
          if ((((c_quest4.getX() - player.getX()) * (c_quest4.getX() - player.getX())) + ((c_quest4.getY() - player.getY()) * (c_quest4.getY() - player.getY()))) > (250 * 250))
          {
            i0 = 1;
          }
          else
          {
            i0 = 0;
          }
          if (i0 == 0)
          {
            i1 = Rnd.get(15);
            c_quest4.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest4);
          }
        }
        L2Character nextTarget = ((L2Attackable) npc).getMostHated();
        if (nextTarget != null)
          npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
      }
    }
    return super.onSpellFinished(npc, player, skill);
View Full Code Here

        {
          npc.setTarget(attacker);
          npc.doCast(SkillTable.getInstance().getInfo(4258, 1));
        }
      }
      L2Character originalAttacker = isPet ? attacker.getPet() : attacker;
      int hate = (int) (((damage / npc.getMaxHp()) / 0.05) * 20000);
      ((L2Attackable) npc).addDamageHate(originalAttacker, 0, hate);
      if (Rnd.get(10) < 1)
      {
        int i0 = Rnd.get((15 * 15));
 
View Full Code Here

    int npcId = npc.getNpcId();
    if (npcId == ZAKEN)
    {
      if (_Zone.isInsideZone(npc))
      {
        L2Character target = isPet ? player.getPet() : player;
        ((L2Attackable) npc).addDamageHate(target, 1, 200);
      }
      if (player.getZ() > (npc.getZ() - 100) && player.getZ() < (npc.getZ() + 100))
      {
        if (_quest0 < 5 && Rnd.get(3) < 1)
View Full Code Here

    boolean bss = activeChar.checkBss();
    boolean sps = activeChar.checkSps();
   
    for(L2Object target2 : targets)
    {
      L2Character target = (L2Character) target2;

      if(activeChar instanceof L2PcInstance && target instanceof L2PcInstance
        && target.isAlikeDead() && target.isFakeDeath())
      {
        target.stopFakeDeath(null);
      }
      else if(target.isAlikeDead())
      {
        if(skill.getTargetType() == L2Skill.SkillTargetType.TARGET_AREA_CORPSE_MOB && target instanceof L2NpcInstance)
        {
          ((L2NpcInstance) target).endDecayTask();
        }
        continue;
      }

      boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, skill));

      int damage = (int) Formulas.calcMagicDam(activeChar, target, skill, sps, bss, mcrit);

      if(damage > 5000 && Config.LOG_HIGH_DAMAGES && activeChar instanceof L2PcInstance)
      {
        String name = "";
        if(target instanceof L2RaidBossInstance) name = "RaidBoss ";
        if(target instanceof L2NpcInstance)
          name += target.getName() + "(" + ((L2NpcInstance) target).getTemplate().npcId + ")";
        if(target instanceof L2PcInstance)
          name = target.getName() + "(" + target.getObjectId() + ") ";
        name += target.getLevel() + " lvl";
        Log.add(activeChar.getName() + "(" + activeChar.getObjectId() + ") "
          + activeChar.getLevel() + " lvl did damage " + damage + " with skill "
          + skill.getName() + "(" + skill.getId() + ") to " + name, "damage_mdam");
      }

      // Why are we trying to reduce the current target HP here?
      // Why not inside the below "if" condition, after the effects processing as it should be?
      // It doesn't seem to make sense for me. I'm moving this line inside the "if" condition, right after the effects processing...
      // [changed by nexus - 2006-08-15]
      //target.reduceCurrentHp(damage, activeChar);

      if(damage > 0)
      {
        // Manage attack or cast break of the target (calculating rate, sending message...)
        if(!target.isRaid() && Formulas.calcAtkBreak(target, damage))
        {
          target.breakAttack();
          target.breakCast();
        }

        activeChar.sendDamageMessage(target, damage, mcrit, false, false);

        if(skill.hasEffects())
        {
          if(target.reflectSkill(skill))
          {
            activeChar.stopSkillEffects(skill.getId());
            skill.getEffects(null, activeChar,false,sps,bss);
            SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
            sm.addSkillName(skill.getId());
            activeChar.sendPacket(sm);
            sm = null;
          }
          else
          {
            // activate attacked effects, if any
            if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill,false,sps,bss))
            {
              // Like L2OFF must remove the first effect only if the second effect is successful
              target.stopSkillEffects(skill.getId());
              skill.getEffects(activeChar, target,false,sps,bss);
            }
            else
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
              sm.addString(target.getName());
              sm.addSkillName(skill.getDisplayId());
              activeChar.sendPacket(sm);
              sm = null;
            }
          }
        }

        target.reduceCurrentHp(damage, activeChar);
      }
      target = null;
    }
   
    if (bss){
View Full Code Here

  }

  @Override
  public boolean testImpl(Env env)
  {
    L2Character target = env.target;
    if(target instanceof L2PcInstance && ((L2PcInstance) target).getPvpFlag() != 0)
      return ((L2PcInstance) target).getPvpFlag() == _pvp;
    return false;
  }
View Full Code Here

    {
      // Get a target
      if(!(targets[index] instanceof L2Character))
        continue;

      L2Character target = (L2Character) targets[index];

      if(target == null || target.isDead()) //bypass if target is null or dead
        continue;

      switch(type)
      {
        case BETRAY:
        {
          if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
            skill.getEffects(activeChar, target, ss, sps, bss);
          else
          {
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
            sm.addString(target.getName());
            sm.addSkillName(skill.getId());
            activeChar.sendPacket(sm);
            sm = null;
          }
          break;
        }
        case FAKE_DEATH:
        {
          // stun/fakedeath is not mdef dependant, it depends on lvl difference, target CON and power of stun
          skill.getEffects(activeChar, target, ss, sps, bss);
          break;
        }
        case STUN:
          // Calculate skill evasion
          if(Formulas.calcPhysicalSkillEvasion(target, skill))
          {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.ATTACK_FAILED));
            break;
          }
          // Calculate vengeance
          if(target.vengeanceSkill(skill))
          {
            target = activeChar;
          }
        case ROOT:
        {
          if(target.reflectSkill(skill))
            target = activeChar;

          if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
            skill.getEffects(activeChar, target, ss, sps, bss);
          else
          {
            if(activeChar instanceof L2PcInstance)
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
              sm.addString(target.getName());
              sm.addSkillName(skill.getDisplayId());
              activeChar.sendPacket(sm);
              sm = null;
            }
          }
          break;
        }
        case SLEEP:
        case PARALYZE: //use same as root for now
        {
          if(target.reflectSkill(skill))
            target = activeChar;

          if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
            skill.getEffects(activeChar, target, ss, sps, bss);
          else
          {
            if(activeChar instanceof L2PcInstance)
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
              sm.addString(target.getName());
              sm.addSkillName(skill.getDisplayId());
              activeChar.sendPacket(sm);
              sm = null;
            }
          }
          break;
        }
        case CONFUSION:
        case MUTE:
        {
          if(target.reflectSkill(skill))
            target = activeChar;

          if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
          {
            skill.getEffects(activeChar, target, ss, sps, bss);
          }
          else
          {
            if(activeChar instanceof L2PcInstance)
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
              sm.addString(target.getName());
              sm.addSkillName(skill.getDisplayId());
              activeChar.sendPacket(sm);
              sm = null;
            }
          }
          break;
        }
        case CONFUSE_MOB_ONLY:
        {
          // do nothing if not on mob
          if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
          {
            L2Effect[] effects = target.getAllEffects();
            for(L2Effect e : effects)
            {
              if(e.getSkill().getSkillType() == type)
                e.exit(false);
            }
            skill.getEffects(activeChar, target, ss, sps, bss);
          }
          else
          {
            if(activeChar instanceof L2PcInstance)
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
              activeChar.sendPacket(sm);
              sm = null;
            }
          }
        }
        case AGGDAMAGE:
        {
          if(target instanceof L2Attackable)
            target.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, activeChar, (int) ((150 * skill.getPower()) / (target.getLevel() + 7)));
          //TODO [Nemesiss] should this have 100% chance?
          skill.getEffects(activeChar, target, ss, sps, bss);
          break;
        }
        case AGGREDUCE:
        {
          // these skills needs to be rechecked
          if(target instanceof L2Attackable)
          {
            skill.getEffects(activeChar, target, ss, sps, bss);

            double aggdiff = ((L2Attackable) target).getHating(activeChar) - target.calcStat(Stats.AGGRESSION, ((L2Attackable) target).getHating(activeChar), target, skill);

            if(skill.getPower() > 0)
              ((L2Attackable) target).reduceHate(null, (int) skill.getPower());
            else if(aggdiff > 0)
              ((L2Attackable) target).reduceHate(null, (int) aggdiff);
          }
          break;
        }
        case AGGREDUCE_CHAR:
        {
          // 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);
          }
          else
          {
            if(activeChar instanceof L2PcInstance)
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
              sm.addString(target.getName());
              sm.addSkillName(skill.getId());
              activeChar.sendPacket(sm);
              sm = null;
            }
          }
          break;
        }
        case AGGREMOVE:
        {
          // these skills needs to be rechecked
          if(target instanceof L2Attackable && !target.isRaid())
          {
            if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss))
            {
              if(skill.getTargetType() == L2Skill.SkillTargetType.TARGET_UNDEAD)
              {
                if(target.isUndead())
                  ((L2Attackable) target).reduceHate(null, ((L2Attackable) target).getHating(((L2Attackable) target).getMostHated()));
              }
              else
                ((L2Attackable) target).reduceHate(null, ((L2Attackable) target).getHating(((L2Attackable) target).getMostHated()));
            }
            else
            {
              if(activeChar instanceof L2PcInstance)
              {
                SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
                sm.addString(target.getName());
                sm.addSkillName(skill.getId());
                activeChar.sendPacket(sm);
                sm = null;
              }
            }
          }
          break;
        }
        case UNBLEED:
        {
          negateEffect(target, SkillType.BLEED, skill.getPower());
          break;
        }
        case UNPOISON:
        {
          negateEffect(target, SkillType.POISON, skill.getPower());
          break;
        }
        case ERASE:
        {
          if(Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, ss, sps, bss)
          // Doesn't affect siege golem, wild hog cannon and Pets
          && !(target instanceof L2SiegeSummonInstance) && !(target instanceof L2PetInstance))
          {
            L2PcInstance summonOwner = null;
            L2Summon summonPet = null;
            summonOwner = ((L2Summon) target).getOwner();
            summonPet = summonOwner.getPet();
            summonPet.unSummon(summonOwner);
            summonPet = null;
            SystemMessage sm = new SystemMessage(SystemMessageId.LETHAL_STRIKE);
            summonOwner.sendPacket(sm);
            sm = null;
          }
          else
          {
            if(activeChar instanceof L2PcInstance)
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
              sm.addString(target.getName());
              sm.addSkillName(skill.getId());
              activeChar.sendPacket(sm);
              sm = null;
            }
          }
          break;
        }
        case MAGE_BANE: {
          for (L2Object t : targets) {
            L2Character target1 = (L2Character) t;

            if (target1.reflectSkill(skill)) {
              target1 = activeChar;
            }
            if (!Formulas.getInstance().calcSkillSuccess(activeChar,
                target1, skill, ss, sps, bss)) {
              continue;
            }
            L2Effect[] effects = target1.getAllEffects();
            for (L2Effect e : effects) {

              if (e.getStackType().equals("mAtkSpeedUp")
                  || e.getStackType().equals("mAtk")
                  || e.getSkill().getId() == 1059
                  || e.getSkill().getId() == 1085
                  || e.getSkill().getId() == 4356
                  || e.getSkill().getId() == 4355)
                e.exit();
            }
          }
          break;
        }
        case WARRIOR_BANE: {
          for (L2Object t : targets) {
            L2Character target1 = (L2Character) t;
            if (target1.reflectSkill(skill)) {
              target1 = activeChar;
            }
            if (!Formulas.getInstance().calcSkillSuccess(activeChar,
                target1, skill, ss, sps, bss)) {
              continue;
            }
            L2Effect[] effects = target1.getAllEffects();
            for (L2Effect e : effects) {
              if (e.getStackType().equals("SpeedUp")
                  || e.getStackType().equals("pAtkSpeedUp")
                  || e.getSkill().getId() == 1204
                  || e.getSkill().getId() == 1086
View Full Code Here

        Object[] characters = result.toArray();
        QuestTimer timer = getQuestTimer("clean_player", npc, null);
        if (timer != null)
            timer.cancel();
        startQuestTimer("clean_player", 20000, npc, null);
        L2Character target = (L2Character) characters[Rnd.get(characters.length)];
        FastList.recycle(result);
        return target;

    }
View Full Code Here

            _target = getRandomTarget(npc);
            if (_target != null)
                _skill = SkillTable.getInstance().getInfo(getRandomSkill(npc), 1);
        }

        L2Character target = _target;
        L2Skill skill = _skill;
        if (skill == null)
            skill = SkillTable.getInstance().getInfo(getRandomSkill(npc), 1);
        if (target == null || target.isDead() || !(_Zone.isInsideZone(target))) {
            //npc.setIsCastingNow(false);
            return;
        }

        if (Util.checkIfInRange(skill.getCastRange(), npc, target, true)) {
View Full Code Here

TOP

Related Classes of com.l2jfrozen.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.