Use unified code for adding remaining DoT damage to some talents.

--HG--
branch : trunk
This commit is contained in:
thenecromancer
2010-07-21 01:42:02 +02:00
parent a94afe82ca
commit 389f6084c9
2 changed files with 23 additions and 10 deletions
+21 -10
View File
@@ -5927,16 +5927,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return false; return false;
} }
AuraEffectList const& DoTAuras = target->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE);
for (Unit::AuraEffectList::const_iterator i = DoTAuras.begin(); i != DoTAuras.end(); ++i)
{
if ((*i)->GetCasterGUID() != GetGUID() || (*i)->GetId() != 12654 || (*i)->GetEffIndex() != 0)
continue;
basepoints0 += ((*i)->GetAmount() * ((*i)->GetTotalTicks() - ((*i)->GetTickNumber()))) / 2;
break;
}
triggered_spell_id = 12654; triggered_spell_id = 12654;
basepoints0 += GetRemainingDotDamage(GetGUID(), triggered_spell_id);
break; break;
} }
// Glyph of Ice Block // Glyph of Ice Block
@@ -6766,6 +6758,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// 4 damage tick // 4 damage tick
basepoints0 = triggerAmount*damage/400; basepoints0 = triggerAmount*damage/400;
triggered_spell_id = 61840; triggered_spell_id = 61840;
// Add remaining ticks to damage done
basepoints0 += GetRemainingDotDamage(GetGUID(), triggered_spell_id);
break; break;
} }
// Sheath of Light // Sheath of Light
@@ -8157,8 +8151,10 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
SpellEntry const *TriggerPS = sSpellStore.LookupEntry(trigger_spell_id); SpellEntry const *TriggerPS = sSpellStore.LookupEntry(trigger_spell_id);
if (!TriggerPS) if (!TriggerPS)
return false; return false;
basepoints0 = int32(damage * triggerAmount / 100 / (GetSpellMaxDuration(TriggerPS) / TriggerPS->EffectAmplitude[0])); basepoints0 = int32(damage * triggerAmount / 100 / (GetSpellMaxDuration(TriggerPS) / TriggerPS->EffectAmplitude[0]));
target = pVictim; basepoints0 += GetRemainingDotDamage(GetGUID(), trigger_spell_id);
break;
} }
break; break;
} }
@@ -16565,6 +16561,21 @@ void Unit::OutDebugInfo() const
sLog.outString("On vehicle %u.", GetVehicleBase()->GetEntry()); sLog.outString("On vehicle %u.", GetVehicleBase()->GetEntry());
} }
uint32 Unit::GetRemainingDotDamage(uint64 caster, uint32 spellId, uint8 effectIndex) const
{
uint32 amount = 0;
AuraEffectList const& DoTAuras = GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE);
for (AuraEffectList::const_iterator i = DoTAuras.begin(); i != DoTAuras.end(); ++i)
{
if ((*i)->GetCasterGUID() != caster || (*i)->GetId() != spellId || (*i)->GetEffIndex() != effectIndex)
continue;
amount += ((*i)->GetAmount() * ((*i)->GetTotalTicks() - ((*i)->GetTickNumber()))) / (*i)->GetTotalTicks();
break;
}
return amount;
}
void CharmInfo::SetIsCommandAttack(bool val) void CharmInfo::SetIsCommandAttack(bool val)
{ {
m_isCommandAttack = val; m_isCommandAttack = val;
+2
View File
@@ -1826,6 +1826,8 @@ class Unit : public WorldObject
void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL); void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL);
uint32 GetCastingTimeForBonus(SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime); uint32 GetCastingTimeForBonus(SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime);
uint32 GetRemainingDotDamage(uint64 caster, uint32 spellId, uint8 effectIndex = 0) const;
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply); void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply);
virtual bool IsImmunedToSpell(SpellEntry const* spellInfo); virtual bool IsImmunedToSpell(SpellEntry const* spellInfo);