|
@@ -2214,25 +2214,21 @@ public final class Formulas
|
|
|
|
|
|
public static final boolean calcLethalHit(L2Character activeChar, L2Character target, L2Skill skill)
|
|
public static final boolean calcLethalHit(L2Character activeChar, L2Character target, L2Skill skill)
|
|
{
|
|
{
|
|
- if (!target.isRaid() && !(target instanceof L2DoorInstance) && !((target instanceof L2Npc) && (((L2Npc) target).getNpcId() == 35062)))
|
|
|
|
|
|
+ if (!target.isRaid() && !target.isInvul() && !(target.isDoor()) && !((target.isNpc()) && (((L2Npc) target).getNpcId() == 35062)))
|
|
{
|
|
{
|
|
- // activeChar.sendMessage(Double.toString(chance));
|
|
|
|
- // activeChar.sendMessage(Double.toString(calcLethal(activeChar, target, skill.getLethalChance2(),skill.getMagicLevel())));
|
|
|
|
- // activeChar.sendMessage(Double.toString(calcLethal(activeChar, target, skill.getLethalChance1(),skill.getMagicLevel())));
|
|
|
|
-
|
|
|
|
// 2nd lethal effect activate (cp,hp to 1 or if target is npc then hp to 1)
|
|
// 2nd lethal effect activate (cp,hp to 1 or if target is npc then hp to 1)
|
|
if ((skill.getLethalChance2() > 0) && (Rnd.get(1000) < calcLethal(activeChar, target, skill.getLethalChance2(), skill.getMagicLevel())))
|
|
if ((skill.getLethalChance2() > 0) && (Rnd.get(1000) < calcLethal(activeChar, target, skill.getLethalChance2(), skill.getMagicLevel())))
|
|
{
|
|
{
|
|
- if (target instanceof L2Npc)
|
|
|
|
|
|
+ if (target.isNpc())
|
|
{
|
|
{
|
|
target.reduceCurrentHp(target.getCurrentHp() - 1, activeChar, skill);
|
|
target.reduceCurrentHp(target.getCurrentHp() - 1, activeChar, skill);
|
|
}
|
|
}
|
|
- else if (target instanceof L2PcInstance) // If is a active player set his HP and CP to 1
|
|
|
|
|
|
+ else if (target.isPlayer()) // If is a active player set his HP and CP to 1
|
|
{
|
|
{
|
|
L2PcInstance player = (L2PcInstance) target;
|
|
L2PcInstance player = (L2PcInstance) target;
|
|
if (!player.isInvul())
|
|
if (!player.isInvul())
|
|
{
|
|
{
|
|
- if (!((activeChar instanceof L2PcInstance) && (((L2PcInstance) activeChar).isGM() && !((L2PcInstance) activeChar).getAccessLevel().canGiveDamage())))
|
|
|
|
|
|
+ if (!(activeChar.isPlayer() && (activeChar.isGM() && !activeChar.getAccessLevel().canGiveDamage())))
|
|
{
|
|
{
|
|
player.setCurrentHp(1);
|
|
player.setCurrentHp(1);
|
|
player.setCurrentCp(1);
|
|
player.setCurrentCp(1);
|
|
@@ -2244,24 +2240,21 @@ public final class Formulas
|
|
}
|
|
}
|
|
else if ((skill.getLethalChance1() > 0) && (Rnd.get(1000) < calcLethal(activeChar, target, skill.getLethalChance1(), skill.getMagicLevel())))
|
|
else if ((skill.getLethalChance1() > 0) && (Rnd.get(1000) < calcLethal(activeChar, target, skill.getLethalChance1(), skill.getMagicLevel())))
|
|
{
|
|
{
|
|
- if (target instanceof L2PcInstance)
|
|
|
|
|
|
+ if (target.isMonster())
|
|
{
|
|
{
|
|
- L2PcInstance player = (L2PcInstance) target;
|
|
|
|
- if (!player.isInvul())
|
|
|
|
|
|
+ target.reduceCurrentHp(target.getCurrentHp() / 2, activeChar, skill);
|
|
|
|
+ activeChar.sendPacket(SystemMessageId.HALF_KILL);
|
|
|
|
+ }
|
|
|
|
+ else if (target.isPlayer())
|
|
|
|
+ {
|
|
|
|
+ L2PcInstance player = target.getActingPlayer();
|
|
|
|
+ if (!((activeChar.isPlayer()) && (activeChar.isGM() && !activeChar.getAccessLevel().canGiveDamage())))
|
|
{
|
|
{
|
|
- if (!((activeChar instanceof L2PcInstance) && (((L2PcInstance) activeChar).isGM() && !((L2PcInstance) activeChar).getAccessLevel().canGiveDamage())))
|
|
|
|
- {
|
|
|
|
- player.setCurrentCp(1); // Set CP to 1
|
|
|
|
- player.sendPacket(SystemMessageId.CP_DISAPPEARS_WHEN_HIT_WITH_A_HALF_KILL_SKILL);
|
|
|
|
- activeChar.sendPacket(SystemMessageId.CP_SIPHON);
|
|
|
|
- }
|
|
|
|
|
|
+ player.setCurrentCp(1); // Set CP to 1
|
|
|
|
+ player.sendPacket(SystemMessageId.CP_DISAPPEARS_WHEN_HIT_WITH_A_HALF_KILL_SKILL);
|
|
|
|
+ activeChar.sendPacket(SystemMessageId.HALF_KILL);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // TODO: remove half kill since SYSMsg got changed.
|
|
|
|
- /*
|
|
|
|
- * else if (target instanceof L2Npc) // If is a monster remove first damage and after 50% of current hp target.reduceCurrentHp(target.getCurrentHp() / 2, activeChar, skill);
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|