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("%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()));

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.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);
}