A Project for Chronicle 4 based on L2JServer.


    [Share] Disable/Enable direct hit on hp with Blows.

    Share
    avatar
    mystogan64

    Posts : 51
    Join date : 2013-10-04

    [Share] Disable/Enable direct hit on hp with Blows.

    Post  mystogan64 on 5th November 2013, 19:04

    Hello , today i am going to share a skill option that will allow any blow attack to direct hit in the HP . Its tested in 459 rev and it works.

    Lets begin.

    Step 1: net.sf.l2j.gameserver.handler.skillhandlers.Blow.java
    Code:

    double damage = (int) Formulas.getInstance().calcBlowDamage(activeChar, target, skill, shld, soul);

    +if (skill.getDmgDirectlyToHP() && (target instanceof L2PcInstance))
    + {
    + // no vegeange implementation
    + final L2Character[] ts =
    + {
    + target,
    + activeChar
    + };
    +
    + /*
    + * This loop iterates over previous array but, if skill damage is not reflected it stops on first iteration (target) and misses activeChar
    + */
    + for (L2Character targ : ts)
    + {
    + L2PcInstance player = (L2PcInstance) targ;
    + // L2PcInstance player = (L2PcInstance)target;
    + if (!player.isInvul())
    + {
    + // Check and calculate transfered damage
    + L2Summon summon = player.getPet();
    + if ((summon instanceof L2SummonInstance) && Util.checkIfInRange(900, player, summon, true))
    + {
    + int tDmg = ((int) damage * (int) player.getStat().calcStat(Stats.TRANSFER_DAMAGE_PERCENT, 0, null, null)) / 100;
    +
    + // Only transfer dmg up to current HP, it should
    + // not be killed
    + if (summon.getCurrentHp() < tDmg)
    + {
    + tDmg = (int) summon.getCurrentHp() - 1;
    + }
    + if (tDmg > 0)
    + {
    + summon.reduceCurrentHp(tDmg, activeChar);
    + damage -= tDmg;
    + }
    + }
    + if (damage >= player.getCurrentHp())
    + {
    + player.setCurrentHp(0);
    + if (player.isInOlympiadMode())
    + {
    + player.abortAttack();
    + player.abortCast();
    + player.getStatus().stopHpMpRegeneration();
    + // player.setIsDead(true);
    + player.setIsPendingRevive(true);
    + if (player.getPet() != null)
    + {
    + player.getPet().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null);
    + }
    + }
    + else
    + {
    + player.doDie(activeChar);
    + }
    + }
    +
    + else
    + {
    + player.setCurrentHp(player.getCurrentHp() - damage);
    + }
    + }
    +
    + SystemMessage smsg = new SystemMessage(SystemMessage.S1_GAVE_YOU_S2_DMG);
    + smsg.addString(activeChar.getName());
    + smsg.addNumber((int) damage);
    + player.sendPacket(smsg);
    +
    + // stop if no vengeance, so only target will be effected
    + if (!player.vengeanceSkill(skill))
    + {
    + break;
    + }
    + } // end for
    + } // end skill directlyToHp check
    Step 2: net.sf.l2j.gameserver.model.L2Character.java
    Code:

    public void sendMessage(String message)
            {

                    // Overriden in L2PcInstance
            }
    +public boolean vengeanceSkill(L2Skill skill)
    +   {
    +     if(!skill.isMagic() && skill.getCastRange() <= 40)
    +     {
    +     final double venganceChance = calcStat(Stats.VENGEANCE_SKILL_PHYSICAL_DAMAGE, 0, null, skill);
    +     if(venganceChance > Rnd.get(100))
    +     return true;
    +     }
    +     return false;
    +     }
    Step 3: net.sf.l2j.gameserver.skills.Stats.java
    Code:

    REFLECT_SKILL_PHYSIC("reflectSkillPhysic"),
    +VENGEANCE_SKILL_PHYSICAL_DAMAGE("vengeanceSkillPhysic"),
    Step 4: net.sf.l2j.gameserver.model.L2Skill.java
    Code:

    private final int _nextDanceCost;
    +private final boolean _directHpDmg; // If true then dmg is being make directly

    _nextDanceCost = set.getInteger("nextDanceCost", 0);
    +_directHpDmg = set.getBool("dmgDirectlyToHp", false);

    public final boolean isOffensive()
     {
     return _isOffensive;
     }
    +public final boolean getDmgDirectlyToHP()
    + {
    + return _directHpDmg;
    + }
    Step 5: and for the last step you need to edit datapack , gameserver/data/stats/skills

    <set name="dmgDirectlyToHp" val="false"/>


    Hope you like my share.

      Current date/time is 24th September 2017, 09:49