*Implement spellhaste mod for Channeled spells.

*Fix build with VCPP.

--HG--
branch : trunk
This commit is contained in:
QAston committed 2009-02-11 20:10:00 +01:00
1 parent 651e7c29eb
commit 40bf3b630a
9 files changed
+77 -16

No files matched your search

+31 -2
View File
@@ -8126,12 +8126,17 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
else if (DoneAdvertisedBenefit || TakenAdvertisedBenefit)
{
// Damage Done from spell damage bonus
uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
if (IsChanneledSpell(spellProto))
ModSpellCastTime(spellProto, CastingTime);
// Damage over Time spells bonus calculation
float DotFactor = 1.0f;
if(damagetype == DOT)
{
int32 DotDuration = GetSpellDuration(spellProto);
//apply casting time mods for channeled spells
if (IsChanneledSpell(spellProto))
ModSpellCastTime(spellProto, DotDuration);
// 200% limit
if(DotDuration > 0)
{
@@ -8614,12 +8619,17 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
else if (DoneAdvertisedBenefit || TakenAdvertisedBenefit)
{
// Damage Done from spell damage bonus
uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
if (IsChanneledSpell(spellProto))
ModSpellCastTime(spellProto, CastingTime);
// Damage over Time spells bonus calculation
float DotFactor = 1.0f;
if(damagetype == DOT)
{
int32 DotDuration = GetSpellDuration(spellProto);
//apply casting time mods for channeled spells
if (IsChanneledSpell(spellProto))
ModSpellCastTime(spellProto, DotDuration);
// 200% limit
if(DotDuration > 0)
{
@@ -10084,6 +10094,23 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, uint8 effect_index, U
return duration>0 ? duration : 0;
}
void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime)
{
if (!spellProto || castTime<0)
return;
//called from caster
if(Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime);
if( !(spellProto->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_UNK5)) )
castTime = float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED);
else
{
if (spellProto->Attributes & SPELL_ATTR_RANGED && !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG))
castTime = float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK];
}
}
DiminishingLevels Unit::GetDiminishing(DiminishingGroup group)
{
for(Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
@@ -11586,6 +11613,8 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT
case SPELL_AURA_PERIODIC_LEECH:
if ( GetSpellDuration(spellProto) )
overTime = GetSpellDuration(spellProto);
if (IsChanneledSpell(spellProto))
ModSpellCastTime(spellProto, overTime);
break;
default:
// -5% per additional effect