Package net.sf.l2j.gameserver.skills

Examples of net.sf.l2j.gameserver.skills.Formulas$FuncMaxMpAdd


            if (Config.DEBUG) _log.fine("Begin Skill processing in Pdam.java " + skill.getSkillType());

        for (int index = 0; index < targets.length; index++)
        {
            L2Character target = (L2Character) targets[index];
            Formulas f = Formulas.getInstance();
            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 = f.calcShldUse(activeChar, target);
            // PDAM critical chance not affected by buffs, only by STR. Only some skills are meant to crit.
            boolean crit = false;
            if (skill.getBaseCritRate() > 0)
              crit = f.calcCrit(skill.getBaseCritRate() * 10 * f.getSTRBonus(activeChar));

            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) f.calcPhysDam(activeChar, target, skill, shld, false, dual, soul);
            if (crit) damage *= 2; // PDAM Critical damage always 2x and not affected by buffs

            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_pdam");
            }

            if (soul && weapon != null) weapon.setChargedSoulshot(L2ItemInstance.CHARGED_NONE);

            if (damage > 0)
            {
                activeChar.sendDamageMessage(target, damage, false, crit, 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 (f.calcSkillSuccess(activeChar, target, skill, false, false, false))
                        {
                            skill.getEffects(activeChar, target);

                            SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
                            sm.addSkillName(skill.getId());
View Full Code Here


    activeChar.sendPacket(adminReply);
  }


  private void handleShow(String params, L2PcInstance activeChar) {
    Formulas f = Formulas.getInstance();
    params = params.trim();

    L2Character npc1 = null;
    L2Character npc2 = null;
    if (params.length() == 0)
    {
      npc1 = activeChar;
      npc2 = (L2Character)activeChar.getTarget();
      if(npc2 == null)
      {
        activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
        return;
      }
    }
    else
    {
      int mid1 = 0;
      int mid2 = 0;
      StringTokenizer st = new StringTokenizer(params);
      mid1 = Integer.parseInt(st.nextToken());
      mid2 = Integer.parseInt(st.nextToken());

      npc1 = new L2MonsterInstance(IdFactory.getInstance().getNextId(),
          NpcTable.getInstance().getTemplate(mid1));
      npc2 = new L2MonsterInstance(IdFactory.getInstance().getNextId(),
          NpcTable.getInstance().getTemplate(mid2));
    }

    int miss1 = 0;
    int miss2 = 0;
    int shld1 = 0;
    int shld2 = 0;
    int crit1 = 0;
    int crit2 = 0;
    double patk1 = 0;
    double patk2 = 0;
    double pdef1 = 0;
    double pdef2 = 0;
    double dmg1 = 0;
    double dmg2 = 0;


    // ATTACK speed in milliseconds
    int sAtk1 = npc1.calculateTimeBetweenAttacks(npc2, null);
    int sAtk2 = npc2.calculateTimeBetweenAttacks(npc1, null);
    // number of ATTACK per 100 seconds
    sAtk1 = 100000 / sAtk1;
    sAtk2 = 100000 / sAtk2;

    for (int i=0; i < 10000; i++)
    {
      boolean _miss1 = f.calcHitMiss(npc1, npc2);
      if (_miss1) miss1++;
      boolean _shld1 = f.calcShldUse(npc1, npc2);
      if (_shld1) shld1++;
      boolean _crit1 = f.calcCrit(npc1.getCriticalHit(npc2, null));
      if (_crit1) crit1++;

      double _patk1 = npc1.getPAtk(npc2);
      _patk1 += Rnd.nextDouble()* npc1.getRandomDamage(npc2);
      patk1 += _patk1;

      double _pdef1 = npc1.getPDef(npc2);
      pdef1 += _pdef1;

      if (!_miss1) {
        npc1.setAttackingBodypart();
        double _dmg1 = f.calcPhysDam(npc1, npc2, null, _shld1, _crit1, false, false);
        dmg1 += _dmg1;
        npc1.abortAttack();
      }
    }

    for (int i=0; i < 10000; i++)
    {
      boolean _miss2 = f.calcHitMiss(npc2, npc1);
      if (_miss2) miss2++;
      boolean _shld2 = f.calcShldUse(npc2, npc1);
      if (_shld2) shld2++;
      boolean _crit2 = f.calcCrit(npc2.getCriticalHit(npc1, null));
      if (_crit2) crit2++;

      double _patk2 = npc2.getPAtk(npc1);
      _patk2 += Rnd.nextDouble()* npc2.getRandomDamage(npc1);
      patk2 += _patk2;

      double _pdef2 = npc2.getPDef(npc1);
      pdef2 += _pdef2;

      if (!_miss2) {
        npc2.setAttackingBodypart();
        double _dmg2 = f.calcPhysDam(npc2, npc1, null, _shld2, _crit2, false, false);
        dmg2 += _dmg2;
        npc2.abortAttack();
      }
    }

    miss1 /= 100;
    miss2 /= 100;
    shld1 /= 100;
    shld2 /= 100;
    crit1 /= 100;
    crit2 /= 100;
    patk1 /= 10000;
    patk2 /= 10000;
    pdef1 /= 10000;
    pdef2 /= 10000;
    dmg1  /= 10000;
    dmg2  /= 10000;

    // total damage per 100 seconds
    int tdmg1 = (int)(sAtk1 * dmg1);
    int tdmg2 = (int)(sAtk2 * dmg2);
    // HP restored per 100 seconds
    double maxHp1 = npc1.getMaxHp();
    int hp1 = (int)(f.calcHpRegen(npc1) * 100000 / f.getRegeneratePeriod(npc1));

    double maxHp2 = npc2.getMaxHp();
    int hp2 = (int)(f.calcHpRegen(npc2) * 100000 / f.getRegeneratePeriod(npc2));

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

    TextBuilder replyMSG = new TextBuilder();
    replyMSG.append("<html><title>Selected mobs to fight</title>");
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.skills.Formulas$FuncMaxMpAdd

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.