[7701] Move explicit healing repeating code to DealHeal functions. Author: Trazom
--HG-- branch : trunk
This commit is contained in:
+2
-11
@@ -957,8 +957,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
|||||||
else
|
else
|
||||||
procEx |= PROC_EX_NORMAL_HIT;
|
procEx |= PROC_EX_NORMAL_HIT;
|
||||||
|
|
||||||
caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, crit);
|
|
||||||
|
|
||||||
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
|
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
|
||||||
if (m_canTrigger && missInfo != SPELL_MISS_REFLECT)
|
if (m_canTrigger && missInfo != SPELL_MISS_REFLECT)
|
||||||
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo);
|
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo);
|
||||||
@@ -966,12 +964,8 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
|||||||
if (m_spellAura)
|
if (m_spellAura)
|
||||||
m_spellAura->SetProcDamage(addhealth);
|
m_spellAura->SetProcDamage(addhealth);
|
||||||
|
|
||||||
int32 gain = unitTarget->ModifyHealth( int32(addhealth) );
|
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit);
|
||||||
|
|
||||||
unitTarget->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
|
unitTarget->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
|
||||||
if(caster->GetTypeId()==TYPEID_PLAYER)
|
|
||||||
if(BattleGround *bg = ((Player*)caster)->GetBattleGround())
|
|
||||||
bg->UpdatePlayerScore(((Player*)caster), SCORE_HEALING_DONE, gain);
|
|
||||||
}
|
}
|
||||||
// Do damage and triggers
|
// Do damage and triggers
|
||||||
else if (m_damage > 0)
|
else if (m_damage > 0)
|
||||||
@@ -2748,10 +2742,7 @@ void Spell::finish(bool ok)
|
|||||||
|
|
||||||
// Heal caster for all health leech from all targets
|
// Heal caster for all health leech from all targets
|
||||||
if (m_healthLeech)
|
if (m_healthLeech)
|
||||||
{
|
m_caster->DealHeal(m_caster, uint32(m_healthLeech), m_spellInfo);
|
||||||
int32 gain = m_caster->ModifyHealth(m_healthLeech);
|
|
||||||
m_caster->SendHealSpellLog(m_caster, m_spellInfo->Id, uint32(m_healthLeech), false, &gain);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsMeleeAttackResetSpell())
|
if (IsMeleeAttackResetSpell())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1612,8 +1612,7 @@ void AuraEffect::TriggerSpell()
|
|||||||
case 23493:
|
case 23493:
|
||||||
{
|
{
|
||||||
int32 heal = caster->GetMaxHealth() / 10;
|
int32 heal = caster->GetMaxHealth() / 10;
|
||||||
int32 gain = caster->ModifyHealth( heal );
|
caster->DealHeal(caster, heal, auraSpellInfo);
|
||||||
caster->SendHealSpellLog(caster, 23493, heal, false, &gain);
|
|
||||||
|
|
||||||
int32 mana = caster->GetMaxPower(POWER_MANA);
|
int32 mana = caster->GetMaxPower(POWER_MANA);
|
||||||
if (mana)
|
if (mana)
|
||||||
@@ -5853,10 +5852,8 @@ void AuraEffect::PeriodicTick()
|
|||||||
// Don't apply heal mods for this aura
|
// Don't apply heal mods for this aura
|
||||||
uint32 heal = uint32(new_damage * multiplier);//pCaster->SpellHealingBonus(pCaster, spellProto, uint32(new_damage * multiplier), DOT, stackAmount);
|
uint32 heal = uint32(new_damage * multiplier);//pCaster->SpellHealingBonus(pCaster, spellProto, uint32(new_damage * multiplier), DOT, stackAmount);
|
||||||
|
|
||||||
int32 gain = pCaster->ModifyHealth(heal);
|
int32 gain = pCaster->DealHeal(pCaster, heal, spellProto);
|
||||||
pCaster->getHostilRefManager().threatAssist(pCaster, gain * 0.5f, spellProto);
|
pCaster->getHostilRefManager().threatAssist(pCaster, gain * 0.5f, spellProto);
|
||||||
|
|
||||||
pCaster->SendHealSpellLog(pCaster, spellProto->Id, heal,false, &gain);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELL_AURA_PERIODIC_HEAL:
|
case SPELL_AURA_PERIODIC_HEAL:
|
||||||
|
|||||||
@@ -2601,14 +2601,8 @@ void Spell::EffectHealPct( uint32 /*i*/ )
|
|||||||
if(Player* modOwner = m_caster->GetSpellModOwner())
|
if(Player* modOwner = m_caster->GetSpellModOwner())
|
||||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
|
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
|
||||||
|
|
||||||
int32 gain = unitTarget->ModifyHealth( int32(addhealth) );
|
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo);
|
||||||
caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false, &gain);
|
|
||||||
|
|
||||||
unitTarget->getHostilRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo);
|
unitTarget->getHostilRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo);
|
||||||
|
|
||||||
if(caster->GetTypeId()==TYPEID_PLAYER)
|
|
||||||
if(BattleGround *bg = ((Player*)caster)->GetBattleGround())
|
|
||||||
bg->UpdatePlayerScore(((Player*)caster), SCORE_HEALING_DONE, gain);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2625,8 +2619,7 @@ void Spell::EffectHealMechanical( uint32 /*i*/ )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(damage), HEAL);
|
uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(damage), HEAL);
|
||||||
int32 Gain = unitTarget->ModifyHealth( int32(damage) );
|
caster->DealHeal(unitTarget, addhealth, m_spellInfo);
|
||||||
caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false, &Gain);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2656,11 +2649,7 @@ void Spell::EffectHealthLeech(uint32 i)
|
|||||||
if(m_caster->isAlive())
|
if(m_caster->isAlive())
|
||||||
{
|
{
|
||||||
new_damage = m_caster->SpellHealingBonus(m_caster, m_spellInfo, new_damage, HEAL);
|
new_damage = m_caster->SpellHealingBonus(m_caster, m_spellInfo, new_damage, HEAL);
|
||||||
|
m_caster->DealHeal(m_caster, uint32(new_damage), m_spellInfo);
|
||||||
int32 Gain = m_caster->ModifyHealth(new_damage);
|
|
||||||
|
|
||||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
m_caster->SendHealSpellLog(m_caster, m_spellInfo->Id, uint32(new_damage), false, &Gain);
|
|
||||||
}
|
}
|
||||||
// m_healthLeech+=tmpvalue;
|
// m_healthLeech+=tmpvalue;
|
||||||
// m_damage+=new_damage;
|
// m_damage+=new_damage;
|
||||||
@@ -4324,9 +4313,8 @@ void Spell::EffectHealMaxHealth(uint32 /*i*/)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int32 addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth();
|
int32 addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth();
|
||||||
unitTarget->SetHealth(unitTarget->GetMaxHealth());
|
|
||||||
if(m_originalCaster)
|
if(m_originalCaster)
|
||||||
m_originalCaster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false, &addhealth);
|
m_originalCaster->DealHeal(unitTarget, addhealth, m_spellInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectInterruptCast(uint32 i)
|
void Spell::EffectInterruptCast(uint32 i)
|
||||||
|
|||||||
+17
-8
@@ -8141,6 +8141,21 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellProto, bool critical)
|
||||||
|
{
|
||||||
|
int32 gain = pVictim->ModifyHealth(int32(addhealth));
|
||||||
|
|
||||||
|
if (GetTypeId()==TYPEID_PLAYER)
|
||||||
|
{
|
||||||
|
SendHealSpellLog(pVictim, spellProto->Id, addhealth, critical, gain);
|
||||||
|
|
||||||
|
if (BattleGround *bg = ((Player*)this)->GetBattleGround())
|
||||||
|
bg->UpdatePlayerScore((Player*)this, SCORE_HEALING_DONE, gain);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gain;
|
||||||
|
}
|
||||||
|
|
||||||
Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo)
|
Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo)
|
||||||
{
|
{
|
||||||
if(!victim)
|
if(!victim)
|
||||||
@@ -8324,21 +8339,15 @@ void Unit::UnsummonAllTotems()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical, int32 * Gain )
|
void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical, int32 gain)
|
||||||
{
|
{
|
||||||
// we guess size
|
// we guess size
|
||||||
WorldPacket data(SMSG_SPELLHEALLOG, (8+8+4+4+1));
|
WorldPacket data(SMSG_SPELLHEALLOG, (8+8+4+4+1));
|
||||||
data.append(pVictim->GetPackGUID());
|
data.append(pVictim->GetPackGUID());
|
||||||
data.append(GetPackGUID());
|
data.append(GetPackGUID());
|
||||||
data << uint32(SpellID);
|
data << uint32(SpellID);
|
||||||
int32 gainAmount;
|
|
||||||
if (!Gain)
|
|
||||||
gainAmount = pVictim->GetHealthGain(Damage);
|
|
||||||
else
|
|
||||||
gainAmount = *Gain;
|
|
||||||
|
|
||||||
data << uint32(Damage);
|
data << uint32(Damage);
|
||||||
data << uint32(Damage-gainAmount >0 ? Damage-gainAmount : 0); // overheal
|
data << uint32((int32)Damage > gain ? (int32)Damage - gain : 0); // overheal
|
||||||
data << uint8(critical ? 1 : 0);
|
data << uint8(critical ? 1 : 0);
|
||||||
data << uint8(0); // unused in client?
|
data << uint8(0); // unused in client?
|
||||||
SendMessageToSet(&data, true);
|
SendMessageToSet(&data, true);
|
||||||
|
|||||||
+2
-1
@@ -1071,6 +1071,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
void RemoveSpellbyDamageTaken(uint32 damage, uint32 spell);
|
void RemoveSpellbyDamageTaken(uint32 damage, uint32 spell);
|
||||||
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);
|
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);
|
void Kill(Unit *pVictim, bool durabilityLoss = true);
|
||||||
|
int32 DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellProto, bool critical = false);
|
||||||
|
|
||||||
void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const *procSpell = NULL);
|
void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const *procSpell = NULL);
|
||||||
void ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage );
|
void ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage );
|
||||||
@@ -1170,7 +1171,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
virtual bool IsUnderWater() const;
|
virtual bool IsUnderWater() const;
|
||||||
bool isInAccessiblePlaceFor(Creature const* c) const;
|
bool isInAccessiblePlaceFor(Creature const* c) const;
|
||||||
|
|
||||||
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical, int32 * Gain = NULL);
|
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical, int32 gain);
|
||||||
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
|
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
|
||||||
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true);
|
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true);
|
||||||
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user