Implemented AuraType.ModMaxPower

This commit is contained in:
hondacrx
2017-11-22 12:44:25 -05:00
parent 88258e844d
commit 0909720464
4 changed files with 35 additions and 27 deletions
+5 -5
View File
@@ -139,17 +139,17 @@ namespace Framework.Constants
} }
public enum UnitMods 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, StatAgility,
StatStamina, StatStamina,
StatIntellect, StatIntellect,
Health, 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, Rage,
Focus, Focus,
Energy, Energy,
Unused, // Old HAPPINESS ComboPoints,
Rune, Runes,
RunicPower, RunicPower,
SoulShards, SoulShards,
Eclipse, Eclipse,
@@ -163,7 +163,7 @@ namespace Framework.Constants
ArcaneCharges, ArcaneCharges,
Fury, Fury,
Pain, 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, ResistanceHoly,
ResistanceFire, ResistanceFire,
ResistanceNature, ResistanceNature,
@@ -553,7 +553,7 @@ namespace Game.Entities
{ {
// Hunter trap: Search units which are unfriendly to the trap's owner // Hunter trap: Search units which are unfriendly to the trap's owner
var checker = new NearestUnfriendlyNoTotemUnitInObjectRangeCheck(this, owner, radius); var checker = new NearestUnfriendlyNoTotemUnitInObjectRangeCheck(this, owner, radius);
var searcher = new UnitSearcher(this, checker); var searcher = new UnitLastSearcher(this, checker);
Cell.VisitAllObjects(this, searcher, radius); Cell.VisitAllObjects(this, searcher, radius);
target = searcher.GetTarget(); target = searcher.GetTarget();
} }
+15 -21
View File
@@ -75,9 +75,22 @@ namespace Game.Entities
case UnitMods.Rage: case UnitMods.Rage:
case UnitMods.Focus: case UnitMods.Focus:
case UnitMods.Energy: case UnitMods.Energy:
case UnitMods.Rune: case UnitMods.ComboPoints:
case UnitMods.Runes:
case UnitMods.RunicPower: 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; break;
case UnitMods.ResistanceHoly: case UnitMods.ResistanceHoly:
case UnitMods.ResistanceFire: case UnitMods.ResistanceFire:
@@ -173,25 +186,6 @@ namespace Game.Entities
return stat; 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) public void ApplyStatBuffMod(Stats stat, float val, bool apply)
{ {
+14
View File
@@ -3587,6 +3587,20 @@ namespace Game.Spells
target.UpdateAttackPowerAndDamage(true); 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 ***/ /*** HEAL & ENERGIZE ***/
/********************************/ /********************************/