diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 34c471f1f4..b50c2290db 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index a14adc109c..ee15b88bd5 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 761d3388c6..0a273cb3ac 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index a14adc109c..ee15b88bd5 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 761d3388c6..0a273cb3ac 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 53e151594a..2363867d3f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 761d3388c6..0a273cb3ac 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 53e151594a..2363867d3f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 761d3388c6..0a273cb3ac 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 53e151594a..2363867d3f 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 761d3388c6..0a273cb3ac 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 53e151594a..2363867d3f 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 21400a6899..5cf14e7993 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 78e70dee82..5d7774c3b0 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 21400a6899..5cf14e7993 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 78e70dee82..5d7774c3b0 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 21400a6899..5cf14e7993 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 78e70dee82..5d7774c3b0 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java index 357049622f..15a8397860 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java @@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler return true; } + // At this point summon should be prevented from attacking friendly targets. + if (activeChar.isSummon()) + { + return true; + } + // By default any flagged/PK player is considered enemy. return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 717b1bc79a..275bcb58ab 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable return; } - final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); + final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false); if (checkTargetLost(target)) { setTarget(null); @@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); _startFollow = val; - _actor.doCast(_skill, _item, _forceUse, _dontMove); + _actor.doCast(_skill, _item, _skill.isBad(), _dontMove); } private void thinkPickUp() diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 21400a6899..5cf14e7993 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -396,6 +396,12 @@ public class L2Npc extends L2Character return false; } + // Summons can attack NPCs. + if (attacker.isSummon()) + { + return true; + } + if (!isTargetable()) { return false; diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 78e70dee82..5d7774c3b0 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable } else { - target = skill.getTarget(this, forceUse, dontMove, false); + final L2Object currentTarget = _owner.getTarget(); + target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); } // Check the validity of the target @@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable @Override public void doCast(Skill skill) { - if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) + if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) { // Send a System Message to the L2PcInstance _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); @@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable return; } - super.doCast(skill); + doCast(skill, null, skill.isBad(), false); } @Override