Core/Spells: Remove leftover code from old mechanic - default spellpower scaling coefficients
Port From (https://github.com/TrinityCore/TrinityCore/commit/407e5aea1a0e9395f8a0dda58b004c5659e78b7b)
This commit is contained in:
@@ -890,103 +890,6 @@ namespace Game.Entities
|
|||||||
spell.Finish(ok);
|
spell.Finish(ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint GetCastingTimeForBonus(SpellInfo spellProto, DamageEffectType damagetype, uint CastingTime)
|
|
||||||
{
|
|
||||||
// Not apply this to creature casted spells with casttime == 0
|
|
||||||
if (CastingTime == 0 && IsTypeId(TypeId.Unit) && !IsPet())
|
|
||||||
return 3500;
|
|
||||||
|
|
||||||
if (CastingTime > 7000) CastingTime = 7000;
|
|
||||||
if (CastingTime < 1500) CastingTime = 1500;
|
|
||||||
|
|
||||||
if (damagetype == DamageEffectType.DOT && !spellProto.IsChanneled())
|
|
||||||
CastingTime = 3500;
|
|
||||||
|
|
||||||
int overTime = 0;
|
|
||||||
byte effects = 0;
|
|
||||||
bool DirectDamage = false;
|
|
||||||
bool AreaEffect = false;
|
|
||||||
|
|
||||||
foreach (SpellEffectInfo effect in spellProto.GetEffects())
|
|
||||||
{
|
|
||||||
if (effect == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
switch (effect.Effect)
|
|
||||||
{
|
|
||||||
case SpellEffectName.SchoolDamage:
|
|
||||||
case SpellEffectName.PowerDrain:
|
|
||||||
case SpellEffectName.HealthLeech:
|
|
||||||
case SpellEffectName.EnvironmentalDamage:
|
|
||||||
case SpellEffectName.PowerBurn:
|
|
||||||
case SpellEffectName.Heal:
|
|
||||||
DirectDamage = true;
|
|
||||||
break;
|
|
||||||
case SpellEffectName.ApplyAura:
|
|
||||||
switch (effect.ApplyAuraName)
|
|
||||||
{
|
|
||||||
case AuraType.PeriodicDamage:
|
|
||||||
case AuraType.PeriodicHeal:
|
|
||||||
case AuraType.PeriodicLeech:
|
|
||||||
if (spellProto.GetDuration() != 0)
|
|
||||||
overTime = spellProto.GetDuration();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// -5% per additional effect
|
|
||||||
++effects;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (effect.IsTargetingArea())
|
|
||||||
AreaEffect = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Combined Spells with Both Over Time and Direct Damage
|
|
||||||
if (overTime > 0 && CastingTime > 0 && DirectDamage)
|
|
||||||
{
|
|
||||||
// mainly for DoTs which are 3500 here otherwise
|
|
||||||
int OriginalCastTime = spellProto.CalcCastTime();
|
|
||||||
if (OriginalCastTime > 7000)
|
|
||||||
OriginalCastTime = 7000;
|
|
||||||
if (OriginalCastTime < 1500)
|
|
||||||
OriginalCastTime = 1500;
|
|
||||||
// Portion to Over Time
|
|
||||||
float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f));
|
|
||||||
|
|
||||||
if (damagetype == DamageEffectType.DOT)
|
|
||||||
CastingTime = (uint)(CastingTime * PtOT);
|
|
||||||
else if (PtOT < 1.0f)
|
|
||||||
CastingTime = (uint)(CastingTime * (1 - PtOT));
|
|
||||||
else
|
|
||||||
CastingTime = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Area Effect Spells receive only half of bonus
|
|
||||||
if (AreaEffect)
|
|
||||||
CastingTime /= 2;
|
|
||||||
|
|
||||||
// 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
|
|
||||||
foreach (SpellEffectInfo effect in spellProto.GetEffects())
|
|
||||||
{
|
|
||||||
if (effect != null && (effect.Effect == SpellEffectName.HealthLeech ||
|
|
||||||
(effect.Effect == SpellEffectName.ApplyAura && effect.ApplyAuraName == AuraType.PeriodicLeech)))
|
|
||||||
{
|
|
||||||
CastingTime /= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -5% of total per any additional effect
|
|
||||||
for (byte i = 0; i < effects; ++i)
|
|
||||||
CastingTime *= (uint)0.95f;
|
|
||||||
|
|
||||||
return CastingTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual SpellInfo GetCastSpellInfo(SpellInfo spellInfo)
|
public virtual SpellInfo GetCastSpellInfo(SpellInfo spellInfo)
|
||||||
{
|
{
|
||||||
SpellInfo findMatchingAuraEffectIn(AuraType type)
|
SpellInfo findMatchingAuraEffectIn(AuraType type)
|
||||||
|
|||||||
@@ -3771,30 +3771,6 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType = WeaponAttackType.BaseAttack) { return SpellSchoolMask.None; }
|
public virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType = WeaponAttackType.BaseAttack) { return SpellSchoolMask.None; }
|
||||||
|
|
||||||
float CalculateDefaultCoefficient(SpellInfo spellInfo, DamageEffectType damagetype)
|
|
||||||
{
|
|
||||||
// Damage over Time spells bonus calculation
|
|
||||||
float DotFactor = 1.0f;
|
|
||||||
if (damagetype == DamageEffectType.DOT)
|
|
||||||
{
|
|
||||||
|
|
||||||
int DotDuration = spellInfo.GetDuration();
|
|
||||||
if (!spellInfo.IsChanneled() && DotDuration > 0)
|
|
||||||
DotFactor = DotDuration / 15000.0f;
|
|
||||||
|
|
||||||
uint DotTicks = spellInfo.GetMaxTicks();
|
|
||||||
if (DotTicks != 0)
|
|
||||||
DotFactor /= DotTicks;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint CastingTime = (uint)(spellInfo.IsChanneled() ? spellInfo.GetDuration() : spellInfo.CalcCastTime());
|
|
||||||
// Distribute Damage over multiple effects, reduce by AoE
|
|
||||||
CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime);
|
|
||||||
|
|
||||||
// As wowwiki says: C = (Cast Time / 3.5)
|
|
||||||
return (CastingTime / 3500.0f) * DotFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void UpdateDamageDoneMods(WeaponAttackType attackType)
|
public virtual void UpdateDamageDoneMods(WeaponAttackType attackType)
|
||||||
{
|
{
|
||||||
UnitMods unitMod = attackType switch
|
UnitMods unitMod = attackType switch
|
||||||
|
|||||||
Reference in New Issue
Block a user