Core/Spells: Change haste benefit to cast time formulas, may need further correction

- With these changes, Paladin/Death Knight mount summons will no longer benefit from haste
This commit is contained in:
Trisjdc committed 2014-06-12 20:03:52 +01:00
1 parent d28f0f9a5a
commit 4992c0290b
2 files changed
+29 -15

No files matched your search

+26 -9
View File
@@ -12883,20 +12883,37 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
return std::max(duration, 0);
}
void Unit::ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell* spell)
void Unit::ModSpellCastTime(SpellInfo const* spellInfo, int32 & castTime, Spell* spell)
{
if (!spellProto || castTime < 0)
if (!spellInfo || castTime < 0)
return;
if (spellInfo->IsChanneled() && !spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
return;
// called from caster
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime, spell);
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell);
if (!(spellProto->Attributes & (SPELL_ATTR0_ABILITY|SPELL_ATTR0_TRADESPELL)) && ((GetTypeId() == TYPEID_PLAYER && spellProto->SpellFamilyName) || GetTypeId() == TYPEID_UNIT))
castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
else if (spellProto->Attributes & SPELL_ATTR0_REQ_AMMO && !(spellProto->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG))
castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
else if (spellProto->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat.
castTime = 500;
switch (spellInfo->DmgClass)
{
case SPELL_DAMAGE_CLASS_NONE:
if (spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION) // required double check
castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
else if (spellInfo->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat.
castTime = 500;
break;
case SPELL_DAMAGE_CLASS_MELEE:
break; // no known cases
case SPELL_DAMAGE_CLASS_MAGIC:
castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
break;
case SPELL_DAMAGE_CLASS_RANGED:
castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
break;
default:
break;
}
}
DiminishingLevels Unit::GetDiminishing(DiminishingGroup group)