// Check if the actor is a L2GuardInstance
if (_actor instanceof L2GuardInstance && target instanceof L2PcInstance)
{
int mobid = ((L2NpcInstance)_actor).getNpcId();
if (target instanceof L2PcInstance && Config.GOODFACTION_GUARDS_LIST.contains(mobid)) return ((L2PcInstance) target).getPlayerFaction() == 2;
if (target instanceof L2PcInstance && Config.EVILFACTION_GUARDS_LIST.contains(mobid)) return ((L2PcInstance) target).getPlayerFaction() == 1;
// Check if the L2MonsterInstance target is aggressive
if (target instanceof L2MonsterInstance) return ((L2MonsterInstance) target).isAggressive();
return false;
}