diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 32 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 9 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 15 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.h | 1 |
4 files changed, 36 insertions, 21 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 754dc02b4c4..f5275357733 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9241,8 +9241,21 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f case UNIT_MOD_RAGE: case UNIT_MOD_FOCUS: case UNIT_MOD_ENERGY: - case UNIT_MOD_RUNE: - case UNIT_MOD_RUNIC_POWER: UpdateMaxPower(GetPowerTypeByAuraGroup(unitMod)); break; + case UNIT_MOD_COMBO_POINTS: + case UNIT_MOD_RUNES: + case UNIT_MOD_RUNIC_POWER: + case UNIT_MOD_SOUL_SHARDS: + case UNIT_MOD_ECLIPSE: + case UNIT_MOD_HOLY_POWER: + case UNIT_MOD_ALTERNATIVE: + case UNIT_MOD_MAELSTROM: + case UNIT_MOD_CHI: + case UNIT_MOD_INSANITY: + case UNIT_MOD_BURNING_EMBERS: + case UNIT_MOD_DEMONIC_FURY: + case UNIT_MOD_ARCANE_CHARGES: + case UNIT_MOD_FURY: + case UNIT_MOD_PAIN: UpdateMaxPower(Powers(unitMod - UNIT_MOD_POWER_START)); break; case UNIT_MOD_RESISTANCE_HOLY: case UNIT_MOD_RESISTANCE_FIRE: @@ -9259,6 +9272,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f case UNIT_MOD_DAMAGE_RANGED: UpdateDamagePhysical(RANGED_ATTACK); break; default: + ASSERT(false, "Not implemented UnitMod %u", unitMod); break; } @@ -9352,20 +9366,6 @@ Stats Unit::GetStatByAuraGroup(UnitMods unitMod) const return stat; } -Powers Unit::GetPowerTypeByAuraGroup(UnitMods unitMod) const -{ - switch (unitMod) - { - case UNIT_MOD_RAGE: return POWER_RAGE; - case UNIT_MOD_FOCUS: return POWER_FOCUS; - case UNIT_MOD_ENERGY: return POWER_ENERGY; - case UNIT_MOD_RUNE: return POWER_RUNES; - case UNIT_MOD_RUNIC_POWER: return POWER_RUNIC_POWER; - default: - case UNIT_MOD_MANA: return POWER_MANA; - } -} - float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const { if (attType == RANGED_ATTACK) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 3fd5d7a6da7..d12c3d00180 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -334,12 +334,12 @@ enum UnitMods UNIT_MOD_STAT_STAMINA, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_HEALTH, - UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_RUNIC_POWER must be in existed order, it's accessed by index values of Powers enum. + UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_PAIN must be listed in existing order, it is accessed by index values of Powers enum. UNIT_MOD_RAGE, UNIT_MOD_FOCUS, UNIT_MOD_ENERGY, - UNIT_MOD_UNUSED, // Old UNIT_MOD_HAPPINESS - UNIT_MOD_RUNE, + UNIT_MOD_COMBO_POINTS, + UNIT_MOD_RUNES, UNIT_MOD_RUNIC_POWER, UNIT_MOD_SOUL_SHARDS, UNIT_MOD_ECLIPSE, @@ -375,6 +375,8 @@ enum UnitMods UNIT_MOD_POWER_END = UNIT_MOD_PAIN + 1 }; +static_assert(UNIT_MOD_POWER_END - UNIT_MOD_POWER_START == MAX_POWERS, "UnitMods powers section does not match Powers enum!"); + enum BaseModGroup { CRIT_PERCENTAGE, @@ -1631,7 +1633,6 @@ class TC_GAME_API Unit : public WorldObject float GetTotalAuraModValue(UnitMods unitMod) const; SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const; Stats GetStatByAuraGroup(UnitMods unitMod) const; - Powers GetPowerTypeByAuraGroup(UnitMods unitMod) const; bool CanModifyStats() const { return m_canModifyStats; } void SetCanModifyStats(bool modifyStats) { m_canModifyStats = modifyStats; } virtual bool UpdateStats(Stats stat) = 0; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 86e340d0b17..bbcefc74014 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -483,7 +483,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleNULL, //415 &AuraEffect::HandleNoImmediateEffect, //416 SPELL_AURA_MOD_COOLDOWN_BY_HASTE_REGEN implemented in SpellHistory::StartCooldown &AuraEffect::HandleNoImmediateEffect, //417 SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE_REGEN implemented in Spell::TriggerGlobalCooldown - &AuraEffect::HandleNULL, //418 SPELL_AURA_MOD_MAX_POWER + &AuraEffect::HandleAuraModMaxPower, //418 SPELL_AURA_MOD_MAX_POWER &AuraEffect::HandleAuraModIncreaseBaseManaPercent, //419 SPELL_AURA_MOD_BASE_MANA_PCT &AuraEffect::HandleNULL, //420 SPELL_AURA_MOD_BATTLE_PET_XP_PCT &AuraEffect::HandleNULL, //421 SPELL_AURA_MOD_ABSORB_EFFECTS_AMOUNT_PCT @@ -3918,6 +3918,19 @@ void AuraEffect::HandleOverrideAttackPowerBySpellPower(AuraApplication const* au target->UpdateAttackPowerAndDamage(true); } +void AuraEffect::HandleAuraModMaxPower(AuraApplication const* aurApp, uint8 mode, bool apply) const +{ + if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT))) + return; + + Unit* target = aurApp->GetTarget(); + + Powers power = Powers(GetMiscValue()); + UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power); + + target->HandleStatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply); +} + /********************************/ /*** HEAL & ENERGIZE ***/ /********************************/ diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index c1bdfc1c753..2682d66102e 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -236,6 +236,7 @@ class TC_GAME_API AuraEffect void HandleModStatBonusPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleOverrideSpellPowerByAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleOverrideAttackPowerBySpellPower(AuraApplication const* aurApp, uint8 mode, bool apply) const; + void HandleAuraModMaxPower(AuraApplication const* aurApp, uint8 mode, bool apply) const; // heal and energize void HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleModPowerRegenPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const; |