From f177fcbf121b2986c9fe4a7df7693f2f93added4 Mon Sep 17 00:00:00 2001
From: Adry_85 <Adrya85@hotmail.it>
Date: Mon, 22 Apr 2013 17:46:15 +0000
Subject: [PATCH] BETA: Fixing Chain Heal behavior with different targets. 
 Reported by: badboy29 	Tested by: badboy29 	Reviewed by: !UnAfraid

---
 .../handlers/targethandlers/AreaFriendly.java | 49 ++++++++-----------
 .../scripts/handlers/targethandlers/One.java  |  2 +-
 2 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/AreaFriendly.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/AreaFriendly.java
index a8256b5c61..782d941d4b 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/AreaFriendly.java
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/AreaFriendly.java
@@ -49,25 +49,22 @@ public class AreaFriendly implements ITargetTypeHandler
 			return _emptyTargetList;
 		}
 		
-		if (skill.getCastRange() >= 0)
+		if (onlyFirst)
 		{
-			if (onlyFirst)
+			return new L2Character[]
 			{
-				return new L2Character[]
-				{
-					target
-				};
-			}
-			
-			if (activeChar.getActingPlayer().isInOlympiadMode())
+				target
+			};
+		}
+		
+		if (activeChar.getActingPlayer().isInOlympiadMode())
+		{
+			return new L2Character[]
 			{
-				return new L2Character[]
-				{
-					activeChar
-				};
-			}
-			targetList.add(target); // Add target to target list
+				activeChar
+			};
 		}
+		targetList.add(target); // Add target to target list
 		
 		if (target != null)
 		{
@@ -107,35 +104,31 @@ public class AreaFriendly implements ITargetTypeHandler
 			return false;
 		}
 		
-		if ((target == null) || target.isDead() || target.isAlikeDead() || target.isDoor() || (target instanceof L2SiegeFlagInstance) || target.isMonster())
+		if ((target == null) || target.isAlikeDead() || target.isDoor() || (target instanceof L2SiegeFlagInstance) || target.isMonster())
 		{
 			return false;
 		}
 		
-		if ((target.getActingPlayer() != null) && (target.getActingPlayer().inObserverMode() || target.getActingPlayer().isInOlympiadMode()))
+		if ((target.getActingPlayer() != null) && (target.getActingPlayer() != activeChar) && (target.getActingPlayer().inObserverMode() || target.getActingPlayer().isInOlympiadMode()))
 		{
 			return false;
 		}
 		
-		if (target.isPlayer())
+		if (target.isPlayable())
 		{
-			if ((target.getAllyId() != 0) && (activeChar.getAllyId() == target.getAllyId()))
+			if ((target != activeChar) && activeChar.isInParty() && target.isInParty())
 			{
-				return true;
+				return (activeChar.getParty().getLeader() == target.getParty().getLeader());
 			}
 			
-			if ((target.getClanId() != 0) && (activeChar.getClanId() == target.getClanId()))
+			if ((activeChar.getClanId() != 0) && (target.getClanId() != 0))
 			{
-				return true;
+				return (activeChar.getClanId() == target.getClanId());
 			}
 			
-			if ((target != activeChar) && activeChar.isInParty() && target.isInParty())
+			if ((activeChar.getAllyId() != 0) && (target.getAllyId() != 0))
 			{
-				if (activeChar.getParty().getLeader() == target.getParty().getLeader())
-				{
-					return true;
-				}
-				return false;
+				return (activeChar.getAllyId() == target.getAllyId());
 			}
 			
 			if ((target != activeChar) && (target.getActingPlayer().getPvpFlag() > 0))
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/One.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/One.java
index e0902ee2a8..6a7ad24dd4 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/One.java
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/targethandlers/One.java
@@ -34,7 +34,7 @@ public class One implements ITargetTypeHandler
 	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
 	{
 		// Check for null target or any other invalid target
-		if ((target == null) || target.isDead() || ((target == activeChar) && (skill.isOffensive() || skill.isPVP())))
+		if ((target == null) || target.isDead() || ((target == activeChar) && skill.isOffensive()))
 		{
 			activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
 			return _emptyTargetList;
-- 
GitLab