aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorthenecromancer <none@none>2010-07-21 01:42:02 +0200
committerthenecromancer <none@none>2010-07-21 01:42:02 +0200
commit389f6084c9b694ebb55f5106460e4eb0205d3af2 (patch)
treeeb2323f7853f456bce46afb86f1ded4ce0bff809 /src
parenta94afe82cadd2223456124b88bbc7cc39bc71de2 (diff)
Use unified code for adding remaining DoT damage to some talents.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp31
-rw-r--r--src/server/game/Entities/Unit/Unit.h2
2 files changed, 23 insertions, 10 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 95101a5be87..9156612392f 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -5927,16 +5927,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
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;
+ basepoints0 += GetRemainingDotDamage(GetGUID(), triggered_spell_id);
break;
}
// Glyph of Ice Block
@@ -6766,6 +6758,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// 4 damage tick
basepoints0 = triggerAmount*damage/400;
triggered_spell_id = 61840;
+ // Add remaining ticks to damage done
+ basepoints0 += GetRemainingDotDamage(GetGUID(), triggered_spell_id);
break;
}
// Sheath of Light
@@ -8157,8 +8151,10 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
SpellEntry const *TriggerPS = sSpellStore.LookupEntry(trigger_spell_id);
if (!TriggerPS)
return false;
+
basepoints0 = int32(damage * triggerAmount / 100 / (GetSpellMaxDuration(TriggerPS) / TriggerPS->EffectAmplitude[0]));
- target = pVictim;
+ basepoints0 += GetRemainingDotDamage(GetGUID(), trigger_spell_id);
+ break;
}
break;
}
@@ -16565,6 +16561,21 @@ void Unit::OutDebugInfo() const
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)
{
m_isCommandAttack = val;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 9b50a47f3c8..63b0ca91771 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1826,6 +1826,8 @@ class Unit : public WorldObject
void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL);
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 ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply);
virtual bool IsImmunedToSpell(SpellEntry const* spellInfo);