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 charX, charY, charZ, targetX, targetY, targetZ, dx, dy, dz; int radius = getSkillRadius(); for (L2Object obj : cha.getKnownObjects()) { if (obj == null || !(obj instanceof L2Character)) continue; target = (L2Character) obj; if(!target.isAlikeDead()) // If target is is not dead of fake death { charX = cha.getX(); charY = cha.getY(); charZ = cha.getZ(); targetX = obj.getX(); targetY = obj.getY(); targetZ = obj.getZ(); dx = Math.abs(charX - targetX); dy = Math.abs(charY - targetY); dz = Math.abs(charZ - targetZ); if (dx*dx + dy*dy + dz*dz > radius*radius) // 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()]); }