Browse Source

BETA: TargetMe effect fix. It shouldn't affect non-enemies. Shield Strike will no longer change the target of a non-enemy player.

nik 12 years ago
parent
commit
b25799a188

+ 10 - 4
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/TargetMe.java

@@ -15,6 +15,7 @@
 package handlers.effecthandlers;
 
 import com.l2jserver.gameserver.model.actor.L2Playable;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
 import com.l2jserver.gameserver.model.effects.EffectTemplate;
 import com.l2jserver.gameserver.model.effects.L2Effect;
@@ -48,10 +49,15 @@ public class TargetMe extends L2Effect
 			
 			if (getEffected().getTarget() != getEffector())
 			{
-				// Target is different
-				getEffected().setTarget(getEffector());
-				if (getEffected().isPlayer())
-					getEffected().sendPacket(new MyTargetSelected(getEffector().getObjectId(), 0));
+				L2PcInstance effector = getEffector().getActingPlayer();
+				// If effector is null, then its not a player, but NPC. If its not null, then it should check if the skill is pvp skill.
+				if (effector == null || effector.checkPvpSkill(getEffected(), getSkill()))
+				{
+					// Target is different
+					getEffected().setTarget(getEffector());
+					if (getEffected().isPlayer())
+						getEffected().sendPacket(new MyTargetSelected(getEffector().getObjectId(), 0));
+				}
 			}
 			((L2Playable)getEffected()).setLockedTarget(getEffector());
 			return true;