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

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

View File

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

View File

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