All pastes #48615 Raw Edit

new L2Skill

public java v1 · immutable
#48615 ·published 2006-04-08 10:00 UTC
rendered paste body
Index: C:/Documents and Settings/Vivian/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/model/L2Skill.java===================================================================--- C:/Documents and Settings/Vivian/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/model/L2Skill.java	(revision 1768)+++ C:/Documents and Settings/Vivian/workspace/L2_GameServer_c4/java/net/sf/l2j/gameserver/model/L2Skill.java	(working copy)@@ -1015,86 +1015,160 @@ 			} 			case TARGET_AREA: 			{-				if (-						(                                               // )-								!(target instanceof L2Attackable) &&    //   Target is not L2Attackable and-								!(target instanceof L2PcInstance)       //   Target is not L2PcInstance-						) ||                                            // ) or-						(                                               // (-								this.getCastRange() >= 0 &&             //   Range skill and-								(                                       //   (-										target == null ||               //     No target or-										target == activeChar ||         //     Target is self or-										target.isAlikeDead()            //     Target is dead/fake death-								)                                       //   )-						)                                               // )-				)-				{-					activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IS_INCORRECT));-					return null;-				}-				-				L2Character cha;-				if (this.getCastRange() >= 0)-				{-					cha = target;-					targetList.add((L2Character)cha); // Add target to target list-				}-				else-					cha = activeChar;-				-				boolean skillUserIsL2PcInstance = (activeChar instanceof L2PcInstance);-				boolean effectOriginIsL2PcInstance = (cha instanceof L2PcInstance);-				boolean objIsL2PcInstance;-				int radius = getSkillRadius();-				for (L2Object obj : cha.getKnownList().getKnownObjects())-				{-					if (!(obj instanceof L2Character)) continue;-					-					target = (L2Character) obj;-					if(!target.isAlikeDead() && target != activeChar)   // If target is not dead/fake death and not self-					{-						if (!Util.checkIfInRange(radius, cha, obj, true)) // Go to next obj if obj isn't in range-							continue;-						-						objIsL2PcInstance = (obj instanceof L2PcInstance);-						-						if (skillUserIsL2PcInstance)                // Skill attacker is L2PcInstance, hit everything except-						{-							if (-									(                               // (-											objIsL2PcInstance &&    //   obj is L2PcInstance and-											(                       //   (-													(               //     In same clan-															(((L2PcInstance)activeChar).getClan() != null && ((L2PcInstance)obj).getClan() != null) &&-															((L2PcInstance)activeChar).getClan().getClanId() == ((L2PcInstance)obj).getClan().getClanId()-													) ||            //     or in same party-													(-															(((L2PcInstance)activeChar).getParty() != null && ((L2PcInstance)obj).getParty() != null) &&-															((L2PcInstance)activeChar).getParty().getPartyLeaderOID() == ((L2PcInstance)obj).getParty().getPartyLeaderOID()-													) ||            //     or not pvp with -													!((L2PcInstance)activeChar).checkPvpSkill(obj, this)-											)                       //   )-									)-							)-								continue;-						}-						else                                                // Skill user is not L2PcInstance-						{-							if (effectOriginIsL2PcInstance &&               // If effect starts at L2PcInstance and-									!objIsL2PcInstance)                     // Object is not L2PcInstance-								continue;-						}-						-						targetList.add((L2Character)obj);   // Add obj to target lists-					}-				}-				-				if (targetList.size() == 0)-					return null;-				-				return targetList.toArray(new L2Character[targetList.size()]);-			}+            if (+                    (                                               // )+                            !(target instanceof L2Attackable) &&    //   Target is not L2Attackable and+                            !(target instanceof L2PcInstance)       //   Target is not L2PcInstance+                    ) ||                                            // ) or+                    (                                               // (+                            this.getCastRange() >= 0 &&             //   Range skill and+                            (                                       //   (+                                    target == null ||               //     No target or+                                    target == activeChar ||         //     Target is self or+                                    target.isAlikeDead()            //     Target is dead/fake death+                            )                                       //   )+                    )                                               // )+                )+            {+                activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IS_INCORRECT));+                return null;+            }+            +            L2Character cha;+            if (this.getCastRange() >= 0)+            {+                cha = target;+                targetList.add((L2Character)cha); // Add target to target list+            }+            else+                cha = activeChar;++            boolean skillUserIsL2PcInstance = (activeChar instanceof L2PcInstance);+            boolean effectOriginIsL2PcInstance = (cha instanceof L2PcInstance);+            boolean skillUserIsL2PetOrSummon = (activeChar instanceof L2PetInstance);+            boolean objIsL2PcInstance;+            boolean objIsL2PetInstance;+            boolean objIsL2Summon;+            int radius = getSkillRadius();+            if (skillUserIsL2PetOrSummon == false)+            	skillUserIsL2PetOrSummon = (activeChar instanceof L2Summon);+            	if (skillUserIsL2PetOrSummon == true)+            		activeChar = ((L2Summon)activeChar).getOwner();+            else+            	if (skillUserIsL2PetOrSummon == true)+            		activeChar = ((L2PetInstance)activeChar).getOwner();+            for (L2Object obj : cha.getKnownList().getKnownObjects())+            {+                if (!(obj instanceof L2Character)) continue;++                target = (L2Character) obj;+                if(!target.isAlikeDead() && target != activeChar)   // If target is not dead/fake death and not self+                {+                    if (!Util.checkIfInRange(radius, cha, obj, true)) // Go to next obj if obj isn't in range+                        continue;++                    objIsL2PcInstance = (obj instanceof L2PcInstance);+                    objIsL2PetInstance = (obj instanceof L2PetInstance);+                    objIsL2Summon = (obj instanceof L2Summon);+                    if ((skillUserIsL2PcInstance) || (skillUserIsL2PetOrSummon))        // Skill attacker is L2PcInstance or Pet, Summon, hit everything except+                    {+                        if (+                                (                               // (+                                        objIsL2PcInstance &&    //   obj is L2PcInstance and+                                        (                       //   (+                                                (               //     In same clan+                                                        (((L2PcInstance)activeChar).getClan() != null && ((L2PcInstance)obj).getClan() != null) &&+                                                        ((L2PcInstance)activeChar).getClan().getClanId() == ((L2PcInstance)obj).getClan().getClanId()+                                                ) ||            //     or in same party+                                                (+                                                        (((L2PcInstance)activeChar).getParty() != null && ((L2PcInstance)obj).getParty() != null) &&+                                                        ((L2PcInstance)activeChar).getParty().getPartyLeaderOID() == ((L2PcInstance)obj).getParty().getPartyLeaderOID()+                                                ) ||            //     or not pvp with +                                                (+                                                		!((L2PcInstance)activeChar).checkPvpSkill(obj, this)+                                                ) ||            //      or not in pvp zone+                                                (+                                                		!((L2PcInstance)obj).getInPvpZone()		+                                                ) ||            //      or not Karma <= 0+                                                (+                                                		((L2PcInstance)obj).getKarma() <= 0+                                                )+                                        )                       //   )+                                )+                            )+                            continue;+                        if (+                                (                               // (+                                        objIsL2PetInstance &&    //   obj is L2PcInstance and+                                        (                       //   (+                                                (               //     In same clan+                                                        (((L2PcInstance)activeChar).getClan() != null && ((L2PetInstance)obj).getOwner().getClan() != null) &&+                                                        ((L2PcInstance)activeChar).getClan().getClanId() == ((L2PetInstance)obj).getOwner().getClan().getClanId()+                                                ) ||            //     or in same party+                                                (+                                                        (((L2PcInstance)activeChar).getParty() != null && ((L2PetInstance)obj).getOwner().getParty() != null) &&+                                                        ((L2PcInstance)activeChar).getParty().getPartyLeaderOID() == ((L2PetInstance)obj).getOwner().getParty().getPartyLeaderOID()+                                                ) ||            //     or not pvp with +                                                (+                                                		!((L2PcInstance)activeChar).checkPvpSkill(obj, this)+                                                ) ||            //      or not in pvp zone+                                                (+                                                		!((L2PetInstance)obj).getOwner().getInPvpZone()		+                                                ) ||            //      or not Karma <= 0+                                                (+                                                		((L2PetInstance)obj).getOwner().getKarma() <= 0+                                                ) ||+                                                (+                                                		((L2PetInstance)obj).getOwner() == (L2PcInstance)activeChar+                                                )+                                        )                       //   )+                                )+                            )+                            continue;+                        if (+                                (                               // (+                                        objIsL2Summon &&    //   obj is L2PcInstance and+                                        (                       //   (+                                                (               //     In same clan+                                                        (((L2PcInstance)activeChar).getClan() != null && ((L2Summon)obj).getOwner().getClan() != null) &&+                                                        ((L2PcInstance)activeChar).getClan().getClanId() == ((L2Summon)obj).getOwner().getClan().getClanId()+                                                ) ||            //     or in same party+                                                (+                                                        (((L2PcInstance)activeChar).getParty() != null && ((L2Summon)obj).getOwner().getParty() != null) &&+                                                        ((L2PcInstance)activeChar).getParty().getPartyLeaderOID() == ((L2Summon)obj).getOwner().getParty().getPartyLeaderOID()+                                                ) ||            //     or not pvp with +                                                (+                                                		!((L2PcInstance)activeChar).checkPvpSkill(obj, this)+                                                ) ||            //      or not in pvp zone+                                                (+                                                		!((L2Summon)obj).getOwner().getInPvpZone()		+                                                ) ||            //      or not Karma <= 0+                                                (+                                                		((L2Summon)obj).getOwner().getKarma() <= 0+                                                ) ||+                                                (+                                                		((L2Summon)obj).getOwner() == (L2PcInstance)activeChar+                                                )+                                        )                       //   )+                                )+                            )+                            continue;+                    }+                    else                                                // Skill user is not L2PcInstance+                    {+                        if (effectOriginIsL2PcInstance &&               // If effect starts at L2PcInstance and+                                !objIsL2PcInstance)                     // Object is not L2PcInstance+                            continue;+                    }+                    targetList.add((L2Character)obj);   // Add obj to target lists+                }+            }+            +            if (targetList.size() == 0)+                return null;++            return targetList.toArray(new L2Character[targetList.size()]);+        } 			case TARGET_MULTIFACE: 			{ 				if((!(target instanceof L2Attackable)@@ -1284,6 +1358,141 @@ 				activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IS_INCORRECT)); 				return null; 			}+			case TARGET_AREA_CORPSE_MOB:+	        {+    	    	if (!(target instanceof L2Attackable) || !target.isDead())+        	{+        		activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IS_INCORRECT));+        		return null;+        	}+        	L2Character cha;+            if (this.getCastRange() >= 0)+            {+                cha = target;+                targetList.add((L2Character)cha); // Add target to target list+            }+            else+                cha = activeChar;++            boolean skillUserIsL2PcInstance = (activeChar instanceof L2PcInstance);+            boolean effectOriginIsL2PcInstance = (cha instanceof L2PcInstance);+            boolean objIsL2PcInstance;+            boolean objIsL2PetInstance;+            boolean objIsL2Summon;+            int radius = getSkillRadius();+            for (L2Object obj : cha.getKnownList().getKnownObjects())+            {+                if (!(obj instanceof L2Character)) continue;++                target = (L2Character) obj;+                if(!target.isAlikeDead() && target != activeChar)   // If target is not dead/fake death and not self+                {+                    if (!Util.checkIfInRange(radius, cha, obj, true)) // Go to next obj if obj isn't in range+                        continue;+                    +                    objIsL2PcInstance = (obj instanceof L2PcInstance);+                    objIsL2PetInstance = (obj instanceof L2PetInstance);+                    objIsL2Summon = (obj instanceof L2Summon);++                    if (skillUserIsL2PcInstance)                // Skill attacker is L2PcInstance, hit everything except+                    {+                        if (+                                (                               // (+                                        objIsL2PcInstance &&    //   obj is L2PcInstance and+                                        (                       //   (+                                                (               //     In same clan+                                                        (((L2PcInstance)activeChar).getClan() != null && ((L2PcInstance)obj).getClan() != null) &&+                                                        ((L2PcInstance)activeChar).getClan().getClanId() == ((L2PcInstance)obj).getClan().getClanId()+                                                ) ||            //     or in same party+                                                (+                                                        (((L2PcInstance)activeChar).getParty() != null && ((L2PcInstance)obj).getParty() != null) &&+                                                        ((L2PcInstance)activeChar).getParty().getPartyLeaderOID() == ((L2PcInstance)obj).getParty().getPartyLeaderOID()+                                                ) ||            //     or not pvp with +                                                (+                                                		!((L2PcInstance)activeChar).checkPvpSkill(obj, this)+                                                ) ||            //      or not in pvp zone+                                                (+                                                		!((L2PcInstance)obj).getInPvpZone()		+                                                ) ||            //      or not Karma <= 0+                                                (+                                                		((L2PcInstance)obj).getKarma() <= 0+                                                )+                                        )                       //   )+                                )+                            )+                            continue;+                        if (+                                 (                               // (+                                        objIsL2PetInstance &&    //   obj is L2PcInstance and+                                        (                       //   (+                                                (               //     In same clan+                                                        (((L2PcInstance)activeChar).getClan() != null && ((L2PetInstance)obj).getOwner().getClan() != null) &&+                                                        ((L2PcInstance)activeChar).getClan().getClanId() == ((L2PetInstance)obj).getOwner().getClan().getClanId()+                                                ) ||            //     or in same party+                                                (+                                                        (((L2PcInstance)activeChar).getParty() != null && ((L2PetInstance)obj).getOwner().getParty() != null) &&+                                                        ((L2PcInstance)activeChar).getParty().getPartyLeaderOID() == ((L2PetInstance)obj).getOwner().getParty().getPartyLeaderOID()+                                                ) ||            //     or not pvp with +                                                (+                                                		!((L2PcInstance)activeChar).checkPvpSkill(obj, this)+                                                ) ||            //      or not in pvp zone+                                                (+                                                		!((L2PetInstance)obj).getOwner().getInPvpZone()		+                                                ) ||            //      or not Karma <= 0+                                                (+                                                		((L2PetInstance)obj).getOwner().getKarma() <= 0+                                                ) ||+                                                (+                                                		((L2PetInstance)obj).getOwner() == (L2PcInstance)activeChar+                                                )+                                        )                       //   )+                                 )+                            )+                            continue;+                        if (+                                 (                               // (+                                        objIsL2Summon &&    //   obj is L2PcInstance and+                                        (                       //   (+                                                (               //     In same clan+                                                        (((L2PcInstance)activeChar).getClan() != null && ((L2Summon)obj).getOwner().getClan() != null) &&+                                                        ((L2PcInstance)activeChar).getClan().getClanId() == ((L2Summon)obj).getOwner().getClan().getClanId()+                                                ) ||            //     or in same party+                                                (+                                                        (((L2PcInstance)activeChar).getParty() != null && ((L2Summon)obj).getOwner().getParty() != null) &&+                                                        ((L2PcInstance)activeChar).getParty().getPartyLeaderOID() == ((L2Summon)obj).getOwner().getParty().getPartyLeaderOID()+                                                ) ||            //     or not pvp with +                                                (+                                                		!((L2PcInstance)activeChar).checkPvpSkill(obj, this)+                                                ) ||            //      or not in pvp zone+                                                (+                                                		!((L2Summon)obj).getOwner().getInPvpZone()		+                                                ) ||            //      or not Karma <= 0+                                                (+                                                		((L2Summon)obj).getOwner().getKarma() <= 0+                                                ) ||+                                                (+                                                		((L2Summon)obj).getOwner() == (L2PcInstance)activeChar+                                                )+                                        )                       //   )+                                  )+                            )+                            continue;+                    }+                    else                                                // Skill user is not L2PcInstance+                    {+                        if (effectOriginIsL2PcInstance &&               // If effect starts at L2PcInstance and+                                !objIsL2PcInstance)                     // Object is not L2PcInstance+                            continue;+                    }++                    targetList.add((L2Character)obj);   // Add obj to target lists+                }+            }+            +            if (targetList.size() == 0)+                return null;+            return targetList.toArray(new L2Character[targetList.size()]);+        } 			case TARGET_CORPSE_MOB: 			{ 				if(!(target instanceof L2Attackable) || !target.isDead())@@ -1328,6 +1537,11 @@ 			} 			case TARGET_AREA_UNDEAD: 			{+				if (target == null)+				{+	        		activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IS_INCORRECT));+	        		return null;+	        	} 				L2Character cha; 				if (this.getCastRange() >= 0) 				{@@ -1336,7 +1550,7 @@ 				} 				else 					cha = activeChar;-				+			 				int radius = getSkillRadius(); 				if (cha != null && cha.getKnownList() != null) 					for (L2Object obj : cha.getKnownList().getKnownObjects())