Skip to content

Commit 0442ff5

Browse files
committed
Merge pull request #12284 from Unholychick/patch-mana
Core/Spells: Implement SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER
2 parents f278214 + 6b430db commit 0442ff5

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/server/game/Miscellaneous/SharedDefines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ enum SpellAttr7
544544
SPELL_ATTR7_UNK13 = 0x00002000, // 13 Not set in 3.2.2a.
545545
SPELL_ATTR7_UNK14 = 0x00004000, // 14 Only 52150 (Raise Dead - Pet) spell.
546546
SPELL_ATTR7_UNK15 = 0x00008000, // 15 Exorcism. Usable on players? 100% crit chance on undead and demons?
547-
SPELL_ATTR7_UNK16 = 0x00010000, // 16 Druid spells (29166, 54833, 64372, 68285).
547+
SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER = 0x00010000, // 16 These spells can replenish a powertype, which is not the current powertype.
548548
SPELL_ATTR7_UNK17 = 0x00020000, // 17 Only 27965 (Suicide) spell.
549549
SPELL_ATTR7_HAS_CHARGE_EFFECT = 0x00040000, // 18 Only spells that have Charge among effects.
550550
SPELL_ATTR7_ZONE_TELEPORT = 0x00080000, // 19 Teleports to specific zones.

src/server/game/Spells/Auras/SpellAuraEffects.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6295,6 +6295,9 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
62956295
{
62966296
Powers powerType = Powers(GetMiscValue());
62976297

6298+
if (target->getPowerType() != powerType && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
6299+
return;
6300+
62986301
if (!target->IsAlive() || !target->GetMaxPower(powerType))
62996302
return;
63006303

src/server/game/Spells/SpellEffects.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,12 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
17511751

17521752
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
17531753

1754+
if (unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
1755+
return;
1756+
1757+
if (unitTarget->GetMaxPower(power) == 0)
1758+
return;
1759+
17541760
// Some level depends spells
17551761
int level_multiplier = 0;
17561762
int level_diff = 0;
@@ -1796,9 +1802,6 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
17961802
if (damage < 0)
17971803
return;
17981804

1799-
if (unitTarget->GetMaxPower(power) == 0)
1800-
return;
1801-
18021805
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, damage, power);
18031806

18041807
// Mad Alchemist's Potion
@@ -1863,6 +1866,9 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
18631866

18641867
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
18651868

1869+
if (unitTarget->getPowerType() != power && !(m_spellInfo->AttributesEx7 & SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER))
1870+
return;
1871+
18661872
uint32 maxPower = unitTarget->GetMaxPower(power);
18671873
if (maxPower == 0)
18681874
return;

0 commit comments

Comments
 (0)