diff --git a/Source/Framework/Constants/UnitConst.cs b/Source/Framework/Constants/UnitConst.cs index d54212ab5..db14451af 100644 --- a/Source/Framework/Constants/UnitConst.cs +++ b/Source/Framework/Constants/UnitConst.cs @@ -139,17 +139,17 @@ namespace Framework.Constants } public enum UnitMods { - StatStrength, // STAT_STRENGTH..UNIT_MOD_STAT_INTELLECT must be in existed order, it's accessed by index values of Stats enum. + StatStrength, // STAT_STRENGTH..UNIT_MOD_STAT_INTELLECT must be in existed order, it's accessed by index values of Stats enum. StatAgility, StatStamina, StatIntellect, Health, - Mana, // MANA..RUNIC_POWER must be in existed order, it's accessed by index values of Powers enum. + Mana, // UNIT_MOD_MANA..UNIT_MOD_PAIN must be listed in existing order, it is accessed by index values of Powers enum. Rage, Focus, Energy, - Unused, // Old HAPPINESS - Rune, + ComboPoints, + Runes, RunicPower, SoulShards, Eclipse, @@ -163,7 +163,7 @@ namespace Framework.Constants ArcaneCharges, Fury, Pain, - Armor, // ARMOR..RESISTANCE_ARCANE must be in existed order, it's accessed by index values of SpellSchools enum. + Armor, // ARMOR..RESISTANCE_ARCANE must be in existed order, it's accessed by index values of SpellSchools enum. ResistanceHoly, ResistanceFire, ResistanceNature, diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 0a879c591..126116cc2 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -553,7 +553,7 @@ namespace Game.Entities { // Hunter trap: Search units which are unfriendly to the trap's owner var checker = new NearestUnfriendlyNoTotemUnitInObjectRangeCheck(this, owner, radius); - var searcher = new UnitSearcher(this, checker); + var searcher = new UnitLastSearcher(this, checker); Cell.VisitAllObjects(this, searcher, radius); target = searcher.GetTarget(); } diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index d509b8c17..c7f4290ee 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -75,9 +75,22 @@ namespace Game.Entities case UnitMods.Rage: case UnitMods.Focus: case UnitMods.Energy: - case UnitMods.Rune: + case UnitMods.ComboPoints: + case UnitMods.Runes: case UnitMods.RunicPower: - UpdateMaxPower(GetPowerTypeByAuraGroup(unitMod)); + case UnitMods.SoulShards: + case UnitMods.Eclipse: + case UnitMods.HolyPower: + case UnitMods.Alternative: + case UnitMods.Maelstrom: + case UnitMods.Chi: + case UnitMods.Insanity: + case UnitMods.BurningEmbers: + case UnitMods.DemonicFury: + case UnitMods.ArcaneCharges: + case UnitMods.Fury: + case UnitMods.Pain: + UpdateMaxPower((PowerType)(unitMod - UnitMods.PowerStart)); break; case UnitMods.ResistanceHoly: case UnitMods.ResistanceFire: @@ -173,25 +186,6 @@ namespace Game.Entities return stat; } - PowerType GetPowerTypeByAuraGroup(UnitMods unitMod) - { - switch (unitMod) - { - case UnitMods.Rage: - return PowerType.Rage; - case UnitMods.Focus: - return PowerType.Focus; - case UnitMods.Energy: - return PowerType.Energy; - case UnitMods.Rune: - return PowerType.Runes; - case UnitMods.RunicPower: - return PowerType.RunicPower; - default: - case UnitMods.Mana: - return PowerType.Mana; - } - } public void ApplyStatBuffMod(Stats stat, float val, bool apply) { diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 9a24640bc..48b522b37 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -3587,6 +3587,20 @@ namespace Game.Spells target.UpdateAttackPowerAndDamage(true); } + [AuraEffectHandler(AuraType.ModMaxPower)] + void HandleAuraModMaxPower(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) + { + if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat)) + return; + + Unit target = aurApp.GetTarget(); + + PowerType power = (PowerType)GetMiscValue(); + UnitMods unitMod = (UnitMods)(UnitMods.PowerStart + (int)power); + + target.HandleStatModifier(unitMod, UnitModifierType.TotalValue, GetAmount(), apply); + } + /********************************/ /*** HEAL & ENERGIZE ***/ /********************************/