Package lineage2.gameserver.templates.item

Examples of lineage2.gameserver.templates.item.WeaponTemplate


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


    if (!player.isInZone(ZoneType.FISHING) || player.isInWater())
    {
      player.sendPacket(Msg.YOU_CANT_FISH_HERE);
      return false;
    }
    WeaponTemplate weaponItem = player.getActiveWeaponItem();
    if ((weaponItem == null) || (weaponItem.getItemType() != WeaponType.ROD))
    {
      player.sendPacket(Msg.FISHING_POLES_ARE_NOT_INSTALLED);
      return false;
    }
    ItemInstance lure = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
View Full Code Here

   * @param skill Skill
   * @return boolean
   */
  public static boolean calcBlow(Creature activeChar, Creature target, Skill skill)
  {
    WeaponTemplate weapon = activeChar.getActiveWeaponItem();
    double base_weapon_crit = weapon == null ? 4. : weapon.getCritical();
    double crit_height_bonus = (0.008 * Math.min(25, Math.max(-25, target.getZ() - activeChar.getZ()))) + 1.1;
    double buffs_mult = activeChar.calcStat(Stats.FATALBLOW_RATE, target, skill);
    double skill_mod = skill.isBehind() ? 5 : 4;
    double chance = base_weapon_crit * buffs_mult * crit_height_bonus * skill_mod;
    if (!target.isInCombat())
View Full Code Here

   * @param target Creature
   * @return boolean
   */
  public static boolean calcShldUse(Creature attacker, Creature target)
  {
    WeaponTemplate template = target.getSecondaryWeaponItem();
    if ((template == null) || (template.getItemType() != WeaponTemplate.WeaponType.NONE))
    {
      return false;
    }
    int angle = (int) target.calcStat(Stats.SHIELD_ANGLE, attacker, null);
    if (!PositionUtils.isFacing(target, attacker, angle))
View Full Code Here

      return;
    }
    getListeners().onAttack(target);
    int sAtk = Math.max(calculateAttackDelay(), 333);
    int ssGrade = 0;
    WeaponTemplate 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(this, SetupGauge.RED_MINI, reuse));
          _attackReuseEndTime = (reuse + System.currentTimeMillis()) - 75;
          if (reuse > sAtk)
          {
            ThreadPoolManager.getInstance().schedule(new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT, null, null), reuse);
          }
        }
      }
      ssGrade = weaponItem.getCrystalType().externalOrdinal;
    }
    _attackEndTime = (sAtk + System.currentTimeMillis()) - 10;
    _isAttackAborted = false;
    Attack attack = new Attack(this, target, getChargedSoulShot(), ssGrade);
    setHeading(PositionUtils.calculateHeadingFrom(this, target));
    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

   * @param target Creature
   * @param sAtk int
   */
  private void doAttackHitByBow(Attack attack, Creature target, int sAtk)
  {
    WeaponTemplate activeWeapon = getActiveWeaponItem();
    if (activeWeapon == null)
    {
      return;
    }
    int damage1 = 0, damage2 = 0;
    boolean shld1 = false;
    boolean crit1 = false;
    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;
      damage2 = (int) info.reflectableDamage;
      shld1 = info.shld;
      crit1 = info.crit;
      int range = activeWeapon.getAttackRange();
      damage1 *= ((Math.min(range, getDistance(target)) / range) * .4) + 0.8;
    }
    ThreadPoolManager.getInstance().schedule(new HitTask(this, target, damage1, damage2, crit1, miss1, attack._soulshot, shld1, true, true), sAtk);
    attack.addHit(target, damage2, miss1, crit1, shld1);
  }
View Full Code Here

   * Method getRandomDamage.
   * @return int
   */
  public int getRandomDamage()
  {
    WeaponTemplate weaponItem = getActiveWeaponItem();
    if (weaponItem == null)
    {
      return 5 + (int) Math.sqrt(getLevel());
    }
    return weaponItem.getRandomDamage();
  }
View Full Code Here

            else
            {
              set.set("class", ItemTemplate.ItemClass.WEAPON);
            }
          }
          template = new WeaponTemplate(set);
        }
      }
      catch (Exception e)
      {
        warn("Fail create item: " + set.get("item_id"), e);
View Full Code Here

    Fishing fishing = player.getFishing();
    if ((fishing == null) || !fishing.isInCombat())
    {
      return;
    }
    WeaponTemplate 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))
    {
      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);
      pen = 50;
View Full Code Here

    if ((playable == null) || !playable.isPlayer())
    {
      return false;
    }
    final Player player = (Player) playable;
    final WeaponTemplate weaponItem = player.getActiveWeaponItem();
    final ItemInstance weaponInst = player.getActiveWeaponInstance();
    final int SoulshotId = item.getItemId();
    boolean isAutoSoulShot = false;
    if (player.getAutoSoulShot().contains(SoulshotId))
    {
      isAutoSoulShot = true;
    }
    if (weaponInst == null)
    {
      if (!isAutoSoulShot)
      {
        player.sendPacket(Msg.CANNOT_USE_SOULSHOTS);
      }
      return false;
    }
    if (weaponInst.getChargedSoulshot() != ItemInstance.CHARGED_NONE)
    {
      return false;
    }
    final int grade = weaponItem.getCrystalType().externalOrdinal;
    int soulShotConsumption = weaponItem.getSoulShotCount();
    if (soulShotConsumption == 0)
    {
      if (isAutoSoulShot)
      {
        player.removeAutoSoulShot(SoulshotId);
        player.sendPacket(new ExAutoSoulShot(SoulshotId, false), new SystemMessage(SystemMessage.THE_AUTOMATIC_USE_OF_S1_WILL_NOW_BE_CANCELLED).addItemName(SoulshotId));
        return false;
      }
      player.sendPacket(Msg.CANNOT_USE_SOULSHOTS);
      return false;
    }
    if (((grade == 0) && (SoulshotId != 5789) && (SoulshotId != 1835)) || ((grade == 1) && (SoulshotId != 1463) && (SoulshotId != 22082) && (SoulshotId != 13037)) || ((grade == 2) && (SoulshotId != 1464) && (SoulshotId != 22083) && (SoulshotId != 13045)) || ((grade == 3) && (SoulshotId != 1465) && (SoulshotId != 22084)) || ((grade == 4) && (SoulshotId != 1466) && (SoulshotId != 22085) && (SoulshotId != 13055)) || ((grade == 5) && (SoulshotId != 1467) && (SoulshotId != 22086)) || ((grade == 6) && (SoulshotId != 17754) && (SoulshotId != 33780)))
    {
      if (isAutoSoulShot)
      {
        return false;
      }
      player.sendPacket(Msg.SOULSHOT_DOES_NOT_MATCH_WEAPON_GRADE);
      return false;
    }
    if ((weaponItem.getItemType() == WeaponType.BOW) || (weaponItem.getItemType() == WeaponType.CROSSBOW))
    {
      final 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

TOP

Related Classes of lineage2.gameserver.templates.item.WeaponTemplate

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.