[7701] Move explicit healing repeating code to DealHeal functions.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Trazom 2009-04-23 04:51:49 +04:00 committed by VladimirMangos
parent adf9eb942d
commit 7c0201f834
6 changed files with 24 additions and 31 deletions

View file

@ -1040,18 +1040,12 @@ 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);
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) else if (m_damage)
@ -2776,10 +2770,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);
m_caster->ModifyHealth(m_healthLeech);
m_caster->SendHealSpellLog(m_caster, m_spellInfo->Id, uint32(m_healthLeech));
}
if (IsMeleeAttackResetSpell()) if (IsMeleeAttackResetSpell())
{ {

View file

@ -1431,8 +1431,7 @@ void Aura::TriggerSpell()
case 23493: case 23493:
{ {
int32 heal = caster->GetMaxHealth() / 10; int32 heal = caster->GetMaxHealth() / 10;
caster->ModifyHealth( heal ); caster->DealHeal(caster, heal, auraSpellInfo);
caster->SendHealSpellLog(caster, 23493, heal);
int32 mana = caster->GetMaxPower(POWER_MANA); int32 mana = caster->GetMaxPower(POWER_MANA);
if (mana) if (mana)
@ -5876,10 +5875,8 @@ void Aura::PeriodicTick()
uint32 heal = pCaster->SpellHealingBonus(pCaster, spellProto, uint32(new_damage * multiplier), DOT, stackAmount); uint32 heal = 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);
break; break;
} }
case SPELL_AURA_PERIODIC_HEAL: case SPELL_AURA_PERIODIC_HEAL:

View file

@ -2504,14 +2504,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);
caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false); int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo);
int32 gain = unitTarget->ModifyHealth( int32(addhealth) );
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);
} }
} }
@ -2528,8 +2522,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);
caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false); caster->DealHeal(unitTarget, addhealth, m_spellInfo);
unitTarget->ModifyHealth( int32(damage) );
} }
} }
@ -2559,11 +2552,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);
m_caster->ModifyHealth(new_damage);
if(m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->SendHealSpellLog(m_caster, m_spellInfo->Id, uint32(new_damage));
} }
// m_healthLeech+=tmpvalue; // m_healthLeech+=tmpvalue;
// m_damage+=new_damage; // m_damage+=new_damage;

View file

@ -7423,6 +7423,21 @@ void Unit::UnsummonAllTotems()
} }
} }
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);
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)

View file

@ -952,6 +952,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss); uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss);
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 );

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7700" #define REVISION_NR "7701"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__