Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.L2Character


            }
        }

        for (int index = 0; index < targets.length; index++)
        {
            L2Character target = (L2Character) targets[index];

            if (activeChar instanceof L2PcInstance && target instanceof L2PcInstance
                && target.isAlikeDead() && target.isFakeDeath())
            {
                target.stopFakeDeath(null);
            }
            else if (target.isAlikeDead())
            {
                continue;
            }
            //      if (skill != null)
            //      if (skill.isOffensive())
            //      {

            //        boolean acted;
            //        if (skill.getSkillType() == L2Skill.SkillType.DOT || skill.getSkillType() == L2Skill.SkillType.MDOT)
            //            acted = Formulas.getInstance().calcSkillSuccess(
            //            activeChar, target, skill);
            //        else
            //            acted = Formulas.getInstance().calcMagicAffected(
            //            activeChar, target, skill);
            //        if (!acted) {
            //          activeChar.sendPacket(new SystemMessage(SystemMessage.MISSED_TARGET));
            //          continue;
            //        }
            //
            //      }

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

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

            if (damage > 5000 && 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.getInstance().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);
              SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
            sm.addSkillName(skill.getId());
            activeChar.sendPacket(sm);
                  }
                  else
                  {
                    // activate attacked effects, if any
                        target.stopSkillEffects(skill.getId());
                        if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, false, ss, bss))
                            skill.getEffects(activeChar, target);
                        else
                        {
                            SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
                            sm.addString(target.getName());
                            sm.addSkillName(skill.getDisplayId());
                            activeChar.sendPacket(sm);
                        }
                  }
                }

                target.reduceCurrentHp(damage, activeChar);
            }
        }
        // self Effect :]
        L2Effect effect = activeChar.getFirstEffect(skill.getId());
        if (effect != null && effect.isSelfEffect())
View Full Code Here


   * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.L2PcInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
   */
  @Override
  public void useSkill(L2Character actChar, L2Skill skill, L2Object[] targets)
  {
        L2Character target = null;

        for(int index = 0;index < targets.length;index++)
        {
            target = (L2Character)targets[index];
            double mp = skill.getPower();
            if (skill.getSkillType() == SkillType.MANAHEAL_PERCENT){
              //double mp = skill.getPower();
             mp = target.getMaxMp() * mp / 100.0;
            }
            else {
             mp = (skill.getSkillType() == SkillType.MANARECHARGE) ? target.calcStat(Stats.RECHARGE_MP_RATE,mp, null, null) : mp;
            }
      //int cLev = activeChar.getLevel();
      //hp += skill.getPower()/*+(Math.sqrt(cLev)*cLev)+cLev*/;
            target.setLastHealAmount((int)mp);
      target.setCurrentMp(mp+target.getCurrentMp());
      StatusUpdate sump = new StatusUpdate(target.getObjectId());
      sump.addAttribute(StatusUpdate.CUR_MP, (int)target.getCurrentMp());
      target.sendPacket(sump);

            if (actChar instanceof L2PcInstance && actChar != target)
            {
                SystemMessage sm = new SystemMessage(SystemMessageId.S2_MP_RESTORED_BY_S1);
                sm.addString(actChar.getName());
                sm.addNumber((int)mp);
                target.sendPacket(sm);
            }
            else
            {
                SystemMessage sm = new SystemMessage(SystemMessageId.S1_MP_RESTORED);
                sm.addNumber((int)mp);
                target.sendPacket(sm);
            }
    }
  }
View Full Code Here

  }

  @Override
  protected void runImpl()
  {
    L2Character player = getClient().getActiveChar();
    if (player == null)
      return;

    if (Config.DEBUG)
      _log.fine("client: x:" + _x + " y:" + _y + " z:" + _z
          + " server x:" + player.getX() + " y:" + player.getY()
          + " z:" + player.getZ());
    if (player.getAI() != null)
    {
      player.getAI().notifyEvent(CtrlEvent.EVT_ARRIVED_BLOCKED,
          new L2CharPosition(_x, _y, _z, _heading));
    }
    if (player instanceof L2PcInstance
        && ((L2PcInstance) player).getParty() != null)
      ((L2PcInstance) player).getParty().broadcastToPartyMembers(
View Full Code Here

  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
  {
        L2PcInstance player = null;
        if (activeChar instanceof L2PcInstance) player = (L2PcInstance)activeChar;

        L2Character target = null;
        L2PcInstance targetPlayer;
        List<L2Character> targetToRes = new FastList<L2Character>();

        for (int index = 0; index < targets.length; index++)
        {
            target = (L2Character) targets[index];

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

                // Check for same party or for same clan, if target is for clan.
                if (skill.getTargetType() == SkillTargetType.TARGET_CORPSE_CLAN)
                {
                    if (player.getClanId() != targetPlayer.getClanId()) continue;
                }
            }
            if(target.isVisible()) targetToRes.add(target);
        }

        if (targetToRes.size() == 0)
        {
            activeChar.abortCast();
View Full Code Here

    { 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);
            }
        }
    for (int index = 0; index < targets.length; index++)
    {
      target = (L2Character) targets[index];

            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, ss, 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());
        // [L2J_JP EDIT START - TSL]
        target.sendPacket(sump);
        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);
        if (activeChar instanceof L2PcInstance)
              {
                  SystemMessage sm2 = new SystemMessage(SystemMessageId.YOUR_OPPONENTS_MP_WAS_REDUCED_BY_S1);
          sm2.addNumber((int)mp);
                  activeChar.sendPacket(sm2);
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;

                    // Check to see if the current player target is in a festival.
                    if (targetChar.isFestivalParticipant()) {
                        targetChar.sendPacket(SystemMessage.sendString("You may not use an escape skill in a festival."));
                        continue;
                    }

                    // Check to see if player is in jail
                    if (targetChar.isInJail())
                    {
                        targetChar.sendPacket(SystemMessage.sendString("You can not escape from jail."));
                        continue;
                    }

                    // Check to see if player is in a duel
                    if (targetChar.isInDuel())
                    {
                        targetChar.sendPacket(SystemMessage.sendString("You cannot use escape skills during a duel."));
                        continue;
                    }
                }

                target.teleToLocation(MapRegionTable.TeleportWhereType.Town);
      }
        } catch (Throwable e) {
         if (Config.DEBUG) e.printStackTrace();
      }
   }
View Full Code Here

  @Override
  public void onStart()
  {
    super.onStart();

    L2Character effected = getEffected();
    if (effected instanceof L2PcInstance)
      ((L2PcInstance)effected).setSilentMoving(true);
  }
View Full Code Here

  @Override
  public void onExit()
  {
    super.onExit();

    L2Character effected = getEffected();
    if (effected instanceof L2PcInstance)
      ((L2PcInstance)effected).setSilentMoving(false);
  }
View Full Code Here

    boolean ss = false;
    boolean bss = false;

        for(int index = 0;index < targets.length;index++)
        {
      L2Character target = (L2Character)targets[index];
      if (target.isAlikeDead() && getTargetType() != SkillTargetType.TARGET_CORPSE_MOB)
        continue;

            if (activeChar != target && target.isInvul())
                continue; // No effect on invulnerable chars unless they cast it themselves.

      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);
          }
            }
            // If there is no weapon equipped, check for an active summon.
            else if (activeChar instanceof L2Summon)
            {
                L2Summon activeSummon = (L2Summon)activeChar;

                if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
                {
                    bss = true;
                    activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
                }
                else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT)
                {
                    ss = true;
                    activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
                }
            }

      boolean mcrit = Formulas.getInstance().calcMCrit(activeChar.getMCriticalHit(target, this));
      int damage = (int)Formulas.getInstance().calcMagicDam(
          activeChar, target, this, ss, bss, mcrit);

      double hpAdd = _absorbAbs + _absorbPart * damage;
      double hp = ((activeChar.getCurrentHp() + hpAdd) > activeChar.getMaxHp() ? activeChar.getMaxHp() : (activeChar.getCurrentHp() + hpAdd));

            activeChar.setCurrentHp(hp);

      StatusUpdate suhp = new StatusUpdate(activeChar.getObjectId());
      suhp.addAttribute(StatusUpdate.CUR_HP, (int)hp);
      activeChar.sendPacket(suhp);

            // Check to see if we should damage the target
            if (damage > 0 && (!target.isDead() || getTargetType() != SkillTargetType.TARGET_CORPSE_MOB))
            {
                // Manage attack or cast break of the target (calculating rate, sending message...)
                if (!target.isRaid() && Formulas.getInstance().calcAtkBreak(target, damage))
                {
                    target.breakAttack();
                    target.breakCast();
                }

              activeChar.sendDamageMessage(target, damage, mcrit, false, false);
               
                if (hasEffects() && getTargetType() != SkillTargetType.TARGET_CORPSE_MOB)
                {
                  if (target.reflectSkill(this))
                  {
                    activeChar.stopSkillEffects(getId());
              getEffects(null, activeChar);
              SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
            sm.addSkillName(getId());
            activeChar.sendPacket(sm);
                  }
                  else
                  {
                    // activate attacked effects, if any
                        target.stopSkillEffects(getId());
                        if (Formulas.getInstance().calcSkillSuccess(activeChar, target, this, false, ss, bss))
                            getEffects(activeChar, target);
                        else
                        {
                            SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
                            sm.addString(target.getName());
                            sm.addSkillName(getDisplayId());
                            activeChar.sendPacket(sm);
                        }
                  }
                }
               
                target.reduceCurrentHp(damage, activeChar);
            }

            // Check to see if we should do the decay right after the cast
            if (target.isDead() && getTargetType() == SkillTargetType.TARGET_CORPSE_MOB && target instanceof L2NpcInstance) {
                ((L2NpcInstance)target).endDecayTask();
            }
    }
        //effect self :]
        L2Effect effect = activeChar.getFirstEffect(getId());
View Full Code Here

    if (caster.isAlikeDead())
      return;

    // Update Seeds Effects
    for (int i=0;i<targets.length; i++){
      L2Character target = (L2Character)targets[i];
      if (target.isAlikeDead() && getTargetType() != SkillTargetType.TARGET_CORPSE_MOB)
        continue;

            EffectSeed oldEffect = (EffectSeed) target.getFirstEffect(getId());
            if (oldEffect == null)
                getEffects(caster, target);
            else oldEffect.increasePower();

            L2Effect[] effects = target.getAllEffects();
            for (int j = 0; j < effects.length; j++)
                if (effects[j].getEffectType() == L2Effect.EffectType.SEED)
                    effects[j].rescheduleEffect();
/*
      for (int j=0;j<effects.length;j++){
View Full Code Here

TOP

Related Classes of net.sf.l2j.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.