Summons cast skills on non flagged players.

This commit is contained in:
MobiusDev 2018-12-29 06:41:10 +00:00
parent 68654aaee3
commit 08294a16cf
40 changed files with 180 additions and 50 deletions

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override

View File

@ -122,6 +122,12 @@ public class NotFriend implements IAffectObjectHandler
return true; 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. // By default any flagged/PK player is considered enemy.
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0); return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
} }

View File

@ -118,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return; return;
} }
final L2Object target = _skill.getTarget(_actor, _forceUse, _dontMove, false); final L2Object target = _skill.getTarget(_actor, _skill.isBad(), _dontMove, false);
if (checkTargetLost(target)) if (checkTargetLost(target))
{ {
setTarget(null); setTarget(null);
@ -133,7 +133,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false); summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE); setIntention(AI_INTENTION_IDLE);
_startFollow = val; _startFollow = val;
_actor.doCast(_skill, _item, _forceUse, _dontMove); _actor.doCast(_skill, _item, _skill.isBad(), _dontMove);
} }
private void thinkPickUp() private void thinkPickUp()

View File

@ -396,6 +396,12 @@ public class L2Npc extends L2Character
return false; return false;
} }
// Summons can attack NPCs.
if (attacker.isSummon())
{
return true;
}
if (!isTargetable()) if (!isTargetable())
{ {
return false; return false;

View File

@ -627,7 +627,8 @@ public abstract class L2Summon extends L2Playable
} }
else 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 // Check the validity of the target
@ -776,7 +777,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) 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 // Send a System Message to the L2PcInstance
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET); _owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
@ -786,7 +787,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
super.doCast(skill); doCast(skill, null, skill.isBad(), false);
} }
@Override @Override