Fixed and improved and SiegeGuard related behaviors.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment
2020-07-03 22:49:50 +00:00
parent 4d08c902de
commit e11a5bb916
51 changed files with 680 additions and 542 deletions

View File

@ -40,7 +40,6 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.instance.DefenderInstance;
import org.l2jmobius.gameserver.model.actor.instance.GrandBossInstance;
@ -711,7 +710,7 @@ public class AttackableAI extends CreatureAI
}
if (targetExistsInAttackByList)
{
World.getInstance().forEachVisibleObjectInRange(npc, Npc.class, factionRange, called ->
World.getInstance().forEachVisibleObjectInRange(npc, Attackable.class, factionRange, called ->
{
// Don't call dead npcs, npcs without ai or npcs which are too far away.
if (called.isDead() || !called.hasAI() || (Math.abs(finalTarget.getZ() - called.getZ()) > 600))
@ -736,9 +735,9 @@ public class AttackableAI extends CreatureAI
called.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, finalTarget, 1);
EventDispatcher.getInstance().notifyEventAsync(new OnAttackableFactionCall(called, getActiveChar(), finalTarget.getActingPlayer(), finalTarget.isSummon()), called);
}
else if (called.isAttackable() && (called.getAI()._intention != CtrlIntention.AI_INTENTION_ATTACK))
else if (called.getAI()._intention != CtrlIntention.AI_INTENTION_ATTACK)
{
((Attackable) called).addDamageHate(finalTarget, 0, npc.getHating(finalTarget));
called.addDamageHate(finalTarget, 0, npc.getHating(finalTarget));
called.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, finalTarget);
}
});

View File

@ -215,7 +215,9 @@ public class DefenderInstance extends Attackable
if (((_fort != null) && _fort.getZone().isActive()) || ((_castle != null) && _castle.getZone().isActive()))
{
final int activeSiegeId = (_fort != null) ? _fort.getResidenceId() : _castle.getResidenceId();
if ((player != null) && (((player.getSiegeState() == 2) && player.isRegisteredOnThisSiegeField(activeSiegeId)) || ((player.getSiegeState() == 1))))
// Do not add hate on defenders.
if ((player.getSiegeState() == 2) && player.isRegisteredOnThisSiegeField(activeSiegeId))
{
return;
}