Core/Spells: Add holy power resource handler. By @Greymane

This commit is contained in:
Tuxity
2012-09-28 11:17:18 +02:00
parent 1bb39edd02
commit eee2a4bd9c
2 changed files with 39 additions and 0 deletions

View File

@@ -3488,6 +3488,9 @@ void Spell::_handle_finish_phase()
// Real add combo points from effects
if (m_comboPointGain)
m_caster->m_movedPlayer->GainSpellComboPoints(m_comboPointGain);
if (m_spellInfo->PowerType == POWER_HOLY_POWER && m_caster->m_movedPlayer->getClass() == CLASS_PALADIN)
HandleHolyPower(m_caster->m_movedPlayer);
}
if (m_caster->m_extraAttacks && GetSpellInfo()->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
@@ -4654,6 +4657,41 @@ void Spell::HandleThreatSpells()
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %u, added an additional %f threat for %s %u target(s)", m_spellInfo->Id, threat, m_spellInfo->_IsPositiveSpell() ? "assisting" : "harming", uint32(m_UniqueTargetInfo.size()));
}
void Spell::HandleHolyPower(Player* caster)
{
if (!caster)
return;
bool hit = true;
Player* modOwner = caster->GetSpellModOwner();
m_powerCost = caster->GetPower(POWER_HOLY_POWER); // Always use all the holy power we have
if (!m_powerCost || !modOwner)
return;
if (uint64 targetGUID = m_targets.GetUnitTargetGUID())
{
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if (ihit->targetGUID == targetGUID)
{
if (ihit->missCondition != SPELL_MISS_NONE && ihit->missCondition != SPELL_MISS_MISS)
hit = false;
break;
}
}
// The spell did hit the target, apply aura cost mods if there are any.
if (hit)
{
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, m_powerCost);
m_caster->ModifyPower(POWER_HOLY_POWER, -m_powerCost);
}
}
}
void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i, SpellEffectHandleMode mode)
{
effectHandleMode = mode;

View File

@@ -435,6 +435,7 @@ class Spell
void SendChannelStart(uint32 duration);
void SendResurrectRequest(Player* target);
void HandleHolyPower(Player* caster);
void HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i, SpellEffectHandleMode mode);
void HandleThreatSpells();