Core/Spells: Named and implemented most of SpellAttr8
Port From (https://github.com/TrinityCore/TrinityCore/commit/dc9361fcc2eb16a59b52dfd8b0d47dfc1bf639be)
This commit is contained in:
@@ -877,6 +877,18 @@ namespace Game.Spells
|
||||
return SpellCastResult.NotInRaidInstance;
|
||||
}
|
||||
|
||||
if (HasAttribute(SpellAttr8.RemoveOutsideDungeonsAndRaids))
|
||||
{
|
||||
if (mapEntry == null || !mapEntry.IsDungeon())
|
||||
return SpellCastResult.TargetNotInInstance;
|
||||
}
|
||||
|
||||
if (HasAttribute(SpellAttr8.NotInBattleground))
|
||||
{
|
||||
if (mapEntry == null || mapEntry.IsBattleground())
|
||||
return SpellCastResult.NotInBattleground;
|
||||
}
|
||||
|
||||
// DB base check (if non empty then must fit at least single for allow)
|
||||
var saBounds = Global.SpellMgr.GetSpellAreaMapBounds(Id);
|
||||
if (!saBounds.Empty())
|
||||
@@ -993,6 +1005,10 @@ namespace Game.Spells
|
||||
|
||||
Unit unitTarget = target.ToUnit();
|
||||
|
||||
if (HasAttribute(SpellAttr8.OnlyTargetIfSameCreator))
|
||||
if (caster != target && caster.GetGUID() != target.GetOwnerGUID())
|
||||
return SpellCastResult.BadTargets;
|
||||
|
||||
// creature/player specific target checks
|
||||
if (unitTarget != null)
|
||||
{
|
||||
@@ -1046,6 +1062,10 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (HasAttribute(SpellAttr8.OnlyTargetOwnSummons))
|
||||
if (!unitTarget.IsSummon() || unitTarget.ToTempSummon().GetSummonerGUID() != caster.GetGUID())
|
||||
return SpellCastResult.BadTargets;
|
||||
}
|
||||
// corpse specific target checks
|
||||
else if (target.IsTypeId(TypeId.Corpse))
|
||||
@@ -1137,7 +1157,7 @@ namespace Game.Spells
|
||||
if (HasEffect(SpellEffectName.SelfResurrect) || HasEffect(SpellEffectName.Resurrect))
|
||||
return SpellCastResult.TargetCannotBeResurrected;
|
||||
|
||||
if (HasAttribute(SpellAttr8.BattleResurrection))
|
||||
if (HasAttribute(SpellAttr8.EnforceInCombatRessurectionLimit))
|
||||
{
|
||||
Map map = caster.GetMap();
|
||||
if (map != null)
|
||||
@@ -4248,7 +4268,7 @@ namespace Game.Spells
|
||||
if (Scaling.Coefficient != 0.0f)
|
||||
{
|
||||
uint level = _spellInfo.SpellLevel;
|
||||
if (target != null && _spellInfo.IsPositiveEffect(EffectIndex) && (Effect == SpellEffectName.ApplyAura))
|
||||
if (target != null && _spellInfo.HasAttribute(SpellAttr8.UseTargetsLevelForSpellScaling))
|
||||
level = target.GetLevel();
|
||||
else if (caster != null && caster.IsUnit())
|
||||
level = caster.ToUnit().GetLevel();
|
||||
@@ -4333,7 +4353,12 @@ namespace Game.Spells
|
||||
if (contentTuning != null)
|
||||
expansion = contentTuning.ExpansionID;
|
||||
|
||||
uint level = caster != null && caster.IsUnit() ? caster.ToUnit().GetLevel() : 1;
|
||||
uint level = 1;
|
||||
if (target != null && _spellInfo.HasAttribute(SpellAttr8.UseTargetsLevelForSpellScaling))
|
||||
level = target.GetLevel();
|
||||
else if (caster != null && caster.IsUnit())
|
||||
level = caster.ToUnit().GetLevel();
|
||||
|
||||
tempValue = Global.DB2Mgr.EvaluateExpectedStat(stat, level, expansion, 0, Class.None, 0) * BasePoints / 100.0f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user