Force use for summon skills.

This commit is contained in:
MobiusDev
2019-01-27 14:37:37 +00:00
parent 0a2dbf9de3
commit dac640e17c
20 changed files with 960 additions and 860 deletions

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override

View File

@@ -45,9 +45,7 @@ public class NotFriend implements IAffectObjectHandler
final L2PcInstance player = activeChar.getActingPlayer(); final L2PcInstance player = activeChar.getActingPlayer();
final L2PcInstance targetPlayer = target.getActingPlayer(); final L2PcInstance targetPlayer = target.getActingPlayer();
if (player != null) if ((player != null) && (targetPlayer != null))
{
if (targetPlayer != null)
{ {
// Same player. // Same player.
if (player == targetPlayer) if (player == targetPlayer)
@@ -131,7 +129,6 @@ public class NotFriend implements IAffectObjectHandler
// 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);
} }
}
return target.isAutoAttackable(activeChar); return target.isAutoAttackable(activeChar);
} }

View File

@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
else else
{ {
final L2Object currentTarget = _owner.getTarget(); final L2Object currentTarget = _owner.getTarget();
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false); if (currentTarget != null)
{
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
}
else
{
target = skill.getTarget(this, forceUse, dontMove, false);
}
} }
// Check the validity of the target // Check the validity of the target
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
@Override @Override
public void doCast(Skill skill) public void doCast(Skill skill)
{ {
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack()) if ((skill.getTarget(this, false, 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);
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
return; return;
} }
doCast(skill, null, skill.isBad(), false); super.doCast(skill);
} }
@Override @Override