From c81505475b52d7f1e2529b07f891ab8c545dc2ef Mon Sep 17 00:00:00 2001 From: Zwisus Date: Mon, 28 Mar 2016 21:49:41 +0800 Subject: [PATCH] Spell_Miss will Restore Rage and Energy --- src/game/WorldHandlers/Spell.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index a361385a..0c461167 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -3795,7 +3795,33 @@ void Spell::TakePower() Powers powerType = Powers(m_spellInfo->powerType); - m_caster->ModifyPower(powerType, -(int32)m_powerCost); + bool hit = true; + for (uint8 j = 0; j < 3; ++j) + { + // Spell targets a single enemy + if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_CHAIN_DAMAGE || + m_spellInfo->EffectImplicitTargetA[j] == TARGET_CURRENT_ENEMY_COORDINATES) + { + if (m_caster->GetTypeId() == TYPEID_PLAYER) + { + if (powerType == POWER_ENERGY) + if (uint64 targetGUID = m_targets.getUnitTargetGuid()) + for (std::list::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + if (ihit->targetGUID = targetGUID) + { + if (ihit->missCondition != SPELL_MISS_NONE) + { + hit = false; + } + break; + } + } + } + } + if (hit || m_spellInfo->AttributesEx & SPELL_ATTR_EX_REQ_TARGET_COMBO_POINTS || m_spellInfo->AttributesEx & SPELL_ATTR_EX_REQ_COMBO_POINTS) + m_caster->ModifyPower(powerType, -(int32)m_powerCost); + else + m_caster->ModifyPower(powerType, -(int32)m_powerCost / 5); // Set the five second timer if (powerType == POWER_MANA && m_powerCost > 0)