diff --git a/Scripts/Spells/DeathKnight.cs b/Scripts/Spells/DeathKnight.cs index beb31d12c..41e9926ed 100644 --- a/Scripts/Spells/DeathKnight.cs +++ b/Scripts/Spells/DeathKnight.cs @@ -32,46 +32,38 @@ namespace Scripts.Spells.DeathKnight public const uint ArmySkeletonTransform = 127527; public const uint ArmySpikedGhoulTransform = 127525; public const uint ArmySuperZombieTransform = 127526; + public const uint Blood = 137008; public const uint BloodPlague = 55078; - public const uint BloodPresence = 48263; - public const uint BloodShieldMastery = 77513; public const uint BloodShieldAbsorb = 77535; - public const uint ChainsOfIce = 45524; + public const uint BloodShieldMastery = 77513; public const uint CorpseExplosionTriggered = 43999; public const uint DeathAndDecayDamage = 52212; - public const uint DeathAndDecaySlow = 143375; - public const uint DeathCoilBarrier = 115635; public const uint DeathCoilDamage = 47632; - public const uint DeathCoilHeal = 47633; - public const uint DeathGrip = 49560; + public const uint DeathGripDummy = 243912; + public const uint DeathGripJump = 49575; + public const uint DeathGripTaunt = 51399; public const uint DeathStrikeHeal = 45470; - public const uint EnhancedDeathCoil = 157343; + public const uint DeathStrikeOffhand = 66188; + public const uint FesteringWound = 194310; + public const uint Frost = 137006; public const uint FrostFever = 55095; - public const uint GhoulExplode = 47496; - public const uint GlyphOfAbsorbMagic = 159415; - public const uint GlyphOfAntiMagicShell = 58623; - public const uint GlyphOfArmyOfTheDead = 58669; - public const uint GlyphOfDeathCoil = 63333; - public const uint GlyphOfDeathAndDecay = 58629; public const uint GlyphOfFoulMenagerie = 58642; - public const uint GlyphOfRegenerativeMagic = 146648; - public const uint GlyphOfRunicPowerTriggered = 159430; - public const uint GlyphOfSwiftDeath = 146645; public const uint GlyphOfTheGeist = 58640; public const uint GlyphOfTheSkeleton = 146652; - public const uint ImprovedBloodPresence = 50371; - public const uint ImprovedSoulReaper = 157342; public const uint MarkOfBloodHeal = 206945; public const uint NecrosisEffect = 216974; + public const uint RaiseDeadSummon = 52150; + public const uint RecentlyUsedDeathStrike = 180612; public const uint RunicPowerEnergize = 49088; public const uint RunicReturn = 61258; - public const uint ScourgeStrikeTriggered = 70890; - public const uint ShadowOfDeath = 164047; - public const uint SoulReaperDamage = 114867; - public const uint SoulReaperHaste = 114868; - public const uint T15Dps4pBonus = 138347; - public const uint UnholyPresence = 48265; - public const uint WillOfTheNecropolis = 157335; + public const uint SludgeBelcher = 207313; + public const uint SludgeBelcherSummon = 212027; + public const uint TighteningGrasp = 206970; + public const uint TighteningGraspSlow = 143375; + public const uint Unholy = 137007; + public const uint UnholyVigor = 196263; + public const uint VolatileShielding = 207188; + public const uint VolatileShieldingDamage = 207194; public static uint[] ArmyTransforms = { @@ -142,12 +134,12 @@ namespace Scripts.Spells.DeathKnight public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.RunicPowerEnergize, SpellIds.GlyphOfAbsorbMagic, SpellIds.GlyphOfRegenerativeMagic); + return ValidateSpellInfo(SpellIds.RunicPowerEnergize, SpellIds.VolatileShielding); } public override bool Load() { - absorbPct = GetSpellInfo().GetEffect(0).CalcValue(GetCaster()); + absorbPct = GetSpellInfo().GetEffect(1).CalcValue(GetCaster()); maxHealth = (int)GetCaster().GetMaxHealth(); absorbedAmount = 0; return true; @@ -155,26 +147,15 @@ namespace Scripts.Spells.DeathKnight void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) { - amount = maxHealth; - - /// todo, check if AMS has basepoints for 2. in that case, this function should be rewritten. - if (!GetUnitOwner().HasAura(SpellIds.GlyphOfAbsorbMagic)) - amount /= 2; - } - - void Absorb(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount) - { - // we may only absorb a certain percentage of incoming damage. - absorbAmount = (uint)(dmgInfo.GetDamage() * absorbPct / 100); + amount = MathFunctions.CalculatePct(maxHealth, absorbPct); } void Trigger(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount) { absorbedAmount += absorbAmount; - if (!GetTarget().HasAura(SpellIds.GlyphOfAbsorbMagic)) + if (!GetTarget().HasAura(SpellIds.VolatileShielding)) { - // Patch 6.0.2 (October 14, 2014): Anti-Magic Shell now restores 2 Runic Power per 1% of max health absorbed. int bp = (int)(2 * absorbAmount * 100 / maxHealth); GetTarget().CastCustomSpell(SpellIds.RunicPowerEnergize, SpellValueMod.BasePoint0, bp, GetTarget(), true, null, aurEff); } @@ -182,23 +163,17 @@ namespace Scripts.Spells.DeathKnight void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { - Player player = GetTarget().ToPlayer(); - if (player) + AuraEffect volatileShielding = GetTarget().GetAuraEffect(SpellIds.VolatileShielding, 1); + if (volatileShielding != null) { - AuraEffect glyph = player.GetAuraEffect(SpellIds.GlyphOfRegenerativeMagic, 0); - if (glyph != null) // reduce cooldown of AMS if player has glyph - { - // Cannot reduce cooldown by more than 50% - int val = Math.Min(glyph.GetAmount(), (int)absorbedAmount * 100 / maxHealth); - player.GetSpellHistory().ModifyCooldown(GetId(), -(int)(player.GetSpellHistory().GetRemainingCooldown(GetSpellInfo()) * val / 100)); - } + int damage = (int)MathFunctions.CalculatePct(absorbedAmount, volatileShielding.GetAmount()); + GetTarget().CastCustomSpell(SpellIds.VolatileShieldingDamage, SpellValueMod.BasePoint0, damage, null, TriggerCastFlags.FullMask, null, volatileShielding); } } public override void Register() { DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.SchoolAbsorb)); - OnEffectAbsorb.Add(new EffectAbsorbHandler(Absorb, 0)); AfterEffectAbsorb.Add(new EffectAbsorbHandler(Trigger, 0)); AfterEffectRemove.Add(new EffectApplyHandler(HandleEffectRemove, 0, AuraType.SchoolAbsorb, AuraEffectHandleModes.Real)); } @@ -214,40 +189,6 @@ namespace Scripts.Spells.DeathKnight } } - [Script] // 43264 - Periodic Taunt // 6.x, does this belong here or in spell_generic? apply this in creature_template_addon? sniffs say this is always cast army of the dead ghouls. - class spell_dk_army_periodic_taunt : SpellScriptLoader - { - public spell_dk_army_periodic_taunt() : base("spell_dk_army_periodic_taunt") { } - - class spell_dk_army_periodic_taunt_SpellScript : SpellScript - { - public override bool Load() - { - return GetCaster().IsGuardian(); - } - - SpellCastResult CheckCast() - { - Unit owner = GetCaster().GetOwner(); - if (owner) - if (!owner.HasAura(SpellIds.GlyphOfArmyOfTheDead)) - return SpellCastResult.SpellCastOk; - - return SpellCastResult.SpellUnavailable; - } - - public override void Register() - { - OnCheckCast.Add(new CheckCastHandler(CheckCast)); - } - } - - public override SpellScript GetSpellScript() - { - return new spell_dk_army_periodic_taunt_SpellScript(); - } - } - [Script] // 127517 - Army Transform // 6.x, does this belong here or in spell_generic? where do we cast this? sniffs say this is only cast when caster has glyph of foul menagerie. class spell_dk_army_transform : SpellScriptLoader { @@ -255,6 +196,11 @@ namespace Scripts.Spells.DeathKnight class spell_dk_army_transform_SpellScript : SpellScript { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.GlyphOfFoulMenagerie); + } + public override bool Load() { return GetCaster().IsGuardian(); @@ -272,7 +218,7 @@ namespace Scripts.Spells.DeathKnight void HandleDummy(uint effIndex) { - GetCaster().CastSpell(GetCaster(), SpellIds.ArmyTransforms[RandomHelper.URand(0, 5)], true); + GetCaster().CastSpell(GetCaster(), SpellIds.ArmyTransforms.SelectRandom(), true); } public override void Register() @@ -295,75 +241,20 @@ namespace Scripts.Spells.DeathKnight class spell_dk_blood_boil_SpellScript : SpellScript { - public spell_dk_blood_boil_SpellScript() - { - bpDuration = 0; - ffDuration = 0; - } - public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.BloodPlague, SpellIds.FrostFever); + return ValidateSpellInfo(SpellIds.BloodPlague); } - void FilterTargets(List targets) + void HandleEffect() { - if (targets.Empty()) - return; - - Unit caster = GetCaster(); - - foreach (WorldObject target in targets) - { - if (bpDuration != 0 && ffDuration != 0) - break; - - Unit unit = target.ToUnit(); - if (unit) - { - Aura bp = unit.GetAura(SpellIds.BloodPlague, caster.GetGUID()); - if (bp != null) - bpDuration = bp.GetDuration(); - Aura ff = unit.GetAura(SpellIds.FrostFever, caster.GetGUID()); - if (ff != null) - ffDuration = ff.GetDuration(); - } - } - } - - void HandleEffect(uint effIndex) - { - Unit caster = GetCaster(); - Unit target = GetHitUnit(); - - if (ffDuration != 0) - caster.CastSpell(target, SpellIds.FrostFever, true); - if (bpDuration != 0) - caster.CastSpell(target, SpellIds.BloodPlague, true); - - Aura bp = target.GetAura(SpellIds.BloodPlague, caster.GetGUID()); - if (bp != null) - { - bp.SetDuration(bpDuration); - bp.SetMaxDuration(bpDuration); - } - - Aura ff = target.GetAura(SpellIds.FrostFever, caster.GetGUID()); - if (ff != null) - { - ff.SetDuration(ffDuration); - ff.SetMaxDuration(ffDuration); - } + GetCaster().CastSpell(GetHitUnit(), SpellIds.BloodPlague, true); } public override void Register() { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.SchoolDamage)); + OnHit.Add(new HitHandler(HandleEffect)); } - - int bpDuration; - int ffDuration; } public override SpellScript GetSpellScript() @@ -441,19 +332,24 @@ namespace Scripts.Spells.DeathKnight class spell_dk_death_and_decay_SpellScript : SpellScript { - void HandleDummy(uint effIndex) + public override bool Validate(SpellInfo spellInfo) { - if (GetCaster().HasAura(SpellIds.GlyphOfDeathAndDecay)) + return ValidateSpellInfo(SpellIds.TighteningGrasp, SpellIds.TighteningGraspSlow); + } + + void HandleDummy() + { + if (GetCaster().HasAura(SpellIds.TighteningGrasp)) { Position pos = GetExplTargetDest(); if (pos != null) - GetCaster().CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SpellIds.DeathAndDecaySlow, true); + GetCaster().CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SpellIds.TighteningGraspSlow, true); } } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnCast.Add(new CastHandler(HandleDummy)); } } @@ -468,7 +364,7 @@ namespace Scripts.Spells.DeathKnight { Unit caster = GetCaster(); if (caster) - caster.CastCustomSpell(SpellIds.DeathAndDecayDamage, SpellValueMod.BasePoint0, aurEff.GetAmount(), GetTarget(), true, null, aurEff); + caster.CastSpell(GetTarget(), SpellIds.DeathAndDecayDamage, true, null, aurEff); } public override void Register() @@ -492,61 +388,21 @@ namespace Scripts.Spells.DeathKnight { public override bool Validate(SpellInfo spell) { - return ValidateSpellInfo(SpellIds.DeathCoilDamage, SpellIds.DeathCoilHeal, SpellIds.GlyphOfDeathCoil); + return ValidateSpellInfo(SpellIds.DeathCoilDamage, SpellIds.Unholy, SpellIds.UnholyVigor); } void HandleDummy(uint effIndex) { Unit caster = GetCaster(); - Unit target = GetHitUnit(); - if (target) - { - if (caster.IsFriendlyTo(target)) - { - if (target.GetCreatureType() == CreatureType.Undead) // Any undead ally, including caster if he has lichborne. - { - caster.CastSpell(target, SpellIds.DeathCoilHeal, true); - } - else if (target != caster) // Any non undead ally except caster and only if caster has glyph of death coil. - { - SpellInfo DCD = Global.SpellMgr.GetSpellInfo(SpellIds.DeathCoilDamage); - SpellEffectInfo eff = DCD.GetEffect(0); - int bp = (int)caster.SpellDamageBonusDone(target, DCD, (uint)eff.CalcValue(caster), DamageEffectType.SpellDirect, eff); + caster.CastSpell(GetHitUnit(), SpellIds.DeathCoilDamage, true); - caster.CastCustomSpell(target, SpellIds.DeathCoilBarrier, bp, 0, 0, true); - } - } - else // Any enemy target. - { - caster.CastSpell(target, SpellIds.DeathCoilDamage, true); - } - } - - if (caster.HasAura(SpellIds.EnhancedDeathCoil)) - caster.CastSpell(caster, SpellIds.ShadowOfDeath, true); - } - - SpellCastResult CheckCast() - { - Unit caster = GetCaster(); - Unit target = GetExplTargetUnit(); - if (target) - { - if (!caster.IsFriendlyTo(target) && !caster.isInFront(target)) - return SpellCastResult.UnitNotInfront; - - if (target.IsFriendlyTo(caster) && target.GetCreatureType() != CreatureType.Undead && !caster.HasAura(SpellIds.GlyphOfDeathCoil)) - return SpellCastResult.BadTargets; - } - else - return SpellCastResult.BadTargets; - - return SpellCastResult.SpellCastOk; + AuraEffect unholyAura = caster.GetAuraEffect(SpellIds.Unholy, 6); + if (unholyAura != null) // can be any effect, just here to send SPELL_FAILED_DONT_REPORT on failure + caster.CastSpell(caster, SpellIds.UnholyVigor, true, null, unholyAura); } public override void Register() { - OnCheckCast.Add(new CheckCastHandler(CheckCast)); OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); } } @@ -596,35 +452,46 @@ namespace Scripts.Spells.DeathKnight } } - [Script] // 49560 - Death Grip - class spell_dk_death_grip : SpellScriptLoader + [Script] //49576 - Death Grip Initial + class spell_dk_death_grip_initial : SpellScriptLoader { - public spell_dk_death_grip() : base("spell_dk_death_grip") { } + public spell_dk_death_grip_initial() : base("spell_dk_death_grip_initial") { } - class spell_dk_death_grip_SpellScript : SpellScript + class spell_dk_death_grip_initial_SpellScript : SpellScript { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.DeathGripDummy, SpellIds.DeathGripJump, SpellIds.Blood, SpellIds.DeathGripTaunt); + } + + SpellCastResult CheckCast() + { + Unit caster = GetCaster(); + // Death Grip should not be castable while jumping/falling + if (caster.HasUnitState(UnitState.Jumping) || caster.HasUnitMovementFlag(MovementFlag.Falling)) + return SpellCastResult.Moving; + + return SpellCastResult.SpellCastOk; + } + void HandleDummy(uint effIndex) { - int damage = GetEffectValue(); - Position pos = GetExplTargetDest(); - Unit target = GetHitUnit(); - if (target) - { - if (!target.HasAuraType(AuraType.DeflectSpells)) // Deterrence - target.CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), (uint)damage, true); - } + GetCaster().CastSpell(GetHitUnit(), SpellIds.DeathGripDummy, true); + GetHitUnit().CastSpell(GetCaster(), SpellIds.DeathGripJump, true); + if (GetCaster().HasAura(SpellIds.Blood)) + GetCaster().CastSpell(GetHitUnit(), SpellIds.DeathGripTaunt, true); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnCheckCast.Add(new CheckCastHandler(CheckCast)); + OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.ScriptEffect)); } - } public override SpellScript GetSpellScript() { - return new spell_dk_death_grip_SpellScript(); + return new spell_dk_death_grip_initial_SpellScript(); } } @@ -663,27 +530,34 @@ namespace Scripts.Spells.DeathKnight { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.DeathStrikeHeal, SpellIds.BloodShieldMastery, SpellIds.BloodShieldAbsorb); + return ValidateSpellInfo(SpellIds.DeathStrikeHeal, SpellIds.BloodShieldMastery, SpellIds.BloodShieldAbsorb, + SpellIds.RecentlyUsedDeathStrike, SpellIds.Frost, SpellIds.DeathStrikeOffhand); } void HandleHeal(uint effIndex) { Unit caster = GetCaster(); - int heal = (int)caster.GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 4; /// todo, add versatality bonus as it will probably not apply to the heal due to its damageclass SPELL_DAMAGE_CLASS_NONE. + //TODO: heal = std::min(10% health, 20% of all damage taken in last 5 seconds) + int heal = (int)MathFunctions.CalculatePct(caster.GetMaxHealth(), GetSpellInfo().GetEffect(4).CalcValue()); caster.CastCustomSpell(SpellIds.DeathStrikeHeal, SpellValueMod.BasePoint0, heal, caster, true); - if (!caster.HasAura(SpellIds.BloodPresence) || !caster.HasAura(SpellIds.ImprovedBloodPresence)) - return; - - /// todo, if SPELL_AURA_MOD_ABSORB_PERCENTAGE will not apply to SPELL_DAMAGE_CLASS_NONE, resolve must be applied here. AuraEffect aurEff = caster.GetAuraEffect(SpellIds.BloodShieldMastery, 0); if (aurEff != null) caster.CastCustomSpell(SpellIds.BloodShieldAbsorb, SpellValueMod.BasePoint0, MathFunctions.CalculatePct(heal, aurEff.GetAmount()), caster); + + if (caster.HasAura(SpellIds.Frost)) + caster.CastSpell(GetHitUnit(), SpellIds.DeathStrikeOffhand, true); + } + + void TriggerRecentlyUsedDeathStrike() + { + GetCaster().CastSpell(GetCaster(), SpellIds.RecentlyUsedDeathStrike, true); } public override void Register() { OnEffectHitTarget.Add(new EffectHandler(HandleHeal, 1, SpellEffectName.WeaponPercentDamage)); + AfterCast.Add(new CastHandler(TriggerRecentlyUsedDeathStrike)); } } @@ -702,43 +576,17 @@ namespace Scripts.Spells.DeathKnight { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.FrostFever, SpellIds.BloodPlague, SpellIds.ChainsOfIce); + return ValidateSpellInfo(SpellIds.FesteringWound); } - void HandleScriptEffect(uint effIndex) + void HandleDummy(uint effIndex) { - int extraDuration = GetEffectValue(); - Unit target = GetHitUnit(); - ObjectGuid casterGUID = GetCaster().GetGUID(); - - Aura ff = target.GetAura(SpellIds.FrostFever, casterGUID); - if (ff != null) - { - int newDuration = Math.Min(ff.GetDuration() + extraDuration, 2 * Time.Minute * Time.InMilliseconds); // caps at 2min. - ff.SetDuration(newDuration); - ff.SetMaxDuration(newDuration); - } - - Aura bp = target.GetAura(SpellIds.BloodPlague, casterGUID); - if (bp != null) - { - int newDuration = Math.Min(bp.GetDuration() + extraDuration, 2 * Time.Minute * Time.InMilliseconds); // caps at 2min. - bp.SetDuration(newDuration); - bp.SetMaxDuration(newDuration); - } - - Aura coi = target.GetAura(SpellIds.ChainsOfIce, casterGUID); - if (coi != null) - { - int newDuration = Math.Min(coi.GetDuration() + extraDuration, 20 * Time.InMilliseconds); // is 20sec cap? couldnt manage to get runes up to pass 20. - coi.SetDuration(newDuration); - coi.SetMaxDuration(newDuration); - } + GetCaster().CastCustomSpell(SpellIds.FesteringWound, SpellValueMod.AuraStack, GetEffectValue(), GetHitUnit(), TriggerCastFlags.FullMask); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 2, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 2, SpellEffectName.Dummy)); } } @@ -788,100 +636,7 @@ namespace Scripts.Spells.DeathKnight } } - [Script] // 58677 - Glyph of Death's Embrace - class spell_dk_glyph_of_deaths_embrace : SpellScriptLoader - { - public spell_dk_glyph_of_deaths_embrace() : base("spell_dk_glyph_of_deaths_embrace") { } - - class spell_dk_glyph_of_deaths_embrace_AuraScript : AuraScript - { - bool CheckProc(ProcEventInfo eventInfo) - { - Unit actionTarget = eventInfo.GetActionTarget(); - return actionTarget && actionTarget.GetCreatureType() == CreatureType.Undead && actionTarget.GetOwner(); - } - - public override void Register() - { - DoCheckProc.Add(new CheckProcHandler(CheckProc)); - } - } - - public override AuraScript GetAuraScript() - { - return new spell_dk_glyph_of_deaths_embrace_AuraScript(); - } - } - - [Script] // 159429 - Glyph of Runic Power - class spell_dk_glyph_of_runic_power : SpellScriptLoader - { - public spell_dk_glyph_of_runic_power() : base("spell_dk_glyph_of_runic_power") { } - - class spell_dk_glyph_of_runic_power_AuraScript : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.GlyphOfRunicPowerTriggered); - } - - public override bool Load() - { - return GetUnitOwner().GetClass() == Class.Deathknight; - } - - bool CheckProc(ProcEventInfo eventInfo) - { - return eventInfo.GetSpellInfo() != null - && Convert.ToBoolean(eventInfo.GetSpellInfo().GetAllEffectsMechanicMask() & (1 << (int)Mechanics.Snare | 1 << (int)Mechanics.Root | 1 << (int)Mechanics.Freeze)); - } - - void HandleProc(ProcEventInfo eventInfo) - { - Unit target = eventInfo.GetProcTarget(); - if (target) - target.CastSpell(target, SpellIds.GlyphOfRunicPowerTriggered, true); - } - - public override void Register() - { - DoCheckProc.Add(new CheckProcHandler(CheckProc)); - OnProc.Add(new AuraProcHandler(HandleProc)); - } - } - - public override AuraScript GetAuraScript() - { - return new spell_dk_glyph_of_runic_power_AuraScript(); - } - } - - [Script] // 48792 - Icebound Fortitude - class spell_dk_icebound_fortitude : SpellScriptLoader - { - public spell_dk_icebound_fortitude() : base("spell_dk_icebound_fortitude") { } - - class spell_dk_icebound_fortitude_AuraScript : AuraScript - { - void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) - { - if (GetUnitOwner().HasAura(SpellIds.ImprovedBloodPresence)) - amount += 30; /// todo, figure out how tooltip is updated - } - - public override void Register() - { - DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 2, AuraType.ModDamagePercentTaken)); - } - } - - public override AuraScript GetAuraScript() - { - return new spell_dk_icebound_fortitude_AuraScript(); - } - } - - [Script] // 206940 - Mark of Blood 7.1.5 + [Script] // 206940 - Mark of Blood class spell_dk_mark_of_blood : SpellScriptLoader { public spell_dk_mark_of_blood() : base("spell_dk_mark_of_blood") { } @@ -913,7 +668,7 @@ namespace Scripts.Spells.DeathKnight } } - [Script] // 207346 - Necrosis 7.1.5 + [Script] // 207346 - Necrosis class spell_dk_necrosis : SpellScriptLoader { public spell_dk_necrosis() : base("spell_dk_necrosis") { } @@ -950,6 +705,11 @@ namespace Scripts.Spells.DeathKnight class spell_dk_pet_geist_transform_SpellScript : SpellScript { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.GlyphOfTheGeist); + } + public override bool Load() { return GetCaster().IsPet(); @@ -984,6 +744,11 @@ namespace Scripts.Spells.DeathKnight class spell_dk_pet_skeleton_transform_SpellScript : SpellScript { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.GlyphOfTheSkeleton); + } + SpellCastResult CheckCast() { Unit owner = GetCaster().GetOwner(); @@ -1053,21 +818,18 @@ namespace Scripts.Spells.DeathKnight class spell_dk_raise_dead_SpellScript : SpellScript { - public spell_dk_raise_dead_SpellScript() { } - public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffect(0) != null && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); - } - - public override bool Load() - { - return GetCaster().IsTypeId(TypeId.Player); + return ValidateSpellInfo(SpellIds.RaiseDeadSummon, SpellIds.SludgeBelcher, SpellIds.SludgeBelcherSummon); } void HandleDummy(uint effIndex) { - GetCaster().CastSpell((Unit)null, (uint)GetEffectValue(), true); + uint spellId = SpellIds.RaiseDeadSummon; + if (GetCaster().HasAura(SpellIds.SludgeBelcher)) + spellId = SpellIds.SludgeBelcherSummon; + + GetCaster().CastSpell((Unit)null, spellId, true); } public override void Register() @@ -1082,50 +844,6 @@ namespace Scripts.Spells.DeathKnight } } - [Script] // 114866 - Soul Reaper, 130735 - Soul Reaper, 130736 - Soul Reaper - class spell_dk_soul_reaper : SpellScriptLoader - { - public spell_dk_soul_reaper() : base("spell_dk_soul_reaper") { } - - class spell_dk_soul_reaper_AuraScript : AuraScript - { - void HandlePeriodicDummy(AuraEffect aurEff) - { - Unit caster = GetCaster(); - Unit target = GetUnitOwner(); - - if (!caster || !target) - return; - - float pct = target.GetHealthPct(); - - if (pct < 35.0f || (pct < 45.0f && (caster.HasAura(SpellIds.ImprovedSoulReaper) || caster.HasAura(SpellIds.T15Dps4pBonus)))) - caster.CastSpell(target, SpellIds.SoulReaperDamage, true, null, aurEff); - } - - void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.ByDeath) - return; - - Unit caster = GetCaster(); - if (caster) - caster.CastSpell(caster, SpellIds.SoulReaperHaste, true); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicDummy, 1, AuraType.PeriodicDummy)); - AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 1, AuraType.PeriodicDummy, AuraEffectHandleModes.Real)); - } - } - - public override AuraScript GetAuraScript() - { - return new spell_dk_soul_reaper_AuraScript(); - } - } - [Script] // 115994 - Unholy Blight class spell_dk_unholy_blight : SpellScriptLoader { @@ -1133,6 +851,11 @@ namespace Scripts.Spells.DeathKnight class spell_dk_unholy_blight_SpellScript : SpellScript { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.FrostFever, SpellIds.BloodPlague); + } + void HandleDummy(uint effIndex) { GetCaster().CastSpell(GetHitUnit(), SpellIds.FrostFever, true); @@ -1165,7 +888,7 @@ namespace Scripts.Spells.DeathKnight public override void Register() { - DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 1, AuraType.ModIncreaseHealth)); + DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 1, AuraType.ModIncreaseHealth2)); } } @@ -1174,85 +897,4 @@ namespace Scripts.Spells.DeathKnight return new spell_dk_vampiric_blood_AuraScript(); } } - - [Script] // 81164 - Will of the Necropolis - class spell_dk_will_of_the_necropolis : SpellScriptLoader - { - public spell_dk_will_of_the_necropolis() : base("spell_dk_will_of_the_necropolis") { } - - class spell_dk_will_of_the_necropolis_AuraScript : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return spellInfo.GetEffect(0) != null && ValidateSpellInfo(SpellIds.WillOfTheNecropolis); - } - - bool CheckProc(ProcEventInfo eventInfo) - { - Unit target = GetTarget(); - - if (target.HasAura(SpellIds.WillOfTheNecropolis)) - return false; - - return target.HealthBelowPctDamaged(30, eventInfo.GetDamageInfo().GetDamage()); - } - - void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) - { - GetTarget().CastSpell(GetTarget(), SpellIds.WillOfTheNecropolis, true, null, aurEff); - } - - public override void Register() - { - DoCheckProc.Add(new CheckProcHandler(CheckProc)); - OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell)); - } - } - - public override AuraScript GetAuraScript() - { - return new spell_dk_will_of_the_necropolis_AuraScript(); - } - } - - [Script] // 49576 - Death Grip Initial - class spell_dk_death_grip_initial : SpellScriptLoader - { - public spell_dk_death_grip_initial() : base("spell_dk_death_grip_initial") { } - - class spell_dk_death_grip_initial_SpellScript : SpellScript - { - SpellCastResult CheckCast() - { - Unit caster = GetCaster(); - // Death Grip should not be castable while jumping/falling - if (caster.HasUnitState(UnitState.Jumping) || caster.HasUnitMovementFlag(MovementFlag.Falling)) - return SpellCastResult.Moving; - - // Patch 3.3.3 (2010-03-23): Minimum range has been changed to 8 yards in PvP. - Unit target = GetExplTargetUnit(); - if (target && target.IsTypeId(TypeId.Player)) - if (caster.GetDistance(target) < 8.0f) - return SpellCastResult.TooClose; - - return SpellCastResult.SpellCastOk; - } - - void HandleDummy(uint effIndex) - { - GetCaster().CastSpell(GetHitUnit(), SpellIds.DeathGrip, true); - } - - public override void Register() - { - OnCheckCast.Add(new CheckCastHandler(CheckCast)); - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - public override SpellScript GetSpellScript() - { - return new spell_dk_death_grip_initial_SpellScript(); - } - } }