Package l2p.gameserver.templates

Examples of l2p.gameserver.templates.L2Weapon


      this, target
    });
    // Get the Attack Speed of the L2Character (delay (in milliseconds) before next attack)
    int sAtk = Math.max(calculateAttackDelay(), 333);
    int ssGrade = 0;
    L2Weapon weaponItem = getActiveWeaponItem();
    if(weaponItem != null)
    {
      if(isPlayer() && weaponItem.getAttackReuseDelay() > 0)
      {
        int reuse = (int) (weaponItem.getAttackReuseDelay() * getReuseModifier(target) * 666 * calcStat(Stats.ATK_BASE, 0, target, null) / 293. / getPAtkSpd());
        if(reuse > 0)
        {
          sendPacket(new SetupGauge(SetupGauge.RED, reuse));
          _attackReuseEndTime = reuse + System.currentTimeMillis() - 75;
          if(reuse > sAtk)
          {
            ThreadPoolManager.getInstance().scheduleAi(new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT, null, null), reuse, isPlayable());
          }
        }
      }
      ssGrade = weaponItem.getCrystalType().externalOrdinal;
    }
    _attackEndTime = sAtk + System.currentTimeMillis() + 10000;
    _isAttackAborted = false;
    Attack attack = new Attack(this, target, getChargedSoulShot(), ssGrade);
    setHeading(target, true);
    // Select the type of attack to start
    if(weaponItem == null)
    {
      doAttackHitSimple(attack, target, 1., !isPlayer(), sAtk, true);
    }
    else
    {
      switch(weaponItem.getItemType())
      {
        case BOW:
        case CROSSBOW:
          doAttackHitByBow(attack, target, sAtk);
          break;
View Full Code Here


    attack.addHit(target, damage1, miss1, crit1, shld1);
  }

  private void doAttackHitByBow(Attack attack, L2Character target, int sAtk)
  {
    L2Weapon activeWeapon = getActiveWeaponItem();
    if(activeWeapon == null)
    {
      return;
    }
    int damage1 = 0;
    boolean shld1 = false;
    boolean crit1 = false;
    // Calculate if hit is missed or not
    boolean miss1 = Formulas.calcHitMiss(this, target);
    reduceArrowCount();
    if(!miss1)
    {
      AttackInfo info = Formulas.calcPhysDam(this, target, null, false, false, attack._soulshot, false);
      damage1 = (int) info.damage;
      shld1 = info.shld;
      crit1 = info.crit;
      int range = activeWeapon.getAttackRange();
      damage1 *= Math.min(range, getDistance(target)) / range * .4 + 0.8; // разброс 20% в обе стороны
    }
    ThreadPoolManager.getInstance().scheduleAi(new HitTask(this, target, damage1, crit1, miss1, attack._soulshot, shld1, true, true), sAtk, isPlayable());
    attack.addHit(target, damage1, miss1, crit1, shld1);
  }
View Full Code Here

    return (int) calcStat(Stats.POWER_ATTACK_RANGE, getTemplate().baseAtkRange, null, null);
  }

  public final int getRandomDamage()
  {
    L2Weapon weaponItem = getActiveWeaponItem();
    if(weaponItem == null)
    {
      return 5 + (int) Math.sqrt(getLevel());
    }
    return weaponItem.getRandomDamage();
  }
View Full Code Here

      {
        player.sendPacket(Msg.INVALID_TARGET);
        return;
      }
    }
    L2Weapon weaponItem = getActiveWeaponItem();
    if(weaponItem != null && (weaponItem.getItemType() == WeaponType.BOW || weaponItem.getItemType() == WeaponType.CROSSBOW))
    {
      double bowMpConsume = weaponItem.getMpConsume();
      if(bowMpConsume > 0)
      {
        // cheap shot SA
        double chance = calcStat(Stats.MP_USE_BOW_CHANCE, 0., target, null);
        if(chance > 0 && Rnd.chance(chance))
View Full Code Here

    {
      return;
    }
    L2Player player = (L2Player) caster;
    L2Fishing fish = player.getFishCombat();
    L2Weapon weaponItem = player.getActiveWeaponItem();
    int SS = player.getChargedFishShot() ? 2 : 1;
    int pen = 0;
    double gradebonus = 1 + weaponItem.getCrystalType().ordinal() * 0.1;
    int dmg = (int) (getPower() * gradebonus * SS);
    if(player.getSkillLevel(1315) < getLevel() - 2) // 1315 - Fish Expertise
    {
      // Penalty
      player.sendPacket(Msg.SINCE_THE_SKILL_LEVEL_OF_REELING_PUMPING_IS_HIGHER_THAN_THE_LEVEL_OF_YOUR_FISHING_MASTERY_A_PENALTY_OF_S1_WILL_BE_APPLIED);
View Full Code Here

        env.value = 1;
        return;
      }
      // TODO переделать РЅР° ту же систему, что
      // Сѓ эффектов
      L2Weapon weapon = env.character.getActiveWeaponItem();
      if (weapon == null) {
        env.value *= 0.01 * env.target.calcStat(
            Stats.FIST_WPN_RECEPTIVE, env.character, env.skill);
      } else if (weapon.getItemType().getDefence() != null) {
        env.value *= 0.01 * env.target.calcStat(weapon.getItemType()
            .getDefence(), env.character, env.skill);
      }
      env.value = calcDamageResists(env.skill, env.character, env.target,
          env.value);
    }
View Full Code Here

      if (env.value == 0) {
        return;
      }
      L2Character target = env.target;
      if (target != null) {
        L2Weapon weapon = target.getActiveWeaponItem();
        if (weapon != null) {
          switch (weapon.getItemType()) {
          case BOW:
          case CROSSBOW:
            env.value += 30.;
            break;
          case DAGGER:
View Full Code Here

    if(player.getAutoSoulShot().contains(FishshotId))
    {
      isAutoSoulShot = true;
    }
    L2ItemInstance weaponInst = player.getActiveWeaponInstance();
    L2Weapon weaponItem = player.getActiveWeaponItem();
    if(weaponInst == null || weaponItem.getItemType() != WeaponType.ROD)
    {
      if(!isAutoSoulShot)
      {
        player.sendPacket(Msg.CANNOT_USE_SOULSHOTS);
      }
      return;
    }
    if(item.getCount() < 1)
    {
      if(isAutoSoulShot)
      {
        player.removeAutoSoulShot(FishshotId);
        player.sendPacket(new ExAutoSoulShot(FishshotId, false), new SystemMessage(SystemMessage.THE_AUTOMATIC_USE_OF_S1_WILL_NOW_BE_CANCELLED).addString(item.getName()));
        return;
      }
      player.sendPacket(Msg.NOT_ENOUGH_SPIRITSHOTS);
      return;
    }
    // spiritshot is already active
    if(weaponInst.getChargedFishshot())
    {
      return;
    }
    int grade = weaponItem.getCrystalType().externalOrdinal;
    if(grade == 0 && FishshotId != 6535 || grade == 1 && FishshotId != 6536 || grade == 2 && FishshotId != 6537 || grade == 3 && FishshotId != 6538 || grade == 4 && FishshotId != 6539 || grade == 5 && FishshotId != 6540)
    {
      if(isAutoSoulShot)
      {
        return;
View Full Code Here

    if(playable == null || !playable.isPlayer())
    {
      return;
    }
    L2Player player = (L2Player) playable;
    L2Weapon weaponItem = player.getActiveWeaponItem();
    L2ItemInstance weaponInst = player.getActiveWeaponInstance();
    int SoulshotId = item.getItemId();
    boolean isAutoSoulShot = false;
    L2Item itemTemplate = ItemTable.getInstance().getTemplate(item.getItemId());
    if(player.getAutoSoulShot().contains(SoulshotId))
    {
      isAutoSoulShot = true;
    }
    if(weaponInst == null)
    {
      if(!isAutoSoulShot)
      {
        player.sendPacket(Msg.CANNOT_USE_SOULSHOTS);
      }
      return;
    }
    // soulshot is already active
    if(weaponInst.getChargedSoulshot() != L2ItemInstance.CHARGED_NONE)
    {
      return;
    }
    int grade = weaponItem.getCrystalType().externalOrdinal;
    int soulShotConsumption = weaponItem.getSoulShotCount();
    long count = item.getCount();
    if(soulShotConsumption == 0)
    {
      // Can't use soulshots
      if(isAutoSoulShot)
      {
        player.removeAutoSoulShot(SoulshotId);
        player.sendPacket(new ExAutoSoulShot(SoulshotId, false), new SystemMessage(SystemMessage.THE_AUTOMATIC_USE_OF_S1_WILL_NOW_BE_CANCELLED).addString(itemTemplate.getName()));
        return;
      }
      player.sendPacket(Msg.CANNOT_USE_SOULSHOTS);
      return;
    }
    if(grade == 0 && SoulshotId != 5789 && SoulshotId != 1835 // NG
      || grade == 1 && SoulshotId != 1463 && SoulshotId != 22082 && SoulshotId != 13037 // D
      || grade == 2 && SoulshotId != 1464 && SoulshotId != 22083 && SoulshotId != 13045 // C
      || grade == 3 && SoulshotId != 1465 && SoulshotId != 22084 // B
      || grade == 4 && SoulshotId != 1466 && SoulshotId != 22085 && SoulshotId != 13055 // A
      || grade == 5 && SoulshotId != 1467 && SoulshotId != 22086 // S
      )
    {
      // wrong grade for weapon
      if(isAutoSoulShot)
      {
        return;
      }
      player.sendPacket(Msg.SOULSHOT_DOES_NOT_MATCH_WEAPON_GRADE);
      return;
    }
    if(weaponItem.getItemType() == WeaponType.BOW || weaponItem.getItemType() == WeaponType.CROSSBOW)
    {
      int newSS = (int) player.calcStat(Stats.SS_USE_BOW, soulShotConsumption, null, null);
      if(newSS < soulShotConsumption && Rnd.chance(player.calcStat(Stats.SS_USE_BOW_CHANCE, soulShotConsumption, null, null)))
      {
        soulShotConsumption = newSS;
View Full Code Here

    {
      return;
    }
    L2Player player = (L2Player) playable;
    L2ItemInstance weaponInst = player.getActiveWeaponInstance();
    L2Weapon weaponItem = player.getActiveWeaponItem();
    int SoulshotId = item.getItemId();
    boolean isAutoSoulShot = false;
    L2Item itemTemplate = ItemTable.getInstance().getTemplate(item.getItemId());
    if(player.getAutoSoulShot().contains(SoulshotId))
    {
      isAutoSoulShot = true;
    }
    if(weaponInst == null)
    {
      if(!isAutoSoulShot)
      {
        player.sendPacket(Msg.CANNOT_USE_SPIRITSHOTS);
      }
      return;
    }
    if(weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
    // already charged by blessed spirit shot
    // btw we cant charge only when bsps is charged
    {
      return;
    }
    int spiritshotId = item.getItemId();
    int grade = weaponItem.getCrystalType().externalOrdinal;
    int blessedsoulSpiritConsumption = weaponItem.getSpiritShotCount();
    long count = item.getCount();
    if(blessedsoulSpiritConsumption == 0)
    {
      // Can't use Spiritshots
      if(isAutoSoulShot)
View Full Code Here

TOP

Related Classes of l2p.gameserver.templates.L2Weapon

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.