Replaced instanceof L2MonsterInstance with isMonster method.
This commit is contained in:
parent
5f62a4c740
commit
bd285c1368
@ -23,7 +23,6 @@ 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.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee;
|
||||
@ -109,7 +108,7 @@ public final class KimerianCommon extends AbstractInstance
|
||||
else if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
|
||||
{
|
||||
final L2Character monster = (L2Character) player.getTarget();
|
||||
if ((monster != null) && (monster instanceof L2MonsterInstance) && player.isInCombat())
|
||||
if ((monster != null) && monster.isMonster() && player.isInCombat())
|
||||
{
|
||||
addAttackDesire(npc, monster);
|
||||
}
|
||||
|
@ -42,13 +42,16 @@ public class ConditionTargetAggro extends Condition
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
if (effected != null)
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
if (effected.isMonster())
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ 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.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee;
|
||||
@ -109,7 +108,7 @@ public final class KimerianCommon extends AbstractInstance
|
||||
else if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
|
||||
{
|
||||
final L2Character monster = (L2Character) player.getTarget();
|
||||
if ((monster != null) && (monster instanceof L2MonsterInstance) && player.isInCombat())
|
||||
if ((monster != null) && monster.isMonster() && player.isInCombat())
|
||||
{
|
||||
addAttackDesire(npc, monster);
|
||||
}
|
||||
|
@ -42,13 +42,16 @@ public class ConditionTargetAggro extends Condition
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
if (effected != null)
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
if (effected.isMonster())
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ 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.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee;
|
||||
@ -109,7 +108,7 @@ public final class KimerianCommon extends AbstractInstance
|
||||
else if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
|
||||
{
|
||||
final L2Character monster = (L2Character) player.getTarget();
|
||||
if ((monster != null) && (monster instanceof L2MonsterInstance) && player.isInCombat())
|
||||
if ((monster != null) && monster.isMonster() && player.isInCombat())
|
||||
{
|
||||
addAttackDesire(npc, monster);
|
||||
}
|
||||
|
@ -42,13 +42,16 @@ public class ConditionTargetAggro extends Condition
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
if (effected != null)
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
if (effected.isMonster())
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ 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.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee;
|
||||
@ -109,7 +108,7 @@ public final class KimerianCommon extends AbstractInstance
|
||||
else if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
|
||||
{
|
||||
final L2Character monster = (L2Character) player.getTarget();
|
||||
if ((monster != null) && (monster instanceof L2MonsterInstance) && player.isInCombat())
|
||||
if ((monster != null) && monster.isMonster() && player.isInCombat())
|
||||
{
|
||||
addAttackDesire(npc, monster);
|
||||
}
|
||||
|
@ -42,13 +42,16 @@ public class ConditionTargetAggro extends Condition
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
if (effected != null)
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
if (effected.isMonster())
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -848,7 +848,7 @@ public class Q00144_PailakaInjuredDragon extends Quest
|
||||
@Override
|
||||
public String onSpawn(L2Npc npc)
|
||||
{
|
||||
if (npc instanceof L2MonsterInstance)
|
||||
if (npc.isMonster())
|
||||
{
|
||||
for (int mobId : WALL_MONSTERS)
|
||||
{
|
||||
|
@ -246,7 +246,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
return GeoEngine.getInstance().canSeeTarget(me, player); // Los Check
|
||||
}
|
||||
// Check if the L2MonsterInstance target is aggressive
|
||||
if ((target instanceof L2MonsterInstance) && Config.GUARD_ATTACK_AGGRO_MOB)
|
||||
if (target.isMonster() && Config.GUARD_ATTACK_AGGRO_MOB)
|
||||
{
|
||||
return (((L2MonsterInstance) target).isAggressive() && GeoEngine.getInstance().canSeeTarget(me, target));
|
||||
}
|
||||
@ -2336,7 +2336,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
setIntention(AI_INTENTION_ATTACK, attacker);
|
||||
}
|
||||
|
||||
if (me instanceof L2MonsterInstance)
|
||||
if (me.isMonster())
|
||||
{
|
||||
L2MonsterInstance master = (L2MonsterInstance) me;
|
||||
|
||||
@ -2388,7 +2388,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
setIntention(AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
|
||||
if (me instanceof L2MonsterInstance)
|
||||
if (me.isMonster())
|
||||
{
|
||||
L2MonsterInstance master = (L2MonsterInstance) me;
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class L2Attackable extends L2Npc
|
||||
}
|
||||
|
||||
// If this L2Attackable is a L2MonsterInstance and it has spawned minions, call its minions to battle
|
||||
if (this instanceof L2MonsterInstance)
|
||||
if (isMonster())
|
||||
{
|
||||
L2MonsterInstance master = (L2MonsterInstance) this;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class ConditionTargetAggro extends Condition
|
||||
{
|
||||
if (effected != null)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
if (effected.isMonster())
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
@ -113,7 +112,7 @@ public abstract class AbstractNpcInfo implements IClientOutgoingPacket
|
||||
_title = cha.getTitle(); // On every subclass
|
||||
}
|
||||
|
||||
if (Config.SHOW_NPC_LVL && (_npc instanceof L2MonsterInstance))
|
||||
if (Config.SHOW_NPC_LVL && _npc.isMonster())
|
||||
{
|
||||
String t = "Lv " + cha.getLevel() + (cha.isAggressive() ? "*" : "");
|
||||
if (_title != null)
|
||||
|
@ -42,13 +42,16 @@ public class ConditionTargetAggro extends Condition
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
if (effected != null)
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
if (effected.isMonster())
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -42,13 +42,16 @@ public class ConditionTargetAggro extends Condition
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
if (effected != null)
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
if (effected.isMonster())
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -42,13 +42,16 @@ public class ConditionTargetAggro extends Condition
|
||||
@Override
|
||||
public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item)
|
||||
{
|
||||
if (effected instanceof L2MonsterInstance)
|
||||
if (effected != null)
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
if (effected.isMonster())
|
||||
{
|
||||
return ((L2MonsterInstance) effected).isAggressive() == _isAggro;
|
||||
}
|
||||
if (effected.isPlayer())
|
||||
{
|
||||
return ((L2PcInstance) effected).getReputation() < 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user