Replaced instanceof L2Attackable with isAttackable method.

This commit is contained in:
MobiusDev
2018-07-02 00:55:13 +00:00
parent 6c1d37f4ae
commit 0b09d49f8d
51 changed files with 73 additions and 86 deletions

View File

@@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel()));
html.replace("%name%", npc.getTemplate().getName()); html.replace("%name%", npc.getTemplate().getName());
html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); 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("%hp%", String.valueOf((int) npc.getCurrentHp()));
html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp()));
html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp()));

View File

@@ -18,7 +18,6 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet; 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.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType; import com.l2jmobius.gameserver.model.effects.L2EffectType;
@@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect
@Override @Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) 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); effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector);
} }

View File

@@ -88,7 +88,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
final L2Attackable mob = (L2Attackable) o; final L2Attackable mob = (L2Attackable) o;
@@ -123,7 +123,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
// Start HP/MP/CP Regeneration task // Start HP/MP/CP Regeneration task

View File

@@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition
{ {
skill.forEachTargetAffected(sweeper, effected, o -> skill.forEachTargetAffected(sweeper, effected, o ->
{ {
if (o instanceof L2Attackable) if ((o != null) && o.isAttackable())
{ {
final L2Attackable target = (L2Attackable) o; final L2Attackable target = (L2Attackable) o;
if (target.isDead()) if (target.isDead())

View File

@@ -3206,7 +3206,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
*/ */
protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire)
{ {
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).addDamageHate(target, 0, desire); ((L2Attackable) npc).addDamageHate(target, 0, desire);
} }

View File

@@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel()));
html.replace("%name%", npc.getTemplate().getName()); html.replace("%name%", npc.getTemplate().getName());
html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); 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("%hp%", String.valueOf((int) npc.getCurrentHp()));
html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp()));
html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp()));

View File

@@ -18,7 +18,6 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet; 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.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType; import com.l2jmobius.gameserver.model.effects.L2EffectType;
@@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect
@Override @Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) 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); effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector);
} }

View File

@@ -88,7 +88,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
final L2Attackable mob = (L2Attackable) o; final L2Attackable mob = (L2Attackable) o;
@@ -123,7 +123,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
// Start HP/MP/CP Regeneration task // Start HP/MP/CP Regeneration task

View File

@@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition
{ {
skill.forEachTargetAffected(sweeper, effected, o -> skill.forEachTargetAffected(sweeper, effected, o ->
{ {
if (o instanceof L2Attackable) if ((o != null) && o.isAttackable())
{ {
final L2Attackable target = (L2Attackable) o; final L2Attackable target = (L2Attackable) o;
if (target.isDead()) if (target.isDead())

View File

@@ -3206,7 +3206,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
*/ */
protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire)
{ {
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).addDamageHate(target, 0, desire); ((L2Attackable) npc).addDamageHate(target, 0, desire);
} }

View File

@@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel()));
html.replace("%name%", npc.getTemplate().getName()); html.replace("%name%", npc.getTemplate().getName());
html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); 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("%hp%", String.valueOf((int) npc.getCurrentHp()));
html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp()));
html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp()));

View File

@@ -18,7 +18,6 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet; 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.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType; import com.l2jmobius.gameserver.model.effects.L2EffectType;
@@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect
@Override @Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) 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); effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector);
} }

View File

@@ -88,7 +88,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
final L2Attackable mob = (L2Attackable) o; final L2Attackable mob = (L2Attackable) o;
@@ -123,7 +123,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
// Start HP/MP/CP Regeneration task // Start HP/MP/CP Regeneration task

View File

@@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition
{ {
skill.forEachTargetAffected(sweeper, effected, o -> skill.forEachTargetAffected(sweeper, effected, o ->
{ {
if (o instanceof L2Attackable) if ((o != null) && o.isAttackable())
{ {
final L2Attackable target = (L2Attackable) o; final L2Attackable target = (L2Attackable) o;
if (target.isDead()) if (target.isDead())

View File

@@ -3218,7 +3218,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
*/ */
protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire)
{ {
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).addDamageHate(target, 0, desire); ((L2Attackable) npc).addDamageHate(target, 0, desire);
} }

View File

@@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel()));
html.replace("%name%", npc.getTemplate().getName()); html.replace("%name%", npc.getTemplate().getName());
html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); 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("%hp%", String.valueOf((int) npc.getCurrentHp()));
html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp()));
html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp()));

View File

@@ -18,7 +18,6 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet; 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.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType; import com.l2jmobius.gameserver.model.effects.L2EffectType;
@@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect
@Override @Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) 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); effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector);
} }

View File

@@ -88,7 +88,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
final L2Attackable mob = (L2Attackable) o; final L2Attackable mob = (L2Attackable) o;
@@ -123,7 +123,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
// Start HP/MP/CP Regeneration task // Start HP/MP/CP Regeneration task

View File

@@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition
{ {
skill.forEachTargetAffected(sweeper, effected, o -> skill.forEachTargetAffected(sweeper, effected, o ->
{ {
if (o instanceof L2Attackable) if ((o != null) && o.isAttackable())
{ {
final L2Attackable target = (L2Attackable) o; final L2Attackable target = (L2Attackable) o;
if (target.isDead()) if (target.isDead())

View File

@@ -3218,7 +3218,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
*/ */
protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire)
{ {
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).addDamageHate(target, 0, desire); ((L2Attackable) npc).addDamageHate(target, 0, desire);
} }

View File

@@ -740,7 +740,7 @@ public class HeartInfinityDefence extends AbstractNpcAI
@Override @Override
public final String onEnterZone(L2Character character, L2ZoneType zone) public final String onEnterZone(L2Character character, L2ZoneType zone)
{ {
if (character instanceof L2Attackable) if (character.isAttackable())
{ {
final L2Attackable npc = (L2Attackable) character; final L2Attackable npc = (L2Attackable) character;
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc); final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc);

View File

@@ -73,7 +73,7 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%lvl%", String.valueOf(((L2Npc) target).getTemplate().getLevel())); html.replace("%lvl%", String.valueOf(((L2Npc) target).getTemplate().getLevel()));
html.replace("%name%", ((L2Npc) target).getTemplate().getName()); html.replace("%name%", ((L2Npc) target).getTemplate().getName());
html.replace("%tmplid%", String.valueOf(((L2Npc) target).getTemplate().getId())); 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("%hp%", String.valueOf((int) ((L2Character) target).getCurrentHp()));
html.replace("%hpmax%", String.valueOf(((L2Character) target).getMaxHp())); html.replace("%hpmax%", String.valueOf(((L2Character) target).getMaxHp()));
html.replace("%mp%", String.valueOf((int) ((L2Character) target).getCurrentMp())); html.replace("%mp%", String.valueOf((int) ((L2Character) target).getCurrentMp()));

View File

@@ -18,7 +18,6 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet; 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.conditions.Condition;
import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType; import com.l2jmobius.gameserver.model.effects.L2EffectType;
@@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect
@Override @Override
public void onStart(BuffInfo info) 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()); info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, info.getEffector());
} }

View File

@@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2Party;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location; 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.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.L2Playable; 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())) 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).addDamageHate(foe, 0, 999);
((L2QuestGuardInstance) npc).getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, foe, null); ((L2QuestGuardInstance) npc).getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, foe, null);

View File

@@ -270,7 +270,7 @@ public class L2AttackableAI extends L2CharacterAI
} }
else else
{ {
if (target instanceof L2Attackable) if (target.isAttackable())
{ {
if (!target.isAutoAttackable(me)) 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; return false;
} }
@@ -854,7 +854,7 @@ public class L2AttackableAI extends L2CharacterAI
called.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, originalAttackTarget, 1); called.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, originalAttackTarget, 1);
EventDispatcher.getInstance().notifyEventAsync(new OnAttackableFactionCall(called, getActiveChar(), originalAttackTarget.getActingPlayer(), originalAttackTarget.isSummon()), called); 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())); ((L2Attackable) called).addDamageHate(getAttackTarget(), 0, npc.getHating(getAttackTarget()));
called.getAI().setIntention(AI_INTENTION_ATTACK, getAttackTarget()); called.getAI().setIntention(AI_INTENTION_ATTACK, getAttackTarget());
@@ -2079,7 +2079,7 @@ public class L2AttackableAI extends L2CharacterAI
{ {
return obj; return obj;
} }
if ((obj instanceof L2Attackable) && actor.isChaos()) if (obj.isAttackable() && actor.isChaos())
{ {
if (!((L2Attackable) obj).isInMyClan(actor)) if (!((L2Attackable) obj).isInMyClan(actor))
{ {
@@ -2149,7 +2149,7 @@ public class L2AttackableAI extends L2CharacterAI
actor.setTarget(obj); actor.setTarget(obj);
setAttackTarget(obj); setAttackTarget(obj);
} }
else if (obj instanceof L2Attackable) else if (obj.isAttackable())
{ {
if (actor.isChaos()) if (actor.isChaos())
{ {
@@ -2222,7 +2222,7 @@ public class L2AttackableAI extends L2CharacterAI
actor.setTarget(obj); actor.setTarget(obj);
setAttackTarget(obj); setAttackTarget(obj);
} }
else if (obj instanceof L2Attackable) else if (obj.isAttackable())
{ {
if (actor.isChaos()) if (actor.isChaos())
{ {

View File

@@ -136,7 +136,7 @@ public class L2CharacterAI extends AbstractAI
@Override @Override
protected void onEvtAttacked(L2Character attacker) protected void onEvtAttacked(L2Character attacker)
{ {
if ((attacker instanceof L2Attackable) && !attacker.isCoreAIDisabled()) if ((attacker != null) && attacker.isAttackable() && !attacker.isCoreAIDisabled())
{ {
clientStartAutoAttack(); clientStartAutoAttack();
} }
@@ -204,7 +204,7 @@ public class L2CharacterAI extends AbstractAI
// Also enable random animations for this L2Character if allowed // Also enable random animations for this L2Character if allowed
// This is only for mobs - town npcs are handled in their constructor // This is only for mobs - town npcs are handled in their constructor
if (_actor instanceof L2Attackable) if (_actor.isAttackable())
{ {
((L2Npc) _actor).startRandomAnimationTask(); ((L2Npc) _actor).startRandomAnimationTask();
} }
@@ -672,7 +672,7 @@ public class L2CharacterAI extends AbstractAI
return; return;
} }
if (_actor instanceof L2Attackable) if (_actor.isAttackable())
{ {
((L2Attackable) _actor).setisReturningToSpawnPoint(false); ((L2Attackable) _actor).setisReturningToSpawnPoint(false);
} }
@@ -1424,7 +1424,7 @@ public class L2CharacterAI extends AbstractAI
boolean cancast = true; boolean cancast = true;
for (L2Character target : L2World.getInstance().getVisibleObjects(_actor, L2Character.class, sk.getAffectRange())) 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; continue;
} }
@@ -1443,7 +1443,7 @@ public class L2CharacterAI extends AbstractAI
boolean cancast = true; boolean cancast = true;
for (L2Character target : L2World.getInstance().getVisibleObjects(getAttackTarget(), L2Character.class, sk.getAffectRange())) 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; continue;
} }
@@ -1463,7 +1463,7 @@ public class L2CharacterAI extends AbstractAI
boolean cancast = false; boolean cancast = false;
for (L2Character target : L2World.getInstance().getVisibleObjects(_actor, L2Character.class, sk.getAffectRange())) 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; continue;
} }
@@ -1482,7 +1482,7 @@ public class L2CharacterAI extends AbstractAI
boolean cancast = true; boolean cancast = true;
for (L2Character target : L2World.getInstance().getVisibleObjects(getAttackTarget(), L2Character.class, sk.getAffectRange())) 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; continue;
} }

View File

@@ -559,7 +559,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
npc.setHeading(_location.getHeading()); npc.setHeading(_location.getHeading());
} }
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).setChampion(false); ((L2Attackable) npc).setChampion(false);
} }

View File

@@ -88,7 +88,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
final L2Attackable mob = (L2Attackable) o; final L2Attackable mob = (L2Attackable) o;
@@ -123,7 +123,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
// Start HP/MP/CP Regeneration task // Start HP/MP/CP Regeneration task

View File

@@ -13789,7 +13789,7 @@ public final class L2PcInstance extends L2Playable
{ {
return false; return false;
} }
if (cha instanceof L2Attackable) if (cha.isAttackable())
{ {
return true; return true;
} }

View File

@@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.model.actor.instance; package com.l2jmobius.gameserver.model.actor.instance;
import com.l2jmobius.gameserver.enums.InstanceType; 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.L2Character;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
@@ -49,7 +48,7 @@ public final class L2QuestGuardInstance extends L2GuardInstance
{ {
super.addDamage(attacker, damage, skill); super.addDamage(attacker, damage, skill);
if (attacker instanceof L2Attackable) if (attacker.isAttackable())
{ {
EventDispatcher.getInstance().notifyEventAsync(new OnAttackableAttack(null, this, damage, skill, false), this); EventDispatcher.getInstance().notifyEventAsync(new OnAttackableAttack(null, this, damage, skill, false), this);
} }
@@ -64,7 +63,7 @@ public final class L2QuestGuardInstance extends L2GuardInstance
return false; return false;
} }
if (killer instanceof L2Attackable) if (killer.isAttackable())
{ {
// Delayed notification // Delayed notification
EventDispatcher.getInstance().notifyEventAsyncDelayed(new OnAttackableKill(null, this, false), this, _onKillDelay); EventDispatcher.getInstance().notifyEventAsyncDelayed(new OnAttackableKill(null, this, false), this, _onKillDelay);

View File

@@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.enums.TrapAction; import com.l2jmobius.gameserver.enums.TrapAction;
import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.L2World; 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.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.tasks.npc.trap.TrapTask; 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 // trap owned by players not attack non-flagged players
if (_owner != null) if (_owner != null)
{ {
if (target instanceof L2Attackable) if (target.isAttackable())
{ {
return true; return true;
} }

View File

@@ -61,7 +61,7 @@ public class ConditionPlayerCanSweep extends Condition
L2Attackable target; L2Attackable target;
for (L2Object objTarget : targets) for (L2Object objTarget : targets)
{ {
if (objTarget instanceof L2Attackable) if ((objTarget != null) && objTarget.isAttackable())
{ {
target = (L2Attackable) objTarget; target = (L2Attackable) objTarget;
if (target.isDead()) if (target.isDead())

View File

@@ -2726,7 +2726,7 @@ public abstract class AbstractScript extends ManagedScript
*/ */
protected void addAttackDesire(L2Npc npc, L2Character target, int desire) protected void addAttackDesire(L2Npc npc, L2Character target, int desire)
{ {
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).addDamageHate(target, 0, desire); ((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) protected void addSkillCastDesire(L2Npc npc, L2Character target, Skill skill, int desire)
{ {
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).addDamageHate(target, 0, desire); ((L2Attackable) npc).addDamageHate(target, 0, desire);
} }

View File

@@ -438,7 +438,7 @@ public final class Instance
spawnDat.setInstanceId(_id); spawnDat.setInstanceId(_id);
spawnDat.setRandomWalking(set.getBoolean("allowRandomWalk")); spawnDat.setRandomWalking(set.getBoolean("allowRandomWalk"));
final L2Npc spawned = spawnDat.doSpawn(); 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")); ((L2Attackable) spawned).setOnKillDelay(set.getInt("delay"));
} }

View File

@@ -43,7 +43,6 @@ import com.l2jmobius.gameserver.model.L2ExtractableSkill;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.PcCondOverride; import com.l2jmobius.gameserver.model.PcCondOverride;
import com.l2jmobius.gameserver.model.StatsSet; 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.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2BlockInstance; import com.l2jmobius.gameserver.model.actor.instance.L2BlockInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2CubicInstance; import com.l2jmobius.gameserver.model.actor.instance.L2CubicInstance;
@@ -1210,7 +1209,7 @@ public final class Skill implements IIdentifiable
else else
{ {
// target is mob // target is mob
if ((targetPlayer == null) && (target instanceof L2Attackable) && (caster instanceof L2Attackable)) if ((targetPlayer == null) && target.isAttackable() && caster.isAttackable())
{ {
return false; return false;
} }
@@ -1253,7 +1252,7 @@ public final class Skill implements IIdentifiable
return Collections.<AbstractFunction> emptyList(); return Collections.<AbstractFunction> emptyList();
} }
if (!player.isPlayable() && !(player instanceof L2Attackable)) if (!player.isPlayable() && !player.isAttackable())
{ {
return Collections.<AbstractFunction> emptyList(); return Collections.<AbstractFunction> emptyList();
} }

View File

@@ -32,7 +32,6 @@ import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.instancemanager.SiegeManager; import com.l2jmobius.gameserver.instancemanager.SiegeManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.L2SiegeClan; 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.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2CubicInstance; import com.l2jmobius.gameserver.model.actor.instance.L2CubicInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -590,7 +589,7 @@ public final class Formulas
final double weaponMod = attacker.getRandomDamageMultiplier(); final double weaponMod = attacker.getRandomDamageMultiplier();
double penaltyMod = 1; 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; final int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 1;
if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size()) if (lvlDiff >= Config.NPC_SKILL_DMG_PENALTY.size())

View File

@@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel()));
html.replace("%name%", npc.getTemplate().getName()); html.replace("%name%", npc.getTemplate().getName());
html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); 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("%hp%", String.valueOf((int) npc.getCurrentHp()));
html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp()));
html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp()));

View File

@@ -18,7 +18,6 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet; 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.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType; import com.l2jmobius.gameserver.model.effects.L2EffectType;
@@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect
@Override @Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) 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); effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector);
} }

View File

@@ -88,7 +88,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
final L2Attackable mob = (L2Attackable) o; final L2Attackable mob = (L2Attackable) o;
@@ -123,7 +123,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
// Start HP/MP/CP Regeneration task // Start HP/MP/CP Regeneration task

View File

@@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition
{ {
skill.forEachTargetAffected(sweeper, effected, o -> skill.forEachTargetAffected(sweeper, effected, o ->
{ {
if (o instanceof L2Attackable) if ((o != null) && o.isAttackable())
{ {
final L2Attackable target = (L2Attackable) o; final L2Attackable target = (L2Attackable) o;
if (target.isDead()) if (target.isDead())

View File

@@ -3181,7 +3181,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
*/ */
protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire)
{ {
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).addDamageHate(target, 0, desire); ((L2Attackable) npc).addDamageHate(target, 0, desire);
} }

View File

@@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel()));
html.replace("%name%", npc.getTemplate().getName()); html.replace("%name%", npc.getTemplate().getName());
html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); 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("%hp%", String.valueOf((int) npc.getCurrentHp()));
html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp()));
html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp()));

View File

@@ -18,7 +18,6 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet; 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.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType; import com.l2jmobius.gameserver.model.effects.L2EffectType;
@@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect
@Override @Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) 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); effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector);
} }

View File

@@ -88,7 +88,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
final L2Attackable mob = (L2Attackable) o; final L2Attackable mob = (L2Attackable) o;
@@ -123,7 +123,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
// Start HP/MP/CP Regeneration task // Start HP/MP/CP Regeneration task

View File

@@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition
{ {
skill.forEachTargetAffected(sweeper, effected, o -> skill.forEachTargetAffected(sweeper, effected, o ->
{ {
if (o instanceof L2Attackable) if ((o != null) && o.isAttackable())
{ {
final L2Attackable target = (L2Attackable) o; final L2Attackable target = (L2Attackable) o;
if (target.isDead()) if (target.isDead())

View File

@@ -3181,7 +3181,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
*/ */
protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire)
{ {
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).addDamageHate(target, 0, desire); ((L2Attackable) npc).addDamageHate(target, 0, desire);
} }

View File

@@ -62,7 +62,7 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel())); html.replace("%lvl%", String.valueOf(npc.getTemplate().getLevel()));
html.replace("%name%", npc.getTemplate().getName()); html.replace("%name%", npc.getTemplate().getName());
html.replace("%tmplid%", String.valueOf(npc.getTemplate().getId())); 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("%hp%", String.valueOf((int) npc.getCurrentHp()));
html.replace("%hpmax%", String.valueOf(npc.getMaxHp())); html.replace("%hpmax%", String.valueOf(npc.getMaxHp()));
html.replace("%mp%", String.valueOf((int) npc.getCurrentMp())); html.replace("%mp%", String.valueOf((int) npc.getCurrentMp()));

View File

@@ -18,7 +18,6 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.StatsSet; 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.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType; import com.l2jmobius.gameserver.model.effects.L2EffectType;
@@ -50,7 +49,7 @@ public final class GetAgro extends AbstractEffect
@Override @Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item) 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); effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, effector);
} }

View File

@@ -88,7 +88,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
final L2Attackable mob = (L2Attackable) o; final L2Attackable mob = (L2Attackable) o;
@@ -123,7 +123,7 @@ public final class L2WorldRegion
{ {
for (L2Object o : _visibleObjects.values()) for (L2Object o : _visibleObjects.values())
{ {
if (o instanceof L2Attackable) if (o.isAttackable())
{ {
c++; c++;
// Start HP/MP/CP Regeneration task // Start HP/MP/CP Regeneration task

View File

@@ -58,7 +58,7 @@ public class ConditionPlayerCanSweep extends Condition
{ {
skill.forEachTargetAffected(sweeper, effected, o -> skill.forEachTargetAffected(sweeper, effected, o ->
{ {
if (o instanceof L2Attackable) if ((o != null) && o.isAttackable())
{ {
final L2Attackable target = (L2Attackable) o; final L2Attackable target = (L2Attackable) o;
if (target.isDead()) if (target.isDead())

View File

@@ -3181,7 +3181,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
*/ */
protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire) protected void addAttackPlayerDesire(L2Npc npc, L2Playable target, int desire)
{ {
if (npc instanceof L2Attackable) if (npc.isAttackable())
{ {
((L2Attackable) npc).addDamageHate(target, 0, desire); ((L2Attackable) npc).addDamageHate(target, 0, desire);
} }