More refactoring of code.
This commit is contained in:
@@ -73,8 +73,8 @@ namespace Game.AI
|
||||
if (summoner != null)
|
||||
{
|
||||
Unit target = summoner.GetAttackerForHelper();
|
||||
if (target == null && summoner.CanHaveThreatList() && !summoner.GetThreatManager().isThreatListEmpty())
|
||||
target = summoner.GetThreatManager().getHostilTarget();
|
||||
if (target == null && summoner.CanHaveThreatList() && !summoner.GetThreatManager().IsThreatListEmpty())
|
||||
target = summoner.GetThreatManager().GetHostilTarget();
|
||||
if (target != null && (creature.IsFriendlyTo(summoner) || creature.IsHostileTo(target)))
|
||||
creature.GetAI().AttackStart(target);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ namespace Game.AI
|
||||
|
||||
return me.GetVictim() != null;
|
||||
}
|
||||
else if (me.GetThreatManager().isThreatListEmpty())
|
||||
else if (me.GetThreatManager().IsThreatListEmpty())
|
||||
{
|
||||
EnterEvadeMode(EvadeReason.NoHostiles);
|
||||
return false;
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace Game.AI
|
||||
if (!obj.IsTypeMask(TypeMask.Unit))
|
||||
return false;
|
||||
|
||||
var threatList = me.GetThreatManager().getThreatList();
|
||||
var threatList = me.GetThreatManager().GetThreatList();
|
||||
foreach (var refe in threatList)
|
||||
if (refe.getUnitGuid() == obj.GetGUID())
|
||||
if (refe.GetUnitGuid() == obj.GetGUID())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Game.AI
|
||||
me.GetMotionMaster().Clear();
|
||||
me.GetMotionMaster().MoveIdle();
|
||||
me.CombatStop();
|
||||
me.GetHostileRefManager().deleteReferences();
|
||||
me.GetHostileRefManager().DeleteReferences();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -230,7 +230,7 @@ namespace Game.AI
|
||||
SpellCastTargets targets = new SpellCastTargets();
|
||||
targets.SetUnitTarget(target);
|
||||
|
||||
spell.prepare(targets);
|
||||
spell.Prepare(targets);
|
||||
}
|
||||
|
||||
// deleted cached Spell objects
|
||||
@@ -262,14 +262,14 @@ namespace Game.AI
|
||||
return;
|
||||
|
||||
//owner is in group; group members filled in already (no raid . subgroupcount = whole count)
|
||||
if (group && !group.isRaidGroup() && m_AllySet.Count == (group.GetMembersCount() + 2))
|
||||
if (group && !group.IsRaidGroup() && m_AllySet.Count == (group.GetMembersCount() + 2))
|
||||
return;
|
||||
|
||||
m_AllySet.Clear();
|
||||
m_AllySet.Add(me.GetGUID());
|
||||
if (group) //add group
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next())
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player target = refe.GetSource();
|
||||
if (!target || !target.IsInMap(owner) || !group.SameSubGroup(owner.ToPlayer(), target))
|
||||
|
||||
@@ -113,17 +113,17 @@ namespace Game.AI
|
||||
// Select the targets satifying the predicate.
|
||||
public Unit SelectTarget(SelectAggroTarget targetType, uint position, ISelector selector)
|
||||
{
|
||||
var threatlist = GetThreatManager().getThreatList();
|
||||
var threatlist = GetThreatManager().GetThreatList();
|
||||
if (position >= threatlist.Count)
|
||||
return null;
|
||||
|
||||
List<Unit> targetList = new List<Unit>();
|
||||
Unit currentVictim = null;
|
||||
|
||||
var currentVictimReference = GetThreatManager().getCurrentVictim();
|
||||
var currentVictimReference = GetThreatManager().GetCurrentVictim();
|
||||
if (currentVictimReference != null)
|
||||
{
|
||||
currentVictim = currentVictimReference.getTarget();
|
||||
currentVictim = currentVictimReference.GetTarget();
|
||||
|
||||
// Current victim always goes first
|
||||
if (currentVictim && selector.Check(currentVictim))
|
||||
@@ -132,10 +132,10 @@ namespace Game.AI
|
||||
|
||||
foreach (var hostileRef in threatlist)
|
||||
{
|
||||
if (currentVictim != null && hostileRef.getTarget() != currentVictim && selector.Check(hostileRef.getTarget()))
|
||||
targetList.Add(hostileRef.getTarget());
|
||||
else if (currentVictim == null && selector.Check(hostileRef.getTarget()))
|
||||
targetList.Add(hostileRef.getTarget());
|
||||
if (currentVictim != null && hostileRef.GetTarget() != currentVictim && selector.Check(hostileRef.GetTarget()))
|
||||
targetList.Add(hostileRef.GetTarget());
|
||||
else if (currentVictim == null && selector.Check(hostileRef.GetTarget()))
|
||||
targetList.Add(hostileRef.GetTarget());
|
||||
}
|
||||
|
||||
if (position >= targetList.Count)
|
||||
@@ -178,13 +178,13 @@ namespace Game.AI
|
||||
{
|
||||
var targetList = new List<Unit>();
|
||||
|
||||
var threatlist = GetThreatManager().getThreatList();
|
||||
var threatlist = GetThreatManager().GetThreatList();
|
||||
if (threatlist.Empty())
|
||||
return targetList;
|
||||
|
||||
foreach (var hostileRef in threatlist)
|
||||
if (selector.Check(hostileRef.getTarget()))
|
||||
targetList.Add(hostileRef.getTarget());
|
||||
if (selector.Check(hostileRef.GetTarget()))
|
||||
targetList.Add(hostileRef.GetTarget());
|
||||
|
||||
if (targetList.Count < maxTargets)
|
||||
return targetList;
|
||||
@@ -368,15 +368,15 @@ namespace Game.AI
|
||||
public virtual void HealDone(Unit to, uint addhealth) { }
|
||||
public virtual void SpellInterrupted(uint spellId, uint unTimeMs) {}
|
||||
|
||||
public virtual void sGossipHello(Player player) { }
|
||||
public virtual void sGossipSelect(Player player, uint menuId, uint gossipListId) { }
|
||||
public virtual void sGossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { }
|
||||
public virtual void sQuestAccept(Player player, Quest quest) { }
|
||||
public virtual void sQuestSelect(Player player, Quest quest) { }
|
||||
public virtual void sQuestComplete(Player player, Quest quest) { }
|
||||
public virtual void sQuestReward(Player player, Quest quest, uint opt) { }
|
||||
public virtual bool sOnDummyEffect(Unit caster, uint spellId, int effIndex) { return false; }
|
||||
public virtual void sOnGameEvent(bool start, ushort eventId) { }
|
||||
public virtual void GossipHello(Player player) { }
|
||||
public virtual void GossipSelect(Player player, uint menuId, uint gossipListId) { }
|
||||
public virtual void GossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { }
|
||||
public virtual void QuestAccept(Player player, Quest quest) { }
|
||||
public virtual void QuestSelect(Player player, Quest quest) { }
|
||||
public virtual void QuestComplete(Player player, Quest quest) { }
|
||||
public virtual void QuestReward(Player player, Quest quest, uint opt) { }
|
||||
public virtual bool OnDummyEffect(Unit caster, uint spellId, int effIndex) { return false; }
|
||||
public virtual void OnGameEvent(bool start, ushort eventId) { }
|
||||
|
||||
public static AISpellInfoType[] AISpellInfo;
|
||||
|
||||
@@ -552,9 +552,9 @@ namespace Game.AI
|
||||
if (_playerOnly && !target.IsTypeId(TypeId.Player))
|
||||
return false;
|
||||
|
||||
HostileReference currentVictim = _source.GetThreatManager().getCurrentVictim();
|
||||
HostileReference currentVictim = _source.GetThreatManager().GetCurrentVictim();
|
||||
if (currentVictim != null)
|
||||
return target.GetGUID() != currentVictim.getUnitGuid();
|
||||
return target.GetGUID() != currentVictim.GetUnitGuid();
|
||||
|
||||
return target != _source.GetVictim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user