From ebaa4f7e6808e7aa9f915368a6d99f2372dfa432 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 7 Sep 2020 09:47:22 +0000 Subject: [PATCH] Fixed ally target for clan skills. Contributed by G-hamsteR. --- .../org/l2jmobius/gameserver/model/Skill.java | 71 ++----------------- .../org/l2jmobius/gameserver/model/Skill.java | 69 +++--------------- 2 files changed, 15 insertions(+), 125 deletions(-) diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/Skill.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/Skill.java index 8f2c001677..ab41011c7c 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/Skill.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/Skill.java @@ -2079,88 +2079,31 @@ public abstract class Skill return targetList; } } - PlayerInstance src = null; - if (creature instanceof PlayerInstance) - { - src = (PlayerInstance) creature; - } - else if (creature instanceof Summon) - { - src = ((Summon) creature).getOwner(); - } if (clan != null) { // Get all visible objects in a spheric area near the Creature - // Get Clan Members - for (WorldObject newTarget : creature.getKnownList().getKnownObjects().values()) + for (WorldObject newTarget : player.getKnownList().getKnownCharactersInRadius(radius)) { - if (!(newTarget instanceof PlayerInstance)) + final PlayerInstance newPlayer = newTarget.getActingPlayer(); + if (newPlayer == null) { continue; } - final PlayerInstance playerTarget = (PlayerInstance) newTarget; - if (playerTarget.isDead() && (_targetType != SkillTargetType.TARGET_CORPSE_ALLY)) + if (newPlayer.isDead()) { continue; } - // if ally is different --> clan is different too, so --> continue - if (player.getAllyId() != 0) - { - if (playerTarget.getAllyId() != player.getAllyId()) - { - continue; - } - } - else if (player.getClanId() != playerTarget.getClanId()) + if (((player.getAllyId() == 0) && (newPlayer.getClanId() != player.getClanId())) || (player.getAllyId() != newPlayer.getAllyId())) { continue; } - // check for Events - if (src != null) - { - if (playerTarget == src) - { - continue; - } - // if src is in event and trg not OR viceversa: - // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack) - if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventTvT || src._inEventVIP) && (!playerTarget._inEvent && !playerTarget._inEventCTF && !playerTarget._inEventDM && !playerTarget._inEventTvT && !playerTarget._inEventVIP)) || ((playerTarget._inEvent || playerTarget._inEventCTF || playerTarget._inEventDM || playerTarget._inEventTvT || playerTarget._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventTvT && !src._inEventVIP))) - { - continue; - } - } - final Summon pet = ((PlayerInstance) newTarget).getPet(); - if ((pet != null) && Util.checkIfInRange(radius, creature, pet, true) && !onlyFirst && (((_targetType == SkillTargetType.TARGET_CORPSE_ALLY) && pet.isDead()) || ((_targetType == SkillTargetType.TARGET_ALLY) && !pet.isDead())) && player.checkPvpSkill(newTarget, this)) - { - targetList.add(pet); - } - if (_targetType == SkillTargetType.TARGET_CORPSE_ALLY) - { - if (!((PlayerInstance) newTarget).isDead()) - { - continue; - } - if ((_skillType == SkillType.RESURRECT) && ((PlayerInstance) newTarget).isInsideZone(ZoneId.SIEGE)) - { - continue; - } - } - if (!Util.checkIfInRange(radius, creature, newTarget, true)) - { - continue; - } - // Don't add this target if this is a Pc->Pc pvp casting and pvp condition not met - if (!player.checkPvpSkill(newTarget, this)) - { - continue; - } - - targetList.add((Creature) newTarget); + targetList.add(newPlayer); if (onlyFirst) { return targetList; } } + return targetList; } } return targetList; diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/Skill.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/Skill.java index cbf737c4c3..0092b2d5f0 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/Skill.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/Skill.java @@ -2080,88 +2080,35 @@ public abstract class Skill return targetList; } } - PlayerInstance src = null; - if (creature instanceof PlayerInstance) - { - src = (PlayerInstance) creature; - } - else if (creature instanceof Summon) - { - src = ((Summon) creature).getOwner(); - } if (clan != null) { // Get all visible objects in a spheric area near the Creature - // Get Clan Members - for (WorldObject newTarget : creature.getKnownList().getKnownObjects().values()) + for (WorldObject newTarget : player.getKnownList().getKnownCharactersInRadius(radius)) { - if (!(newTarget instanceof PlayerInstance)) + final PlayerInstance newPlayer = newTarget.getActingPlayer(); + if (newPlayer == null) { continue; } - final PlayerInstance playerTarget = (PlayerInstance) newTarget; - if (playerTarget.isDead() && (_targetType != SkillTargetType.TARGET_CORPSE_ALLY)) + if (newPlayer.isDead()) { continue; } - // if ally is different --> clan is different too, so --> continue - if (player.getAllyId() != 0) - { - if (playerTarget.getAllyId() != player.getAllyId()) - { - continue; - } - } - else if (player.getClanId() != playerTarget.getClanId()) + if (player.isInDuel() && (player.getDuelId() != newPlayer.getDuelId())) { continue; } - // check for Events - if (src != null) - { - if (playerTarget == src) - { - continue; - } - // if src is in event and trg not OR viceversa: - // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack) - if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventTvT || src._inEventVIP) && (!playerTarget._inEvent && !playerTarget._inEventCTF && !playerTarget._inEventDM && !playerTarget._inEventTvT && !playerTarget._inEventVIP)) || ((playerTarget._inEvent || playerTarget._inEventCTF || playerTarget._inEventDM || playerTarget._inEventTvT || playerTarget._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventTvT && !src._inEventVIP))) - { - continue; - } - } - final Summon pet = ((PlayerInstance) newTarget).getPet(); - if ((pet != null) && Util.checkIfInRange(radius, creature, pet, true) && !onlyFirst && (((_targetType == SkillTargetType.TARGET_CORPSE_ALLY) && pet.isDead()) || ((_targetType == SkillTargetType.TARGET_ALLY) && !pet.isDead())) && player.checkPvpSkill(newTarget, this)) - { - targetList.add(pet); - } - if (_targetType == SkillTargetType.TARGET_CORPSE_ALLY) - { - if (!((PlayerInstance) newTarget).isDead()) - { - continue; - } - if ((_skillType == SkillType.RESURRECT) && ((PlayerInstance) newTarget).isInsideZone(ZoneId.SIEGE)) - { - continue; - } - } - if (!Util.checkIfInRange(radius, creature, newTarget, true)) + if (((player.getAllyId() == 0) && (newPlayer.getClanId() != player.getClanId())) || (player.getAllyId() != newPlayer.getAllyId())) { continue; } - // Don't add this target if this is a Pc->Pc pvp casting and pvp condition not met - if (!player.checkPvpSkill(newTarget, this)) - { - continue; - } - - targetList.add((Creature) newTarget); + targetList.add(newPlayer); if (onlyFirst) { return targetList; } } + return targetList; } } return targetList;