Scripts/Spells: Update and fix Innervate
Port From (https://github.com/TrinityCore/TrinityCore/commit/aff4f875696108159ca05cc1ed370eab6dc0b12c)
This commit is contained in:
@@ -16,13 +16,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
|
using Framework.Dynamic;
|
||||||
|
using Game.DataStorage;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Scripting;
|
using Game.Scripting;
|
||||||
using Game.Spells;
|
using Game.Spells;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Framework.Dynamic;
|
|
||||||
|
|
||||||
namespace Scripts.Spells.Druid
|
namespace Scripts.Spells.Druid
|
||||||
{
|
{
|
||||||
@@ -65,6 +66,8 @@ namespace Scripts.Spells.Druid
|
|||||||
public const uint IdolOfFeralShadows = 34241;
|
public const uint IdolOfFeralShadows = 34241;
|
||||||
public const uint IdolOfWorship = 60774;
|
public const uint IdolOfWorship = 60774;
|
||||||
public const uint IncarnationKingOfTheJungle = 102543;
|
public const uint IncarnationKingOfTheJungle = 102543;
|
||||||
|
public const uint Innervate = 29166;
|
||||||
|
public const uint InnervateRank2 = 326228;
|
||||||
public const uint Infusion = 37238;
|
public const uint Infusion = 37238;
|
||||||
public const uint Languish = 71023;
|
public const uint Languish = 71023;
|
||||||
public const uint LifebloomEnergize = 64372;
|
public const uint LifebloomEnergize = 64372;
|
||||||
@@ -587,26 +590,39 @@ namespace Scripts.Spells.Druid
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Script] // 29166 - Innervate
|
[Script] // 29166 - Innervate
|
||||||
class spell_dru_innervate : AuraScript
|
class spell_dru_innervate : SpellScript
|
||||||
{
|
{
|
||||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
SpellCastResult CheckCast()
|
||||||
{
|
{
|
||||||
if (aurEff.GetTotalTicks() == 0)
|
Player target = GetExplTargetUnit()?.ToPlayer();
|
||||||
{
|
if (target == null)
|
||||||
amount = 0;
|
return SpellCastResult.BadTargets;
|
||||||
return;
|
|
||||||
|
ChrSpecializationRecord spec = CliDB.ChrSpecializationStorage.LookupByKey(target.GetPrimarySpecialization());
|
||||||
|
if (spec == null || spec.Role != 1)
|
||||||
|
return SpellCastResult.BadTargets;
|
||||||
|
|
||||||
|
return SpellCastResult.SpellCastOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HandleRank2()
|
||||||
|
{
|
||||||
Unit caster = GetCaster();
|
Unit caster = GetCaster();
|
||||||
if (caster)
|
if (caster != GetHitUnit())
|
||||||
amount = MathFunctions.CalculatePct(caster.GetCreatePowerValue(PowerType.Mana), amount) / (int)aurEff.GetTotalTicks();
|
{
|
||||||
else
|
AuraEffect innervateR2 = caster.GetAuraEffect(SpellIds.InnervateRank2, 0);
|
||||||
amount = 0;
|
if (innervateR2 != null)
|
||||||
|
caster.CastSpell(caster, SpellIds.Innervate,
|
||||||
|
new CastSpellExtraArgs(TriggerCastFlags.IgnoreSpellAndCategoryCD | TriggerCastFlags.IgnoreCastInProgress)
|
||||||
|
.SetTriggeringSpell(GetSpell())
|
||||||
|
.AddSpellMod(SpellValueMod.BasePoint0, -innervateR2.GetAmount()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Register()
|
public override void Register()
|
||||||
{
|
{
|
||||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.PeriodicEnergize));
|
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||||
|
OnHit.Add(new HitHandler(HandleRank2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user