Fixed guards not moving.
This commit is contained in:
@ -158,6 +158,22 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (me instanceof L2GuardInstance)
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObjectInRange(me, L2GuardInstance.class, 500, guard ->
|
||||
{
|
||||
if (guard.isAttackingNow() && (guard.getTarget() == player))
|
||||
{
|
||||
me.getAI().startFollow(player);
|
||||
me.addDamageHate(player, 0, 10);
|
||||
}
|
||||
});
|
||||
if (player.getReputation() < 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (me.isMonster())
|
||||
{
|
||||
@ -334,7 +350,6 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
_globalAggro--;
|
||||
}
|
||||
}
|
||||
|
||||
// Add all autoAttackable L2Character in L2Attackable Aggro Range to its _aggroList with 0 damage and 1 hate
|
||||
// A L2Attackable isn't aggressive during 10s after its spawn because _globalAggro is set to -10
|
||||
if (_globalAggro >= 0)
|
||||
@ -354,15 +369,22 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
|
||||
final int hating = npc.getHating(t);
|
||||
|
||||
// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
|
||||
if (hating == 0)
|
||||
{
|
||||
npc.addDamageHate(t, 0, 1);
|
||||
|
||||
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
|
||||
final int hating = npc.getHating(t);
|
||||
|
||||
// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
|
||||
if (hating == 0)
|
||||
{
|
||||
npc.addDamageHate(t, 0, 1);
|
||||
}
|
||||
if (npc instanceof L2GuardInstance)
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObjectInRange(npc, L2GuardInstance.class, 500, guard ->
|
||||
{
|
||||
guard.addDamageHate(t, 0, 10);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -422,7 +444,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
|
||||
// Check if the actor is a L2GuardInstance
|
||||
if ((npc instanceof L2GuardInstance) && !npc.isWalker())
|
||||
if ((npc instanceof L2GuardInstance) && !npc.isWalker() && !npc.isRandomWalkingEnabled())
|
||||
{
|
||||
// Order to the L2GuardInstance to return to its home location because there's no target to attack
|
||||
npc.returnHome();
|
||||
|
@ -259,7 +259,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
// Set the AI attack target (change target)
|
||||
setTarget(target);
|
||||
|
||||
stopFollow();
|
||||
// stopFollow();
|
||||
|
||||
// Launch the Think Event
|
||||
notifyEvent(CtrlEvent.EVT_THINK, null);
|
||||
@ -278,7 +278,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
// Set the AI attack target
|
||||
setTarget(target);
|
||||
|
||||
stopFollow();
|
||||
// stopFollow();
|
||||
|
||||
// Launch the Think Event
|
||||
notifyEvent(CtrlEvent.EVT_THINK, null);
|
||||
|
@ -1386,13 +1386,13 @@ public class L2Attackable extends L2Npc
|
||||
setWalking();
|
||||
|
||||
// check the region where this mob is, do not activate the AI if region is inactive.
|
||||
if (!isInActiveRegion())
|
||||
{
|
||||
if (hasAI())
|
||||
{
|
||||
getAI().stopAITask();
|
||||
}
|
||||
}
|
||||
// if (!isInActiveRegion())
|
||||
// {
|
||||
// if (hasAI())
|
||||
// {
|
||||
// getAI().stopAITask();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,12 +24,14 @@ import com.l2jmobius.gameserver.ai.L2SpecialSiegeGuardAI;
|
||||
import com.l2jmobius.gameserver.enums.InstanceType;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
public class L2DefenderInstance extends L2Attackable
|
||||
@ -53,6 +55,16 @@ public class L2DefenderInstance extends L2Attackable
|
||||
return new L2SpecialSiegeGuardAI(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDamage(L2Character attacker, int damage, Skill skill)
|
||||
{
|
||||
super.addDamage(attacker, damage, skill);
|
||||
L2World.getInstance().forEachVisibleObjectInRange(this, L2DefenderInstance.class, 500, defender ->
|
||||
{
|
||||
defender.addDamageHate(attacker, 0, 10);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True if a siege is in progress and the L2Character attacker isn't a Defender.
|
||||
* @param attacker The L2Character that the L2SiegeGuardInstance try to attack
|
||||
|
@ -23,13 +23,13 @@ import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.enums.InstanceType;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.L2WorldRegion;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.EventType;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcFirstTalk;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
|
||||
@ -66,21 +66,34 @@ public class L2GuardInstance extends L2Attackable
|
||||
return super.isAutoAttackable(attacker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDamage(L2Character attacker, int damage, Skill skill)
|
||||
{
|
||||
super.addDamage(attacker, damage, skill);
|
||||
getAI().startFollow(attacker);
|
||||
addDamageHate(attacker, 0, 10);
|
||||
L2World.getInstance().forEachVisibleObjectInRange(this, L2GuardInstance.class, 500, guard ->
|
||||
{
|
||||
guard.getAI().startFollow(attacker);
|
||||
guard.addDamageHate(attacker, 0, 10);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the home location of its L2GuardInstance.
|
||||
*/
|
||||
@Override
|
||||
public void onSpawn()
|
||||
{
|
||||
setRandomWalking(false);
|
||||
super.onSpawn();
|
||||
|
||||
setRandomWalking(getTemplate().isRandomWalkEnabled());
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
// check the region where this mob is, do not activate the AI if region is inactive.
|
||||
final L2WorldRegion region = L2World.getInstance().getRegion(this);
|
||||
if ((region != null) && (!region.isActive()))
|
||||
{
|
||||
getAI().stopAITask();
|
||||
}
|
||||
// final L2WorldRegion region = L2World.getInstance().getRegion(this);
|
||||
// if ((region != null) && (!region.isActive()))
|
||||
// {
|
||||
// getAI().stopAITask();
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable
|
||||
_talkable = set.getBoolean("talkable", true);
|
||||
_undying = set.getBoolean("undying", true);
|
||||
_showName = set.getBoolean("showName", true);
|
||||
_randomWalk = set.getBoolean("randomWalk", true);
|
||||
_randomWalk = set.getBoolean("randomWalk", !_type.equals("L2Guard"));
|
||||
_randomAnimation = set.getBoolean("randomAnimation", true);
|
||||
_flying = set.getBoolean("flying", false);
|
||||
_canMove = set.getBoolean("canMove", true);
|
||||
|
Reference in New Issue
Block a user