Package l2p.gameserver.model

Examples of l2p.gameserver.model.L2Skill


      //System.out.println("seed (" + _seedId + ") zone " + L2Manor.getInstance().getSeedManorId(_seedId) + " != castle_zone " + castleId);
      player.sendPacket(Msg.THIS_SEED_MAY_NOT_BE_SOWN_HERE);
      return;
    }
    // use Sowing skill, id 2097
    L2Skill skill = SkillTable.getInstance().getInfo(2097, 1);
    if(skill == null)
    {
      player.sendActionFailed();
      return;
    }
    if(skill.checkCondition(player, target, false, false, true))
    {
      player.setUseSeed(seedId);
      player.getAI().Cast(skill, target);
    }
  }
View Full Code Here


      return;
    }
    ArrayList<Integer> skill_ids = SkillSpellbookTable.getSpellbookHandlers().get(item.getItemId());
    for(int skill_id : skill_ids)
    {
      L2Skill skill = SkillTable.getInstance().getInfo(skill_id, 1);
      if(skill == null)
      {
        continue;
      }
      if(player.getSkillLevel(skill_id) > 0)
      {
        continue;
      }
      if(!(skill.isCommon() || SkillTreeTable.getInstance().isSkillPossible(player, skill_id, 1)))
      {
        continue;
      }
      if(player.getLevel() < SkillSpellbookTable.getMinLevel(item.getItemId()))
      {
View Full Code Here

  private void negateEffectAtPower(L2Character target, EffectType type, Integer power)
  {
    for(L2Effect e : target.getEffectList().getAllEffects())
    {
      L2Skill skill = e.getSkill();
      if(_onlyPhysical && skill.isMagic() || !skill.isCancelable() || skill.isOffensive() && !_negateDebuffs)
      {
        continue;
      }
      // Если у бафа выше уровень чем у скилла Cancel, то есть шанс, что этот баф не снимется
      if(!skill.isOffensive() && skill.getMagicLevel() > getMagicLevel() && Rnd.chance(skill.getMagicLevel() - getMagicLevel()))
      {
        continue;
      }
      if(e.getEffectType() == type && e.getStackOrder() <= power)
      {
View Full Code Here

  private void negateEffectAtPower(L2Character target, String stackType, Integer power)
  {
    for(L2Effect e : target.getEffectList().getAllEffects())
    {
      L2Skill skill = e.getSkill();
      if(_onlyPhysical && skill.isMagic() || !skill.isCancelable() || skill.isOffensive() && !_negateDebuffs)
      {
        continue;
      }
      // Если у бафа выше уровень чем у скилла Cancel, то есть шанс, что этот баф не снимется
      if(!skill.isOffensive() && skill.getMagicLevel() > getMagicLevel() && Rnd.chance(skill.getMagicLevel() - getMagicLevel()))
      {
        continue;
      }
      if(e.checkStackType(stackType) && e.getStackOrder() <= power)
      {
View Full Code Here

    if(!target.isDead() || target.isDying())
    {
      player.sendPacket(Msg.THAT_IS_THE_INCORRECT_TARGET);
      return;
    }
    L2Skill skill = SkillTable.getInstance().getInfo(2098, 1);
    if(skill != null && skill.checkCondition(player, target, false, false, true))
    {
      player.getAI().Cast(skill, target);
    }
    else
    {
View Full Code Here

      }
      makeSkills();
      for(int i = 0; i < lastLvl; i++)
      {
        currentSkill.currentLevel = i;
        L2Skill current = currentSkill.currentSkills.get(i);
        if(displayLevels.get(current.getLevel()) != null)
        {
          current.setDisplayLevel(displayLevels.get(current.getLevel()).shortValue());
        }
        current.setEnchantLevelCount(eLevels);
        //System.out.println(current.getLevel() + ":" + displayLevels.get(current.getLevel()));
        for(n = first; n != null; n = n.getNextSibling())
        {
          if("cond".equalsIgnoreCase(n.getNodeName()))
          {
            Condition condition = parseCondition(n.getFirstChild());
            if(condition != null)
            {
              Node msg = n.getAttributes().getNamedItem("msg");
              if(msg != null)
              {
                condition.setMessage(msg.getNodeValue());
              }
              current.attach(condition);
            }
          }
          if("for".equalsIgnoreCase(n.getNodeName()))
          {
            parseTemplate(n, current);
View Full Code Here

  public static boolean calcCastBreak(L2Character target, boolean crit) {
    if (target == null || target.isInvul() || target.isRaid()
        || !target.isCastingNow()) {
      return false;
    }
    L2Skill skill = target.getCastingSkill();
    if (skill != null
        && (skill.getSkillType() == SkillType.TAKECASTLE
            || skill.getSkillType() == SkillType.TAKEFORTRESS || skill
            .getSkillType() == SkillType.TAKEFLAG)) {
      return false;
    }
    return Rnd.chance(target.calcStat(Stats.CAST_INTERRUPT, crit ? 75 : 10,
        null, skill));
View Full Code Here

      GArray<L2Effect> el = target.getEffectList().getEffectsBySkillId(_target);
      if(el != null)
      {
        level = el.get(0).getSkill().getLevel();
      }
      L2Skill next = SkillTable.getInstance().getInfo(_target, level + 1);
      if(next != null)
      {
        next.getEffects(activeChar, target, false, false);
      }
    }
  }
View Full Code Here

  public static boolean calcSkillSuccess(Env env, Stats resistType,
      Stats attibuteType, int spiritshot) {
    if (env.value == -1) {
      return true;
    }
    L2Skill skill = env.skill;
    if (!skill.isOffensive()) {
      return Rnd.chance(env.value);
    }
    L2Character character = env.character;
    L2Character target = env.target;
    env.value = Math.max(Math.min(env.value, 100), 1); // РќР° РІСЃСЏРєРёР№
                              // случай
    double base = env.value; // Запоминаем базовый шанс
                  // (нужен позже)
    double mLevel = skill.getMagicLevel() == 0 || !character.isPlayer() ? character
        .getLevel() : skill.getMagicLevel(); // Разница РІ
                            // СѓСЂРѕРІРЅСЏС…
    mLevel = (mLevel - target.getLevel() + 3) * skill.getLevelModifier();
    env.value += mLevel >= 0 ? 0 : mLevel;
    boolean isGM = character.isPlayer() && ((L2Player) character).isGM();
    if (isGM) {
      character.sendMessage("magic level: " + mLevel);
      character.sendMessage("chance: " + env.value);
    }
    if (skill.getSavevs() > 0) {
      if (isGM) {
        character.sendMessage("skill: " + skill);
        character.sendMessage("chance: " + env.value);
        character.sendMessage("save type: " + skill.getSavevs());
      }
      env.value += 30 - calcSavevsDependence(skill.getSavevs(), target); // Бонус
                                        // РѕС‚
                                        // MEN/CON/etc
      if (isGM) {
        character.sendMessage("chance w/savevs: " + env.value);
      }
    }
    env.value = Math.max(env.value, 1);
    if (skill.isMagic()) // Этот блок только для
                // магических скиллов
    {
      int mdef = Math.max(1, target.getMDef(target, skill)); // Вычисляем
                                  // mDef
                                  // цели
      double matk = character.getMAtk(target, skill);
      if (skill.isSSPossible() && spiritshot > 0) // Считаем
                            // Р±РѕРЅСѓСЃ РѕС‚
                            // шотов
      {
        matk *= spiritshot * 2;
      }
      env.value *= Config.SKILLS_CHANCE_MOD
          * Math.pow(matk, Config.SKILLS_CHANCE_POW) / mdef;
    }
    if (!skill.isIgnoreResists()) {
      double res = 0;
      if (resistType != null) {
        res += target.calcStat(resistType, character, skill);
      }
      if (attibuteType != null) {
        res -= character.calcStat(attibuteType, target, skill);
      }
      res += target.calcStat(Stats.DEBUFF_RECEPTIVE, character, skill);
      if (res != 0) {
        double mod = Math.abs(0.02 * res) + 1;
        env.value = res > 0 ? env.value / mod : env.value * mod;
        if (isGM) {
          if (resistType != null) {
            character.sendMessage("resist: " + resistType);
            character.sendMessage("defense: "
                + (int) target.calcStat(resistType, character,
                    skill));
          }
          if (attibuteType != null) {
            character.sendMessage("attack: "
                + (int) character.calcStat(attibuteType,
                    target, skill));
            character.sendMessage("chance w/resist: " + env.value);
          }
        }
      }
    }
    env.value = character.calcStat(Stats.ACTIVATE_RATE, env.value, target,
        skill); // Учитываем общий Р±РѕРЅСѓСЃ Рє
            // шансам, если есть
    // if(skill.isSoulBoost()) // Бонус РѕС‚ РґСѓС€ камаелей
    // env.value *= 0.85 + 0.06 * Math.min(character.getConsumedSouls(), 5);
    env.value = Math.max(env.value,
        Math.min(base, Config.SKILLS_CHANCE_MIN)); // Если
                              // базовый
                              // шанс
                              // более
                              // Config.SKILLS_CHANCE_MIN,
                              // то РїСЂРё
                              // небольшой
                              // разнице РІ
                              // СѓСЂРѕРІРЅСЏС…,
                              // делаем
                              // кап
                              // СЃРЅРёР·Сѓ.
    env.value = Math.max(Math.min(env.value, Config.SKILLS_CHANCE_CAP), 1); // Применяем
                                        // кап
    if (target.isPlayer()) {
      L2Player player = (L2Player) target;
      if ((Config.SKILLS_SHOW_CHANCE && character.isMonster() || player
          .isGM()) && player.getVarB("SkillsMobChance")) {
        target.sendMessage(character.getName()
            + ": "
            + new CustomMessage(
                "l2p.gameserver.skills.Formulas.Chance", target)
                .addString(skill.getName())
                .addNumber(Math.round(env.value)).toString());
      }
    }
    if (Config.SKILLS_SHOW_CHANCE || isGM) {
      L2Player player = character.getPlayer();
      if (player != null && !player.getVarB("SkillsHideChance")) {
        player.sendMessage(new CustomMessage(
            "l2p.gameserver.skills.Formulas.Chance", player)
            .addString(skill.getName()).addNumber(
                Math.round(env.value)));
      }
    }
    return Rnd.chance(env.value);
  }
View Full Code Here

            getEffects(caster, target, getActivateRate() > 0, false);
          }
        }
        break;
      case TRAP:
        L2Skill trapSkill = getFirstAddedSkill();
        if(trapSkill == null)
        {
          System.out.println("Not implemented trap skill, id = " + getId());
          return;
        }
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.L2Skill

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.