From 0b09d49f8d58287f0b08ea5eb1dbafc2843b7805 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 2 Jul 2018 00:55:13 +0000 Subject: [PATCH] Replaced instanceof L2Attackable with isAttackable method. --- .../actionshifthandlers/L2NpcActionShift.java | 2 +- .../scripts/handlers/effecthandlers/GetAgro.java | 3 +-- .../l2jmobius/gameserver/model/L2WorldRegion.java | 4 ++-- .../model/conditions/ConditionPlayerCanSweep.java | 2 +- .../gameserver/model/events/AbstractScript.java | 2 +- .../actionshifthandlers/L2NpcActionShift.java | 2 +- .../scripts/handlers/effecthandlers/GetAgro.java | 3 +-- .../l2jmobius/gameserver/model/L2WorldRegion.java | 4 ++-- .../model/conditions/ConditionPlayerCanSweep.java | 2 +- .../gameserver/model/events/AbstractScript.java | 2 +- .../actionshifthandlers/L2NpcActionShift.java | 2 +- .../scripts/handlers/effecthandlers/GetAgro.java | 3 +-- .../l2jmobius/gameserver/model/L2WorldRegion.java | 4 ++-- .../model/conditions/ConditionPlayerCanSweep.java | 2 +- .../gameserver/model/events/AbstractScript.java | 2 +- .../actionshifthandlers/L2NpcActionShift.java | 2 +- .../scripts/handlers/effecthandlers/GetAgro.java | 3 +-- .../l2jmobius/gameserver/model/L2WorldRegion.java | 4 ++-- .../model/conditions/ConditionPlayerCanSweep.java | 2 +- .../gameserver/model/events/AbstractScript.java | 2 +- .../HeartInfinityDefence/HeartInfinityDefence.java | 2 +- .../actionshifthandlers/L2NpcActionShift.java | 2 +- .../scripts/handlers/effecthandlers/GetAgro.java | 3 +-- .../Q00727_HopeWithinTheDarkness.java | 3 +-- .../l2jmobius/gameserver/ai/L2AttackableAI.java | 12 ++++++------ .../com/l2jmobius/gameserver/ai/L2CharacterAI.java | 14 +++++++------- .../com/l2jmobius/gameserver/model/L2Spawn.java | 2 +- .../l2jmobius/gameserver/model/L2WorldRegion.java | 4 ++-- .../model/actor/instance/L2PcInstance.java | 2 +- .../model/actor/instance/L2QuestGuardInstance.java | 5 ++--- .../model/actor/instance/L2TrapInstance.java | 3 +-- .../model/conditions/ConditionPlayerCanSweep.java | 2 +- .../gameserver/model/events/AbstractScript.java | 4 ++-- .../gameserver/model/instancezone/Instance.java | 2 +- .../l2jmobius/gameserver/model/skills/Skill.java | 5 ++--- .../l2jmobius/gameserver/model/stats/Formulas.java | 3 +-- .../actionshifthandlers/L2NpcActionShift.java | 2 +- .../scripts/handlers/effecthandlers/GetAgro.java | 3 +-- .../l2jmobius/gameserver/model/L2WorldRegion.java | 4 ++-- .../model/conditions/ConditionPlayerCanSweep.java | 2 +- .../gameserver/model/events/AbstractScript.java | 2 +- .../actionshifthandlers/L2NpcActionShift.java | 2 +- .../scripts/handlers/effecthandlers/GetAgro.java | 3 +-- .../l2jmobius/gameserver/model/L2WorldRegion.java | 4 ++-- .../model/conditions/ConditionPlayerCanSweep.java | 2 +- .../gameserver/model/events/AbstractScript.java | 2 +- .../actionshifthandlers/L2NpcActionShift.java | 2 +- .../scripts/handlers/effecthandlers/GetAgro.java | 3 +-- .../l2jmobius/gameserver/model/L2WorldRegion.java | 4 ++-- .../model/conditions/ConditionPlayerCanSweep.java | 2 +- .../gameserver/model/events/AbstractScript.java | 2 +- 51 files changed, 73 insertions(+), 86 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java index c97231d42a..c30658f04d 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java @@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%name%", npc.getTemplate().getName()); html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); - html.replace("%aggro%", String.valueOf((target instanceof L2Attackable) ? ((L2Attackable) target).getAggroRange() : 0)); + html.replace("%aggro%", String.valueOf(target.isAttackable() ? ((L2Attackable) target).getAggroRange() : 0)); html.replace("%hp%", String.valueOf((int) npc.getCurrentHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java index 568e28da10..0298934d56 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java @@ -18,7 +18,6 @@ package handlers.effecthandlers; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (effected instanceof L2Attackable) + if ((effected != null) && effected.isAttackable()) { effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 4a88a92311..23ae510e98 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -88,7 +88,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; final L2Attackable mob = (L2Attackable) o; @@ -123,7 +123,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; // Start HP/MP/CP Regeneration task diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java index 808ac84c6e..bfa29da0e9 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java @@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition { skill.forEachTargetAffected(sweeper, effected, o -> { - if (o instanceof L2Attackable) + if ((o != null) && o.isAttackable()) { final L2Attackable target = (L2Attackable) o; if (target.isDead()) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index 608cfa742b..9bcd361cf1 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -3206,7 +3206,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) { - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).addDamageHate(target, 0, desire); } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java index c97231d42a..c30658f04d 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java @@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%name%", npc.getTemplate().getName()); html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); - html.replace("%aggro%", String.valueOf((target instanceof L2Attackable) ? ((L2Attackable) target).getAggroRange() : 0)); + html.replace("%aggro%", String.valueOf(target.isAttackable() ? ((L2Attackable) target).getAggroRange() : 0)); html.replace("%hp%", String.valueOf((int) npc.getCurrentHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java index 568e28da10..0298934d56 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java @@ -18,7 +18,6 @@ package handlers.effecthandlers; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (effected instanceof L2Attackable) + if ((effected != null) && effected.isAttackable()) { effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 4a88a92311..23ae510e98 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -88,7 +88,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; final L2Attackable mob = (L2Attackable) o; @@ -123,7 +123,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; // Start HP/MP/CP Regeneration task diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java index 808ac84c6e..bfa29da0e9 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java @@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition { skill.forEachTargetAffected(sweeper, effected, o -> { - if (o instanceof L2Attackable) + if ((o != null) && o.isAttackable()) { final L2Attackable target = (L2Attackable) o; if (target.isDead()) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index 608cfa742b..9bcd361cf1 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -3206,7 +3206,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) { - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).addDamageHate(target, 0, desire); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java index c97231d42a..c30658f04d 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java @@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%name%", npc.getTemplate().getName()); html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); - html.replace("%aggro%", String.valueOf((target instanceof L2Attackable) ? ((L2Attackable) target).getAggroRange() : 0)); + html.replace("%aggro%", String.valueOf(target.isAttackable() ? ((L2Attackable) target).getAggroRange() : 0)); html.replace("%hp%", String.valueOf((int) npc.getCurrentHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java index 568e28da10..0298934d56 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java @@ -18,7 +18,6 @@ package handlers.effecthandlers; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (effected instanceof L2Attackable) + if ((effected != null) && effected.isAttackable()) { effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 4a88a92311..23ae510e98 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -88,7 +88,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; final L2Attackable mob = (L2Attackable) o; @@ -123,7 +123,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; // Start HP/MP/CP Regeneration task diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java index 808ac84c6e..bfa29da0e9 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java @@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition { skill.forEachTargetAffected(sweeper, effected, o -> { - if (o instanceof L2Attackable) + if ((o != null) && o.isAttackable()) { final L2Attackable target = (L2Attackable) o; if (target.isDead()) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index ac33b37ded..25a3f9ccdc 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -3218,7 +3218,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) { - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).addDamageHate(target, 0, desire); } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java index c97231d42a..c30658f04d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java @@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%name%", npc.getTemplate().getName()); html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); - html.replace("%aggro%", String.valueOf((target instanceof L2Attackable) ? ((L2Attackable) target).getAggroRange() : 0)); + html.replace("%aggro%", String.valueOf(target.isAttackable() ? ((L2Attackable) target).getAggroRange() : 0)); html.replace("%hp%", String.valueOf((int) npc.getCurrentHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java index 568e28da10..0298934d56 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java @@ -18,7 +18,6 @@ package handlers.effecthandlers; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (effected instanceof L2Attackable) + if ((effected != null) && effected.isAttackable()) { effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 4a88a92311..23ae510e98 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -88,7 +88,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; final L2Attackable mob = (L2Attackable) o; @@ -123,7 +123,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; // Start HP/MP/CP Regeneration task diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java index 808ac84c6e..bfa29da0e9 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java @@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition { skill.forEachTargetAffected(sweeper, effected, o -> { - if (o instanceof L2Attackable) + if ((o != null) && o.isAttackable()) { final L2Attackable target = (L2Attackable) o; if (target.isDead()) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index ac33b37ded..25a3f9ccdc 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -3218,7 +3218,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) { - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).addDamageHate(target, 0, desire); } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HeartInfinityDefence/HeartInfinityDefence.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HeartInfinityDefence/HeartInfinityDefence.java index 08d8ff123f..5d09e3556d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HeartInfinityDefence/HeartInfinityDefence.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HeartInfinityDefence/HeartInfinityDefence.java @@ -740,7 +740,7 @@ public class HeartInfinityDefence extends AbstractNpcAI @Override public final String onEnterZone(L2Character character, L2ZoneType zone) { - if (character instanceof L2Attackable) + if (character.isAttackable()) { final L2Attackable npc = (L2Attackable) character; final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java index 7be9fb179b..c1364e6747 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java @@ -73,7 +73,7 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%lvl%", String.valueOf(((L2Npc) target).getTemplate().getLevel())); html.replace("%name%", ((L2Npc) target).getTemplate().getName()); html.replace("%tmplid%", String.valueOf(((L2Npc) target).getTemplate().getId())); - html.replace("%aggro%", String.valueOf((target instanceof L2Attackable) ? ((L2Attackable) target).getAggroRange() : 0)); + html.replace("%aggro%", String.valueOf(target.isAttackable() ? ((L2Attackable) target).getAggroRange() : 0)); html.replace("%hp%", String.valueOf((int) ((L2Character) target).getCurrentHp())); html.replace("%hpmax%", String.valueOf(((L2Character) target).getMaxHp())); html.replace("%mp%", String.valueOf((int) ((L2Character) target).getCurrentMp())); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java index eaa16cf7d1..71ba81b430 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java @@ -18,7 +18,6 @@ package handlers.effecthandlers; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect @Override public void onStart(BuffInfo info) { - if (info.getEffected() instanceof L2Attackable) + if ((info.getEffected() != null) && info.getEffected().isAttackable()) { info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, info.getEffector()); } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00727_HopeWithinTheDarkness/Q00727_HopeWithinTheDarkness.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00727_HopeWithinTheDarkness/Q00727_HopeWithinTheDarkness.java index 6ee92143e6..213ad9a9ff 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00727_HopeWithinTheDarkness/Q00727_HopeWithinTheDarkness.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00727_HopeWithinTheDarkness/Q00727_HopeWithinTheDarkness.java @@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Playable; @@ -262,7 +261,7 @@ public class Q00727_HopeWithinTheDarkness extends Quest { for (L2Character foe : L2World.getInstance().getVisibleObjects(npc, L2Character.class, npc.getAggroRange())) { - if ((foe instanceof L2Attackable) && !(foe instanceof L2QuestGuardInstance)) + if (foe.isAttackable() && !(foe instanceof L2QuestGuardInstance)) { ((L2QuestGuardInstance) npc).addDamageHate(foe, 0, 999); ((L2QuestGuardInstance) npc).getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, foe, null); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index b5d40a5c09..479d325e8a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -270,7 +270,7 @@ public class L2AttackableAI extends L2CharacterAI } else { - if (target instanceof L2Attackable) + if (target.isAttackable()) { if (!target.isAutoAttackable(me)) { @@ -288,7 +288,7 @@ public class L2AttackableAI extends L2CharacterAI } } - if ((target instanceof L2Attackable) || (target instanceof L2Npc)) + if (target.isAttackable() || (target instanceof L2Npc)) { return false; } @@ -854,7 +854,7 @@ public class L2AttackableAI extends L2CharacterAI called.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, originalAttackTarget, 1); EventDispatcher.getInstance().notifyEventAsync(new OnAttackableFactionCall(called, getActiveChar(), originalAttackTarget.getActingPlayer(), originalAttackTarget.isSummon()), called); } - else if ((called instanceof L2Attackable) && (getAttackTarget() != null) && (called.getAI()._intention != AI_INTENTION_ATTACK)) + else if (called.isAttackable() && (getAttackTarget() != null) && (called.getAI()._intention != AI_INTENTION_ATTACK)) { ((L2Attackable) called).addDamageHate(getAttackTarget(), 0, npc.getHating(getAttackTarget())); called.getAI().setIntention(AI_INTENTION_ATTACK, getAttackTarget()); @@ -2079,7 +2079,7 @@ public class L2AttackableAI extends L2CharacterAI { return obj; } - if ((obj instanceof L2Attackable) && actor.isChaos()) + if (obj.isAttackable() && actor.isChaos()) { if (!((L2Attackable) obj).isInMyClan(actor)) { @@ -2149,7 +2149,7 @@ public class L2AttackableAI extends L2CharacterAI actor.setTarget(obj); setAttackTarget(obj); } - else if (obj instanceof L2Attackable) + else if (obj.isAttackable()) { if (actor.isChaos()) { @@ -2222,7 +2222,7 @@ public class L2AttackableAI extends L2CharacterAI actor.setTarget(obj); setAttackTarget(obj); } - else if (obj instanceof L2Attackable) + else if (obj.isAttackable()) { if (actor.isChaos()) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index 251fedc9ed..4fe2180137 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -136,7 +136,7 @@ public class L2CharacterAI extends AbstractAI @Override protected void onEvtAttacked(L2Character attacker) { - if ((attacker instanceof L2Attackable) && !attacker.isCoreAIDisabled()) + if ((attacker != null) && attacker.isAttackable() && !attacker.isCoreAIDisabled()) { clientStartAutoAttack(); } @@ -204,7 +204,7 @@ public class L2CharacterAI extends AbstractAI // Also enable random animations for this L2Character if allowed // This is only for mobs - town npcs are handled in their constructor - if (_actor instanceof L2Attackable) + if (_actor.isAttackable()) { ((L2Npc) _actor).startRandomAnimationTask(); } @@ -672,7 +672,7 @@ public class L2CharacterAI extends AbstractAI return; } - if (_actor instanceof L2Attackable) + if (_actor.isAttackable()) { ((L2Attackable) _actor).setisReturningToSpawnPoint(false); } @@ -1424,7 +1424,7 @@ public class L2CharacterAI extends AbstractAI boolean cancast = true; for (L2Character target : L2World.getInstance().getVisibleObjects(_actor, L2Character.class, sk.getAffectRange())) { - if (!GeoEngine.getInstance().canSeeTarget(_actor, target) || ((target instanceof L2Attackable) && !((L2Npc) _actor).isChaos())) + if (!GeoEngine.getInstance().canSeeTarget(_actor, target) || (target.isAttackable() && !((L2Npc) _actor).isChaos())) { continue; } @@ -1443,7 +1443,7 @@ public class L2CharacterAI extends AbstractAI boolean cancast = true; for (L2Character target : L2World.getInstance().getVisibleObjects(getAttackTarget(), L2Character.class, sk.getAffectRange())) { - if (!GeoEngine.getInstance().canSeeTarget(_actor, target) || (target == null) || ((target instanceof L2Attackable) && !((L2Npc) _actor).isChaos())) + if (!GeoEngine.getInstance().canSeeTarget(_actor, target) || (target == null) || (target.isAttackable() && !((L2Npc) _actor).isChaos())) { continue; } @@ -1463,7 +1463,7 @@ public class L2CharacterAI extends AbstractAI boolean cancast = false; for (L2Character target : L2World.getInstance().getVisibleObjects(_actor, L2Character.class, sk.getAffectRange())) { - if (!GeoEngine.getInstance().canSeeTarget(_actor, target) || ((target instanceof L2Attackable) && !((L2Npc) _actor).isChaos())) + if (!GeoEngine.getInstance().canSeeTarget(_actor, target) || (target.isAttackable() && !((L2Npc) _actor).isChaos())) { continue; } @@ -1482,7 +1482,7 @@ public class L2CharacterAI extends AbstractAI boolean cancast = true; for (L2Character target : L2World.getInstance().getVisibleObjects(getAttackTarget(), L2Character.class, sk.getAffectRange())) { - if (!GeoEngine.getInstance().canSeeTarget(_actor, target) || ((target instanceof L2Attackable) && !((L2Npc) _actor).isChaos())) + if (!GeoEngine.getInstance().canSeeTarget(_actor, target) || (target.isAttackable() && !((L2Npc) _actor).isChaos())) { continue; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java index 4ca60782ad..441d73f73e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java @@ -559,7 +559,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable npc.setHeading(_location.getHeading()); } - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).setChampion(false); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 722c509db4..5fc4139496 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -88,7 +88,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; final L2Attackable mob = (L2Attackable) o; @@ -123,7 +123,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; // Start HP/MP/CP Regeneration task diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 4ca974fcae..8889090248 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -13789,7 +13789,7 @@ public final class L2PcInstance extends L2Playable { return false; } - if (cha instanceof L2Attackable) + if (cha.isAttackable()) { return true; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2QuestGuardInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2QuestGuardInstance.java index 030596729f..bb132269bb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2QuestGuardInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2QuestGuardInstance.java @@ -17,7 +17,6 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.events.EventDispatcher; @@ -49,7 +48,7 @@ public final class L2QuestGuardInstance extends L2GuardInstance { super.addDamage(attacker, damage, skill); - if (attacker instanceof L2Attackable) + if (attacker.isAttackable()) { EventDispatcher.getInstance().notifyEventAsync(new OnAttackableAttack(null, this, damage, skill, false), this); } @@ -64,7 +63,7 @@ public final class L2QuestGuardInstance extends L2GuardInstance return false; } - if (killer instanceof L2Attackable) + if (killer.isAttackable()) { // Delayed notification EventDispatcher.getInstance().notifyEventAsyncDelayed(new OnAttackableKill(null, this, false), this, _onKillDelay); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TrapInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TrapInstance.java index 771c8d30b6..09acb0ba0a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TrapInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TrapInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.TrapAction; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.L2World; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.tasks.npc.trap.TrapTask; @@ -210,7 +209,7 @@ public final class L2TrapInstance extends L2Npc // trap owned by players not attack non-flagged players if (_owner != null) { - if (target instanceof L2Attackable) + if (target.isAttackable()) { return true; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java index 2972e67f50..6861984497 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java @@ -61,7 +61,7 @@ public class ConditionPlayerCanSweep extends Condition L2Attackable target; for (L2Object objTarget : targets) { - if (objTarget instanceof L2Attackable) + if ((objTarget != null) && objTarget.isAttackable()) { target = (L2Attackable) objTarget; if (target.isDead()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index 97c4881022..6be79478de 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -2726,7 +2726,7 @@ public abstract class AbstractScript extends ManagedScript */ protected void addAttackDesire(L2Npc npc, L2Character target, int desire) { - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).addDamageHate(target, 0, desire); } @@ -2790,7 +2790,7 @@ public abstract class AbstractScript extends ManagedScript */ protected void addSkillCastDesire(L2Npc npc, L2Character target, Skill skill, int desire) { - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).addDamageHate(target, 0, desire); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/instancezone/Instance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/instancezone/Instance.java index 43b21e6b72..d331b48abb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/instancezone/Instance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/instancezone/Instance.java @@ -438,7 +438,7 @@ public final class Instance spawnDat.setInstanceId(_id); spawnDat.setRandomWalking(set.getBoolean("allowRandomWalk")); final L2Npc spawned = spawnDat.doSpawn(); - if ((set.getInt("delay") >= 0) && (spawned instanceof L2Attackable)) + if ((set.getInt("delay") >= 0) && spawned.isAttackable()) { ((L2Attackable) spawned).setOnKillDelay(set.getInt("delay")); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/Skill.java index 345a12ff2b..2f225f6e1a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/Skill.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/Skill.java @@ -43,7 +43,6 @@ import com.l2jmobius.gameserver.model.L2ExtractableSkill; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.PcCondOverride; import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2BlockInstance; import com.l2jmobius.gameserver.model.actor.instance.L2CubicInstance; @@ -1210,7 +1209,7 @@ public final class Skill implements IIdentifiable else { // target is mob - if ((targetPlayer == null) && (target instanceof L2Attackable) && (caster instanceof L2Attackable)) + if ((targetPlayer == null) && target.isAttackable() && caster.isAttackable()) { return false; } @@ -1253,7 +1252,7 @@ public final class Skill implements IIdentifiable return Collections. emptyList(); } - if (!player.isPlayable() && !(player instanceof L2Attackable)) + if (!player.isPlayable() && !player.isAttackable()) { return Collections. emptyList(); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/stats/Formulas.java index 9a331d9a71..5efae2cf74 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -32,7 +32,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.SiegeManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.L2SiegeClan; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2CubicInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -590,7 +589,7 @@ public final class Formulas final double weaponMod = attacker.getRandomDamageMultiplier(); double penaltyMod = 1; - if ((target instanceof L2Attackable) && !target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) + if (target.isAttackable() && !target.isRaid() && !target.isRaidMinion() && (target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY) && (attacker.getActingPlayer() != null) && ((target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)) { final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1; if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java index c97231d42a..c30658f04d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java @@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%name%", npc.getTemplate().getName()); html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); - html.replace("%aggro%", String.valueOf((target instanceof L2Attackable) ? ((L2Attackable) target).getAggroRange() : 0)); + html.replace("%aggro%", String.valueOf(target.isAttackable() ? ((L2Attackable) target).getAggroRange() : 0)); html.replace("%hp%", String.valueOf((int) npc.getCurrentHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java index 568e28da10..0298934d56 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java @@ -18,7 +18,6 @@ package handlers.effecthandlers; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (effected instanceof L2Attackable) + if ((effected != null) && effected.isAttackable()) { effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 4a88a92311..23ae510e98 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -88,7 +88,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; final L2Attackable mob = (L2Attackable) o; @@ -123,7 +123,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; // Start HP/MP/CP Regeneration task diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java index 808ac84c6e..bfa29da0e9 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java @@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition { skill.forEachTargetAffected(sweeper, effected, o -> { - if (o instanceof L2Attackable) + if ((o != null) && o.isAttackable()) { final L2Attackable target = (L2Attackable) o; if (target.isDead()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index 12eaf97845..7a518a5d31 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -3181,7 +3181,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) { - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).addDamageHate(target, 0, desire); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java index c97231d42a..c30658f04d 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java @@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%name%", npc.getTemplate().getName()); html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); - html.replace("%aggro%", String.valueOf((target instanceof L2Attackable) ? ((L2Attackable) target).getAggroRange() : 0)); + html.replace("%aggro%", String.valueOf(target.isAttackable() ? ((L2Attackable) target).getAggroRange() : 0)); html.replace("%hp%", String.valueOf((int) npc.getCurrentHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java index 568e28da10..0298934d56 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java @@ -18,7 +18,6 @@ package handlers.effecthandlers; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (effected instanceof L2Attackable) + if ((effected != null) && effected.isAttackable()) { effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 4a88a92311..23ae510e98 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -88,7 +88,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; final L2Attackable mob = (L2Attackable) o; @@ -123,7 +123,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; // Start HP/MP/CP Regeneration task diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java index 808ac84c6e..bfa29da0e9 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java @@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition { skill.forEachTargetAffected(sweeper, effected, o -> { - if (o instanceof L2Attackable) + if ((o != null) && o.isAttackable()) { final L2Attackable target = (L2Attackable) o; if (target.isDead()) diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index 12eaf97845..7a518a5d31 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -3181,7 +3181,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) { - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).addDamageHate(target, 0, desire); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java index c97231d42a..c30658f04d 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java @@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%name%", npc.getTemplate().getName()); html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); - html.replace("%aggro%", String.valueOf((target instanceof L2Attackable) ? ((L2Attackable) target).getAggroRange() : 0)); + html.replace("%aggro%", String.valueOf(target.isAttackable() ? ((L2Attackable) target).getAggroRange() : 0)); html.replace("%hp%", String.valueOf((int) npc.getCurrentHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java index 568e28da10..0298934d56 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/GetAgro.java @@ -18,7 +18,6 @@ package handlers.effecthandlers; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect @Override public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) { - if (effected instanceof L2Attackable) + if ((effected != null) && effected.isAttackable()) { effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 4a88a92311..23ae510e98 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -88,7 +88,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; final L2Attackable mob = (L2Attackable) o; @@ -123,7 +123,7 @@ public final class L2WorldRegion { for (L2Object o : _visibleObjects.values()) { - if (o instanceof L2Attackable) + if (o.isAttackable()) { c++; // Start HP/MP/CP Regeneration task diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java index 808ac84c6e..bfa29da0e9 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerCanSweep.java @@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition { skill.forEachTargetAffected(sweeper, effected, o -> { - if (o instanceof L2Attackable) + if ((o != null) && o.isAttackable()) { final L2Attackable target = (L2Attackable) o; if (target.isDead()) diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index 12eaf97845..7a518a5d31 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -3181,7 +3181,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) { - if (npc instanceof L2Attackable) + if (npc.isAttackable()) { ((L2Attackable) npc).addDamageHate(target, 0, desire); }