Disable Drain skills used on invulnerable NPCs.
This commit is contained in:
@@ -9005,56 +9005,56 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduce current hp.
|
* Reduce current hp.
|
||||||
* @param i the i
|
* @param amount the amount
|
||||||
* @param attacker the attacker
|
* @param attacker the attacker
|
||||||
*/
|
*/
|
||||||
public void reduceCurrentHp(double i, Creature attacker)
|
public void reduceCurrentHp(double amount, Creature attacker)
|
||||||
{
|
{
|
||||||
reduceCurrentHp(i, attacker, true);
|
reduceCurrentHp(amount, attacker, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduce current hp.
|
* Reduce current hp.
|
||||||
* @param i the i
|
* @param amount the amount
|
||||||
* @param attacker the attacker
|
* @param attacker the attacker
|
||||||
* @param awake the awake
|
* @param awake the awake
|
||||||
*/
|
*/
|
||||||
public void reduceCurrentHp(double i, Creature attacker, boolean awake)
|
public void reduceCurrentHp(double amount, Creature attacker, boolean awake)
|
||||||
{
|
{
|
||||||
if ((this instanceof NpcInstance) && Config.INVUL_NPC_LIST.contains(((NpcInstance) this).getNpcId()))
|
if (isNpc() && Config.INVUL_NPC_LIST.contains(((NpcInstance) this).getNpcId()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.CHAMPION_ENABLE && _champion && (Config.CHAMPION_HP != 0))
|
if (Config.CHAMPION_ENABLE && _champion && (Config.CHAMPION_HP != 0))
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(i / Config.CHAMPION_HP, attacker, awake);
|
getStatus().reduceHp(amount / Config.CHAMPION_HP, attacker, awake);
|
||||||
}
|
}
|
||||||
else if (_advanceFlag)
|
else if (_advanceFlag)
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(i / _advanceMultiplier, attacker, awake);
|
getStatus().reduceHp(amount / _advanceMultiplier, attacker, awake);
|
||||||
}
|
}
|
||||||
else if (_isUnkillable)
|
else if (_isUnkillable)
|
||||||
{
|
{
|
||||||
final double hpToReduce = getStatus().getCurrentHp() - 1;
|
final double hpToReduce = getStatus().getCurrentHp() - 1;
|
||||||
if (i > getStatus().getCurrentHp())
|
if (amount > getStatus().getCurrentHp())
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(hpToReduce, attacker, awake);
|
getStatus().reduceHp(hpToReduce, attacker, awake);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(i, attacker, awake);
|
getStatus().reduceHp(amount, attacker, awake);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(i, attacker, awake);
|
getStatus().reduceHp(amount, attacker, awake);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private long _nextReducingHPByOverTime = -1;
|
private long _nextReducingHPByOverTime = -1;
|
||||||
|
|
||||||
public void reduceCurrentHpByDamOverTime(double i, Creature attacker, boolean awake, int period)
|
public void reduceCurrentHpByDamOverTime(double amount, Creature attacker, boolean awake, int period)
|
||||||
{
|
{
|
||||||
if (_nextReducingHPByOverTime > System.currentTimeMillis())
|
if (_nextReducingHPByOverTime > System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
@@ -9062,12 +9062,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
}
|
}
|
||||||
|
|
||||||
_nextReducingHPByOverTime = System.currentTimeMillis() + (period * 1000);
|
_nextReducingHPByOverTime = System.currentTimeMillis() + (period * 1000);
|
||||||
reduceCurrentHp(i, attacker, awake);
|
reduceCurrentHp(amount, attacker, awake);
|
||||||
}
|
}
|
||||||
|
|
||||||
private long _nextReducingMPByOverTime = -1;
|
private long _nextReducingMPByOverTime = -1;
|
||||||
|
|
||||||
public void reduceCurrentMpByDamOverTime(double i, int period)
|
public void reduceCurrentMpByDamOverTime(double amount, int period)
|
||||||
{
|
{
|
||||||
if (_nextReducingMPByOverTime > System.currentTimeMillis())
|
if (_nextReducingMPByOverTime > System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
@@ -9075,7 +9075,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
}
|
}
|
||||||
|
|
||||||
_nextReducingMPByOverTime = System.currentTimeMillis() + (period * 1000);
|
_nextReducingMPByOverTime = System.currentTimeMillis() + (period * 1000);
|
||||||
reduceCurrentMp(i);
|
reduceCurrentMp(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -57,13 +57,18 @@ public class SkillDrain extends Skill
|
|||||||
for (WorldObject target2 : targets)
|
for (WorldObject target2 : targets)
|
||||||
{
|
{
|
||||||
final Creature target = (Creature) target2;
|
final Creature target = (Creature) target2;
|
||||||
|
if (creature.isPlayable() && target.isInvul())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (target.isAlikeDead() && (getTargetType() != SkillTargetType.TARGET_CORPSE_MOB))
|
if (target.isAlikeDead() && (getTargetType() != SkillTargetType.TARGET_CORPSE_MOB))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like L2OFF no effect on invul object except Npcs
|
// Like L2OFF no effect on invul object except Npcs
|
||||||
if ((creature != target) && (target.isInvul() && !(target instanceof NpcInstance)))
|
if ((creature != target) && (target.isInvul() && !target.isNpc()))
|
||||||
{
|
{
|
||||||
continue; // No effect on invulnerable chars unless they cast it themselves.
|
continue; // No effect on invulnerable chars unless they cast it themselves.
|
||||||
}
|
}
|
||||||
|
@@ -9054,56 +9054,56 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduce current hp.
|
* Reduce current hp.
|
||||||
* @param i the i
|
* @param amount the amount
|
||||||
* @param attacker the attacker
|
* @param attacker the attacker
|
||||||
*/
|
*/
|
||||||
public void reduceCurrentHp(double i, Creature attacker)
|
public void reduceCurrentHp(double amount, Creature attacker)
|
||||||
{
|
{
|
||||||
reduceCurrentHp(i, attacker, true);
|
reduceCurrentHp(amount, attacker, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduce current hp.
|
* Reduce current hp.
|
||||||
* @param i the i
|
* @param amount the amount
|
||||||
* @param attacker the attacker
|
* @param attacker the attacker
|
||||||
* @param awake the awake
|
* @param awake the awake
|
||||||
*/
|
*/
|
||||||
public void reduceCurrentHp(double i, Creature attacker, boolean awake)
|
public void reduceCurrentHp(double amount, Creature attacker, boolean awake)
|
||||||
{
|
{
|
||||||
if ((this instanceof NpcInstance) && Config.INVUL_NPC_LIST.contains(((NpcInstance) this).getNpcId()))
|
if (isNpc() && Config.INVUL_NPC_LIST.contains(((NpcInstance) this).getNpcId()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.CHAMPION_ENABLE && _champion && (Config.CHAMPION_HP != 0))
|
if (Config.CHAMPION_ENABLE && _champion && (Config.CHAMPION_HP != 0))
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(i / Config.CHAMPION_HP, attacker, awake);
|
getStatus().reduceHp(amount / Config.CHAMPION_HP, attacker, awake);
|
||||||
}
|
}
|
||||||
else if (_advanceFlag)
|
else if (_advanceFlag)
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(i / _advanceMultiplier, attacker, awake);
|
getStatus().reduceHp(amount / _advanceMultiplier, attacker, awake);
|
||||||
}
|
}
|
||||||
else if (_isUnkillable)
|
else if (_isUnkillable)
|
||||||
{
|
{
|
||||||
final double hpToReduce = getStatus().getCurrentHp() - 1;
|
final double hpToReduce = getStatus().getCurrentHp() - 1;
|
||||||
if (i > getStatus().getCurrentHp())
|
if (amount > getStatus().getCurrentHp())
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(hpToReduce, attacker, awake);
|
getStatus().reduceHp(hpToReduce, attacker, awake);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(i, attacker, awake);
|
getStatus().reduceHp(amount, attacker, awake);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getStatus().reduceHp(i, attacker, awake);
|
getStatus().reduceHp(amount, attacker, awake);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private long _nextReducingHPByOverTime = -1;
|
private long _nextReducingHPByOverTime = -1;
|
||||||
|
|
||||||
public void reduceCurrentHpByDamOverTime(double i, Creature attacker, boolean awake, int period)
|
public void reduceCurrentHpByDamOverTime(double amount, Creature attacker, boolean awake, int period)
|
||||||
{
|
{
|
||||||
if (_nextReducingHPByOverTime > System.currentTimeMillis())
|
if (_nextReducingHPByOverTime > System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
@@ -9111,12 +9111,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
}
|
}
|
||||||
|
|
||||||
_nextReducingHPByOverTime = System.currentTimeMillis() + (period * 1000);
|
_nextReducingHPByOverTime = System.currentTimeMillis() + (period * 1000);
|
||||||
reduceCurrentHp(i, attacker, awake);
|
reduceCurrentHp(amount, attacker, awake);
|
||||||
}
|
}
|
||||||
|
|
||||||
private long _nextReducingMPByOverTime = -1;
|
private long _nextReducingMPByOverTime = -1;
|
||||||
|
|
||||||
public void reduceCurrentMpByDamOverTime(double i, int period)
|
public void reduceCurrentMpByDamOverTime(double amount, int period)
|
||||||
{
|
{
|
||||||
if (_nextReducingMPByOverTime > System.currentTimeMillis())
|
if (_nextReducingMPByOverTime > System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
@@ -9124,7 +9124,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
}
|
}
|
||||||
|
|
||||||
_nextReducingMPByOverTime = System.currentTimeMillis() + (period * 1000);
|
_nextReducingMPByOverTime = System.currentTimeMillis() + (period * 1000);
|
||||||
reduceCurrentMp(i);
|
reduceCurrentMp(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -57,13 +57,18 @@ public class SkillDrain extends Skill
|
|||||||
for (WorldObject target2 : targets)
|
for (WorldObject target2 : targets)
|
||||||
{
|
{
|
||||||
final Creature target = (Creature) target2;
|
final Creature target = (Creature) target2;
|
||||||
|
if (creature.isPlayable() && target.isInvul())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (target.isAlikeDead() && (getTargetType() != SkillTargetType.TARGET_CORPSE_MOB))
|
if (target.isAlikeDead() && (getTargetType() != SkillTargetType.TARGET_CORPSE_MOB))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like L2OFF no effect on invul object except Npcs
|
// Like L2OFF no effect on invul object except Npcs
|
||||||
if ((creature != target) && (target.isInvul() && !(target instanceof NpcInstance)))
|
if ((creature != target) && (target.isInvul() && !target.isNpc()))
|
||||||
{
|
{
|
||||||
continue; // No effect on invulnerable chars unless they cast it themselves.
|
continue; // No effect on invulnerable chars unless they cast it themselves.
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user