*Implement spellhaste mod for Channeled spells.

*Fix build with VCPP.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-02-11 20:10:00 +01:00
parent 651e7c29eb
commit 40bf3b630a
9 changed files with 77 additions and 16 deletions
@@ -2051,6 +2051,18 @@
Name="Utgarde Keep">
<Filter
Name="Utgarde Keep">
<File
RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_keleseth.cpp"
>
</File>
<File
RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\def_keep.h"
>
</File>
<File
RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp"
>
</File>
</Filter>
<Filter
Name="Utgarde Pinnacle">
@@ -1156,6 +1156,18 @@
Name="Utgarde Keep">
<Filter
Name="Utgarde Keep">
<File
RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_keleseth.cpp"
>
</File>
<File
RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\def_keep.h"
>
</File>
<File
RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp"
>
</File>
</Filter>
<Filter
Name="Utgarde Pinnacle">
@@ -849,6 +849,18 @@
<Filter
Name="Utgarde Keep"
>
<File
RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_keleseth.cpp"
>
</File>
<File
RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\def_keep.h"
>
</File>
<File
RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp"
>
</File>
</Filter>
<Filter
Name="Utgarde Pinnacle"
+1 -1
View File
@@ -7006,7 +7006,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
ApplyFeralAPBonus(feral_bonus, apply);
}
if(!IsUseEquipedWeapon(slot==EQUIPMENT_SLOT_MAINHAND))
if(!IsInFeralForm() || !CanUseAttackType(attType))
return;
if (proto->Delay)
+2
View File
@@ -2284,6 +2284,8 @@ void Spell::handle_immediate()
int32 duration = GetSpellDuration(m_spellInfo);
if (duration)
{
//apply haste mods
m_caster->ModSpellCastTime(m_spellInfo, duration);
// Apply duration mod
if(Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
+4
View File
@@ -2262,6 +2262,10 @@ void Spell::EffectApplyAura(uint32 i)
//apply mods only here, area auras don't have duration
duration = caster->ModSpellDuration(m_spellInfo, i, unitTarget, duration);
//mod duration of channeled aura by spell haste
if (IsChanneledSpell(m_spellInfo))
m_caster->ModSpellCastTime(m_spellInfo, duration);
// if Aura removed and deleted, do not continue.
if(duration== 0 && !(Aur->IsPermanent()))
{
+2 -13
View File
@@ -244,19 +244,8 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
int32 castTime = spellCastTimeEntry->CastTime;
if (spell)
{
if(Player* modOwner = spell->GetCaster()->GetSpellModOwner())
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell);
if( !(spellInfo->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_UNK5)) )
castTime = int32(castTime * spell->GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED));
else
{
if (spell->IsRangedSpell() && !spell->IsAutoRepeat())
castTime = int32(castTime * spell->GetCaster()->m_modAttackSpeedPct[RANGED_ATTACK]);
}
}
if (spell && spell->GetCaster())
spell->GetCaster()->ModSpellCastTime(spellInfo, castTime);
if (spellInfo->Attributes & SPELL_ATTR_RANGED && (!spell || !(spell->IsAutoRepeat())))
castTime += 500;
+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
+1
View File
@@ -1453,6 +1453,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 basePoints, Unit const* target);
int32 CalcSpellDuration(SpellEntry const* spellProto);
int32 ModSpellDuration(SpellEntry const* spellProto, uint8 effect_index, Unit const* target, int32 duration);
void ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime);
float CalculateLevelPenalty(SpellEntry const* spellProto) const;
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }