Some refactoring of code. and some cleanups

This commit is contained in:
hondacrx
2019-09-21 12:11:16 -04:00
parent 7c405230cc
commit 35c06c09fd
214 changed files with 1235 additions and 1341 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ namespace Game.AI
Unit summoner = creature.ToTempSummon().GetSummoner();
if (summoner != null)
{
Unit target = summoner.getAttackerForHelper();
Unit target = summoner.GetAttackerForHelper();
if (target == null && summoner.CanHaveThreatList() && !summoner.GetThreatManager().isThreatListEmpty())
target = summoner.GetThreatManager().getHostilTarget();
if (target != null && (creature.IsFriendlyTo(summoner) || creature.IsHostileTo(target)))
+1 -1
View File
@@ -34,7 +34,7 @@ namespace Game.AI
public override bool CanSeeAlways(WorldObject obj)
{
if (!obj.isTypeMask(TypeMask.Unit))
if (!obj.IsTypeMask(TypeMask.Unit))
return false;
var threatList = me.GetThreatManager().getThreatList();
+1 -1
View File
@@ -30,7 +30,7 @@ namespace Game.AI
public override void UpdateAI(uint diff)
{
if (me.IsInCombat() && me.getAttackers().Empty())
if (me.IsInCombat() && me.GetAttackers().Empty())
EnterEvadeMode(EvadeReason.NoHostiles);
}
+5 -5
View File
@@ -56,7 +56,7 @@ namespace Game.AI
me.GetMotionMaster().Clear();
me.GetMotionMaster().MoveIdle();
me.CombatStop();
me.getHostileRefManager().deleteReferences();
me.GetHostileRefManager().deleteReferences();
return;
}
@@ -163,9 +163,9 @@ namespace Game.AI
// Some spells can target enemy or friendly (DK Ghoul's Leap)
// Check for enemy first (pet then owner)
Unit target = me.getAttackerForHelper();
Unit target = me.GetAttackerForHelper();
if (!target && owner)
target = owner.getAttackerForHelper();
target = owner.GetAttackerForHelper();
if (target)
{
@@ -372,7 +372,7 @@ namespace Game.AI
return null;
// Check pet attackers first so we don't drag a bunch of targets to the owner
Unit myAttacker = me.getAttackerForHelper();
Unit myAttacker = me.GetAttackerForHelper();
if (myAttacker)
if (!myAttacker.HasBreakableByDamageCrowdControlAura())
return myAttacker;
@@ -382,7 +382,7 @@ namespace Game.AI
return null;
// Check owner attackers
Unit ownerAttacker = me.GetCharmerOrOwner().getAttackerForHelper();
Unit ownerAttacker = me.GetCharmerOrOwner().GetAttackerForHelper();
if (ownerAttacker)
if (!ownerAttacker.HasBreakableByDamageCrowdControlAura())
return ownerAttacker;
+1 -1
View File
@@ -54,7 +54,7 @@ namespace Game.AI
Unit victim = !i_victimGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, i_victimGuid) : null;
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
if (victim == null || !victim.isTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) ||
if (victim == null || !victim.IsTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) ||
me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim))
{
var u_check = new NearestAttackableUnitInObjectRangeCheck(me, me.GetCharmerOrOwnerOrSelf(), max_range);
+7 -7
View File
@@ -73,22 +73,22 @@ namespace Game.AI
return;
//Make sure our attack is ready and we aren't currently casting before checking distance
if (me.isAttackReady())
if (me.IsAttackReady())
{
me.AttackerStateUpdate(victim);
me.resetAttackTimer();
me.ResetAttackTimer();
}
if (me.haveOffhandWeapon() && me.isAttackReady(WeaponAttackType.OffAttack))
if (me.HaveOffhandWeapon() && me.IsAttackReady(WeaponAttackType.OffAttack))
{
me.AttackerStateUpdate(victim, WeaponAttackType.OffAttack);
me.resetAttackTimer(WeaponAttackType.OffAttack);
me.ResetAttackTimer(WeaponAttackType.OffAttack);
}
}
public bool DoSpellAttackIfReady(uint spell)
{
if (me.HasUnitState(UnitState.Casting) || !me.isAttackReady())
if (me.HasUnitState(UnitState.Casting) || !me.IsAttackReady())
return true;
var spellInfo = Global.SpellMgr.GetSpellInfo(spell);
@@ -97,7 +97,7 @@ namespace Game.AI
if (me.IsWithinCombatRange(me.GetVictim(), spellInfo.GetMaxRange(false)))
{
me.CastSpell(me.GetVictim(), spellInfo, TriggerCastFlags.None);
me.resetAttackTimer();
me.ResetAttackTimer();
return true;
}
}
@@ -507,7 +507,7 @@ namespace Game.AI
minRange += rangeMod;
}
if (_caster.isMoving() && target.isMoving() && !_caster.IsWalking() && !target.IsWalking() &&
if (_caster.IsMoving() && target.IsMoving() && !_caster.IsWalking() && !target.IsWalking() &&
(_spellInfo.RangeEntry.Flags.HasAnyFlag(SpellRangeFlag.Melee) || target.IsTypeId(TypeId.Player)))
rangeMod += 8.0f / 3.0f;
}