Core/Refactor: Part 3

This commit is contained in:
hondacrx
2018-05-16 19:57:48 -04:00
parent 225a5d27f7
commit 5dacd669b5
112 changed files with 564 additions and 561 deletions
+1 -1
View File
@@ -241,7 +241,7 @@ namespace Game.AI
}
public override bool CanAIAttack(Unit victim)
{
/// todo use one function to replace it
// todo use one function to replace it
if (!me.IsWithinCombatRange(me.GetVictim(), me.m_CombatDistance)
|| (m_minRange != 0 && me.IsWithinCombatRange(me.GetVictim(), m_minRange)))
return false;
+1 -1
View File
@@ -546,7 +546,7 @@ namespace Game.AI
if (me.GetVictim() && me.GetVictim() != victim)
{
// Check if our owner selected this target and clicked "attack"
Unit ownerTarget = null;
Unit ownerTarget;
Player owner = me.GetCharmerOrOwner().ToPlayer();
if (owner)
ownerTarget = owner.GetSelectedUnit();
-1
View File
@@ -57,7 +57,6 @@ namespace Game.AI
if (victim == null || !victim.isTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) ||
me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim))
{
victim = null;
var u_check = new NearestAttackableUnitInObjectRangeCheck(me, me.GetCharmerOrOwnerOrSelf(), max_range);
var checker = new UnitLastSearcher(me, u_check);
Cell.VisitAllObjects(me, checker, max_range);
+1 -3
View File
@@ -133,12 +133,10 @@ namespace Game.AI
uint spellCount = 0;
SpellInfo tempSpell = null;
//Check if each spell is viable(set it to null if not)
for (uint i = 0; i < SharedConst.MaxCreatureSpells; i++)
{
tempSpell = Global.SpellMgr.GetSpellInfo(me.m_spells[i]);
SpellInfo tempSpell = Global.SpellMgr.GetSpellInfo(me.m_spells[i]);
//This spell doesn't exist
if (tempSpell == null)
@@ -142,7 +142,7 @@ namespace Game.AI
if (!HasFollowState(eFollowState.Inprogress) || m_uiLeaderGUID.IsEmpty() || m_pQuestForFollow == null)
return;
/// @todo need a better check for quests with time limit.
// @todo need a better check for quests with time limit.
Player player = GetLeaderForFollower();
if (player)
{
@@ -1255,7 +1255,7 @@ namespace Game.AI
if (e.GetScriptType() != SmartScriptType.Creature)
return true;
uint entry = 0;
uint entry;
if (e.GetEventType() == SmartEvents.TextOver)
{
entry = e.Event.textOver.creatureEntry;
+1 -1
View File
@@ -3272,7 +3272,7 @@ namespace Game.AI
if (me == null || !me.IsInCombat())
return;
List<WorldObject> _targets = null;
List<WorldObject> _targets;
switch (e.GetTargetType())
{