Fixes creatures aggro range, Wrong check on pathpoints, and a crash when there is no unitCaster.

This commit is contained in:
hondacrx
2022-07-17 22:49:28 -04:00
parent abbd51bf8d
commit acb9db8891
4 changed files with 8 additions and 7 deletions
+4 -4
View File
@@ -1786,10 +1786,10 @@ namespace Game.Entities
float maxRadius = 45.0f * aggroRate;
float minRadius = 5.0f * aggroRate;
uint expansionMaxLevel = Global.ObjectMgr.GetMaxLevelForExpansion((Expansion)GetCreatureTemplate().RequiredExpansion);
uint playerLevel = player.GetLevelForTarget(this);
uint creatureLevel = GetLevelForTarget(player);
uint levelDifference = creatureLevel - playerLevel;
int expansionMaxLevel = (int)Global.ObjectMgr.GetMaxLevelForExpansion((Expansion)GetCreatureTemplate().RequiredExpansion);
int playerLevel = (int)player.GetLevelForTarget(this);
int creatureLevel = (int)GetLevelForTarget(player);
int levelDifference = creatureLevel - playerLevel;
// The aggro radius for creatures with equal level as the player is 20 yards.
// The combatreach should not get taken into account for the distance so we drop it from the range (see Supremus as expample)
@@ -952,7 +952,7 @@ namespace Game.Movement
return;
// check if we even need to do anything
if ((_pathPoints[0] - target).LengthSquared() >= distSq)
if ((_pathPoints[_pathPoints.Length - 1] - target).LengthSquared() >= distSq)
return;
int i = _pathPoints.Length - 1;
+1 -1
View File
@@ -3372,7 +3372,7 @@ namespace Game.Spells
return;
Unit unitCaster = m_caster.ToUnit();
if (unitCaster != null)
if (unitCaster == null)
return;
// successful cast of the initial autorepeat spell is moved to idle state so that it is not deleted as long as autorepeat is active
+2 -1
View File
@@ -1018,7 +1018,7 @@ namespace Scripts.Spells.Mage
}
}
// 205021 - Ray of Frost
[Script] // 205021 - Ray of Frost
class spell_mage_ray_of_frost : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
@@ -1039,6 +1039,7 @@ namespace Scripts.Spells.Mage
}
}
[Script]
class spell_mage_ray_of_frost_aura : AuraScript
{
public override bool Validate(SpellInfo spellInfo)