Package lineage2.gameserver.model

Examples of lineage2.gameserver.model.Skill$AddedSkill


    {
      return true;
    }
    env.value = Math.max(Math.min(env.value, 100), 1);
    final double base = env.value;
    final Skill skill = env.skill;
    if (!skill.isOffensive())
    {
      return Rnd.chance(env.value);
    }
    final Creature caster = env.character;
    final Creature target = env.target;
    boolean debugCaster = false;
    boolean debugTarget = false;
    boolean debugGlobal = false;
    if (Config.ALT_DEBUG_ENABLED)
    {
      debugCaster = (caster.getPlayer() != null) && caster.getPlayer().isDebug();
      debugTarget = (target.getPlayer() != null) && target.getPlayer().isDebug();
      final boolean debugPvP = Config.ALT_DEBUG_PVP_ENABLED && (debugCaster && debugTarget) && (!Config.ALT_DEBUG_PVP_DUEL_ONLY || (caster.getPlayer().isInDuel() && target.getPlayer().isInDuel()));
      debugGlobal = debugPvP || (Config.ALT_DEBUG_PVE_ENABLED && ((debugCaster && target.isMonster()) || (debugTarget && caster.isMonster())));
    }
    double statMod = 1.;
    if (skill.getSaveVs() != null)
    {
      statMod = skill.getSaveVs().calcChanceMod(target);
      env.value *= statMod;
    }
    env.value = Math.max(env.value, 1);
    double mAtkMod = 1.;
    int ssMod = 0;
    if (skill.isMagic())
    {
      int mdef = Math.max(1, target.getMDef(target, skill));
      double matk = caster.getMAtk(target, skill);
      if (skill.isSSPossible())
      {
        switch (spiritshot)
        {
          case ItemInstance.CHARGED_BLESSED_SPIRITSHOT:
            ssMod = 4;
            break;
          case ItemInstance.CHARGED_SPIRITSHOT:
            ssMod = 2;
            break;
          default:
            ssMod = 1;
        }
        matk *= ssMod;
      }
      mAtkMod = (Config.SKILLS_CHANCE_MOD * Math.pow(matk, Config.SKILLS_CHANCE_POW)) / mdef;
      env.value *= mAtkMod;
      env.value = Math.max(env.value, 1);
    }
    double lvlDependMod = skill.getLevelModifier();
    if (lvlDependMod != 0)
    {
      final int attackLevel = skill.getMagicLevel() > 0 ? skill.getMagicLevel() : caster.getLevel();
      lvlDependMod = 1. + ((attackLevel - target.getLevel()) * 0.03 * lvlDependMod);
      if (lvlDependMod < 0)
      {
        lvlDependMod = 0;
      }
      else if (lvlDependMod > 2)
      {
        lvlDependMod = 2;
      }
      env.value *= lvlDependMod;
    }
    double vulnMod = 0;
    double profMod = 0;
    double resMod = 1.;
    double debuffMod = 1.;
    if (!skill.isIgnoreResists())
    {
      debuffMod = 1. - (target.calcStat(Stats.DEBUFF_RESIST, caster, skill) / 120.);
      if (debuffMod != 1)
      {
        if (debuffMod == Double.NEGATIVE_INFINITY)
        {
          if (debugGlobal)
          {
            if (debugCaster)
            {
              caster.getPlayer().sendMessage("Full debuff immunity");
            }
            if (debugTarget)
            {
              target.getPlayer().sendMessage("Full debuff immunity");
            }
          }
          return false;
        }
        if (debuffMod == Double.POSITIVE_INFINITY)
        {
          if (debugGlobal)
          {
            if (debugCaster)
            {
              caster.getPlayer().sendMessage("Full debuff vulnerability");
            }
            if (debugTarget)
            {
              target.getPlayer().sendMessage("Full debuff vulnerability");
            }
          }
          return true;
        }
        debuffMod = Math.max(debuffMod, 0);
        env.value *= debuffMod;
      }
      SkillTrait trait = skill.getTraitType();
      if (trait != null)
      {
        vulnMod = trait.calcVuln(env);
        profMod = trait.calcProf(env);
        final double maxResist = 90 + (profMod * 0.85);
        resMod = (maxResist - vulnMod) / 60.;
      }
      if (resMod != 1)
      {
        if (resMod == Double.NEGATIVE_INFINITY)
        {
          if (debugGlobal)
          {
            if (debugCaster)
            {
              caster.getPlayer().sendMessage("Full immunity");
            }
            if (debugTarget)
            {
              target.getPlayer().sendMessage("Full immunity");
            }
          }
          return false;
        }
        if (resMod == Double.POSITIVE_INFINITY)
        {
          if (debugGlobal)
          {
            if (debugCaster)
            {
              caster.getPlayer().sendMessage("Full vulnerability");
            }
            if (debugTarget)
            {
              target.getPlayer().sendMessage("Full vulnerability");
            }
          }
          return true;
        }
        resMod = Math.max(resMod, 0);
        env.value *= resMod;
      }
    }
    double elementMod = 0;
    final Element element = skill.getElement();
    if (element != Element.NONE)
    {
      elementMod = skill.getElementPower();
      Element attackElement = getAttackElement(caster, target);
      if (attackElement == element)
      {
        elementMod += caster.calcStat(element.getAttack(), 0);
      }
      elementMod -= target.calcStat(element.getDefence(), 0);
      elementMod = Math.round(elementMod / 10);
      env.value += elementMod;
    }
    env.value = Math.max(env.value, Math.min(base, Config.SKILLS_CHANCE_MIN));
    env.value = Math.max(Math.min(env.value, Config.SKILLS_CHANCE_CAP), 1);
    final boolean result = Rnd.chance((int) env.value);
    if (debugGlobal)
    {
      StringBuilder stat = new StringBuilder(100);
      if (et == null)
      {
        stat.append(skill.getName());
      }
      else
      {
        stat.append(et._effectType.name());
      }
      stat.append(" AR:");
      stat.append((int) base);
      stat.append(' ');
      if (skill.getSaveVs() != null)
      {
        stat.append(skill.getSaveVs().name());
        stat.append(':');
        stat.append(String.format("%1.1f", statMod));
      }
      if (skill.isMagic())
      {
        stat.append(' ');
        stat.append(" mAtk:");
        stat.append(String.format("%1.1f", mAtkMod));
      }
      if (skill.getTraitType() != null)
      {
        stat.append(' ');
        stat.append(skill.getTraitType().name());
      }
      stat.append(' ');
      stat.append(String.format("%1.1f", resMod));
      stat.append('(');
      stat.append(String.format("%1.1f", profMod));
View Full Code Here


        }
        if (learn2.getMinLevel() > (player.getLevel() + 10))
        {
          continue;
        }
        Skill newSkill = SkillTable.getInstance().getInfo(skill.getId(), i);
        if (newSkill != null)
        {
          player.addSkill(newSkill, true);
          break;
        }
View Full Code Here

    {
      if (sts == null)
      {
        continue;
      }
      Skill skill = SkillTable.getInstance().getInfo(sts.getId(), sts.getLevel());
      if (skill == null)
      {
        continue;
      }
      if (sts.getReuseBasic() <= (15 * 60000L))
 
View Full Code Here

    for (int itemId : skillLearn.getRequiredItems().keySet())
    {
      writeD(itemId);
      writeQ(skillLearn.getRequiredItems().get(itemId));
    }
    Skill skkill = SkillTable.getInstance().getInfo(skillLearn.getId(), skillLearn.getLevel());
    if (skkill.isRelationSkill())
    {
      int[] _ss = skkill.getRelationSkills();
      writeD(_ss.length);
      for (int skillId : _ss)
      {
        writeD(skillId);
        writeD(SkillTable.getInstance().getBaseLevel(skillId));
View Full Code Here

      rset = statement.executeQuery();
      while (rset.next())
      {
        int id = rset.getInt("skill_id");
        int level = rset.getInt("skill_level");
        Skill skill = SkillTable.getInstance().getInfo(id, level);
        _skills.put(skill.getId(), skill);
      }
    }
    catch (Exception e)
    {
      _log.warn("Could not restore clan skills: " + e);
View Full Code Here

   * @param store boolean
   * @return Skill
   */
  public Skill addSkill(Skill newSkill, boolean store)
  {
    Skill oldSkill = null;
    if (newSkill != null)
    {
      oldSkill = _skills.put(newSkill.getId(), newSkill);
      if (store)
      {
        Connection con = null;
        PreparedStatement statement = null;
        try
        {
          con = DatabaseFactory.getInstance().getConnection();
          if (oldSkill != null)
          {
            statement = con.prepareStatement("UPDATE clan_skills SET skill_level=? WHERE skill_id=? AND clan_id=?");
            statement.setInt(1, newSkill.getLevel());
            statement.setInt(2, oldSkill.getId());
            statement.setInt(3, getClanId());
            statement.execute();
          }
          else
          {
View Full Code Here

   * @param def int
   * @return int
   */
  public int getSkillLevel(int id, int def)
  {
    Skill skill = _skills.get(id);
    return skill == null ? def : skill.getLevel();
  }
View Full Code Here

    {
      return;
    }
    if (command.startsWith("gokukuru"))
    {
      Skill skill = SkillTable.getInstance().getInfo(9209, 1);
      player.altUseSkill(skill, player);
      player.broadcastPacket(new MagicSkillUse(player, player, skill.getId(), 1, 0, 0));
    }
    else
    {
      super.onBypassFeedback(player, command);
    }
View Full Code Here

   */
  @Override
  protected void onEvtTimer(int timerId, Object arg1, Object arg2)
  {
    super.onEvtTimer(timerId, arg1, arg2);
    Skill sk;
    switch (timerId)
    {
      case 1:
        sk = SkillTable.getInstance().getInfo(ENRAGED_SKILL_ID, 1);
        addTaskBuff(getActor(), sk);
View Full Code Here

   * @param eff Effect
   * @return Effect
   */
  private Effect cloneEffect(Creature cha, Effect eff)
  {
    Skill skill = eff.getSkill();
    for (EffectTemplate et : skill.getEffectTemplates())
    {
      Effect effect = et.getEffect(new Env(cha, cha, skill));
      if (effect != null)
      {
        effect.setCount(eff.getCount());
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.Skill$AddedSkill

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.