aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQAston <none@none>2010-08-27 01:13:27 +0200
committerQAston <none@none>2010-08-27 01:13:27 +0200
commit1d3deae555f0ec523d77875bd5a307ab9bd19742 (patch)
treecc25c869f8f21ba39f2f763cc55aaaa46243f38c
parent1bb14ba578d6c989fb2b50c18bd0bff40fd6fcc8 (diff)
*Send to client periodic heal absorbtion.
*Heal over time spells are updating healing achievement progress now. --HG-- branch : trunk
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp24
-rw-r--r--src/server/game/Entities/Unit/Unit.h3
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp20
-rw-r--r--src/server/game/Spells/Spell.cpp2
-rw-r--r--src/server/game/Spells/SpellEffects.cpp8
5 files changed, 30 insertions, 27 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 4c7adefa56a..da71e13e3c4 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -5142,8 +5142,7 @@ void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
data << uint32(log->SpellID);
data << uint32(log->damage); // damage amount
int32 overkill = log->damage - log->target->GetHealth();
- data << uint32(overkill > 0 ? overkill : 0);
- //data << uint32(log->overkill); // overkill
+ data << uint32(overkill > 0 ? overkill : 0); // overkill
data << uint8 (log->schoolMask); // damage school
data << uint32(log->absorb); // AbsorbedDamage
data << uint32(log->resist); // resist
@@ -5205,7 +5204,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
case SPELL_AURA_OBS_MOD_HEALTH:
data << uint32(pInfo->damage); // damage
data << uint32(pInfo->overDamage); // overheal
- data << uint32(0); // absorb
+ data << uint32(pInfo->absorb); // absorb
data << uint8(pInfo->critical); // new 3.1.2 critical tick
break;
case SPELL_AURA_OBS_MOD_POWER:
@@ -9924,11 +9923,8 @@ void Unit::SetCharm(Unit* charm, bool apply)
}
}
-int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellProto, bool critical)
+int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth)
{
- uint32 absorb = 0;
- // calculate heal absorb and reduce healing
- CalcHealAbsorb(pVictim, spellProto, addhealth, absorb);
int32 gain = 0;
if (addhealth)
@@ -9941,9 +9937,6 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
if (unit->GetTypeId() == TYPEID_PLAYER)
{
- // overheal = addhealth - gain
- unit->SendHealSpellLog(pVictim, spellProto->Id, addhealth, addhealth - gain, absorb, critical);
-
if (Battleground *bg = unit->ToPlayer()->GetBattleground())
bg->UpdatePlayerScore((Player*)unit, SCORE_HEALING_DONE, gain);
@@ -10161,6 +10154,17 @@ void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32
SendMessageToSet(&data, true);
}
+int32 Unit::HealBySpell(Unit * pVictim, SpellEntry const * spellInfo, uint32 addHealth, bool critical)
+{
+ uint32 absorb = 0;
+ // calculate heal absorb and reduce healing
+ CalcHealAbsorb(pVictim, spellInfo, addHealth, absorb);
+
+ int32 gain = DealHeal(pVictim, addHealth);
+ SendHealSpellLog(pVictim, spellInfo->Id, addHealth, uint32(addHealth - gain), absorb, critical);
+ return gain;
+}
+
void Unit::SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype)
{
WorldPacket data(SMSG_SPELLENERGIZELOG, (8+8+4+4+4+1));
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index f73b581f500..68a9fb2135b 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1300,7 +1300,7 @@ class Unit : public WorldObject
void DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb);
uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *spellProto = NULL, bool durabilityLoss = true);
void Kill(Unit *pVictim, bool durabilityLoss = true);
- int32 DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellProto, bool critical = false);
+ int32 DealHeal(Unit *pVictim, uint32 addhealth);
void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const *procSpell = NULL, SpellEntry const * procAura = NULL);
void ProcDamageAndSpellFor(bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage , SpellEntry const * procAura = NULL);
@@ -1418,6 +1418,7 @@ class Unit : public WorldObject
bool isInAccessiblePlaceFor(Creature const* c) const;
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false);
+ int32 HealBySpell(Unit * pVictim, SpellEntry const * spellInfo, uint32 addHealth, bool critical = false);
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage);
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 7286551483d..6d8336eb1ff 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -1480,7 +1480,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellProto(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount()));
- int32 gain = caster->DealHeal(caster, heal, GetSpellProto());
+ int32 gain = caster->HealBySpell(caster, GetSpellProto(), heal);
caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellProto());
break;
}
@@ -1504,7 +1504,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
damage = int32(damage * gainMultiplier);
- caster->DealHeal(target, damage, GetSpellProto());
+ caster->HealBySpell(target, GetSpellProto(), damage);
break;
}
case SPELL_AURA_PERIODIC_HEAL:
@@ -1573,16 +1573,14 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
sLog.outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId());
- int32 gain = target->ModifyHealth(damage);
+ uint32 absorb = 0;
+ uint32 heal = uint32(damage);
+ caster->CalcHealAbsorb(target, GetSpellProto(), heal, absorb);
+ int32 gain = caster->DealHeal(target, heal);
- SpellPeriodicAuraLogInfo pInfo(this, damage, damage - gain, 0, 0, 0.0f, crit);
+ SpellPeriodicAuraLogInfo pInfo(this, damage, damage - gain, absorb, 0, 0.0f, crit);
target->SendPeriodicAuraLog(&pInfo);
- // add HoTs to amount healed in bgs
- if (caster->GetTypeId() == TYPEID_PLAYER)
- if (Battleground *bg = caster->ToPlayer()->GetBattleground())
- bg->UpdatePlayerScore(caster->ToPlayer(), SCORE_HEALING_DONE, gain);
-
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
bool haveCastItem = GetBase()->GetCastItemGUID() != 0;
@@ -1666,7 +1664,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
SpellPeriodicAuraLogInfo pInfo(this, drain_amount, 0, 0, 0, gain_multiplier, false);
target->SendPeriodicAuraLog(&pInfo);
- int32 gain_amount = int32(drain_amount*gain_multiplier);
+ int32 gain_amount = int32(drain_amount * gain_multiplier);
if (gain_amount)
{
@@ -2143,7 +2141,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
case 23493:
{
int32 heal = caster->CountPctFromMaxHealth(10);
- caster->DealHeal(target, heal, auraSpellInfo);
+ caster->HealBySpell(target, auraSpellInfo, heal);
int32 mana = caster->GetMaxPower(POWER_MANA);
if (mana)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 3a574d3c4ef..3a467069592 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1297,7 +1297,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
- int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit);
+ int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth, crit);
unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
}
// Do damage and triggers
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index fd54d923070..31e01641553 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2555,7 +2555,7 @@ void Spell::EffectHealPct(uint32 /*i*/)
//if (Player *modOwner = m_caster->GetSpellModOwner())
// modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
- int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo);
+ int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth);
unitTarget->getHostileRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo);
}
}
@@ -2573,7 +2573,7 @@ void Spell::EffectHealMechanical(uint32 /*i*/)
return;
uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(damage), HEAL);
- caster->DealHeal(unitTarget, addhealth, m_spellInfo);
+ caster->HealBySpell(unitTarget, m_spellInfo, addhealth);
}
}
@@ -2596,7 +2596,7 @@ void Spell::EffectHealthLeech(uint32 i)
if (m_caster->isAlive())
{
newDamage = m_caster->SpellHealingBonus(m_caster, m_spellInfo, newDamage, HEAL);
- m_caster->DealHeal(m_caster, uint32(newDamage), m_spellInfo);
+ m_caster->HealBySpell(m_caster, m_spellInfo, uint32(newDamage));
}
}
@@ -4434,7 +4434,7 @@ void Spell::EffectHealMaxHealth(uint32 /*i*/)
if (m_originalCaster)
{
addhealth=m_originalCaster->SpellHealingBonus(unitTarget,m_spellInfo, addhealth, HEAL);
- m_originalCaster->DealHeal(unitTarget, addhealth, m_spellInfo);
+ m_originalCaster->HealBySpell(unitTarget, m_spellInfo, addhealth);
}
}