Core/Refactor: Part 3
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -3272,7 +3272,7 @@ namespace Game.AI
|
||||
if (me == null || !me.IsInCombat())
|
||||
return;
|
||||
|
||||
List<WorldObject> _targets = null;
|
||||
List<WorldObject> _targets;
|
||||
|
||||
switch (e.GetTargetType())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user