Package com.l2jfrozen.gameserver.templates

Examples of com.l2jfrozen.gameserver.templates.L2Weapon


  {

    if(env.target == null)
      return false;

    L2Weapon item = env.target.getActiveWeaponItem();

    if(item == null)
      return false;

    return (item.getItemType().mask() & _weaponMask) != 0;
  }
View Full Code Here


     
      setIntention(AI_INTENTION_ACTIVE);
      return;
    }

    L2Weapon weapon = _actor.getActiveWeaponItem();
    final int collision = _actor.getTemplate().collisionRadius;
    final int combinedCollision = collision + originalAttackTarget.getTemplate().collisionRadius;

    //------------------------------------------------------
    // In case many mobs are trying to hit from same place, move a bit,
    // circling around the target
    // Note from Gnacik:
    // On l2js because of that sometimes mobs don't attack player only running
    // around player without any sense, so decrease chance for now
    if (!_actor.isMovementDisabled() && Rnd.nextInt(100) <= 3)
    {
      for (L2Object nearby : _actor.getKnownList().getKnownObjects().values())
      {
        if (nearby instanceof L2Attackable
            && _actor.isInsideRadius(nearby, collision, false, false)
            && nearby != originalAttackTarget)
        {
          int newX = combinedCollision + Rnd.get(40);
          if (Rnd.nextBoolean())
            newX = originalAttackTarget.getX() + newX;
          else
            newX = originalAttackTarget.getX() - newX;
          int newY = combinedCollision + Rnd.get(40);
          if (Rnd.nextBoolean())
            newY = originalAttackTarget.getY() + newY;
          else
            newY = originalAttackTarget.getY() - newY;

          if (!_actor.isInsideRadius(newX, newY, collision, false))
          {
            int newZ = _actor.getZ() + 30;
            if (Config.GEODATA == 0 || GeoData.getInstance().canMoveFromToTarget(_actor.getX(), _actor.getY(), _actor.getZ(), newX, newY, newZ))
              moveTo(newX, newY, newZ);
          }           
          return;
        }
      }
    }
   
    if(weapon != null && weapon.getItemType() == L2WeaponType.BOW)
    {
      // Micht: kepping this one otherwise we should do 2 sqrt
      double distance2 = _actor.getPlanDistanceSq(originalAttackTarget.getX(), originalAttackTarget.getY());
      if (Math.sqrt(distance2) <= 60 + combinedCollision)
      {
View Full Code Here

    int itemId = item.getItemId();
    boolean isBlessed = itemId == 6647;
    int shotConsumption = 1;

    L2ItemInstance weaponInst = null;
    L2Weapon weaponItem = null;

    if(activePet instanceof L2PetInstance && !(activePet instanceof L2BabyPetInstance))
    {
      weaponInst = ((L2PetInstance) activePet).getActiveWeaponInstance();
      weaponItem = ((L2PetInstance) activePet).getActiveWeaponItem();

      if(weaponInst == null)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SPIRITSHOTS));
        return;
      }

      if(weaponInst.getChargedSpiritshot() != L2ItemInstance.CHARGED_NONE)
        // SpiritShots are already active.
        return;

      int shotCount = item.getCount();
      shotConsumption = weaponItem.getSpiritShotCount();

      weaponItem = null;

      if(shotConsumption == 0)
      {
View Full Code Here

      // Cancels fishing
      player.sendPacket(new SystemMessage(SystemMessageId.FISHING_ATTEMPT_CANCELLED));
      return;
    }

    L2Weapon weaponItem = player.getActiveWeaponItem();
    if((weaponItem == null || weaponItem.getItemType() != L2WeaponType.ROD))
    {
      // Fishing poles are not installed
      // player.sendPacket(new SystemMessage(SystemMessageId.FISHING_POLE_NOT_EQUIPPED));
      return;
    }
View Full Code Here

    if(!(playable instanceof L2PcInstance))
      return;

    L2PcInstance activeChar = (L2PcInstance) playable;
    L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
    L2Weapon weaponItem = activeChar.getActiveWeaponItem();

    if(weaponInst == null || weaponItem.getItemType() != L2WeaponType.ROD)
      return;

    if(weaponInst.getChargedFishshot())
      // spiritshot is already active
      return;

    int FishshotId = item.getItemId();
    int grade = weaponItem.getCrystalType();
    int count = item.getCount();

    weaponItem = null;

    if(grade == L2Item.CRYSTAL_NONE && FishshotId != 6535 || grade == L2Item.CRYSTAL_D && FishshotId != 6536 || grade == L2Item.CRYSTAL_C && FishshotId != 6537 || grade == L2Item.CRYSTAL_B && FishshotId != 6538 || grade == L2Item.CRYSTAL_A && FishshotId != 6539 || grade == L2Item.CRYSTAL_S && FishshotId != 6540)
View Full Code Here

    int itemId = 6645;
    int shotConsumption = 1;

    L2ItemInstance weaponInst = null;
    L2Weapon weaponItem = null;

    if(activePet instanceof L2PetInstance && !(activePet instanceof L2BabyPetInstance))
    {
      weaponInst = ((L2PetInstance) activePet).getActiveWeaponInstance();
      weaponItem = ((L2PetInstance) activePet).getActiveWeaponItem();

      if(weaponInst == null)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SOULSHOTS));
        return;
      }

      if(weaponInst.getChargedSoulshot() != L2ItemInstance.CHARGED_NONE)
        // SoulShots are already active.
        return;

      int shotCount = item.getCount();
      shotConsumption = weaponItem.getSoulShotCount();
      weaponItem = null;

      if(shotConsumption == 0)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SOULSHOTS));
View Full Code Here

    {
      _currentItem.item = new L2Armor((L2ArmorType) _currentItem.type, _currentItem.set);
    }
    else if(_currentItem.type instanceof L2WeaponType)
    {
      _currentItem.item = new L2Weapon((L2WeaponType) _currentItem.type, _currentItem.set);
    }
    else if(_currentItem.type instanceof L2EtcItemType)
    {
      _currentItem.item = new L2EtcItem((L2EtcItemType) _currentItem.type, _currentItem.set);
    }
View Full Code Here

    {
      damage *= 1.04;
    }

    // defence modifier depending of the attacker weapon
    L2Weapon weapon = attacker.getActiveWeaponItem();
    Stats stat = null;
    if(weapon != null)
    {
      switch(weapon.getItemType())
      {
        case BOW:
          stat = Stats.BOW_WPN_VULN;
          break;
        case BLUNT:
          stat = Stats.BLUNT_WPN_VULN;
          break;
        case DAGGER:
          stat = Stats.DAGGER_WPN_VULN;
          break;
        case DUAL:
          stat = Stats.DUAL_WPN_VULN;
          break;
        case DUALFIST:
          stat = Stats.DUALFIST_WPN_VULN;
          break;
        case ETC:
          stat = Stats.ETC_WPN_VULN;
          break;
        case FIST:
          stat = Stats.FIST_WPN_VULN;
          break;
        case POLE:
          stat = Stats.POLE_WPN_VULN;
          break;
        case SWORD:
          stat = Stats.SWORD_WPN_VULN;
          break;
        case BIGSWORD:
          stat = Stats.BIGSWORD_WPN_VULN;
          break;
        case BIGBLUNT:
          stat = Stats.BIGBLUNT_WPN_VULN;
          break;
      }
    }

    if (crit)
    {
      //Finally retail like formula
      double cAtkMultiplied = damage + attacker.calcStat(Stats.CRITICAL_DAMAGE, damage, target, skill);
      double cAtkVuln = target.calcStat(Stats.CRIT_VULN, 1, target, null);
      double improvedDamageByCriticalMulAndVuln = cAtkMultiplied * cAtkVuln;
      double improvedDamageByCriticalMulAndAdd = improvedDamageByCriticalMulAndVuln + attacker.calcStat(Stats.CRITICAL_DAMAGE_ADD, 0, target, skill);
     
      if(Config.DEBUG){
        System.out.println("Attacker '"+attacker.getName()+"' Critical Damage Debug:");
        System.out.println("  -  Initial Damage:  "+damage);
        System.out.println("  -  Damage increased of mult:  "+cAtkMultiplied);
        System.out.println("  -  cAtkVuln Mult:  "+cAtkVuln);
        System.out.println("  -  improvedDamageByCriticalMulAndVuln: "+improvedDamageByCriticalMulAndVuln);
        System.out.println("  -  improvedDamageByCriticalMulAndAdd: "+improvedDamageByCriticalMulAndAdd);
      }
     
      damage = improvedDamageByCriticalMulAndAdd;
     
    }
   
    damage = 70 * damage / defence;
   

    if(shld && !Config.ALT_GAME_SHIELD_BLOCKS)
    {
      defence += target.getShldDef();
    }

   
    //damage = 70 * damage / defence;

    if(stat != null)
    {
      // get the vulnerability due to skills (buffs, passives, toggles, etc)
      damage = target.calcStat(stat, damage, target, null);
      if(target instanceof L2NpcInstance)
      {
        // get the natural vulnerability for the template
        damage *= ((L2NpcInstance) target).getTemplate().getVulnerability(stat);
      }
    }
   

    damage += Rnd.nextDouble() * damage / 10;
    //    damage += _rnd.nextDouble()* attacker.getRandomDamage(target);
    //    }
    if(shld && Config.ALT_GAME_SHIELD_BLOCKS)
    {
      damage -= target.getShldDef();
      if(damage < 0)
      {
        damage = 0;
      }
    }

    if(target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.DAGGER && skill != null)
    {
      L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
      if(armor != null)
      {
        if(((L2PcInstance) target).isWearingHeavyArmor())
View Full Code Here

      init = 15;
    }

    if(Config.ALT_GAME_CANCEL_BOW && target.isAttackingNow())
    {
      L2Weapon wpn = target.getActiveWeaponItem();
      if(wpn != null && wpn.getItemType() == L2WeaponType.BOW)
      {
        init = 15;
      }
    }
View Full Code Here

   * @param target
   * @return true if shield defence successfull
   */
  public static boolean calcShldUse(L2Character attacker, L2Character target)
  {
    L2Weapon at_weapon = attacker.getActiveWeaponItem();
    // double shldRate = target.calcStat(Stats.SHIELD_RATE, 0, attacker, null) * DEXbonus[target.getDEX()];
    double shldRate = target.calcStat(Stats.SHIELD_RATE, 0, attacker, null) * BaseStats.DEX.calcBonus(target);
    if (shldRate == 0.0)
      return false;
    // Check for passive skill Aegis (316) or Aegis Stance (318)
    // Like L2OFF you can't parry if your target is behind you
    if (target.getKnownSkill(316) == null && target.getFirstEffect(318) == null)
      if (target.isBehind(attacker) || !target.isFront(attacker) || !attacker.isFront(target))
        return false;
    // if attacker use bow and target wear shield, shield block rate is multiplied by 1.3 (30%)
    if (at_weapon != null && at_weapon.getItemType() == L2WeaponType.BOW)
    {
      shldRate *= 1.3;
    }
    return shldRate > Rnd.get(100);
  }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.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.