Added GroupAIFlags Based on TrinityCore
This commit is contained in:
@@ -335,4 +335,12 @@ namespace Framework.Constants
|
|||||||
SequenceBreak, // this is a boss and the pre-requisite encounters for engaging it are not defeated yet
|
SequenceBreak, // this is a boss and the pre-requisite encounters for engaging it are not defeated yet
|
||||||
Other
|
Other
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum GroupAIFlags
|
||||||
|
{
|
||||||
|
None = 0, // If any creature from group is attacked, members won't assist and won't follow
|
||||||
|
LeaderAggro = 0x00000001, // The member aggroes if the leader aggroes
|
||||||
|
MemberAggro = 0x00000002, // The leader aggroes if the member aggroes
|
||||||
|
Follow = 0x00000004, // The member will follow the leader
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using Framework.Database;
|
|||||||
using Game.Maps;
|
using Game.Maps;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Framework.Constants;
|
||||||
|
|
||||||
namespace Game.Entities
|
namespace Game.Entities
|
||||||
{
|
{
|
||||||
@@ -173,13 +174,10 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void MemberAttackStart(Creature member, Unit target)
|
public void MemberAttackStart(Creature member, Unit target)
|
||||||
{
|
{
|
||||||
byte groupAI = FormationMgr.CreatureGroupMap[member.GetSpawnId()].groupAI;
|
GroupAIFlags groupAI = (GroupAIFlags)FormationMgr.CreatureGroupMap[member.GetSpawnId()].groupAI;
|
||||||
if (groupAI == 0)
|
if (groupAI == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (groupAI == 1 && member != m_leader)
|
|
||||||
return;
|
|
||||||
|
|
||||||
foreach (var pair in m_members)
|
foreach (var pair in m_members)
|
||||||
{
|
{
|
||||||
if (m_leader) // avoid crash if leader was killed and reset.
|
if (m_leader) // avoid crash if leader was killed and reset.
|
||||||
@@ -197,7 +195,7 @@ namespace Game.Entities
|
|||||||
if (other.GetVictim())
|
if (other.GetVictim())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (other.IsValidAttackTarget(target))
|
if (((other != m_leader && groupAI.HasAnyFlag(GroupAIFlags.LeaderAggro)) || (other == m_leader && groupAI.HasAnyFlag(GroupAIFlags.MemberAggro))) && other.IsValidAttackTarget(target))
|
||||||
other.GetAI().AttackStart(target);
|
other.GetAI().AttackStart(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,7 +228,8 @@ namespace Game.Entities
|
|||||||
foreach (var pair in m_members)
|
foreach (var pair in m_members)
|
||||||
{
|
{
|
||||||
Creature member = pair.Key;
|
Creature member = pair.Key;
|
||||||
if (member == m_leader || !member.IsAlive() || member.GetVictim())
|
GroupAIFlags groupAI = (GroupAIFlags)FormationMgr.CreatureGroupMap[member.GetSpawnId()].groupAI;
|
||||||
|
if (member == m_leader || !member.IsAlive() || member.GetVictim() || !groupAI.HasAnyFlag(GroupAIFlags.Follow))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pair.Value.point_1 != 0)
|
if (pair.Value.point_1 != 0)
|
||||||
|
|||||||
@@ -4123,9 +4123,9 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint spellId = aura.GetId();
|
uint spellId = aura.GetId();
|
||||||
var range = m_ownedAuras.Where(p => p.Key == spellId);
|
|
||||||
|
|
||||||
foreach (var pair in range)
|
var range = m_ownedAuras.Where(p => p.Key == spellId);
|
||||||
|
foreach (var pair in range.ToList())
|
||||||
{
|
{
|
||||||
if (pair.Value == aura)
|
if (pair.Value == aura)
|
||||||
{
|
{
|
||||||
@@ -4235,9 +4235,9 @@ namespace Game.Entities
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
uint spellId = aurApp.GetBase().GetId();
|
uint spellId = aurApp.GetBase().GetId();
|
||||||
var range = m_appliedAuras.Where(p => p.Key == spellId);
|
|
||||||
|
|
||||||
foreach (var pair in range)
|
var range = m_appliedAuras.Where(p => p.Key == spellId);
|
||||||
|
foreach (var pair in range.ToList())
|
||||||
{
|
{
|
||||||
if (aurApp == pair.Value)
|
if (aurApp == pair.Value)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user