mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
feat(Core/Unit): New helper HasActivePowerType and script hook OnPlayerHasActivePowerType (#18293)
* Create HasActivePower for script intercept * Replace relevant player-related getPowerType() comparators with HasActivePowerType * Change OnPlayerHasActivePowerType to regular bool instead of optional --------- Co-authored-by: NathanHandley <nathanhandley@protonmail.com>
This commit is contained in:
@@ -1345,7 +1345,7 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex)
|
||||
|
||||
Powers PowerType = Powers(m_spellInfo->Effects[effIndex].MiscValue);
|
||||
|
||||
if (!unitTarget || !unitTarget->IsAlive() || unitTarget->getPowerType() != PowerType || damage < 0)
|
||||
if (!unitTarget || !unitTarget->IsAlive() || !unitTarget->HasActivePowerType(PowerType) || damage < 0)
|
||||
return;
|
||||
|
||||
// add spell damage bonus
|
||||
@@ -1424,7 +1424,7 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
|
||||
|
||||
Powers PowerType = Powers(m_spellInfo->Effects[effIndex].MiscValue);
|
||||
|
||||
if (!unitTarget || !unitTarget->IsAlive() || unitTarget->getPowerType() != PowerType || damage < 0)
|
||||
if (!unitTarget || !unitTarget->IsAlive() || !unitTarget->HasActivePowerType(PowerType) || damage < 0)
|
||||
return;
|
||||
|
||||
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
|
||||
@@ -1877,7 +1877,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
|
||||
|
||||
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
|
||||
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && m_spellInfo->SpellFamilyName != SPELLFAMILY_POTION
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && !unitTarget->HasActivePowerType(power) && m_spellInfo->SpellFamilyName != SPELLFAMILY_POTION
|
||||
&& !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED))
|
||||
return;
|
||||
|
||||
@@ -1982,7 +1982,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
|
||||
|
||||
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
|
||||
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->getPowerType() != power && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED))
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER && !unitTarget->HasActivePowerType(power) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED))
|
||||
return;
|
||||
|
||||
uint32 maxPower = unitTarget->GetMaxPower(power);
|
||||
|
||||
Reference in New Issue
Block a user