Core/Units: Power handling improvements

* Don't include creature_template power multipliers in CreateMana updatefield
* Allow NPCs to have power types other than mana
* Add missing Essence config regeneration rate
* Fixed demon hunter powers not decaying immediately after combat
* Fixed some powers decaying immediately out of combat after energizing (for example holy power)
* Replace hardcoded list of powers to set to full on levelup with a db2 flag check
* Updated Creature::GetPowerIndex for 10.1 new power types
Port From (https://github.com/TrinityCore/TrinityCore/commit/1325e0c4b279d590acbcbb05d6abdf5fdb66a882)
This commit is contained in:
hondacrx
2023-05-23 05:44:42 -04:00
parent 06f99fda8b
commit d55f4f836f
13 changed files with 191 additions and 62 deletions
+6 -12
View File
@@ -563,6 +563,8 @@ namespace Game.Entities
SetStatFlatModifier(UnitMods.ResistanceStart + i, UnitModifierFlatType.Base, cinfo.Resistance[i]);
}
PowerType powerType = CalculateDisplayPowerType();
// Health, Mana or Power, Armor
PetLevelInfo pInfo = Global.ObjectMgr.GetPetLevelInfo(creature_ID, petlevel);
if (pInfo != null) // exist in DB
@@ -570,6 +572,8 @@ namespace Game.Entities
SetCreateHealth(pInfo.health);
SetCreateMana(pInfo.mana);
SetStatPctModifier(UnitMods.PowerStart + (int)powerType, UnitModifierPctType.Base, 1.0f);
if (pInfo.armor > 0)
SetStatFlatModifier(UnitMods.Armor, UnitModifierFlatType.Base, pInfo.armor);
@@ -583,7 +587,7 @@ namespace Game.Entities
ApplyLevelScaling();
SetCreateHealth((uint)(Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.CreatureHealth, petlevel, cinfo.GetHealthScalingExpansion(), m_unitData.ContentTuningID, (Class)cinfo.UnitClass) * cinfo.ModHealth * cinfo.ModHealthExtra * GetHealthMod(cinfo.Rank)));
SetCreateMana(stats.GenerateMana(cinfo));
SetCreateMana(stats.BaseMana);
SetCreateStat(Stats.Strength, 22);
SetCreateStat(Stats.Agility, 22);
@@ -592,17 +596,7 @@ namespace Game.Entities
}
// Power
if (petType == PetType.Hunter) // Hunter pets have focus
SetPowerType(PowerType.Focus);
else if (IsPetGhoul() || IsPetAbomination()) // DK pets have energy
{
SetPowerType(PowerType.Energy);
SetFullPower(PowerType.Energy);
}
else if (IsWarlockPet()) // Warlock pets have energy (since 5.x)
SetPowerType(PowerType.Energy);
else
SetPowerType(PowerType.Mana);
SetPowerType(powerType);
// Damage
SetBonusDamage(0);