Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions GameServer/ai/brain/BD Pets/BDHealerBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ namespace DOL.AI.Brain
/// </summary>
public class BDHealerBrain : BDPetBrain
{
/// <summary>
/// Defines a logger for this class.
/// </summary>
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

/// <summary>
/// Constructs new controlled npc brain
/// </summary>
Expand Down Expand Up @@ -214,7 +209,7 @@ protected override bool CheckDefensiveSpells(Spell spell)
/// </summary>
/// <param name="living"></param>
/// <param name="aggroamount"></param>
public override void AddToAggroList(GameLiving living, int aggroamount) { }
public override void AddToAggroList(GameLiving living, int aggroamount, bool CheckLOS = false) { }

public override void RemoveFromAggroList(GameLiving living) { }

Expand Down
2 changes: 1 addition & 1 deletion GameServer/ai/brain/ControlledNpcBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ protected override void OnFollowLostTarget(GameObject target)
/// </summary>
/// <param name="living"></param>
/// <param name="aggroamount"></param>
public override void AddToAggroList(GameLiving living, int aggroamount)
public override void AddToAggroList(GameLiving living, int aggroamount, bool CheckLOS = false)
{
GameNPC npc_owner = GetNPCOwner();
if (npc_owner == null || !(npc_owner.Brain is StandardMobBrain))
Expand Down
38 changes: 14 additions & 24 deletions GameServer/ai/brain/Guards/KeepGuardBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ namespace DOL.AI.Brain
/// </summary>
public class KeepGuardBrain : StandardMobBrain
{
/// <summary>
/// Defines a logger for this class.
/// </summary>
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

public GameKeepGuard guard;
/// <summary>
/// Constructor for the Brain setting default values
/// </summary>
public KeepGuardBrain()
public GameKeepGuard guard;
protected override bool IsKeepGuard => true;
/// <summary>
/// Constructor for the Brain setting default values
/// </summary>
public KeepGuardBrain()
: base()
{
AggroLevel = 90;
Expand Down Expand Up @@ -55,8 +51,8 @@ public override void Think()

if ((guard is GuardArcher || guard is GuardStaticArcher || guard is GuardLord))
{
// Drop aggro and disengage if the target is out of range.
if (Body.IsAttacking && Body.TargetObject is GameLiving living && Body.IsWithinRadius(Body.TargetObject, AggroRange, false) == false)
// Drop aggro and disengage if the target is out of range.
if (Body.IsAttacking && Body.TargetObject is GameLiving living && Body.IsWithinRadius(Body.TargetObject, AggroRange, false) == false)
{
Body.StopAttack();
RemoveFromAggroList(living);
Expand All @@ -72,8 +68,8 @@ public override void Think()
//if we are not doing an action, let us see if we should move somewhere
if (guard.CurrentSpellHandler == null && !guard.IsMoving && !guard.AttackState && !guard.InCombat)
{
// Tolakram - always clear the aggro list so if this is done by mistake the list will correctly re-fill on next think
ClearAggroList();
// Tolakram - always clear the aggro list so if this is done by mistake the list will correctly re-fill on next think
ClearAggroList();

if (guard.Coordinate.DistanceTo(guard.SpawnPosition, ignoreZ: true) > 50)
{
Expand All @@ -83,19 +79,18 @@ public override void Think()
//Eden - Portal Keeps Guards max distance
if (guard.Level > 200 && guard.Coordinate.DistanceTo(guard.SpawnPosition) > 2000)
{
ClearAggroList();
ClearAggroList();
guard.WalkToSpawn();
}
else if (guard.InCombat == false && guard.Coordinate.DistanceTo(guard.SpawnPosition) > 6000)
{
ClearAggroList();
guard.WalkToSpawn();
}

// We want guards to check aggro even when they are returning home, which StandardMobBrain does not, so add checks here
if (guard.CurrentSpellHandler == null && !guard.AttackState && !guard.InCombat)
{
CheckPlayerAggro();
CheckPlayerAggro();
CheckNPCAggro();

if (HasAggro && Body.IsReturningHome)
Expand Down Expand Up @@ -134,7 +129,7 @@ protected override void CheckPlayerAggro()
Body.Say("Want to attack player " + player.Name);
}

AddToAggroList(player, 1);
AddToAggroList(player, 1, true);
return;
}
}
Expand Down Expand Up @@ -171,7 +166,7 @@ protected override void CheckNPCAggro()
Body.Say("Want to attack player " + player.Name + " pet " + npc.Name);
}

AddToAggroList(npc, 1);
AddToAggroList(npc, 1, true);
return;
}
}
Expand All @@ -190,10 +185,5 @@ public override int CalculateAggroLevelToTarget(GameLiving target)
return AggroLevel;
return 0;
}

public override bool AggroLOS
{
get { return true; }
}
}
}
14 changes: 7 additions & 7 deletions GameServer/ai/brain/Guards/Lord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ namespace DOL.AI.Brain
/// </summary>
public class LordBrain : KeepGuardBrain
{
public LordBrain() : base()
public LordBrain() : base()
{
}
AggroRange = 750;
}

public override void Think()
{
Expand Down Expand Up @@ -55,20 +56,19 @@ protected override void BringFriends(GameLiving trigger)
int iGuardsResponding = 0;

foreach (GameKeepGuard guard in lord.Component.Keep.Guards.Values)
if (guard != null && guard.IsAlive && guard.IsAvailable)
if (guard != null)
if (guard.AssistLord(lord))
iGuardsResponding++;

string sMessage = $"{lord.Name} bellows for assistance ";
string sMessage = $"for assistance ";
if (iGuardsResponding == 0)
sMessage += "but no guards respond!";
else
sMessage += $"and {iGuardsResponding} guards respond!";

foreach (GamePlayer player in lord.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE, true))
if (player != null)
ChatUtil.SendErrorMessage(player, sMessage);
}
player?.YellReceive(Body, sMessage);
}
}
else
base.BringFriends(trigger);
Expand Down
3 changes: 2 additions & 1 deletion GameServer/ai/brain/IOldAggressiveBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public interface IOldAggressiveBrain
/// </summary>
/// <param name="living"></param>
/// <param name="aggroamount"></param>
void AddToAggroList(GameLiving living, int aggroamount);
/// <param name="CheckLOS"></param>
void AddToAggroList(GameLiving living, int aggroamount, bool CheckLOS = false);

/// <summary>
/// Get current amount of aggro on aggrotable
Expand Down
4 changes: 2 additions & 2 deletions GameServer/ai/brain/RoundsBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public override bool Start()
/// </summary>
/// <param name="living"></param>
/// <param name="aggroamount"></param>
public override void AddToAggroList(GameLiving living, int aggroamount)
public override void AddToAggroList(GameLiving living, int aggroamount, bool CheckLOS = false)
{
//save current position in path go to here and reload path point
//insert path in pathpoint
Expand All @@ -57,7 +57,7 @@ public override void AddToAggroList(GameLiving living, int aggroamount)
temporaryPathPoint.Prev = Body.CurrentWayPoint.Prev;
Body.CurrentWayPoint = temporaryPathPoint;
//this path point will be not available after the following point because no link to itself
base.AddToAggroList(living, aggroamount);
base.AddToAggroList(living, aggroamount, CheckLOS);
}

/// <summary>
Expand Down
Loading