Core/Spells: Removed extra health from feed pet

Port From (https://github.com/TrinityCore/TrinityCore/commit/60df74933f0bf75865ba963b33c2c1bdd9cdefbd)
This commit is contained in:
hondacrx
2021-04-22 20:40:17 -04:00
parent e64b091512
commit 47f993bff5
5 changed files with 14 additions and 25 deletions
+12 -7
View File
@@ -3578,19 +3578,24 @@ namespace Game.Spells
if (!pet.IsAlive())
return;
int benefit = (int)pet.GetCurrentFoodBenefitLevel(foodItem.GetTemplate().GetBaseItemLevel());
if (benefit <= 0)
return;
ExecuteLogEffectDestroyItem(effIndex, foodItem.GetEntry());
uint count = 1;
player.DestroyItemCount(foodItem, ref count, true);
// @todo fix crash when a spell has two effects, both pointed at the same item target
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, benefit);
m_caster.CastSpell(pet, effectInfo.TriggerSpell, args);
int pct;
int levelDiff = (int)(pet.GetLevel() - foodItem.GetTemplate().GetBaseItemLevel());
if (levelDiff >= 30)
return;
else if (levelDiff >= 20)
pct = (int)12.5; // we can't pass double so keeping the cast here for future references
else if (levelDiff >= 10)
pct = 25;
else
pct = 50;
m_caster.CastSpell(pet, effectInfo.TriggerSpell, new CastSpellExtraArgs(SpellValueMod.BasePoint0, pct).SetTriggerFlags(TriggerCastFlags.FullMask));
}
[SpellEffectHandler(SpellEffectName.DismissPet)]