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

@@ -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);

View File

@@ -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()));

View File

@@ -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());
}

View File

@@ -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);