Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Character


          {
            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();
         
          // Like L2OFF auto target new mob (like an aggression)
          originalAttacker.setTargetTrasformedNpc(newNpc);
        }
      }
    }
    return super.onAttack(npc, attacker, damage, isPet);
  }
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);
      }
    }
View Full Code Here

  private static final SkillType[] SKILL_IDS = { SkillType.MANADAM };

  @Override
  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
  {
    L2Character target = null;

    if(activeChar.isAlikeDead())
      return;

    /*
    boolean ss = false;
    boolean bss = false;

    L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
    if(weaponInst != null)
    {
      if(weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
      {
        bss = true;
        weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
      }
      else if(weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_SPIRITSHOT)
      {
        ss = true;
        weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
      }
    }
    weaponInst = null;
    */
    boolean sps = activeChar.checkSps();
    boolean bss = activeChar.checkBss();

    for(L2Object target2 : targets)
    {
      target = (L2Character) target2;

      if(target.reflectSkill(skill))
        target = activeChar;
     
      boolean acted = Formulas.getInstance().calcMagicAffected(activeChar, target, skill);
      if(target.isInvul() || !acted)
      {
        activeChar.sendPacket(new SystemMessage(SystemMessageId.MISSED_TARGET));
      }
      else
      {
        double damage = Formulas.getInstance().calcManaDam(activeChar, target, skill, sps, bss);

        double mp = (damage > target.getCurrentMp() ? target.getCurrentMp() : damage);
        target.reduceCurrentMp(mp);

        if(damage > 0)
          if(target.isSleeping())
            target.stopSleeping(null);

        StatusUpdate sump = new StatusUpdate(target.getObjectId());
        sump.addAttribute(StatusUpdate.CUR_MP, (int) target.getCurrentMp());
        target.sendPacket(sump);
        sump = null;

        SystemMessage sm = new SystemMessage(SystemMessageId.S2_MP_HAS_BEEN_DRAINED_BY_S1);

        if(activeChar instanceof L2NpcInstance)
        {
          int mobId = ((L2NpcInstance) activeChar).getNpcId();
          sm.addNpcName(mobId);
        }
        else if(activeChar instanceof L2Summon)
        {
          int mobId = ((L2Summon) activeChar).getNpcId();
          sm.addNpcName(mobId);
        }
        else
        {
          sm.addString(activeChar.getName());
        }
        sm.addNumber((int) mp);
        target.sendPacket(sm);

        target = null;
        sm = null;

        if(activeChar instanceof L2PcInstance)
View Full Code Here

    if(!(object instanceof L2Character))
      return true;

    if(getActiveChar().hasAI())
    {
      L2Character temp = (L2Character) object;
      getActiveChar().getAI().notifyEvent(CtrlEvent.EVT_FORGET_OBJECT, object);

      if(getActiveChar().getTarget() == temp)
      {
        getActiveChar().setTarget(null);
View Full Code Here

      for (int index = 0; index < targets.length; index++)
      {
        if (!(targets[index] instanceof L2Character))
          continue;
       
        L2Character target = (L2Character) targets[index];
       
        if (target instanceof L2PcInstance)
        {
          L2PcInstance targetChar = (L2PcInstance) target;
         
          if (targetChar.isFestivalParticipant())
          {
            targetChar.sendPacket(SystemMessage.sendString("You can't use escape skill in a festival."));
            continue;
          }
         
          if ((targetChar._inEventCTF && CTF.is_started()) || (targetChar._inEventTvT && TvT.is_started()) || (targetChar._inEventDM && DM.is_started()) ||
              (targetChar._inEventRaid && Raid._started) || (targetChar._inEventVIP && VIP._started))
                    {
             targetChar.sendMessage("You can't use escape skill in Event.");
             continue;
          }
         
          if (targetChar.isInJail())
          {
            targetChar.sendPacket(SystemMessage.sendString("You can't escape from jail."));
            continue;
          }
         
          if (targetChar.isInDuel())
          {
            targetChar.sendPacket(SystemMessage.sendString("You can't use escape skills during a duel."));
            continue;
          }
         
          if (targetChar.isAlikeDead())
          {
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED);
            sm.addString(targetChar.getName());
            activeChar.sendPacket(sm);
            sm = null;
            continue;
          }
         
          if (targetChar.isInStoreMode())
          {
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_CURRENTLY_TRADING_OR_OPERATING_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED);
            sm.addString(targetChar.getName());
            activeChar.sendPacket(sm);
            sm = null;
            continue;
          }
         
          /*
           * Like L2OFF player can be recalled also if he is on combat/rooted
           *
           * if(targetChar.isRooted() || targetChar.isInCombat()) { SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED); sm.addString(targetChar.getName());
           * activeChar.sendPacket(sm); sm = null; continue; }
           */
         
          if (GrandBossManager.getInstance().getZone(targetChar) != null && !targetChar.isGM())
          {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING));
            continue;
          }
         
          if (targetChar.isInOlympiadMode())
          {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_SUMMON_PLAYERS_WHO_ARE_IN_OLYMPIAD));
            continue;
          }
         
          if (targetChar.isInsideZone(L2Character.ZONE_PVP))
          {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING));
            continue;
          }
        }
       
        target.teleToLocation(MapRegionTable.TeleportWhereType.Town);
        target = null;
      }
    }
    catch (Throwable e)
    {
View Full Code Here

  @Override
  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
  {
    for(L2Object obj : targets)
    {
      L2Character target = (L2Character) obj;
      if(target != null)
      {
        int spToAdd = (int) skill.getPower();
        target.addExpAndSp(0, spToAdd);
      }
      target = null;
    }
  }
View Full Code Here

      }

      if(object instanceof L2Character)
      {
        // Update the state of the L2Character object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the L2PcInstance
        L2Character obj = (L2Character) object;

        L2CharacterAI obj_ai = obj.getAI();
        if(obj_ai != null)
        {
          obj_ai.describeStateToPlayer(active_char);
        }
View Full Code Here

      for(int index = 0; index < targets.length; index++)
      {
        if(!(targets[index] instanceof L2Character))
          continue;

        L2Character target = (L2Character) targets[index];

        if(target instanceof L2PcInstance)
        {
          L2PcInstance targetChar = (L2PcInstance) target;

          if(targetChar.isFestivalParticipant())
          {
            targetChar.sendPacket(SystemMessage.sendString("You can't use escape skill in a festival."));
            continue;
          }

          if((targetChar._inEventCTF && CTF.is_started()) || (targetChar._inEventTvT && TvT.is_started()) || (targetChar._inEventDM && DM.is_started()) || (targetChar._inEventVIP && VIP._started))
          {
            targetChar.sendMessage("You can't use escape skill in Event.");
            continue;
          }
         
          if(targetChar.isInsideZone(L2Character.ZONE_EVENT))
          {
            targetChar.sendMessage("You cannot use this inside event zone.");
            continue
          }
         
          if(targetChar.isInsideZone(L2Character.ZONE_KAMALOKA))
          {
            targetChar.sendMessage("You cannot use this inside this zone.");
            continue
          }

          if(targetChar.isInJail())
          {
            targetChar.sendPacket(SystemMessage.sendString("You can't escape from jail."));
            continue;
          }

          if(targetChar.isInDuel())
          {
            targetChar.sendPacket(SystemMessage.sendString("You can't use escape skills during a duel."));
            continue;
          }

          if(targetChar.isAlikeDead())
          {
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED);
            sm.addString(targetChar.getName());
            activeChar.sendPacket(sm);
            sm = null;
            continue;
          }

          if(targetChar.isInStoreMode())
          {
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_CURRENTLY_TRADING_OR_OPERATING_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED);
            sm.addString(targetChar.getName());
            activeChar.sendPacket(sm);
            sm = null;
            continue;
          }

          if(targetChar.isRooted() || targetChar.isInCombat())
          {
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED);
            sm.addString(targetChar.getName());
            activeChar.sendPacket(sm);
            sm = null;
            continue;
          }
          if(targetChar.isInOlympiadMode())
          {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_SUMMON_PLAYERS_WHO_ARE_IN_OLYMPIAD));
            continue;
          }
        }

        target.teleToLocation(Config.TELEPORT_X, Config.TELEPORT_Y, Config.TELEPORT_Z);
        target = null;
      }
    }
    catch(Throwable e)
    {
View Full Code Here

      // damage calculation
      int damage = 0;

      for(L2Object target2 : targets)
      {
        L2Character target = (L2Character) target2;
        L2ItemInstance weapon = activeChar.getActiveWeaponInstance();
        if(activeChar instanceof L2PcInstance && target instanceof L2PcInstance && target.isAlikeDead() && target.isFakeDeath())
        {
          target.stopFakeDeath(null);
        }
        else if(target.isAlikeDead())
          continue;

        boolean dual = activeChar.isUsingDualWeapon();
        boolean shld = Formulas.calcShldUse(activeChar, target);
        boolean crit = Formulas.calcCrit(activeChar.getCriticalHit(target, skill));
        boolean soul = (weapon != null && weapon.getChargedSoulshot() == L2ItemInstance.CHARGED_SOULSHOT && weapon.getItemType() != L2WeaponType.DAGGER);

        if(!crit && (skill.getCondition() & L2Skill.COND_CRIT) != 0)
          damage = 0;
        else
          damage = (int) Formulas.calcPhysDam(activeChar, target, skill, shld, crit, dual, soul);

        if(damage > 0)
        {
          target.reduceCurrentHp(damage, activeChar);
          if(soul && weapon != null)
            weapon.setChargedSoulshot(L2ItemInstance.CHARGED_NONE);

          activeChar.sendDamageMessage(target, damage, false, false, false);
View Full Code Here

      if (!(object instanceof L2Character))
      {
        continue;
      }
     
      L2Character target = (L2Character) object;
      double cp = skill.getPower();
      if(skill.getSkillType() == SkillType.COMBATPOINTPERCENTHEAL)
      {
        cp = target.getMaxCp() * cp / 100.0;
      }
      SystemMessage sm = new SystemMessage(SystemMessageId.S1_CP_WILL_BE_RESTORED);
      sm.addNumber((int) cp);
      target.sendPacket(sm);
     
      target.setCurrentCp(cp + target.getCurrentCp());
      StatusUpdate sump = new StatusUpdate(target.getObjectId());
      sump.addAttribute(StatusUpdate.CUR_CP, (int) target.getCurrentCp());
      target.sendPacket(sump);
    }
  }
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.