Core/Spells: defined and implement SPELL_ATTR1_DISCOUNT_POWER_ON_MISS

This commit is contained in:
Ovahlord committed 2021-05-16 19:04:54 +02:00
1 parent ad495c5479
commit 2dce3955b2
2 files changed
+11 -14

No files matched your search

@@ -416,7 +416,7 @@ enum SpellAttr1
SPELL_ATTR1_IS_FISHING = 0x01000000, // 24 only fishing spells
SPELL_ATTR1_UNK25 = 0x02000000, // 25
SPELL_ATTR1_UNK26 = 0x04000000, // 26 works correctly with [target=focus] and [target=mouseover] macros?
SPELL_ATTR1_UNK27 = 0x08000000, // 27 melee spell?
SPELL_ATTR1_DISCOUNT_POWER_ON_MISS = 0x08000000, // 27 Discount Power On Miss
SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR = 0x10000000, // 28 client doesn't display these spells in aura bar
SPELL_ATTR1_CHANNEL_DISPLAY_SPELL_NAME = 0x20000000, // 29 spell name is displayed in cast bar instead of 'channeling' text
SPELL_ATTR1_ENABLE_AT_DODGE = 0x40000000, // 30 Overpower
+10 -13
View File
@@ -5061,25 +5061,22 @@ void Spell::TakePower()
Powers powerType = Powers(m_spellInfo->PowerType);
bool hit = true;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR1_DISCOUNT_POWER_ON_MISS))
{
if (powerType == POWER_RAGE || powerType == POWER_ENERGY || powerType == POWER_RUNE)
if (ObjectGuid targetGUID = m_targets.GetUnitTargetGUID())
{
if (ObjectGuid targetGUID = m_targets.GetUnitTargetGUID())
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if (ihit->targetGUID == targetGUID)
{
if (ihit->targetGUID == targetGUID)
if (ihit->missCondition != SPELL_MISS_NONE)
{
if (ihit->missCondition != SPELL_MISS_NONE)
{
hit = false;
//lower spell cost on fail (by talent aura)
if (Player* modOwner = m_caster->ToPlayer()->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_SPELL_COST_REFUND_ON_FAIL, m_powerCost);
}
break;
hit = false;
//lower spell cost on fail (by talent aura)
if (Player* modOwner = m_caster->ToPlayer()->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_SPELL_COST_REFUND_ON_FAIL, m_powerCost);
}
break;
}
}
}