Ported .Net Core commits:
hondacrx: - Initial commit: Switch to .Net Core 2.0 - Fix build and removed not needed files Fabi: - Updated solution platforms. - Changed folder structure. - Change library target framework to netstandard2.0. - Updated solution platforms again... - Removed windows specific kernel32 function usage (Ctrl-C handler).
This commit is contained in:
@@ -0,0 +1,685 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Spells.DeathKnight
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint ArmyFleshBeastTransform = 127533;
|
||||
public const uint ArmyGeistTransform = 127534;
|
||||
public const uint ArmyNorthrendSkeletonTransform = 127528;
|
||||
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 BloodShieldAbsorb = 77535;
|
||||
public const uint BloodShieldMastery = 77513;
|
||||
public const uint CorpseExplosionTriggered = 43999;
|
||||
public const uint DeathAndDecayDamage = 52212;
|
||||
public const uint DeathCoilDamage = 47632;
|
||||
public const uint DeathGripDummy = 243912;
|
||||
public const uint DeathGripJump = 49575;
|
||||
public const uint DeathGripTaunt = 51399;
|
||||
public const uint DeathStrikeHeal = 45470;
|
||||
public const uint DeathStrikeOffhand = 66188;
|
||||
public const uint FesteringWound = 194310;
|
||||
public const uint Frost = 137006;
|
||||
public const uint FrostFever = 55095;
|
||||
public const uint GlyphOfFoulMenagerie = 58642;
|
||||
public const uint GlyphOfTheGeist = 58640;
|
||||
public const uint GlyphOfTheSkeleton = 146652;
|
||||
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 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 =
|
||||
{
|
||||
ArmyFleshBeastTransform,
|
||||
ArmyGeistTransform,
|
||||
ArmyNorthrendSkeletonTransform,
|
||||
ArmySkeletonTransform,
|
||||
ArmySpikedGhoulTransform,
|
||||
ArmySuperZombieTransform
|
||||
};
|
||||
}
|
||||
|
||||
struct CreatureIds
|
||||
{
|
||||
public const uint DancingRuneWeapon = 27893;
|
||||
}
|
||||
|
||||
[Script] // 70656 - Advantage (T10 4P Melee Bonus)
|
||||
class spell_dk_advantage_t10_4p : AuraScript
|
||||
{
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
Unit caster = eventInfo.GetActor();
|
||||
if (caster)
|
||||
{
|
||||
if (!caster.IsTypeId(TypeId.Player) || caster.GetClass() != Class.Deathknight)
|
||||
return false;
|
||||
|
||||
for (byte i = 0; i < PlayerConst.MaxRunes; ++i)
|
||||
if (caster.ToPlayer().GetRuneCooldown(i) == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 48707 - Anti-Magic Shell
|
||||
class spell_dk_anti_magic_shell : AuraScript
|
||||
{
|
||||
public spell_dk_anti_magic_shell()
|
||||
{
|
||||
absorbPct = 0;
|
||||
maxHealth = 0;
|
||||
absorbedAmount = 0;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RunicPowerEnergize, SpellIds.VolatileShielding);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
absorbPct = GetSpellInfo().GetEffect(1).CalcValue(GetCaster());
|
||||
maxHealth = (int)GetCaster().GetMaxHealth();
|
||||
absorbedAmount = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
amount = MathFunctions.CalculatePct(maxHealth, absorbPct);
|
||||
}
|
||||
|
||||
void Trigger(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
|
||||
{
|
||||
absorbedAmount += absorbAmount;
|
||||
|
||||
if (!GetTarget().HasAura(SpellIds.VolatileShielding))
|
||||
{
|
||||
int bp = (int)(2 * absorbAmount * 100 / maxHealth);
|
||||
GetTarget().CastCustomSpell(SpellIds.RunicPowerEnergize, SpellValueMod.BasePoint0, bp, GetTarget(), true, null, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
AuraEffect volatileShielding = GetTarget().GetAuraEffect(SpellIds.VolatileShielding, 1);
|
||||
if (volatileShielding != null)
|
||||
{
|
||||
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));
|
||||
AfterEffectAbsorb.Add(new EffectAbsorbHandler(Trigger, 0));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(HandleEffectRemove, 0, AuraType.SchoolAbsorb, AuraEffectHandleModes.Real));
|
||||
}
|
||||
|
||||
int absorbPct;
|
||||
int maxHealth;
|
||||
uint absorbedAmount;
|
||||
}
|
||||
|
||||
[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 : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.GlyphOfFoulMenagerie);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsGuardian();
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit owner = GetCaster().GetOwner();
|
||||
if (owner)
|
||||
if (owner.HasAura(SpellIds.GlyphOfFoulMenagerie))
|
||||
return SpellCastResult.SpellCastOk;
|
||||
|
||||
return SpellCastResult.SpellUnavailable;
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.ArmyTransforms.SelectRandom(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 50842 - Blood Boil
|
||||
class spell_dk_blood_boil : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BloodPlague);
|
||||
}
|
||||
|
||||
void HandleEffect()
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.BloodPlague, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnHit.Add(new HitHandler(HandleEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 49028 - Dancing Rune Weapon 7.1.5
|
||||
class spell_dk_dancing_rune_weapon : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
if (Global.ObjectMgr.GetCreatureTemplate(CreatureIds.DancingRuneWeapon) == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// This is a port of the old switch hack in Unit.cpp, it's not correct
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Unit caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
Unit drw = null;
|
||||
foreach (Unit controlled in caster.m_Controlled)
|
||||
{
|
||||
if (controlled.GetEntry() == CreatureIds.DancingRuneWeapon)
|
||||
{
|
||||
drw = controlled;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!drw || !drw.GetVictim())
|
||||
return;
|
||||
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||
return;
|
||||
|
||||
int amount = (int)(damageInfo.GetDamage() / 2);
|
||||
SpellNonMeleeDamage log = new SpellNonMeleeDamage(drw, drw.GetVictim(), spellInfo.Id, spellInfo.GetSpellXSpellVisualId(drw), spellInfo.GetSchoolMask());
|
||||
log.damage = (uint)amount;
|
||||
drw.DealDamage(drw.GetVictim(), (uint)amount, null, DamageEffectType.Direct, spellInfo.GetSchoolMask(), spellInfo, true);
|
||||
drw.SendSpellNonMeleeDamageLog(log);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43265 - Death and Decay
|
||||
class spell_dk_death_and_decay : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
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.TighteningGraspSlow, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCast.Add(new CastHandler(HandleDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_dk_death_and_decay_AuraScript: AuraScript
|
||||
{
|
||||
void HandleDummyTick(AuraEffect aurEff)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
caster.CastSpell(GetTarget(), SpellIds.DeathAndDecayDamage, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummyTick, 2, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 47541 - Death Coil
|
||||
class spell_dk_death_coil : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.DeathCoilDamage, SpellIds.Unholy, SpellIds.UnholyVigor);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
caster.CastSpell(GetHitUnit(), SpellIds.DeathCoilDamage, true);
|
||||
|
||||
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()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 52751 - Death Gate
|
||||
class spell_dk_death_gate : SpellScript
|
||||
{
|
||||
SpellCastResult CheckClass()
|
||||
{
|
||||
if (GetCaster().GetClass() != Class.Deathknight)
|
||||
{
|
||||
SetCustomCastResultMessage(SpellCustomErrors.MustBeDeathKnight);
|
||||
return SpellCastResult.CustomError;
|
||||
}
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
target.CastSpell(target, (uint)GetEffectValue(), false);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckClass));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] //49576 - Death Grip Initial
|
||||
class spell_dk_death_grip_initial : 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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 48743 - Death Pact
|
||||
class spell_dk_death_pact : AuraScript
|
||||
{
|
||||
void HandleCalcAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
amount = (int)caster.CountPctFromMaxHealth(amount);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(HandleCalcAmount, 1, AuraType.SchoolHealAbsorb));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 49998 - Death Strike
|
||||
class spell_dk_death_strike : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.DeathStrikeHeal, SpellIds.BloodShieldMastery, SpellIds.BloodShieldAbsorb,
|
||||
SpellIds.RecentlyUsedDeathStrike, SpellIds.Frost, SpellIds.DeathStrikeOffhand);
|
||||
}
|
||||
|
||||
void HandleHeal(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
//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);
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 85948 - Festering Strike
|
||||
class spell_dk_festering_strike : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FesteringWound);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
GetCaster().CastCustomSpell(SpellIds.FesteringWound, SpellValueMod.AuraStack, GetEffectValue(), GetHitUnit(), TriggerCastFlags.FullMask);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 2, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 47496 - Explode, Ghoul spell for Corpse Explosion
|
||||
class spell_dk_ghoul_explode : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CorpseExplosionTriggered);
|
||||
}
|
||||
|
||||
void HandleDamage(uint effIndex)
|
||||
{
|
||||
SetHitDamage((int)GetCaster().CountPctFromMaxHealth(GetEffectInfo(2).CalcValue(GetCaster())));
|
||||
}
|
||||
|
||||
void Suicide(uint effIndex)
|
||||
{
|
||||
Unit unitTarget = GetHitUnit();
|
||||
if (unitTarget)
|
||||
{
|
||||
// Corpse Explosion (Suicide)
|
||||
unitTarget.CastSpell(unitTarget, SpellIds.CorpseExplosionTriggered, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDamage, 0, SpellEffectName.SchoolDamage));
|
||||
OnEffectHitTarget.Add(new EffectHandler(Suicide, 1, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 206940 - Mark of Blood
|
||||
class spell_dk_mark_of_blood : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MarkOfBloodHeal);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
caster.CastSpell(eventInfo.GetProcTarget(), SpellIds.MarkOfBloodHeal, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 207346 - Necrosis
|
||||
class spell_dk_necrosis : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.NecrosisEffect);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastSpell(eventInfo.GetProcTarget(), SpellIds.NecrosisEffect, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 121916 - Glyph of the Geist (Unholy) // 6.x, does this belong here or in spell_generic? apply this in creature_template_addon? sniffs say this is always cast on raise dead.
|
||||
class spell_dk_pet_geist_transform : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.GlyphOfTheGeist);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsPet();
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit owner = GetCaster().GetOwner();
|
||||
if (owner)
|
||||
if (owner.HasAura(SpellIds.GlyphOfTheGeist))
|
||||
return SpellCastResult.SpellCastOk;
|
||||
|
||||
return SpellCastResult.SpellUnavailable;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 147157 Glyph of the Skeleton (Unholy) // 6.x, does this belong here or in spell_generic? apply this in creature_template_addon? sniffs say this is always cast on raise dead.
|
||||
class spell_dk_pet_skeleton_transform : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.GlyphOfTheSkeleton);
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit owner = GetCaster().GetOwner();
|
||||
if (owner)
|
||||
if (owner.HasAura(SpellIds.GlyphOfTheSkeleton))
|
||||
return SpellCastResult.SpellCastOk;
|
||||
|
||||
return SpellCastResult.SpellUnavailable;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 61257 - Runic Power Back on Snare/Root 7.1.5
|
||||
class spell_dk_pvp_4p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RunicReturn);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo == null)
|
||||
return false;
|
||||
|
||||
return (spellInfo.GetAllEffectsMechanicMask() & ((1 << (int)Mechanics.Root) | (1 << (int)Mechanics.Snare))) != 0;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
eventInfo.GetActionTarget().CastSpell((Unit)null, SpellIds.RunicReturn, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 46584 - Raise Dead
|
||||
class spell_dk_raise_dead : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RaiseDeadSummon, SpellIds.SludgeBelcher, SpellIds.SludgeBelcherSummon);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
uint spellId = SpellIds.RaiseDeadSummon;
|
||||
if (GetCaster().HasAura(SpellIds.SludgeBelcher))
|
||||
spellId = SpellIds.SludgeBelcherSummon;
|
||||
|
||||
GetCaster().CastSpell((Unit)null, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 115994 - Unholy Blight
|
||||
class spell_dk_unholy_blight : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FrostFever, SpellIds.BloodPlague);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.FrostFever, true);
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.BloodPlague, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 55233 - Vampiric Blood
|
||||
class spell_dk_vampiric_blood : AuraScript
|
||||
{
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
amount = (int)GetUnitOwner().CountPctFromMaxHealth(amount);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 1, AuraType.ModIncreaseHealth2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Scripts.Spells
|
||||
{
|
||||
class DemonHunter
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,900 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Scripts.Spells.Druid
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint BalanceT10Bonus = 70718;
|
||||
public const uint BalanceT10BonusProc = 70721;
|
||||
public const uint BlessingOfTheClaw = 28750;
|
||||
public const uint BlessingOfTheRemulos = 40445;
|
||||
public const uint BlessingOfTheElune = 40446;
|
||||
public const uint BlessingOfTheCenarius = 40452;
|
||||
public const uint Exhilarate = 28742;
|
||||
public const uint FeralChargeBear = 16979;
|
||||
public const uint FeralChargeCat = 49376;
|
||||
public const uint FormsTrinketBear = 37340;
|
||||
public const uint FormsTrinketCat = 37341;
|
||||
public const uint FormsTrinketMoonkin = 37343;
|
||||
public const uint FormsTrinketNone = 37344;
|
||||
public const uint FormsTrinketTree = 37342;
|
||||
public const uint IdolOfFeralShadows = 34241;
|
||||
public const uint IdolOfWorship = 60774;
|
||||
public const uint Infusion = 37238;
|
||||
public const uint Languish = 71023;
|
||||
public const uint LifebloomEnergize = 64372;
|
||||
public const uint LifebloomFinalHeal = 33778;
|
||||
public const uint LivingSeedHeal = 48503;
|
||||
public const uint LivingSeedProc = 48504;
|
||||
public const uint MoonfireDamage = 164812;
|
||||
public const uint RejuvenationT10Proc = 70691;
|
||||
public const uint SavageRoar = 62071;
|
||||
public const uint StampedeBearRank1 = 81016;
|
||||
public const uint StampedeCatRank1 = 81021;
|
||||
public const uint StampedeCatState = 109881;
|
||||
public const uint SunfireDamage = 164815;
|
||||
public const uint SurvivalInstincts = 50322;
|
||||
}
|
||||
|
||||
[Script] // 1850 - Dash
|
||||
public class spell_dru_dash : AuraScript
|
||||
{
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
// do not set speed if not in cat form
|
||||
if (GetUnitOwner().GetShapeshiftForm() != ShapeShiftForm.CatForm)
|
||||
amount = 0;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.ModIncreaseSpeed));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 33943 - Flight Form
|
||||
class spell_dru_flight_form : SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.IsInDisallowedMountForm())
|
||||
return SpellCastResult.NotShapeshift;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 37336 - Druid Forms Trinket
|
||||
class spell_dru_forms_trinket : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FormsTrinketBear, SpellIds.FormsTrinketCat, SpellIds.FormsTrinketMoonkin, SpellIds.FormsTrinketNone, SpellIds.FormsTrinketTree);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
Unit target = eventInfo.GetActor();
|
||||
|
||||
switch (target.GetShapeshiftForm())
|
||||
{
|
||||
case ShapeShiftForm.BearForm:
|
||||
case ShapeShiftForm.DireBearForm:
|
||||
case ShapeShiftForm.CatForm:
|
||||
case ShapeShiftForm.MoonkinForm:
|
||||
case ShapeShiftForm.None:
|
||||
case ShapeShiftForm.TreeOfLife:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Unit target = eventInfo.GetActor();
|
||||
uint triggerspell = 0;
|
||||
|
||||
switch (target.GetShapeshiftForm())
|
||||
{
|
||||
case ShapeShiftForm.BearForm:
|
||||
case ShapeShiftForm.DireBearForm:
|
||||
triggerspell = SpellIds.FormsTrinketBear;
|
||||
break;
|
||||
case ShapeShiftForm.CatForm:
|
||||
triggerspell = SpellIds.FormsTrinketCat;
|
||||
break;
|
||||
case ShapeShiftForm.MoonkinForm:
|
||||
triggerspell = SpellIds.FormsTrinketMoonkin;
|
||||
break;
|
||||
case ShapeShiftForm.None:
|
||||
triggerspell = SpellIds.FormsTrinketNone;
|
||||
break;
|
||||
case ShapeShiftForm.TreeOfLife:
|
||||
triggerspell = SpellIds.FormsTrinketTree;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
target.CastSpell(target, triggerspell, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// 34246 - Idol of the Emerald Queen
|
||||
[Script] // 60779 - Idol of Lush Moss
|
||||
class spell_dru_idol_lifebloom : AuraScript
|
||||
{
|
||||
void HandleEffectCalcSpellMod(AuraEffect aurEff, ref SpellModifier spellMod)
|
||||
{
|
||||
if (spellMod == null)
|
||||
{
|
||||
spellMod = new SpellModifier(GetAura());
|
||||
spellMod.op = SpellModOp.Dot;
|
||||
spellMod.type = SpellModType.Flat;
|
||||
spellMod.spellId = GetId();
|
||||
spellMod.mask = GetSpellInfo().GetEffect(aurEff.GetEffIndex()).SpellClassMask;
|
||||
}
|
||||
spellMod.value = aurEff.GetAmount() / 7;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcSpellMod.Add(new EffectCalcSpellModHandler(HandleEffectCalcSpellMod, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 29166 - Innervate
|
||||
[Script]
|
||||
class spell_dru_innervate : AuraScript
|
||||
{
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
amount = MathFunctions.CalculatePct(caster.GetCreatePowers(PowerType.Mana), amount) / aurEff.GetTotalTicks();
|
||||
else
|
||||
amount = 0;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.PeriodicEnergize));
|
||||
}
|
||||
}
|
||||
|
||||
// 33763 - Lifebloom
|
||||
[Script]
|
||||
class spell_dru_lifebloom : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LifebloomFinalHeal, SpellIds.LifebloomEnergize);
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
// Final heal only on duration end
|
||||
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Expire)
|
||||
return;
|
||||
|
||||
// final heal
|
||||
uint stack = GetStackAmount();
|
||||
uint healAmount = (uint)aurEff.GetAmount();
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
healAmount = caster.SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, DamageEffectType.Heal, aurEff.GetSpellEffectInfo(), stack);
|
||||
healAmount = GetTarget().SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, DamageEffectType.Heal, aurEff.GetSpellEffectInfo(), stack);
|
||||
|
||||
GetTarget().CastCustomSpell(GetTarget(), SpellIds.LifebloomFinalHeal, (int)healAmount, 0, 0, true, null, aurEff, GetCasterGUID());
|
||||
|
||||
// restore mana
|
||||
var costs = GetSpellInfo().CalcPowerCost(caster, GetSpellInfo().GetSchoolMask());
|
||||
var m = costs.Find(cost => cost.Power == PowerType.Mana);
|
||||
if (m != null)
|
||||
{
|
||||
int returnMana = m.Amount * (int)stack / 2;
|
||||
caster.CastCustomSpell(caster, SpellIds.LifebloomEnergize, returnMana, 0, 0, true, null, aurEff, GetCasterGUID());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
GetTarget().CastCustomSpell(GetTarget(), SpellIds.LifebloomFinalHeal, (int)healAmount, 0, 0, true, null, aurEff, GetCasterGUID());
|
||||
}
|
||||
|
||||
void HandleDispel(DispelInfo dispelInfo)
|
||||
{
|
||||
Unit target = GetUnitOwner();
|
||||
if (target != null)
|
||||
{
|
||||
AuraEffect aurEff = GetEffect(1);
|
||||
if (aurEff != null)
|
||||
{
|
||||
// final heal
|
||||
uint healAmount = (uint)aurEff.GetAmount();
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
healAmount = caster.SpellHealingBonusDone(target, GetSpellInfo(), healAmount, DamageEffectType.Heal, aurEff.GetSpellEffectInfo(), dispelInfo.GetRemovedCharges());
|
||||
healAmount = target.SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, DamageEffectType.Heal, aurEff.GetSpellEffectInfo(), dispelInfo.GetRemovedCharges());
|
||||
target.CastCustomSpell(target, SpellIds.LifebloomFinalHeal, (int)healAmount, 0, 0, true, null, null, GetCasterGUID());
|
||||
|
||||
// restore mana
|
||||
var costs = GetSpellInfo().CalcPowerCost(caster, GetSpellInfo().GetSchoolMask());
|
||||
var m = costs.Find(cost => cost.Power == PowerType.Mana);
|
||||
if (m != null)
|
||||
{
|
||||
int returnMana = m.Amount * dispelInfo.GetRemovedCharges() / 2;
|
||||
caster.CastCustomSpell(caster, SpellIds.LifebloomEnergize, returnMana, 0, 0, true, null, null, GetCasterGUID());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
target.CastCustomSpell(target, SpellIds.LifebloomFinalHeal, (int)healAmount, 0, 0, true, null, null, GetCasterGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
AfterDispel.Add(new AuraDispelHandler(HandleDispel));
|
||||
}
|
||||
}
|
||||
|
||||
// 48496 - Living Seed
|
||||
[Script]
|
||||
class spell_dru_living_seed : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LivingSeedProc);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
int amount = (int)MathFunctions.CalculatePct(eventInfo.GetHealInfo().GetHeal(), aurEff.GetAmount());
|
||||
GetTarget().CastCustomSpell(SpellIds.LivingSeedProc, SpellValueMod.BasePoint0, amount, eventInfo.GetProcTarget(), true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 48504 - Living Seed (Proc)
|
||||
[Script]
|
||||
class spell_dru_living_seed_proc : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LivingSeedHeal);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastCustomSpell(SpellIds.LivingSeedHeal, SpellValueMod.BasePoint0, aurEff.GetAmount(), GetTarget(), true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 8921 - Moonfire
|
||||
class spell_dru_moonfire : SpellScript
|
||||
{
|
||||
void HandleOnHit(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.MoonfireDamage, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleOnHit, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 16972 - Predatory Strikes
|
||||
[Script]
|
||||
class spell_dru_predatory_strikes : AuraScript
|
||||
{
|
||||
void UpdateAmount(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Player target = GetTarget().ToPlayer();
|
||||
if (target != null)
|
||||
target.UpdateAttackPowerAndDamage();
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(UpdateAmount, SpellConst.EffectAll, AuraType.Dummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(UpdateAmount, SpellConst.EffectAll, AuraType.Dummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
}
|
||||
}
|
||||
|
||||
// 1079 - Rip
|
||||
[Script]
|
||||
class spell_dru_rip : AuraScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
return caster != null && caster.IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
canBeRecalculated = false;
|
||||
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
// 0.01 * $AP * cp
|
||||
byte cp = caster.ToPlayer().GetComboPoints();
|
||||
|
||||
// Idol of Feral Shadows. Can't be handled as SpellMod due its dependency from CPs
|
||||
AuraEffect idol = caster.GetAuraEffect(SpellIds.IdolOfFeralShadows, 0);
|
||||
if (idol != null)
|
||||
amount += cp * idol.GetAmount();
|
||||
// Idol of Worship. Can't be handled as SpellMod due its dependency from CPs
|
||||
else if ((idol = caster.GetAuraEffect(SpellIds.IdolOfWorship, 0)) != null)
|
||||
amount += cp * idol.GetAmount();
|
||||
|
||||
amount += (int)MathFunctions.CalculatePct(caster.GetTotalAttackPowerValue(WeaponAttackType.BaseAttack), cp);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.PeriodicDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 16864 - Omen of Clarity
|
||||
class spell_dru_omen_of_clarity : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BalanceT10Bonus, SpellIds.BalanceT10BonusProc);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (target.HasAura(SpellIds.BalanceT10Bonus))
|
||||
target.CastSpell((Unit)null, SpellIds.BalanceT10BonusProc, true, null);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// 52610 - Savage Roar
|
||||
[Script]
|
||||
class spell_dru_savage_roar : SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.GetShapeshiftForm() != ShapeShiftForm.CatForm)
|
||||
return SpellCastResult.OnlyShapeshift;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_dru_savage_roar_AuraScript : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SavageRoar);
|
||||
}
|
||||
|
||||
void AfterApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.CastSpell(target, SpellIds.SavageRoar, true, null, aurEff, GetCasterGUID());
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().RemoveAurasDueToSpell(SpellIds.SavageRoar);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(AfterApply, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 78892 - Stampede
|
||||
class spell_dru_stampede : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.StampedeBearRank1, SpellIds.StampedeCatRank1, SpellIds.StampedeCatState, SpellIds.FeralChargeCat, SpellIds.FeralChargeBear);
|
||||
}
|
||||
|
||||
void HandleEffectCatProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (GetTarget().GetShapeshiftForm() != ShapeShiftForm.CatForm || eventInfo.GetDamageInfo().GetSpellInfo().Id != SpellIds.FeralChargeCat)
|
||||
return;
|
||||
|
||||
GetTarget().CastSpell(GetTarget(), Global.SpellMgr.GetSpellWithRank(SpellIds.StampedeCatRank1, GetSpellInfo().GetRank()), true, null, aurEff);
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.StampedeCatState, true, null, aurEff);
|
||||
}
|
||||
|
||||
void HandleEffectBearProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (GetTarget().GetShapeshiftForm() != ShapeShiftForm.BearForm || eventInfo.GetDamageInfo().GetSpellInfo().Id != SpellIds.FeralChargeBear)
|
||||
return;
|
||||
|
||||
GetTarget().CastSpell(GetTarget(), Global.SpellMgr.GetSpellWithRank(SpellIds.StampedeBearRank1, GetSpellInfo().GetRank()), true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectCatProc, 0, AuraType.Dummy));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectBearProc, 1, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 50286 - Starfall (Dummy)
|
||||
[Script]
|
||||
class spell_dru_starfall_dummy : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.Resize(2);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
// Shapeshifting into an animal form or mounting cancels the effect
|
||||
if (caster.GetCreatureType() == CreatureType.Beast || caster.IsMounted())
|
||||
{
|
||||
SpellInfo spellInfo = GetTriggeringSpell();
|
||||
if (spellInfo != null)
|
||||
caster.RemoveAurasDueToSpell(spellInfo.Id);
|
||||
return;
|
||||
}
|
||||
|
||||
// Any effect which causes you to lose control of your character will supress the starfall effect.
|
||||
if (caster.HasUnitState(UnitState.Controlled))
|
||||
return;
|
||||
|
||||
caster.CastSpell(GetHitUnit(), (uint)GetEffectValue(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 93402 - Sunfire
|
||||
class spell_dru_sunfire : SpellScript
|
||||
{
|
||||
void HandleOnHit(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.SunfireDamage, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleOnHit, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 61336 - Survival Instincts
|
||||
[Script]
|
||||
class spell_dru_survival_instincts : SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (!caster.IsInFeralForm())
|
||||
return SpellCastResult.OnlyShapeshift;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_dru_survival_instincts_AuraScript : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SurvivalInstincts);
|
||||
}
|
||||
|
||||
void AfterApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
int bp0 = (int)target.CountPctFromMaxHealth(aurEff.GetAmount());
|
||||
target.CastCustomSpell(target, SpellIds.SurvivalInstincts, bp0, 0, 0, true);
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().RemoveAurasDueToSpell(SpellIds.SurvivalInstincts);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(AfterApply, 0, AuraType.Dummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
}
|
||||
}
|
||||
|
||||
// 40121 - Swift Flight Form (Passive)
|
||||
[Script]
|
||||
class spell_dru_swift_flight_passive : AuraScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
Player caster = GetCaster().ToPlayer();
|
||||
if (caster != null)
|
||||
if (caster.GetSkillValue(SkillType.Riding) >= 375)
|
||||
amount = 310;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 1, AuraType.ModIncreaseVehicleFlightSpeed));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 28744 - Regrowth
|
||||
class spell_dru_t3_6p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BlessingOfTheClaw);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetProcTarget(), SpellIds.BlessingOfTheClaw, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.OverrideClassScripts));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 28719 - Healing Touch
|
||||
class spell_dru_t3_8p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Exhilarate);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Spell spell = eventInfo.GetProcSpell();
|
||||
if (spell == null)
|
||||
return;
|
||||
|
||||
Unit caster = eventInfo.GetActor();
|
||||
var costs = spell.GetPowerCost();
|
||||
var m = costs.First(cost => { return cost.Power == PowerType.Mana; });
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
int amount = MathFunctions.CalculatePct(m.Amount, aurEff.GetAmount());
|
||||
caster.CastCustomSpell(SpellIds.Exhilarate, SpellValueMod.BasePoint0, amount, (Unit)null, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 37288 - Mana Restore
|
||||
[Script] // 37295 - Mana Restore
|
||||
class spell_dru_t4_2p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Infusion);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
eventInfo.GetActor().CastSpell((Unit)null, SpellIds.Infusion, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 40442 - Druid Tier 6 Trinket
|
||||
class spell_dru_item_t6_trinket : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BlessingOfTheRemulos, SpellIds.BlessingOfTheElune, SpellIds.BlessingOfTheCenarius);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
uint spellId;
|
||||
int chance;
|
||||
|
||||
// Starfire
|
||||
if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000004u))
|
||||
{
|
||||
spellId = SpellIds.BlessingOfTheRemulos;
|
||||
chance = 25;
|
||||
}
|
||||
// Rejuvenation
|
||||
else if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000010u))
|
||||
{
|
||||
spellId = SpellIds.BlessingOfTheElune;
|
||||
chance = 25;
|
||||
}
|
||||
// Mangle (Bear) and Mangle (Cat)
|
||||
else if (spellInfo.SpellFamilyFlags[1].HasAnyFlag(0x00000440u))
|
||||
{
|
||||
spellId = SpellIds.BlessingOfTheCenarius;
|
||||
chance = 40;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (RandomHelper.randChance(chance))
|
||||
eventInfo.GetActor().CastSpell((Unit)null, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 70723 - Item - Druid T10 Balance 4P Bonus
|
||||
class spell_dru_t10_balance_4p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Languish);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||
return;
|
||||
|
||||
Unit caster = eventInfo.GetActor();
|
||||
Unit target = eventInfo.GetProcTarget();
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.Languish);
|
||||
int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount());
|
||||
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None);
|
||||
// Add remaining ticks to damage done
|
||||
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.Languish, AuraType.PeriodicDamage);
|
||||
|
||||
caster.CastCustomSpell(SpellIds.Languish, SpellValueMod.BasePoint0, amount, target, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 70691 - Item T10 Restoration 4P Bonus
|
||||
[Script]
|
||||
class spell_dru_t10_restoration_4p_bonus : SpellScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
if (GetCaster().ToPlayer().GetGroup() == null)
|
||||
{
|
||||
targets.Clear();
|
||||
targets.Add(GetCaster());
|
||||
}
|
||||
else
|
||||
{
|
||||
targets.Remove(GetExplTargetUnit());
|
||||
List<Unit> tempTargets = new List<Unit>();
|
||||
foreach (var obj in targets)
|
||||
if (obj.IsTypeId(TypeId.Player) && GetCaster().IsInRaidWith(obj.ToUnit()))
|
||||
tempTargets.Add(obj.ToUnit());
|
||||
|
||||
if (tempTargets.Empty())
|
||||
{
|
||||
targets.Clear();
|
||||
FinishCast(SpellCastResult.DontReport);
|
||||
return;
|
||||
}
|
||||
|
||||
Unit target = tempTargets.SelectRandom();
|
||||
targets.Clear();
|
||||
targets.Add(target);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaAlly));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 70664 - Druid T10 Restoration 4P Bonus (Rejuvenation)
|
||||
class spell_dru_t10_restoration_4p_bonus_dummy : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RejuvenationT10Proc);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo == null || spellInfo.Id == SpellIds.RejuvenationT10Proc)
|
||||
return false;
|
||||
|
||||
HealInfo healInfo = eventInfo.GetHealInfo();
|
||||
if (healInfo == null || healInfo.GetHeal() == 0)
|
||||
return false;
|
||||
|
||||
Player caster = eventInfo.GetActor().ToPlayer();
|
||||
if (!caster)
|
||||
return false;
|
||||
|
||||
return caster.GetGroup() || caster != eventInfo.GetProcTarget();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
int amount = (int)eventInfo.GetHealInfo().GetHeal();
|
||||
eventInfo.GetActor().CastCustomSpell(SpellIds.RejuvenationT10Proc, SpellValueMod.BasePoint0, amount, (Unit)null, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 48438 - Wild Growth
|
||||
class spell_dru_wild_growth : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
SpellEffectInfo effect2 = spellInfo.GetEffect(2);
|
||||
if (effect2 == null || effect2.IsEffect() || effect2.CalcValue() <= 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.RemoveAll(obj =>
|
||||
{
|
||||
Unit target = obj.ToUnit();
|
||||
if (target)
|
||||
return !GetCaster().IsInRaidWith(target);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
int maxTargets = GetSpellInfo().GetEffect(2).CalcValue(GetCaster());
|
||||
|
||||
if (targets.Count > maxTargets)
|
||||
{
|
||||
targets.Sort(new HealthPctOrderPred());
|
||||
targets.RemoveRange(maxTargets, targets.Count - maxTargets);
|
||||
}
|
||||
|
||||
_targets = targets;
|
||||
}
|
||||
|
||||
void SetTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.Clear();
|
||||
targets.AddRange(_targets);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaAlly));
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(SetTargets, 1, Targets.UnitDestAreaAlly));
|
||||
}
|
||||
|
||||
List<WorldObject> _targets;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,788 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Spells.Holiday
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
//Romantic Picnic
|
||||
public const uint BasketCheck = 45119; // Holiday - Valentine - Romantic Picnic Near Basket Check
|
||||
public const uint MealPeriodic = 45103; // Holiday - Valentine - Romantic Picnic Meal Periodic - Effect Dummy
|
||||
public const uint MealEatVisual = 45120; // Holiday - Valentine - Romantic Picnic Meal Eat Visual
|
||||
//public const uint MealParticle = 45114; // Holiday - Valentine - Romantic Picnic Meal Particle - Unused
|
||||
public const uint DrinkVisual = 45121; // Holiday - Valentine - Romantic Picnic Drink Visual
|
||||
public const uint RomanticPicnicAchiev = 45123; // Romantic Picnic Periodic = 5000
|
||||
|
||||
//Trickspells
|
||||
public const uint PirateCostumeMale = 24708;
|
||||
public const uint PirateCostumeFemale = 24709;
|
||||
public const uint NinjaCostumeMale = 24710;
|
||||
public const uint NinjaCostumeFemale = 24711;
|
||||
public const uint LeperGnomeCostumeMale = 24712;
|
||||
public const uint LeperGnomeCostumeFemale = 24713;
|
||||
public const uint SkeletonCostume = 24723;
|
||||
public const uint GhostCostumeMale = 24735;
|
||||
public const uint GhostCostumeFemale = 24736;
|
||||
public const uint TrickBuff = 24753;
|
||||
|
||||
//Trickortreatspells
|
||||
public const uint Trick = 24714;
|
||||
public const uint Treat = 24715;
|
||||
public const uint TrickedOrTreated = 24755;
|
||||
public const uint TrickyTreatSpeed = 42919;
|
||||
public const uint TrickyTreatTrigger = 42965;
|
||||
public const uint UpsetTummy = 42966;
|
||||
|
||||
//Wand Spells
|
||||
public const uint HallowedWandPirate = 24717;
|
||||
public const uint HallowedWandNinja = 24718;
|
||||
public const uint HallowedWandLeperGnome = 24719;
|
||||
public const uint HallowedWandRandom = 24720;
|
||||
public const uint HallowedWandSkeleton = 24724;
|
||||
public const uint HallowedWandWisp = 24733;
|
||||
public const uint HallowedWandGhost = 24737;
|
||||
public const uint HallowedWandBat = 24741;
|
||||
|
||||
//Pilgrims Bounty
|
||||
public const uint WellFedApTrigger = 65414;
|
||||
public const uint WellFedZmTrigger = 65412;
|
||||
public const uint WellFedHitTrigger = 65416;
|
||||
public const uint WellFedHasteTrigger = 65410;
|
||||
public const uint WellFedSpiritTrigger = 65415;
|
||||
|
||||
//Mistletoe
|
||||
public const uint CreateMistletoe = 26206;
|
||||
public const uint CreateHolly = 26207;
|
||||
public const uint CreateSnowflakes = 45036;
|
||||
|
||||
//Winter Wondervolt
|
||||
public const uint Px238WinterWondervoltTransform1 = 26157;
|
||||
public const uint Px238WinterWondervoltTransform2 = 26272;
|
||||
public const uint Px238WinterWondervoltTransform3 = 26273;
|
||||
public const uint Px238WinterWondervoltTransform4 = 26274;
|
||||
|
||||
//Ramblabla
|
||||
public const uint Giddyup = 42924;
|
||||
public const uint RentalRacingRam = 43883;
|
||||
public const uint SwiftWorkRam = 43880;
|
||||
public const uint RentalRacingRamAura = 42146;
|
||||
public const uint RamLevelNeutral = 43310;
|
||||
public const uint RamTrot = 42992;
|
||||
public const uint RamCanter = 42993;
|
||||
public const uint RamGallop = 42994;
|
||||
public const uint RamFatigue = 43052;
|
||||
public const uint ExhaustedRam = 43332;
|
||||
public const uint RelayRaceTurnIn = 44501;
|
||||
|
||||
//Brazierhit
|
||||
public const uint TorchTossingTraining = 45716;
|
||||
public const uint TorchTossingPractice = 46630;
|
||||
public const uint TorchTossingTrainingSuccessAlliance = 45719;
|
||||
public const uint TorchTossingTrainingSuccessHorde = 46651;
|
||||
public const uint BraziersHit = 45724;
|
||||
|
||||
//Ribbonpoledata
|
||||
public const uint HasFullMidsummerSet = 58933;
|
||||
public const uint BurningHotPoleDance = 58934;
|
||||
public const uint RibbonDanceCosmetic = 29726;
|
||||
public const uint RibbonDance = 29175;
|
||||
}
|
||||
|
||||
struct QuestIds
|
||||
{
|
||||
//Ramblabla
|
||||
public const uint BrewfestSpeedBunnyGreen = 43345;
|
||||
public const uint BrewfestSpeedBunnyYellow = 43346;
|
||||
public const uint BrewfestSpeedBunnyRed = 43347;
|
||||
|
||||
//Barkerbunny
|
||||
// Horde
|
||||
public const uint BarkForDrohnsDistillery = 11407;
|
||||
public const uint BarkForTchalisVoodooBrewery = 11408;
|
||||
|
||||
// Alliance
|
||||
public const uint BarkBarleybrew = 11293;
|
||||
public const uint BarkForThunderbrews = 11294;
|
||||
}
|
||||
|
||||
struct TextIds
|
||||
{
|
||||
// Bark For Drohn'S Distillery!
|
||||
public const uint DrohnDistillery1 = 23520;
|
||||
public const uint DrohnDistillery2 = 23521;
|
||||
public const uint DrohnDistillery3 = 23522;
|
||||
public const uint DrohnDistillery4 = 23523;
|
||||
|
||||
// Bark For T'Chali'S Voodoo Brewery!
|
||||
public const uint TChalisVoodoo1 = 23524;
|
||||
public const uint TChalisVoodoo2 = 23525;
|
||||
public const uint TChalisVoodoo3 = 23526;
|
||||
public const uint TChalisVoodoo4 = 23527;
|
||||
|
||||
// Bark For The Barleybrews!
|
||||
public const uint Barleybrew1 = 23464;
|
||||
public const uint Barleybrew2 = 23465;
|
||||
public const uint Barleybrew3 = 23466;
|
||||
public const uint Barleybrew4 = 22941;
|
||||
|
||||
// Bark For The Thunderbrews!
|
||||
public const uint Thunderbrews1 = 23467;
|
||||
public const uint Thunderbrews2 = 23468;
|
||||
public const uint Thunderbrews3 = 23469;
|
||||
public const uint Thunderbrews4 = 22942;
|
||||
}
|
||||
|
||||
struct GameobjectIds
|
||||
{
|
||||
public const uint RibbonPole = 181605;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Script] // 45102 Romantic Picnic
|
||||
class spell_love_is_in_the_air_romantic_picnic : AuraScript
|
||||
{
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.SetStandState(UnitStandStateType.Sit);
|
||||
target.CastSpell(target, SpellIds.MealPeriodic, false);
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
// Every 5 seconds
|
||||
Unit target = GetTarget();
|
||||
Unit caster = GetCaster();
|
||||
|
||||
// If our player is no longer sit, remove all auras
|
||||
if (target.GetStandState() != UnitStandStateType.Sit)
|
||||
{
|
||||
target.RemoveAura(SpellIds.RomanticPicnicAchiev);
|
||||
target.RemoveAura(GetAura());
|
||||
return;
|
||||
}
|
||||
|
||||
target.CastSpell(target, SpellIds.BasketCheck, false); // unknown use, it targets Romantic Basket
|
||||
target.CastSpell(target, RandomHelper.RAND(SpellIds.MealEatVisual, SpellIds.DrinkVisual), false);
|
||||
|
||||
bool foundSomeone = false;
|
||||
// For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
|
||||
// required by achievement and "hearts" visual
|
||||
List<Player> playerList = new List<Player>();
|
||||
AnyPlayerInObjectRangeCheck checker = new AnyPlayerInObjectRangeCheck(target, SharedConst.InteractionDistance * 2);
|
||||
var searcher = new PlayerListSearcher(target, playerList, checker);
|
||||
Cell.VisitWorldObjects(target, searcher, SharedConst.InteractionDistance * 2);
|
||||
foreach (var player in playerList)
|
||||
{
|
||||
if (player != target && player.HasAura(GetId())) // && player.GetStandState() == UNIT_STAND_STATE_SIT)
|
||||
{
|
||||
if (caster)
|
||||
{
|
||||
caster.CastSpell(player, SpellIds.RomanticPicnicAchiev, true);
|
||||
caster.CastSpell(target, SpellIds.RomanticPicnicAchiev, true);
|
||||
}
|
||||
foundSomeone = true;
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSomeone && target.HasAura(SpellIds.RomanticPicnicAchiev))
|
||||
target.RemoveAura(SpellIds.RomanticPicnicAchiev);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 24750 Trick
|
||||
class spell_hallow_end_trick : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale,
|
||||
SpellIds.LeperGnomeCostumeMale, SpellIds.LeperGnomeCostumeFemale, SpellIds.SkeletonCostume, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale, SpellIds.TrickBuff);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
{
|
||||
Gender gender = target.GetGender();
|
||||
uint spellId = SpellIds.TrickBuff;
|
||||
switch (RandomHelper.URand(0, 5))
|
||||
{
|
||||
case 1:
|
||||
spellId = gender == Gender.Female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale;
|
||||
break;
|
||||
case 2:
|
||||
spellId = gender == Gender.Female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale;
|
||||
break;
|
||||
case 3:
|
||||
spellId = gender == Gender.Female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale;
|
||||
break;
|
||||
case 4:
|
||||
spellId = gender == Gender.Female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale;
|
||||
break;
|
||||
case 5:
|
||||
spellId = SpellIds.SkeletonCostume;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
caster.CastSpell(target, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 24751 Trick or Treat
|
||||
class spell_hallow_end_trick_or_treat : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Trick, SpellIds.Treat, SpellIds.TrickedOrTreated);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
{
|
||||
caster.CastSpell(target, RandomHelper.randChance(50) ? SpellIds.Trick : SpellIds.Treat, true);
|
||||
caster.CastSpell(target, SpellIds.TrickedOrTreated, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_hallow_end_tricky_treat : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TrickyTreatSpeed, SpellIds.TrickyTreatTrigger, SpellIds.UpsetTummy);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.HasAura(SpellIds.TrickyTreatTrigger) && caster.GetAuraCount(SpellIds.TrickyTreatSpeed) > 3 && RandomHelper.randChance(33))
|
||||
caster.CastSpell(caster, SpellIds.UpsetTummy, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_hallow_end_wand : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellEntry)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale,
|
||||
SpellIds.LeperGnomeCostumeMale, SpellIds.LeperGnomeCostumeFemale, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale);
|
||||
}
|
||||
|
||||
void HandleScriptEffect()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetHitUnit();
|
||||
|
||||
uint spellId = 0;
|
||||
bool female = target.GetGender() == Gender.Female;
|
||||
|
||||
switch (GetSpellInfo().Id)
|
||||
{
|
||||
case SpellIds.HallowedWandLeperGnome:
|
||||
spellId = female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandPirate:
|
||||
spellId = female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandGhost:
|
||||
spellId = female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandNinja:
|
||||
spellId = female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale;
|
||||
break;
|
||||
case SpellIds.HallowedWandRandom:
|
||||
spellId = RandomHelper.RAND(SpellIds.HallowedWandPirate, SpellIds.HallowedWandNinja, SpellIds.HallowedWandLeperGnome, SpellIds.HallowedWandSkeleton, SpellIds.HallowedWandWisp, SpellIds.HallowedWandGhost, SpellIds.HallowedWandBat);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
caster.CastSpell(target, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterHit.Add(new HitHandler(HandleScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script("spell_gen_slow_roasted_turkey", SpellIds.WellFedApTrigger)]
|
||||
[Script("spell_gen_cranberry_chutney", SpellIds.WellFedZmTrigger)]
|
||||
[Script("spell_gen_spice_bread_stuffing", SpellIds.WellFedHitTrigger)]
|
||||
[Script("spell_gen_pumpkin_pie", SpellIds.WellFedSpiritTrigger)]
|
||||
[Script("spell_gen_candied_sweet_potato", SpellIds.WellFedHasteTrigger)]
|
||||
class spell_pilgrims_bounty_buff_food : AuraScript
|
||||
{
|
||||
public spell_pilgrims_bounty_buff_food(uint triggeredSpellId) : base()
|
||||
{
|
||||
_triggeredSpellId = triggeredSpellId;
|
||||
_handled = false;
|
||||
}
|
||||
|
||||
void HandleTriggerSpell(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (_handled)
|
||||
return;
|
||||
|
||||
_handled = true;
|
||||
GetTarget().CastSpell(GetTarget(), _triggeredSpellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleTriggerSpell, 2, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
|
||||
uint _triggeredSpellId;
|
||||
|
||||
bool _handled;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_winter_veil_mistletoe : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CreateMistletoe, SpellIds.CreateHolly, SpellIds.CreateSnowflakes);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
{
|
||||
uint spellId = RandomHelper.RAND(SpellIds.CreateHolly, SpellIds.CreateMistletoe, SpellIds.CreateSnowflakes);
|
||||
GetCaster().CastSpell(target, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 26275 - PX-238 Winter Wondervolt TRAP
|
||||
class spell_winter_veil_px_238_winter_wondervolt : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Px238WinterWondervoltTransform1, SpellIds.Px238WinterWondervoltTransform2,
|
||||
SpellIds.Px238WinterWondervoltTransform3, SpellIds.Px238WinterWondervoltTransform4);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
uint[] spells =
|
||||
{
|
||||
SpellIds.Px238WinterWondervoltTransform1,
|
||||
SpellIds.Px238WinterWondervoltTransform2,
|
||||
SpellIds.Px238WinterWondervoltTransform3,
|
||||
SpellIds.Px238WinterWondervoltTransform4
|
||||
};
|
||||
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
{
|
||||
for (byte i = 0; i < 4; ++i)
|
||||
if (target.HasAura(spells[i]))
|
||||
return;
|
||||
|
||||
target.CastSpell(target, spells[RandomHelper.URand(0, 3)], true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 42924 - Giddyup!
|
||||
class spell_brewfest_giddyup : AuraScript
|
||||
{
|
||||
void OnChange(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (!target.HasAura(SpellIds.RentalRacingRam) && !target.HasAura(SpellIds.SwiftWorkRam))
|
||||
{
|
||||
target.RemoveAura(GetId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.HasAura(SpellIds.ExhaustedRam))
|
||||
return;
|
||||
|
||||
switch (GetStackAmount())
|
||||
{
|
||||
case 1: // green
|
||||
target.RemoveAura(SpellIds.RamLevelNeutral);
|
||||
target.RemoveAura(SpellIds.RamCanter);
|
||||
target.CastSpell(target, SpellIds.RamTrot, true);
|
||||
break;
|
||||
case 6: // yellow
|
||||
target.RemoveAura(SpellIds.RamTrot);
|
||||
target.RemoveAura(SpellIds.RamGallop);
|
||||
target.CastSpell(target, SpellIds.RamCanter, true);
|
||||
break;
|
||||
case 11: // red
|
||||
target.RemoveAura(SpellIds.RamCanter);
|
||||
target.CastSpell(target, SpellIds.RamGallop, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Default)
|
||||
{
|
||||
target.RemoveAura(SpellIds.RamTrot);
|
||||
target.CastSpell(target, SpellIds.RamLevelNeutral, true);
|
||||
}
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
GetTarget().RemoveAuraFromStack(GetId());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
OnEffectRemove.Add(new EffectApplyHandler(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask));
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 43310 - Ram Level - Neutral
|
||||
// 42992 - Ram - Trot
|
||||
// 42993 - Ram - Canter
|
||||
// 42994 - Ram - Gallop
|
||||
[Script]
|
||||
class spell_brewfest_ram : AuraScript
|
||||
{
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (target.HasAura(SpellIds.ExhaustedRam))
|
||||
return;
|
||||
|
||||
switch (GetId())
|
||||
{
|
||||
case SpellIds.RamLevelNeutral:
|
||||
{
|
||||
Aura aura = target.GetAura(SpellIds.RamFatigue);
|
||||
if (aura != null)
|
||||
aura.ModStackAmount(-4);
|
||||
}
|
||||
break;
|
||||
case SpellIds.RamTrot: // green
|
||||
{
|
||||
Aura aura = target.GetAura(SpellIds.RamFatigue);
|
||||
if (aura != null)
|
||||
aura.ModStackAmount(-2);
|
||||
if (aurEff.GetTickNumber() == 4)
|
||||
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyGreen, true);
|
||||
}
|
||||
break;
|
||||
case SpellIds.RamCanter:
|
||||
target.CastCustomSpell(SpellIds.RamFatigue, SpellValueMod.AuraStack, 1, target, TriggerCastFlags.FullMask);
|
||||
if (aurEff.GetTickNumber() == 8)
|
||||
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyYellow, true);
|
||||
break;
|
||||
case SpellIds.RamGallop:
|
||||
target.CastCustomSpell(SpellIds.RamFatigue, SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5 /*Hack*/, target, TriggerCastFlags.FullMask);
|
||||
if (aurEff.GetTickNumber() == 8)
|
||||
target.CastSpell(target, QuestIds.BrewfestSpeedBunnyRed, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 1, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43052 - Ram Fatigue
|
||||
class spell_brewfest_ram_fatigue : AuraScript
|
||||
{
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
|
||||
if (GetStackAmount() == 101)
|
||||
{
|
||||
target.RemoveAura(SpellIds.RamLevelNeutral);
|
||||
target.RemoveAura(SpellIds.RamTrot);
|
||||
target.RemoveAura(SpellIds.RamCanter);
|
||||
target.RemoveAura(SpellIds.RamGallop);
|
||||
target.RemoveAura(SpellIds.Giddyup);
|
||||
|
||||
target.CastSpell(target, SpellIds.ExhaustedRam, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43450 - Brewfest - apple trap - friendly DND
|
||||
class spell_brewfest_apple_trap : AuraScript
|
||||
{
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().RemoveAura(SpellIds.RamFatigue);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ForceReaction, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43332 - Exhausted Ram
|
||||
class spell_brewfest_exhausted_ram : AuraScript
|
||||
{
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.CastSpell(target, SpellIds.RamLevelNeutral, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43714 - Brewfest - Relay Race - Intro - Force - Player to throw- DND
|
||||
class spell_brewfest_relay_race_intro_force_player_to_throw : SpellScript
|
||||
{
|
||||
void HandleForceCast(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
// All this spells trigger a spell that requires reagents; if the
|
||||
// triggered spell is cast as "triggered", reagents are not consumed
|
||||
GetHitUnit().CastSpell(null, GetSpellInfo().GetEffect(effIndex).TriggerSpell, TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnorePowerAndReagentCost);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleForceCast, 0, SpellEffectName.ForceCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_brewfest_relay_race_turn_in : SpellScript
|
||||
{
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
Aura aura = GetHitUnit().GetAura(SpellIds.SwiftWorkRam);
|
||||
if (aura != null)
|
||||
{
|
||||
aura.SetDuration(aura.GetDuration() + 30 * Time.InMilliseconds);
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.RelayRaceTurnIn, TriggerCastFlags.FullMask);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43876 - Dismount Ram
|
||||
class spell_brewfest_dismount_ram : SpellScript
|
||||
{
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
GetCaster().RemoveAura(SpellIds.RentalRacingRam);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
// 43259 Brewfest - Barker Bunny 1
|
||||
// 43260 Brewfest - Barker Bunny 2
|
||||
// 43261 Brewfest - Barker Bunny 3
|
||||
// 43262 Brewfest - Barker Bunny 4
|
||||
[Script]
|
||||
class spell_brewfest_barker_bunny : AuraScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return GetUnitOwner().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Player target = GetTarget().ToPlayer();
|
||||
|
||||
uint BroadcastTextId = 0;
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.DrohnDistillery1, TextIds.DrohnDistillery2, TextIds.DrohnDistillery3, TextIds.DrohnDistillery4);
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.TChalisVoodoo1, TextIds.TChalisVoodoo2, TextIds.TChalisVoodoo3, TextIds.TChalisVoodoo4);
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.Barleybrew1, TextIds.Barleybrew2, TextIds.Barleybrew3, TextIds.Barleybrew4);
|
||||
|
||||
if (target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Incomplete ||
|
||||
target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Complete)
|
||||
BroadcastTextId = RandomHelper.RAND(TextIds.Thunderbrews1, TextIds.Thunderbrews2, TextIds.Thunderbrews3, TextIds.Thunderbrews4);
|
||||
|
||||
if (BroadcastTextId != 0)
|
||||
target.Talk(BroadcastTextId, ChatMsg.Say, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay), target);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectApply.Add(new EffectApplyHandler(OnApply, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 45724 - Braziers Hit!
|
||||
class spell_midsummer_braziers_hit : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TorchTossingTraining, SpellIds.TorchTossingPractice);
|
||||
}
|
||||
|
||||
void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Player player = GetTarget().ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if ((player.HasAura(SpellIds.TorchTossingTraining) && GetStackAmount() == 8) || (player.HasAura(SpellIds.TorchTossingPractice) && GetStackAmount() == 20))
|
||||
{
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
player.CastSpell(player, SpellIds.TorchTossingTrainingSuccessAlliance, true);
|
||||
else if (player.GetTeam() == Team.Horde)
|
||||
player.CastSpell(player, SpellIds.TorchTossingTrainingSuccessHorde, true);
|
||||
Remove();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Reapply));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_gen_ribbon_pole_dancer_check : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.HasFullMidsummerSet, SpellIds.RibbonDance, SpellIds.BurningHotPoleDance);
|
||||
}
|
||||
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
|
||||
// check if aura needs to be removed
|
||||
if (!target.FindNearestGameObject(GameobjectIds.RibbonPole, 8.0f) || !target.HasUnitState(UnitState.Casting))
|
||||
{
|
||||
target.InterruptNonMeleeSpells(false);
|
||||
target.RemoveAurasDueToSpell(GetId());
|
||||
target.RemoveAura(SpellIds.RibbonDanceCosmetic);
|
||||
return;
|
||||
}
|
||||
|
||||
// set xp buff duration
|
||||
Aura aur = target.GetAura(SpellIds.RibbonDance);
|
||||
if (aur != null)
|
||||
{
|
||||
aur.SetMaxDuration(Math.Min(3600000, aur.GetMaxDuration() + 180000));
|
||||
aur.RefreshDuration();
|
||||
|
||||
// reward achievement criteria
|
||||
if (aur.GetMaxDuration() == 3600000 && target.HasAura(SpellIds.HasFullMidsummerSet))
|
||||
target.CastSpell(target, SpellIds.BurningHotPoleDance, true);
|
||||
}
|
||||
else
|
||||
target.AddAura(SpellIds.RibbonDance, target);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,726 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Spells.Hunter
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint AspectCheetahSlow = 186258;
|
||||
public const uint BestialWrath = 19574;
|
||||
public const uint ChimeraShotHeal = 53353;
|
||||
public const uint Exhilaration = 109304;
|
||||
public const uint ExhilarationPet = 128594;
|
||||
public const uint ExhilarationR2 = 231546;
|
||||
public const uint Fire = 82926;
|
||||
public const uint GenericEnergizeFocus = 91954;
|
||||
public const uint ImprovedMendPet = 24406;
|
||||
public const uint LockAndLoad = 56453;
|
||||
public const uint Lonewolf = 155228;
|
||||
public const uint MastersCallTriggered = 62305;
|
||||
public const uint MisdirectionProc = 35079;
|
||||
public const uint PetLastStandTriggered = 53479;
|
||||
public const uint PetHeartOfThePhoenix = 55709;
|
||||
public const uint PetHeartOfThePhoenixTriggered = 54114;
|
||||
public const uint PetHeartOfThePhoenixDebuff = 55711;
|
||||
public const uint PetCarrionFeederTriggered = 54045;
|
||||
public const uint Readiness = 23989;
|
||||
public const uint SerpentSting = 1978;
|
||||
public const uint SniperTrainingR1 = 53302;
|
||||
public const uint SniperTrainingBuffR1 = 64418;
|
||||
public const uint SteadyShotFocus = 77443;
|
||||
public const uint T94PGreatness = 68130;
|
||||
public const uint DraeneiGiftOfTheNaaru = 59543;
|
||||
public const uint RoarOfSacrificeTriggered = 67481;
|
||||
}
|
||||
|
||||
[Script] // 186257 - Aspect of the Cheetah
|
||||
class spell_hun_aspect_cheetah : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.AspectCheetahSlow);
|
||||
}
|
||||
|
||||
void HandleOnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
if (GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Expire)
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.AspectCheetahSlow, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(HandleOnRemove, 0, AuraType.ModIncreaseSpeed, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
// 53209 - Chimera Shot
|
||||
[Script]
|
||||
class spell_hun_chimera_shot : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ChimeraShotHeal, SpellIds.SerpentSting);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void HandleScriptEffect(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.ChimeraShotHeal, true);
|
||||
Aura aur = GetHitUnit().GetAura(SpellIds.SerpentSting, GetCaster().GetGUID());
|
||||
if (aur != null)
|
||||
aur.SetDuration(aur.GetSpellInfo().GetMaxDuration(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
// 77767 - Cobra Shot
|
||||
[Script]
|
||||
class spell_hun_cobra_shot : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.GenericEnergizeFocus, SpellIds.SerpentSting);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void HandleScriptEffect(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.GenericEnergizeFocus, true);
|
||||
Aura aur = GetHitUnit().GetAura(SpellIds.SerpentSting, GetCaster().GetGUID());
|
||||
if (aur != null)
|
||||
{
|
||||
int newDuration = aur.GetDuration() + GetEffectValue() * Time.InMilliseconds;
|
||||
aur.SetDuration(Math.Min(newDuration, aur.GetMaxDuration()), true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 1, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
// 781 - Disengage
|
||||
[Script]
|
||||
class spell_hun_disengage : SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.IsTypeId(TypeId.Player) && !caster.IsInCombat())
|
||||
return SpellCastResult.CantDoThatRightNow;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 109304 - Exhilaration
|
||||
class spell_hun_exhilaration : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ExhilarationR2, SpellIds.Lonewolf);
|
||||
}
|
||||
|
||||
void HandleOnHit()
|
||||
{
|
||||
if (GetCaster().HasAura(SpellIds.ExhilarationR2) && !GetCaster().HasAura(SpellIds.Lonewolf))
|
||||
GetCaster().CastSpell((Unit)null, SpellIds.ExhilarationPet, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnHit.Add(new HitHandler(HandleOnHit));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 212658 - Hunting Party
|
||||
class spell_hun_hunting_party : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Exhilaration, SpellIds.ExhilarationPet);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.Exhilaration, -TimeSpan.FromSeconds(aurEff.GetAmount()));
|
||||
GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.ExhilarationPet, -TimeSpan.FromSeconds(aurEff.GetAmount()));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// -19572 - Improved Mend Pet
|
||||
[Script]
|
||||
class spell_hun_improved_mend_pet : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ImprovedMendPet);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return RandomHelper.randChance(GetEffect(0).GetAmount());
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.ImprovedMendPet, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 53478 - Last Stand Pet
|
||||
[Script]
|
||||
class spell_hun_last_stand_pet : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PetLastStandTriggered);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
int healthModSpellBasePoints0 = (int)caster.CountPctFromMaxHealth(30);
|
||||
caster.CastCustomSpell(caster, SpellIds.PetLastStandTriggered, healthModSpellBasePoints0, 0, 0, true, null);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 53271 - Masters Call
|
||||
[Script]
|
||||
class spell_hun_masters_call : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MastersCallTriggered, (uint)spellInfo.GetEffect(0).CalcValue());
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit ally = GetHitUnit();
|
||||
if (ally)
|
||||
{
|
||||
Player caster = GetCaster().ToPlayer();
|
||||
if (caster)
|
||||
{
|
||||
Pet target = caster.GetPet();
|
||||
if (target)
|
||||
{
|
||||
TriggerCastFlags castMask = (TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnoreCasterAurastate);
|
||||
target.CastSpell(ally, (uint)GetEffectValue(), castMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleScriptEffect(uint effIndex)
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
{
|
||||
// Cannot be processed while pet is dead
|
||||
TriggerCastFlags castMask = (TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnoreCasterAurastate);
|
||||
target.CastSpell(target, SpellIds.MastersCallTriggered, castMask);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 1, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
// 34477 - Misdirection
|
||||
[Script]
|
||||
class spell_hun_misdirection : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MisdirectionProc);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Default || !GetTarget().HasAura(SpellIds.MisdirectionProc))
|
||||
GetTarget().ResetRedirectThreat();
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return GetTarget().GetRedirectThreatTarget();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.MisdirectionProc, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 35079 - Misdirection (Proc)
|
||||
[Script]
|
||||
class spell_hun_misdirection_proc : AuraScript
|
||||
{
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().ResetRedirectThreat();
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
// 54044 - Pet Carrion Feeder
|
||||
[Script]
|
||||
class spell_hun_pet_carrion_feeder : SpellScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
if (!GetCaster().IsPet())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PetCarrionFeederTriggered);
|
||||
}
|
||||
|
||||
SpellCastResult CheckIfCorpseNear()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
float max_range = GetSpellInfo().GetMaxRange(false);
|
||||
|
||||
// search for nearby enemy corpse in range
|
||||
var check = new AnyDeadUnitSpellTargetInRangeCheck<WorldObject>(caster, max_range, GetSpellInfo(), SpellTargetCheckTypes.Enemy);
|
||||
var searcher = new WorldObjectSearcher(caster, check);
|
||||
Cell.VisitWorldObjects(caster, searcher, max_range);
|
||||
if (!searcher.GetTarget())
|
||||
Cell.VisitGridObjects(caster, searcher, max_range);
|
||||
if (!searcher.GetTarget())
|
||||
return SpellCastResult.NoEdibleCorpses;
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
caster.CastSpell(caster, SpellIds.PetCarrionFeederTriggered, false);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckIfCorpseNear));
|
||||
}
|
||||
}
|
||||
|
||||
// 55709 - Pet Heart of the Phoenix
|
||||
[Script]
|
||||
class spell_hun_pet_heart_of_the_phoenix : SpellScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
if (!GetCaster().IsPet())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PetHeartOfThePhoenixTriggered, SpellIds.PetHeartOfThePhoenixDebuff);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit owner = caster.GetOwner();
|
||||
if (owner)
|
||||
{
|
||||
if (!caster.HasAura(SpellIds.PetHeartOfThePhoenixDebuff))
|
||||
{
|
||||
owner.CastCustomSpell(SpellIds.PetHeartOfThePhoenixTriggered, SpellValueMod.BasePoint0, 100, caster, true);
|
||||
caster.CastSpell(caster, SpellIds.PetHeartOfThePhoenixDebuff, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
// 23989 - Readiness
|
||||
[Script]
|
||||
class spell_hun_readiness : SpellScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
|
||||
GetCaster().GetSpellHistory().ResetCooldowns(p =>
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(p.Key);
|
||||
|
||||
///! If spellId in cooldown map isn't valid, the above will return a null pointer.
|
||||
if (spellInfo.SpellFamilyName == SpellFamilyNames.Hunter &&
|
||||
spellInfo.Id != SpellIds.Readiness &&
|
||||
spellInfo.Id != SpellIds.BestialWrath &&
|
||||
spellInfo.Id != SpellIds.DraeneiGiftOfTheNaaru &&
|
||||
spellInfo.GetRecoveryTime() > 0)
|
||||
return true;
|
||||
return false;
|
||||
}, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 82925 - Ready, Set, Aim...
|
||||
[Script]
|
||||
class spell_hun_ready_set_aim : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Fire);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
if (GetStackAmount() == 5)
|
||||
{
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.Fire, true, null, aurEff);
|
||||
GetTarget().RemoveAura(GetId());
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 53480 - Roar of Sacrifice
|
||||
class spell_hun_roar_of_sacrifice : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RoarOfSacrificeTriggered);
|
||||
}
|
||||
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo == null || !Convert.ToBoolean((int)damageInfo.GetSchoolMask() & aurEff.GetMiscValue()))
|
||||
return false;
|
||||
|
||||
if (!GetCaster())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
int damage = (int)MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount());
|
||||
eventInfo.GetActor().CastCustomSpell(SpellIds.RoarOfSacrificeTriggered, SpellValueMod.BasePoint0, damage, GetCaster(), TriggerCastFlags.FullMask, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckProc, 1, AuraType.Dummy));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 37506 - Scatter Shot
|
||||
[Script]
|
||||
class spell_hun_scatter_shot : SpellScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Player caster = GetCaster().ToPlayer();
|
||||
// break Auto Shot and autohit
|
||||
caster.InterruptSpell(CurrentSpellTypes.AutoRepeat);
|
||||
caster.AttackStop();
|
||||
caster.SendAttackSwingCancelAttack();
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// -53302 - Sniper Training
|
||||
[Script]
|
||||
class spell_hun_sniper_training : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SniperTrainingR1, SpellIds.SniperTrainingBuffR1);
|
||||
}
|
||||
|
||||
void HandlePeriodic(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (aurEff.GetAmount() <= 0)
|
||||
{
|
||||
uint spellId = SpellIds.SniperTrainingBuffR1 + GetId() - SpellIds.SniperTrainingR1;
|
||||
Unit target = GetTarget();
|
||||
target.CastSpell(target, spellId, true, null, aurEff);
|
||||
Player playerTarget = GetUnitOwner().ToPlayer();
|
||||
if (playerTarget)
|
||||
{
|
||||
int baseAmount = aurEff.GetBaseAmount();
|
||||
int amount = playerTarget.CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff.GetEffIndex(), baseAmount);
|
||||
GetEffect(0).SetAmount(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleUpdatePeriodic(AuraEffect aurEff)
|
||||
{
|
||||
Player playerTarget = GetUnitOwner().ToPlayer();
|
||||
if (playerTarget)
|
||||
{
|
||||
int baseAmount = aurEff.GetBaseAmount();
|
||||
int amount = playerTarget.isMoving() ?
|
||||
playerTarget.CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff.GetEffIndex(), baseAmount) :
|
||||
aurEff.GetAmount() - 1;
|
||||
aurEff.SetAmount(amount);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicTriggerSpell));
|
||||
OnEffectUpdatePeriodic.Add(new EffectUpdatePeriodicHandler(HandleUpdatePeriodic, 0, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// 56641 - Steady Shot
|
||||
[Script]
|
||||
class spell_hun_steady_shot : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SteadyShotFocus);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void HandleOnHit()
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.SteadyShotFocus, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnHit.Add(new HitHandler(HandleOnHit));
|
||||
}
|
||||
}
|
||||
|
||||
// 1515 - Tame Beast
|
||||
[Script]
|
||||
class spell_hun_tame_beast : SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (!caster.IsTypeId(TypeId.Player))
|
||||
return SpellCastResult.DontReport;
|
||||
|
||||
if (!GetExplTargetUnit())
|
||||
return SpellCastResult.BadImplicitTargets;
|
||||
|
||||
Creature target = GetExplTargetUnit().ToCreature();
|
||||
if (target)
|
||||
{
|
||||
if (target.getLevel() > caster.getLevel())
|
||||
return SpellCastResult.Highlevel;
|
||||
|
||||
// use SMSG_PET_TAME_FAILURE?
|
||||
if (!target.GetCreatureTemplate().IsTameable(caster.ToPlayer().CanTameExoticPets()))
|
||||
return SpellCastResult.BadTargets;
|
||||
|
||||
if (!caster.GetPetGUID().IsEmpty())
|
||||
return SpellCastResult.AlreadyHaveSummon;
|
||||
|
||||
if (!caster.GetCharmGUID().IsEmpty())
|
||||
return SpellCastResult.AlreadyHaveCharm;
|
||||
}
|
||||
else
|
||||
return SpellCastResult.BadImplicitTargets;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
}
|
||||
}
|
||||
|
||||
// 53434 - Call of the Wild
|
||||
[Script]
|
||||
class spell_hun_target_only_pet_and_owner : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.Clear();
|
||||
targets.Add(GetCaster());
|
||||
Unit owner = GetCaster().GetOwner();
|
||||
if (owner)
|
||||
targets.Add(owner);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitCasterAreaParty));
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitCasterAreaParty));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 67151 - Item - Hunter T9 4P Bonus (Steady Shot)
|
||||
class spell_hun_t9_4p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.T94PGreatness);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
if (eventInfo.GetActor().IsTypeId(TypeId.Player) && eventInfo.GetActor().ToPlayer().GetPet())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Unit caster = eventInfo.GetActor();
|
||||
|
||||
caster.CastSpell(caster.ToPlayer().GetPet(), SpellIds.T94PGreatness, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// -56333 - T.N.T.
|
||||
[Script]
|
||||
class spell_hun_tnt : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LockAndLoad);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return RandomHelper.randChance(GetEffect(0).GetAmount());
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.LockAndLoad, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,629 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Groups;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Spells.Mage
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint BlazingBarrierTrigger = 235314;
|
||||
public const uint Cauterized = 87024;
|
||||
public const uint CauterizeDot = 87023;
|
||||
public const uint ConeOfCold = 120;
|
||||
public const uint ConeOfColdSlow = 212792;
|
||||
public const uint ConjureRefreshment = 116136;
|
||||
public const uint ConjureRefreshmentTable = 167145;
|
||||
public const uint DradonhawkForm = 32818;
|
||||
public const uint FingersOfFrost = 44544;
|
||||
public const uint FrostNova = 122;
|
||||
public const uint GiraffeForm = 32816;
|
||||
public const uint IceBarrier = 11426;
|
||||
public const uint IceBlock = 45438;
|
||||
public const uint Ignite = 12654;
|
||||
public const uint LivingBombExplosion = 44461;
|
||||
public const uint LivingBombPeriodic = 217694;
|
||||
public const uint ManaSurge = 37445;
|
||||
public const uint RingOfFrostDummy = 91264;
|
||||
public const uint RingOfFrostFreeze = 82691;
|
||||
public const uint RingOfFrostSummon = 113724;
|
||||
public const uint SerpentForm = 32817;
|
||||
public const uint SheepForm = 32820;
|
||||
public const uint SquirrelForm = 32813;
|
||||
public const uint TemporalDisplacement = 80354;
|
||||
public const uint WorgenForm = 32819;
|
||||
public const uint Chilled = 205708;
|
||||
|
||||
//Misc
|
||||
public const uint HunterInsanity = 95809;
|
||||
public const uint ShamanExhaustion = 57723;
|
||||
public const uint ShamanSated = 57724;
|
||||
public const uint PetNetherwindsFatigued = 160455;
|
||||
}
|
||||
|
||||
[Script] // 235313 - Blazing Barrier
|
||||
class spell_mage_blazing_barrier : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BlazingBarrierTrigger);
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
canBeRecalculated = false;
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
amount = (int)(caster.SpellBaseHealingBonusDone(GetSpellInfo().GetSchoolMask()) * 7.0f);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Unit caster = eventInfo.GetDamageInfo().GetVictim();
|
||||
Unit target = eventInfo.GetDamageInfo().GetAttacker();
|
||||
|
||||
if (caster && target)
|
||||
caster.CastSpell(target, SpellIds.BlazingBarrierTrigger, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.SchoolAbsorb));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 198063 - Burning Determination
|
||||
class spell_mage_burning_determination : AuraScript
|
||||
{
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo != null)
|
||||
if (spellInfo.GetAllEffectsMechanicMask().HasAnyFlag(((1u << (int)Mechanics.Interrupt) | (1 << (int)Mechanics.Silence))))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 86949 - Cauterize
|
||||
class spell_mage_cauterize : SpellScript
|
||||
{
|
||||
void SuppressSpeedBuff(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectLaunch.Add(new EffectHandler(SuppressSpeedBuff, 2, SpellEffectName.TriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_mage_cauterize_AuraScript : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return spellInfo.GetEffect(2) != null && ValidateSpellInfo(SpellIds.CauterizeDot, SpellIds.Cauterized, spellInfo.GetEffect(2).TriggerSpell);
|
||||
}
|
||||
|
||||
void HandleAbsorb(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
|
||||
{
|
||||
AuraEffect effect1 = GetEffect(1);
|
||||
if (effect1 == null || !GetTargetApplication().HasEffect(1) ||
|
||||
dmgInfo.GetDamage() < GetTarget().GetHealth() ||
|
||||
dmgInfo.GetDamage() > GetTarget().GetMaxHealth() * 2 ||
|
||||
GetTarget().HasAura(SpellIds.Cauterized))
|
||||
{
|
||||
PreventDefaultAction();
|
||||
return;
|
||||
}
|
||||
|
||||
GetTarget().SetHealth(GetTarget().CountPctFromMaxHealth(effect1.GetAmount()));
|
||||
GetTarget().CastSpell(GetTarget(), GetAura().GetSpellEffectInfo(2).TriggerSpell, TriggerCastFlags.FullMask);
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.CauterizeDot, TriggerCastFlags.FullMask);
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.Cauterized, TriggerCastFlags.FullMask);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectAbsorb.Add(new EffectAbsorbHandler(HandleAbsorb, 0));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 235219 - Cold Snap
|
||||
class spell_mage_cold_snap : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ConeOfCold, SpellIds.FrostNova, SpellIds.IceBarrier, SpellIds.IceBlock);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
GetCaster().GetSpellHistory().ResetCooldowns(p =>
|
||||
{
|
||||
switch (p.Key)
|
||||
{
|
||||
case SpellIds.ConeOfCold:
|
||||
case SpellIds.FrostNova:
|
||||
case SpellIds.IceBarrier:
|
||||
case SpellIds.IceBlock:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 120 - Cone of Cold
|
||||
class spell_mage_cone_of_cold : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ConeOfColdSlow);
|
||||
}
|
||||
|
||||
void HandleSlow(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.ConeOfColdSlow, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleSlow, 0, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 190336 - Conjure Refreshment
|
||||
class spell_mage_conjure_refreshment : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ConjureRefreshment, SpellIds.ConjureRefreshmentTable);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Player caster = GetCaster().ToPlayer();
|
||||
if (caster)
|
||||
{
|
||||
Group group = caster.GetGroup();
|
||||
if (group)
|
||||
caster.CastSpell(caster, SpellIds.ConjureRefreshmentTable, true);
|
||||
else
|
||||
caster.CastSpell(caster, SpellIds.ConjureRefreshment, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 11426 - Ice Barrier
|
||||
class spell_mage_ice_barrier : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellEntry)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Chilled);
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
canBeRecalculated = false;
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
amount += (int)(caster.SpellBaseHealingBonusDone(GetSpellInfo().GetSchoolMask()) * 10.0f);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
Unit caster = eventInfo.GetDamageInfo().GetVictim();
|
||||
Unit target = eventInfo.GetDamageInfo().GetAttacker();
|
||||
|
||||
if (caster && target)
|
||||
caster.CastSpell(target, SpellIds.Chilled, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.SchoolAbsorb));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.SchoolAbsorb));
|
||||
}
|
||||
}
|
||||
|
||||
// 11119 - Ignite
|
||||
[Script]
|
||||
class spell_mage_ignite : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Ignite);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetProcTarget();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
SpellInfo igniteDot = Global.SpellMgr.GetSpellInfo(SpellIds.Ignite);
|
||||
int pct = aurEff.GetAmount();
|
||||
|
||||
int amount = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), pct) / igniteDot.GetMaxTicks(Difficulty.None));
|
||||
amount += (int)eventInfo.GetProcTarget().GetRemainingPeriodicAmount(eventInfo.GetActor().GetGUID(), SpellIds.Ignite, AuraType.PeriodicDamage);
|
||||
GetTarget().CastCustomSpell(SpellIds.Ignite, SpellValueMod.BasePoint0, amount, eventInfo.GetProcTarget(), true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 37447 - Improved Mana Gems
|
||||
[Script] // 61062 - Improved Mana Gems
|
||||
class spell_mage_imp_mana_gems : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ManaSurge);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
eventInfo.GetActor().CastSpell((Unit)null, SpellIds.ManaSurge, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 44457 - Living Bomb
|
||||
class spell_mage_living_bomb : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LivingBombPeriodic);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetCaster().CastCustomSpell(SpellIds.LivingBombPeriodic, SpellValueMod.BasePoint2, 1, GetHitUnit(), TriggerCastFlags.FullMask);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 44461 - Living Bomb
|
||||
class spell_mage_living_bomb_explosion : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return spellInfo.NeedsExplicitUnitTarget() && ValidateSpellInfo(SpellIds.LivingBombPeriodic);
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.Remove(GetExplTargetWorldObject());
|
||||
}
|
||||
|
||||
void HandleSpread(uint effIndex)
|
||||
{
|
||||
if (GetSpellValue().EffectBasePoints[0] > 0)
|
||||
GetCaster().CastCustomSpell(SpellIds.LivingBombPeriodic, SpellValueMod.BasePoint2, 0, GetHitUnit(), TriggerCastFlags.FullMask);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleSpread, 1, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 217694 - Living Bomb
|
||||
class spell_mage_living_bomb_periodic : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LivingBombExplosion);
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Expire)
|
||||
return;
|
||||
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
caster.CastCustomSpell(SpellIds.LivingBombExplosion, SpellValueMod.BasePoint0, aurEff.GetAmount(), GetTarget(), TriggerCastFlags.FullMask);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 2, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
// @todo move out of here and rename - not a mage spell
|
||||
[Script] // 32826 - Polymorph (Visual)
|
||||
class spell_mage_polymorph_visual : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(PolymorhForms);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit target = GetCaster().FindNearestCreature(NPC_AUROSALIA, 30.0f);
|
||||
if (target)
|
||||
if (target.IsTypeId(TypeId.Unit))
|
||||
target.CastSpell(target, PolymorhForms[RandomHelper.IRand(0, 5)], true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
// add dummy effect spell handler to Polymorph visual
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
|
||||
const uint NPC_AUROSALIA = 18744;
|
||||
uint[] PolymorhForms =
|
||||
{
|
||||
SpellIds.SquirrelForm,
|
||||
SpellIds.GiraffeForm,
|
||||
SpellIds.SerpentForm,
|
||||
SpellIds.DradonhawkForm,
|
||||
SpellIds.WorgenForm,
|
||||
SpellIds.SheepForm
|
||||
};
|
||||
}
|
||||
|
||||
[Script] // 235450 - Prismatic Barrier
|
||||
class spell_mage_prismatic_barrier : AuraScript
|
||||
{
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
canBeRecalculated = false;
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
amount += (int)(caster.SpellBaseHealingBonusDone(GetSpellInfo().GetSchoolMask()) * 7.0f);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.SchoolAbsorb));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 136511 - Ring of Frost
|
||||
class spell_mage_ring_of_frost : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze);
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
TempSummon ringOfFrost = GetRingOfFrostMinion();
|
||||
if (ringOfFrost)
|
||||
GetTarget().CastSpell(ringOfFrost.GetPositionX(), ringOfFrost.GetPositionY(), ringOfFrost.GetPositionZ(), SpellIds.RingOfFrostFreeze, true);
|
||||
}
|
||||
|
||||
void Apply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
List<TempSummon> minions = new List<TempSummon>();
|
||||
GetTarget().GetAllMinionsByEntry(minions, (uint)Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon).GetEffect(0).MiscValue);
|
||||
|
||||
// Get the last summoned RoF, save it and despawn older ones
|
||||
foreach (var summon in minions)
|
||||
{
|
||||
TempSummon ringOfFrost = GetRingOfFrostMinion();
|
||||
if (ringOfFrost)
|
||||
{
|
||||
if (summon.GetTimer() > ringOfFrost.GetTimer())
|
||||
{
|
||||
ringOfFrost.DespawnOrUnsummon();
|
||||
_ringOfFrostGUID = summon.GetGUID();
|
||||
}
|
||||
else
|
||||
summon.DespawnOrUnsummon();
|
||||
}
|
||||
else
|
||||
_ringOfFrostGUID = summon.GetGUID();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleEffectPeriodic, 0, AuraType.ProcTriggerSpell));
|
||||
OnEffectApply.Add(new EffectApplyHandler(Apply, 0, AuraType.ProcTriggerSpell, AuraEffectHandleModes.RealOrReapplyMask));
|
||||
}
|
||||
|
||||
TempSummon GetRingOfFrostMinion()
|
||||
{
|
||||
Creature creature = ObjectAccessor.GetCreature(GetOwner(), _ringOfFrostGUID);
|
||||
if (creature)
|
||||
return creature.ToTempSummon();
|
||||
return null;
|
||||
}
|
||||
|
||||
ObjectGuid _ringOfFrostGUID;
|
||||
}
|
||||
|
||||
[Script] // 82691 - Ring of Frost (freeze efect)
|
||||
class spell_mage_ring_of_frost_freeze : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze);
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
WorldLocation dest = GetExplTargetDest();
|
||||
float outRadius = Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon).GetEffect(0).CalcRadius();
|
||||
float inRadius = 6.5f;
|
||||
|
||||
targets.RemoveAll(target =>
|
||||
{
|
||||
Unit unit = target.ToUnit();
|
||||
if (!unit)
|
||||
return true;
|
||||
|
||||
return unit.HasAura(SpellIds.RingOfFrostDummy) || unit.HasAura(SpellIds.RingOfFrostFreeze) || unit.GetExactDist(GetExplTargetDest()) > outRadius || unit.GetExactDist(GetExplTargetDest()) < inRadius;
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEnemy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_mage_ring_of_frost_freeze_AuraScript : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RingOfFrostDummy);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Expire)
|
||||
if (GetCaster())
|
||||
GetCaster().CastSpell(GetTarget(), SpellIds.RingOfFrostDummy, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModStun, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 80353 - Time Warp
|
||||
class spell_mage_time_warp : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TemporalDisplacement, SpellIds.HunterInsanity, SpellIds.ShamanExhaustion, SpellIds.ShamanSated, SpellIds.PetNetherwindsFatigued);
|
||||
}
|
||||
|
||||
void RemoveInvalidTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.TemporalDisplacement));
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.HunterInsanity));
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.ShamanExhaustion));
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.ShamanSated));
|
||||
}
|
||||
|
||||
void ApplyDebuff()
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
target.CastSpell(target, SpellIds.TemporalDisplacement, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(RemoveInvalidTargets, SpellConst.EffectAll, Targets.UnitCasterAreaRaid));
|
||||
AfterHit.Add(new HitHandler(ApplyDebuff));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] //228597 - Frostbolt 84721 - Frozen Orb 190357 - Blizzard
|
||||
class spell_mage_trigger_chilled : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Chilled);
|
||||
}
|
||||
|
||||
void HandleChilled()
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
GetCaster().CastSpell(target, SpellIds.Chilled, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnHit.Add(new HitHandler(HandleChilled));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 33395 Water Elemental's Freeze
|
||||
class spell_mage_water_elemental_freeze : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FingersOfFrost);
|
||||
}
|
||||
|
||||
void HandleImprovedFreeze()
|
||||
{
|
||||
Unit owner = GetCaster().GetOwner();
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
owner.CastSpell(owner, SpellIds.FingersOfFrost, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterHit.Add(new HitHandler(HandleImprovedFreeze));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
|
||||
namespace Scripts.Spells.Monk
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint CracklingJadeLightningChannel = 117952;
|
||||
public const uint CracklingJadeLightningChiProc = 123333;
|
||||
public const uint CracklingJadeLightningKnockback = 117962;
|
||||
public const uint CracklingJadeLightningKnockbackCd = 117953;
|
||||
public const uint ProvokeSingleTarget = 116189;
|
||||
public const uint ProvokeAoe = 118635;
|
||||
public const uint SoothingMist = 115175;
|
||||
public const uint StanceOfTheSpiritedCrane = 154436;
|
||||
public const uint SurgingMistHeal = 116995;
|
||||
}
|
||||
|
||||
[Script] // 117952 - Crackling Jade Lightning
|
||||
class spell_monk_crackling_jade_lightning : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.StanceOfTheSpiritedCrane, SpellIds.CracklingJadeLightningChiProc);
|
||||
}
|
||||
|
||||
void OnTick(AuraEffect aurEff)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
if (caster.HasAura(SpellIds.StanceOfTheSpiritedCrane))
|
||||
caster.CastSpell(caster, SpellIds.CracklingJadeLightningChiProc, TriggerCastFlags.FullMask);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnTick, 0, AuraType.PeriodicDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 117959 - Crackling Jade Lightning
|
||||
class spell_monk_crackling_jade_lightning_knockback_proc_aura : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CracklingJadeLightningKnockback, SpellIds.CracklingJadeLightningKnockbackCd);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
if (GetTarget().HasAura(SpellIds.CracklingJadeLightningKnockbackCd))
|
||||
return false;
|
||||
|
||||
if (eventInfo.GetActor().HasAura(SpellIds.CracklingJadeLightningChannel, GetTarget().GetGUID()))
|
||||
return false;
|
||||
|
||||
Spell currentChanneledSpell = GetTarget().GetCurrentSpell(CurrentSpellTypes.Channeled);
|
||||
if (!currentChanneledSpell || currentChanneledSpell.GetSpellInfo().Id != SpellIds.CracklingJadeLightningChannel)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
GetTarget().CastSpell(eventInfo.GetActor(), SpellIds.CracklingJadeLightningKnockback, TriggerCastFlags.FullMask);
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.CracklingJadeLightningKnockbackCd, TriggerCastFlags.FullMask);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 115546 - Provoke
|
||||
class spell_monk_provoke : SpellScript
|
||||
{
|
||||
const uint BlackOxStatusEntry = 61146;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
if (!spellInfo.GetExplicitTargetMask().HasAnyFlag(SpellCastTargetFlags.UnitMask)) // ensure GetExplTargetUnit() will return something meaningful during CheckCast
|
||||
return false;
|
||||
return ValidateSpellInfo(SpellIds.ProvokeSingleTarget, SpellIds.ProvokeAoe);
|
||||
}
|
||||
|
||||
SpellCastResult CheckExplicitTarget()
|
||||
{
|
||||
if (GetExplTargetUnit().GetEntry() != BlackOxStatusEntry)
|
||||
{
|
||||
SpellInfo singleTarget = Global.SpellMgr.GetSpellInfo(SpellIds.ProvokeSingleTarget);
|
||||
SpellCastResult singleTargetExplicitResult = singleTarget.CheckExplicitTarget(GetCaster(), GetExplTargetUnit());
|
||||
if (singleTargetExplicitResult != SpellCastResult.SpellCastOk)
|
||||
return singleTargetExplicitResult;
|
||||
}
|
||||
else if (GetExplTargetUnit().GetOwnerGUID() != GetCaster().GetGUID())
|
||||
return SpellCastResult.BadTargets;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (GetHitUnit().GetEntry() != BlackOxStatusEntry)
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.ProvokeSingleTarget, true);
|
||||
else
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.ProvokeAoe, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckExplicitTarget));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,848 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Scripts.Spells.Paladin
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint AvengersShield = 31935;
|
||||
public const uint AuraMasteryImmune = 64364;
|
||||
public const uint BeaconOfLight = 53563;
|
||||
public const uint BeaconOfLightHeal = 53652;
|
||||
public const uint BlessingOfLowerCityDruid = 37878;
|
||||
public const uint BlessingOfLowerCityPaladin = 37879;
|
||||
public const uint BlessingOfLowerCityPriest = 37880;
|
||||
public const uint BlessingOfLowerCityShaman = 37881;
|
||||
public const uint ConcentractionAura = 19746;
|
||||
public const uint DivinePurposeProc = 90174;
|
||||
public const uint DivineSteedHuman = 221883;
|
||||
public const uint DivineSteedDraenei = 221887;
|
||||
public const uint DivineSteedBloodelf = 221886;
|
||||
public const uint DivineSteedTauren = 221885;
|
||||
public const uint DivineStormDamage = 224239;
|
||||
public const uint EnduringLight = 40471;
|
||||
public const uint EnduringJudgement = 40472;
|
||||
public const uint EyeForAnEyeRank1 = 9799;
|
||||
public const uint EyeForAnEyeDamage = 25997;
|
||||
public const uint Forbearance = 25771;
|
||||
public const uint HandOfSacrifice = 6940;
|
||||
public const uint HolyMending = 64891;
|
||||
public const uint HolyPowerArmor = 28790;
|
||||
public const uint HolyPowerAttackPower = 28791;
|
||||
public const uint HolyPowerSpellPower = 28793;
|
||||
public const uint HolyPowerMp5 = 28795;
|
||||
public const uint HolyShockR1 = 20473;
|
||||
public const uint HolyShockR1Damage = 25912;
|
||||
public const uint HolyShockR1Healing = 25914;
|
||||
public const uint ImmuneShieldMarker = 61988;
|
||||
public const uint ItemHealingTrance = 37706;
|
||||
public const uint JudgementDamage = 54158;
|
||||
public const uint RighteousDefenseTaunt = 31790;
|
||||
public const uint SealOfCommand = 105361;
|
||||
public const uint SealOfRighteousness = 25742;
|
||||
}
|
||||
|
||||
// 31821 - Aura Mastery
|
||||
[Script]
|
||||
class spell_pal_aura_mastery : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.AuraMasteryImmune);
|
||||
}
|
||||
|
||||
void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.AuraMasteryImmune, true);
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().RemoveOwnedAura(SpellIds.AuraMasteryImmune, GetCasterGUID());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(HandleEffectApply, 0, AuraType.AddPctModifier, AuraEffectHandleModes.Real));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(HandleEffectRemove, 0, AuraType.AddPctModifier, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
// 64364 - Aura Mastery Immune
|
||||
[Script]
|
||||
class spell_pal_aura_mastery_immune : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ConcentractionAura);
|
||||
}
|
||||
|
||||
bool CheckAreaTarget(Unit target)
|
||||
{
|
||||
return target.HasAura(SpellIds.ConcentractionAura, GetCasterGUID());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckAreaTarget.Add(new CheckAreaTargetHandler(CheckAreaTarget));
|
||||
}
|
||||
}
|
||||
|
||||
// 37877 - Blessing of Faith
|
||||
[Script]
|
||||
class spell_pal_blessing_of_faith : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BlessingOfLowerCityDruid, SpellIds.BlessingOfLowerCityPaladin, SpellIds.BlessingOfLowerCityPriest, SpellIds.BlessingOfLowerCityShaman);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit unitTarget = GetHitUnit();
|
||||
if (unitTarget)
|
||||
{
|
||||
uint spell_id = 0;
|
||||
switch (unitTarget.GetClass())
|
||||
{
|
||||
case Class.Druid:
|
||||
spell_id = SpellIds.BlessingOfLowerCityDruid;
|
||||
break;
|
||||
case Class.Paladin:
|
||||
spell_id = SpellIds.BlessingOfLowerCityPaladin;
|
||||
break;
|
||||
case Class.Priest:
|
||||
spell_id = SpellIds.BlessingOfLowerCityPriest;
|
||||
break;
|
||||
case Class.Shaman:
|
||||
spell_id = SpellIds.BlessingOfLowerCityShaman;
|
||||
break;
|
||||
default:
|
||||
return; // ignore for non-healing classes
|
||||
}
|
||||
Unit caster = GetCaster();
|
||||
caster.CastSpell(caster, spell_id, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 190784 - Divine Steed
|
||||
class spell_pal_divine_steed : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.DivineSteedHuman, SpellIds.DivineSteedDraenei, SpellIds.DivineSteedBloodelf, SpellIds.DivineSteedTauren);
|
||||
}
|
||||
|
||||
void HandleOnCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
|
||||
uint spellId = SpellIds.DivineSteedHuman;
|
||||
switch (caster.GetRace())
|
||||
{
|
||||
case Race.Draenei:
|
||||
spellId = SpellIds.DivineSteedDraenei;
|
||||
break;
|
||||
case Race.BloodElf:
|
||||
spellId = SpellIds.DivineSteedBloodelf;
|
||||
break;
|
||||
case Race.Tauren:
|
||||
spellId = SpellIds.DivineSteedTauren;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
caster.CastSpell(caster, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCast.Add(new CastHandler(HandleOnCast));
|
||||
}
|
||||
}
|
||||
|
||||
// 224239 - Divine Storm
|
||||
[Script]
|
||||
class spell_pal_divine_storm : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.DivineStormDamage);
|
||||
}
|
||||
|
||||
void HandleOnCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
caster.SendPlaySpellVisualKit(73892, 0, 0);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
caster.CastSpell(target, SpellIds.DivineStormDamage, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCast.Add(new CastHandler(HandleOnCast));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 33695 - Exorcism and Holy Wrath Damage
|
||||
[Script]
|
||||
class spell_pal_exorcism_and_holy_wrath_damage : AuraScript
|
||||
{
|
||||
void HandleEffectCalcSpellMod(AuraEffect aurEff, ref SpellModifier spellMod)
|
||||
{
|
||||
if (spellMod == null)
|
||||
{
|
||||
spellMod = new SpellModifier(aurEff.GetBase());
|
||||
spellMod.op = SpellModOp.Damage;
|
||||
spellMod.type = SpellModType.Flat;
|
||||
spellMod.spellId = GetId();
|
||||
spellMod.mask[1] = 0x200002;
|
||||
}
|
||||
|
||||
spellMod.value = aurEff.GetAmount();
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcSpellMod.Add(new EffectCalcSpellModHandler(HandleEffectCalcSpellMod, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// -9799 - Eye for an Eye
|
||||
[Script]
|
||||
class spell_pal_eye_for_an_eye : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.EyeForAnEyeDamage);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||
return;
|
||||
|
||||
int damage = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount());
|
||||
GetTarget().CastCustomSpell(SpellIds.EyeForAnEyeDamage, SpellValueMod.BasePoint0, damage, eventInfo.GetProcTarget(), true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, m_scriptSpellId == SpellIds.EyeForAnEyeRank1 ? AuraType.Dummy : AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// -75806 - Grand Crusader
|
||||
[Script]
|
||||
class spell_pal_grand_crusader : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.AvengersShield);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return GetTarget().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
GetTarget().GetSpellHistory().ResetCooldown(SpellIds.AvengersShield, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// 54968 - Glyph of Holy Light
|
||||
[Script]
|
||||
class spell_pal_glyph_of_holy_light : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
uint maxTargets = GetSpellInfo().MaxAffectedTargets;
|
||||
|
||||
if (targets.Count > maxTargets)
|
||||
{
|
||||
targets.Sort(new HealthPctOrderPred());
|
||||
targets.Resize(maxTargets);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaAlly));
|
||||
}
|
||||
}
|
||||
|
||||
// 6940 - Hand of Sacrifice
|
||||
[Script]
|
||||
class spell_pal_hand_of_sacrifice : AuraScript
|
||||
{
|
||||
int remainingAmount;
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
{
|
||||
remainingAmount = (int)caster.GetMaxHealth();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Split(AuraEffect aurEff, DamageInfo dmgInfo, uint splitAmount)
|
||||
{
|
||||
remainingAmount -= (int)splitAmount;
|
||||
|
||||
if (remainingAmount <= 0)
|
||||
{
|
||||
GetTarget().RemoveAura(SpellIds.HandOfSacrifice);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectSplit.Add(new EffectSplitHandler(Split, 0));
|
||||
}
|
||||
}
|
||||
|
||||
// 20473 - Holy Shock
|
||||
[Script]
|
||||
class spell_pal_holy_shock : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
SpellInfo firstRankSpellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyShockR1);
|
||||
if (firstRankSpellInfo == null)
|
||||
return false;
|
||||
|
||||
// can't use other spell than holy shock due to spell_ranks dependency
|
||||
if (!spellInfo.IsRankOf(firstRankSpellInfo))
|
||||
return false;
|
||||
|
||||
byte rank = spellInfo.GetRank();
|
||||
if (Global.SpellMgr.GetSpellWithRank(SpellIds.HolyShockR1Damage, rank, true) == 0 || Global.SpellMgr.GetSpellWithRank(SpellIds.HolyShockR1Healing, rank, true) == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit unitTarget = GetHitUnit();
|
||||
if (unitTarget)
|
||||
{
|
||||
byte rank = GetSpellInfo().GetRank();
|
||||
if (caster.IsFriendlyTo(unitTarget))
|
||||
caster.CastSpell(unitTarget, Global.SpellMgr.GetSpellWithRank(SpellIds.HolyShockR1Healing, rank), true);
|
||||
else
|
||||
caster.CastSpell(unitTarget, Global.SpellMgr.GetSpellWithRank(SpellIds.HolyShockR1Damage, rank), true);
|
||||
}
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetExplTargetUnit();
|
||||
if (target)
|
||||
{
|
||||
if (!caster.IsFriendlyTo(target))
|
||||
{
|
||||
if (!caster.IsValidAttackTarget(target))
|
||||
return SpellCastResult.BadTargets;
|
||||
|
||||
if (!caster.isInFront(target))
|
||||
return SpellCastResult.NotInfront;
|
||||
}
|
||||
}
|
||||
else
|
||||
return SpellCastResult.BadTargets;
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 37705 - Healing Discount
|
||||
[Script]
|
||||
class spell_pal_item_healing_discount : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ItemHealingTrance);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.ItemHealingTrance, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 40470 - Paladin Tier 6 Trinket
|
||||
class spell_pal_item_t6_trinket : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.EnduringLight, SpellIds.EnduringJudgement);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
uint spellId;
|
||||
int chance;
|
||||
|
||||
// Holy Light & Flash of Light
|
||||
if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0xC0000000))
|
||||
{
|
||||
spellId = SpellIds.EnduringLight;
|
||||
chance = 15;
|
||||
}
|
||||
// Judgements
|
||||
else if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00800000u))
|
||||
{
|
||||
spellId = SpellIds.EnduringJudgement;
|
||||
chance = 50;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (RandomHelper.randChance(chance))
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetProcTarget(), spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 20271 - Judgement
|
||||
// Updated 4.3.4
|
||||
[Script]
|
||||
class spell_pal_judgement : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.JudgementDamage);
|
||||
}
|
||||
|
||||
void HandleScriptEffect(uint effIndex)
|
||||
{
|
||||
uint spellId = SpellIds.JudgementDamage;
|
||||
|
||||
// some seals have SPELL_AURA_DUMMY in EFFECT_2
|
||||
var auras = GetCaster().GetAuraEffectsByType(AuraType.Dummy);
|
||||
foreach (var eff in auras)
|
||||
{
|
||||
if (eff.GetSpellInfo().GetSpellSpecific() == SpellSpecificType.Seal && eff.GetEffIndex() == 2)
|
||||
{
|
||||
if (Global.SpellMgr.HasSpellInfo((uint)eff.GetAmount()))
|
||||
{
|
||||
spellId = (uint)eff.GetAmount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetCaster().CastSpell(GetHitUnit(), spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 633 - Lay on Hands
|
||||
[Script]
|
||||
class spell_pal_lay_on_hands : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Forbearance, SpellIds.ImmuneShieldMarker);
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetExplTargetUnit();
|
||||
if (target)
|
||||
{
|
||||
if (caster == target)
|
||||
{
|
||||
if (target.HasAura(SpellIds.Forbearance) || target.HasAura(SpellIds.ImmuneShieldMarker))
|
||||
return SpellCastResult.TargetAurastate;
|
||||
}
|
||||
}
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
void HandleScript()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster == GetHitUnit())
|
||||
{
|
||||
caster.CastSpell(caster, SpellIds.Forbearance, true);
|
||||
caster.CastSpell(caster, SpellIds.ImmuneShieldMarker, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
AfterHit.Add(new HitHandler(HandleScript));
|
||||
}
|
||||
}
|
||||
|
||||
// 53651 - Beacon of Light
|
||||
[Script]
|
||||
class spell_pal_light_s_beacon : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BeaconOfLight, SpellIds.BeaconOfLightHeal);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
if (!eventInfo.GetActionTarget())
|
||||
return false;
|
||||
if (eventInfo.GetActionTarget().HasAura(SpellIds.BeaconOfLight, eventInfo.GetActor().GetGUID()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
HealInfo healInfo = eventInfo.GetHealInfo();
|
||||
if (healInfo == null || healInfo.GetHeal() == 0)
|
||||
return;
|
||||
|
||||
uint heal = MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());
|
||||
|
||||
var auras = GetCaster().GetSingleCastAuras();
|
||||
foreach (var eff in auras)
|
||||
{
|
||||
if (eff.GetId() == SpellIds.BeaconOfLight)
|
||||
{
|
||||
List<AuraApplication> applications = eff.GetApplicationList();
|
||||
if (!applications.Empty())
|
||||
eventInfo.GetActor().CastCustomSpell(SpellIds.BeaconOfLightHeal, SpellValueMod.BasePoint0, (int)heal, applications.First().GetTarget(), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 31789 - Righteous Defense
|
||||
[Script]
|
||||
class spell_pal_righteous_defense : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RighteousDefenseTaunt);
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (!caster.IsTypeId(TypeId.Player))
|
||||
return SpellCastResult.DontReport;
|
||||
|
||||
Unit target = GetExplTargetUnit();
|
||||
if (target)
|
||||
{
|
||||
if (!target.IsFriendlyTo(caster) || target.getAttackers().Empty())
|
||||
return SpellCastResult.BadTargets;
|
||||
}
|
||||
else
|
||||
return SpellCastResult.BadTargets;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
void HandleTriggerSpellLaunch(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
}
|
||||
|
||||
void HandleTriggerSpellHit(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
GetCaster().CastSpell(target, SpellIds.RighteousDefenseTaunt, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
//! WORKAROUND
|
||||
//! target select will be executed in hitphase of effect 0
|
||||
//! so we must handle trigger spell also in hit phase (default execution in launch phase)
|
||||
//! see issue #3718
|
||||
OnEffectLaunchTarget.Add(new EffectHandler(HandleTriggerSpellLaunch, 1, SpellEffectName.TriggerSpell));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleTriggerSpellHit, 1, SpellEffectName.TriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// 85285 - Sacred Shield
|
||||
[Script]
|
||||
class spell_pal_sacred_shield : SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (!caster.IsTypeId(TypeId.Player))
|
||||
return SpellCastResult.DontReport;
|
||||
|
||||
if (!caster.HealthBelowPct(30))
|
||||
return SpellCastResult.CantDoThatRightNow;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
}
|
||||
};
|
||||
|
||||
// 85256 - Templar's Verdict
|
||||
// Updated 4.3.4
|
||||
[Script]
|
||||
class spell_pal_templar_s_verdict : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellEntry)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.DivinePurposeProc);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
if (!GetCaster().IsTypeId(TypeId.Player))
|
||||
return false;
|
||||
|
||||
if (GetCaster().ToPlayer().GetClass() != Class.Paladin)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChangeDamage(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
float damage = GetHitDamage();
|
||||
|
||||
if (caster.HasAura(SpellIds.DivinePurposeProc))
|
||||
damage *= 7.5f; // 7.5*30% = 225%
|
||||
else
|
||||
{
|
||||
switch (caster.GetPower(PowerType.HolyPower))
|
||||
{
|
||||
case 0: // 1 Holy Power
|
||||
//damage = damage;
|
||||
break;
|
||||
case 1: // 2 Holy Power
|
||||
damage *= 3; // 3*30 = 90%
|
||||
break;
|
||||
case 2: // 3 Holy Power
|
||||
damage *= 7.5f; // 7.5*30% = 225%
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetHitDamage((int)damage);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(ChangeDamage, 0, SpellEffectName.WeaponPercentDamage));
|
||||
}
|
||||
}
|
||||
|
||||
// 20154, 21084 - Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage)
|
||||
[Script]
|
||||
class spell_pal_seal_of_righteousness : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SealOfCommand);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetProcTarget();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
float ap = GetTarget().GetTotalAttackPowerValue(WeaponAttackType.BaseAttack);
|
||||
int holy = GetTarget().SpellBaseDamageBonusDone(SpellSchoolMask.Holy);
|
||||
holy += eventInfo.GetProcTarget().SpellBaseDamageBonusTaken(SpellSchoolMask.Holy);
|
||||
int bp = (int)((ap * 0.022f + 0.044f * holy) * GetTarget().GetBaseAttackTime(WeaponAttackType.BaseAttack) / 1000);
|
||||
GetTarget().CastCustomSpell(SpellIds.SealOfCommand, SpellValueMod.BasePoint0, bp, eventInfo.GetProcTarget(), true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 28789 - Holy Power
|
||||
class spell_pal_t3_6p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.HolyPowerArmor, SpellIds.HolyPowerAttackPower, SpellIds.HolyPowerSpellPower, SpellIds.HolyPowerMp5);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
uint spellId;
|
||||
Unit caster = eventInfo.GetActor();
|
||||
Unit target = eventInfo.GetProcTarget();
|
||||
|
||||
switch (target.GetClass())
|
||||
{
|
||||
case Class.Paladin:
|
||||
case Class.Priest:
|
||||
case Class.Shaman:
|
||||
case Class.Druid:
|
||||
spellId = SpellIds.HolyPowerMp5;
|
||||
break;
|
||||
case Class.Mage:
|
||||
case Class.Warlock:
|
||||
spellId = SpellIds.HolyPowerSpellPower;
|
||||
break;
|
||||
case Class.Hunter:
|
||||
case Class.Rogue:
|
||||
spellId = SpellIds.HolyPowerAttackPower;
|
||||
break;
|
||||
case Class.Warrior:
|
||||
spellId = SpellIds.HolyPowerArmor;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
caster.CastSpell(target, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 64890 Item - Paladin T8 Holy 2P Bonus
|
||||
class spell_pal_t8_2p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.HolyMending);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
HealInfo healInfo = eventInfo.GetHealInfo();
|
||||
if (healInfo == null || healInfo.GetHeal() == 0)
|
||||
return;
|
||||
|
||||
Unit caster = eventInfo.GetActor();
|
||||
Unit target = eventInfo.GetProcTarget();
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyMending);
|
||||
int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());
|
||||
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None);
|
||||
// Add remaining ticks to damage done
|
||||
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.HolyMending, AuraType.PeriodicHeal);
|
||||
|
||||
caster.CastCustomSpell(SpellIds.HolyMending, SpellValueMod.BasePoint0, amount, target, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Spells.Rogue
|
||||
{
|
||||
public struct SpellIds
|
||||
{
|
||||
public const uint BladeFlurryExtraAttack = 22482;
|
||||
public const uint CheatDeathCooldown = 31231;
|
||||
public const uint GlyphOfPreparation = 56819;
|
||||
public const uint KillingSpree = 51690;
|
||||
public const uint KillingSpreeTeleport = 57840;
|
||||
public const uint KillingSpreeWeaponDmg = 57841;
|
||||
public const uint KillingSpreeDmgBuff = 61851;
|
||||
public const uint PreyOnTheWeak = 58670;
|
||||
public const uint ShivTriggered = 5940;
|
||||
public const uint TricksOfTheTradeDmgBoost = 57933;
|
||||
public const uint TricksOfTheTradeProc = 59628;
|
||||
public const uint SerratedBladesR1 = 14171;
|
||||
public const uint Rupture = 1943;
|
||||
public const uint HonorAmongThievesEnergize = 51699;
|
||||
public const uint T52pSetBonus = 37169;
|
||||
}
|
||||
|
||||
[Script] // 51690 - Killing Spree
|
||||
class spell_rog_killing_spree : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
if (targets.Empty() || GetCaster().GetVehicleBase())
|
||||
FinishCast(SpellCastResult.OutOfRange);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Aura aura = GetCaster().GetAura(SpellIds.KillingSpree);
|
||||
if (aura != null)
|
||||
{
|
||||
var script = aura.GetScript<spell_rog_killing_spree_AuraScript>(nameof(spell_rog_killing_spree_AuraScript));
|
||||
if (script != null)
|
||||
script.AddTarget(GetHitUnit());
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 1, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
public class spell_rog_killing_spree_AuraScript : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.KillingSpreeTeleport, SpellIds.KillingSpreeWeaponDmg, SpellIds.KillingSpreeDmgBuff);
|
||||
}
|
||||
|
||||
void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.KillingSpreeDmgBuff, true);
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
while (!_targets.Empty())
|
||||
{
|
||||
ObjectGuid guid = _targets.SelectRandom();
|
||||
Unit target = Global.ObjAccessor.GetUnit(GetTarget(), guid);
|
||||
if (target)
|
||||
{
|
||||
GetTarget().CastSpell(target, SpellIds.KillingSpreeTeleport, true);
|
||||
GetTarget().CastSpell(target, SpellIds.KillingSpreeWeaponDmg, true);
|
||||
break;
|
||||
}
|
||||
else
|
||||
_targets.Remove(guid);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().RemoveAurasDueToSpell(SpellIds.KillingSpreeDmgBuff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleEffectPeriodic, 0, AuraType.PeriodicDummy));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
|
||||
public void AddTarget(Unit target)
|
||||
{
|
||||
_targets.Add(target.GetGUID());
|
||||
}
|
||||
|
||||
List<ObjectGuid> _targets = new List<ObjectGuid>();
|
||||
}
|
||||
|
||||
[Script] // 2098 - Eviscerate
|
||||
class spell_rog_eviscerate : SpellScript
|
||||
{
|
||||
void CalculateDamage(uint effIndex)
|
||||
{
|
||||
int damagePerCombo = (int)(GetCaster().GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 0.559f);
|
||||
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52pSetBonus, 0);
|
||||
if (t5 != null)
|
||||
damagePerCombo += t5.GetAmount();
|
||||
|
||||
SetEffectValue(GetEffectValue() + damagePerCombo * GetCaster().GetPower(PowerType.ComboPoints));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectLaunchTarget.Add(new EffectHandler(CalculateDamage, 0, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 32645 - Envenom
|
||||
class spell_rog_envenom : SpellScript
|
||||
{
|
||||
void CalculateDamage(uint effIndex)
|
||||
{
|
||||
int damagePerCombo = (int)(GetCaster().GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 0.417f);
|
||||
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52pSetBonus, 0);
|
||||
if (t5 != null)
|
||||
damagePerCombo += t5.GetAmount();
|
||||
|
||||
SetEffectValue(GetEffectValue() + damagePerCombo * GetCaster().GetPower(PowerType.ComboPoints));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectLaunchTarget.Add(new EffectHandler(CalculateDamage, 0, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,895 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Spells.Shaman
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint AncestralGuidance = 108281;
|
||||
public const uint AncestralGuidanceHeal = 114911;
|
||||
public const uint ChainedHeal = 70809;
|
||||
public const uint CrashLightningCleave = 187878;
|
||||
public const uint EarthShieldHeal = 204290;
|
||||
public const uint EarthenRagePassive = 170374;
|
||||
public const uint EarthenRagePeriodic = 170377;
|
||||
public const uint EarthenRageDamage = 170379;
|
||||
public const uint Electrified = 64930;
|
||||
public const uint ElementalBlastCrit = 118522;
|
||||
public const uint ElementalBlastHaste = 173183;
|
||||
public const uint ElementalBlastMastery = 173184;
|
||||
public const uint ElementalMastery = 16166;
|
||||
public const uint EnergySurge = 40465;
|
||||
public const uint Exhaustion = 57723;
|
||||
public const uint FireNovaTriggered = 8349;
|
||||
public const uint FlameShock = 8050;
|
||||
public const uint FlameShockMaelstrom = 188389;
|
||||
public const uint FlametongueAttack = 10444;
|
||||
public const uint GatheringStorms = 198299;
|
||||
public const uint GatheringStormsBuff = 198300;
|
||||
public const uint HighTide = 157154;
|
||||
public const uint ItemLightningShield = 23552;
|
||||
public const uint ItemLightningShieldDamage = 27635;
|
||||
public const uint ItemManaSurge = 23571;
|
||||
public const uint LavaBurst = 51505;
|
||||
public const uint LavaBurstBonusDamage = 71824;
|
||||
public const uint LavaLashSpreadFlameShock = 105792;
|
||||
public const uint LavaSurge = 77762;
|
||||
public const uint PathOfFlamesSpread = 210621;
|
||||
public const uint PathOfFlamesTalent = 201909;
|
||||
public const uint PowerSurge = 40466;
|
||||
public const uint Sated = 57724;
|
||||
public const uint TidalWaves = 53390;
|
||||
public const uint TotemicPowerMp5 = 28824;
|
||||
public const uint TotemicPowerSpellPower = 28825;
|
||||
public const uint TotemicPowerAttackPower = 28826;
|
||||
public const uint TotemicPowerArmor = 28827;
|
||||
public const uint WindfuryAttack = 25504;
|
||||
|
||||
//Misc
|
||||
public const uint HunterInsanity = 95809;
|
||||
public const uint MageTemporalDisplacement = 80354;
|
||||
public const uint PetNetherwindsFatigued = 160455;
|
||||
}
|
||||
|
||||
[Script] // 108281 - Ancestral Guidance
|
||||
class spell_sha_ancestral_guidance : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.AncestralGuidanceHeal);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
if (eventInfo.GetHealInfo().GetSpellInfo().Id == SpellIds.AncestralGuidanceHeal)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
int bp0 = MathFunctions.CalculatePct((int)eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount());
|
||||
if (bp0 != 0)
|
||||
eventInfo.GetActor().CastCustomSpell(SpellIds.AncestralGuidanceHeal, SpellValueMod.BasePoint0, bp0, eventInfo.GetActor(), true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 114911 - Ancestral Guidance Heal
|
||||
class spell_sha_ancestral_guidance_heal : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.AncestralGuidance);
|
||||
}
|
||||
|
||||
void ResizeTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.Resize(3);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(ResizeTargets, 0, Targets.UnitDestAreaAlly));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 2825 - Bloodlust
|
||||
class spell_sha_bloodlust : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Sated, SpellIds.HunterInsanity, SpellIds.MageTemporalDisplacement, SpellIds.PetNetherwindsFatigued);
|
||||
}
|
||||
|
||||
void RemoveInvalidTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.Sated));
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.HunterInsanity));
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.MageTemporalDisplacement));
|
||||
}
|
||||
|
||||
void ApplyDebuff()
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
target.CastSpell(target, SpellIds.Sated, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(RemoveInvalidTargets, 0, Targets.UnitCasterAreaRaid));
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(RemoveInvalidTargets, 1, Targets.UnitCasterAreaRaid));
|
||||
AfterHit.Add(new HitHandler(ApplyDebuff));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 187874 - Crash Lightning
|
||||
class spell_sha_crash_lightning : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CrashLightningCleave);
|
||||
}
|
||||
|
||||
void CountTargets(List<WorldObject> targets)
|
||||
{
|
||||
_targetsHit = targets.Count;
|
||||
}
|
||||
|
||||
void TriggerCleaveBuff()
|
||||
{
|
||||
if (_targetsHit >= 2)
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.CrashLightningCleave, true);
|
||||
|
||||
AuraEffect gatheringStorms = GetCaster().GetAuraEffect(SpellIds.GatheringStorms, 0);
|
||||
if (gatheringStorms != null)
|
||||
GetCaster().CastCustomSpell(SpellIds.GatheringStormsBuff, SpellValueMod.BasePoint0, (int)(gatheringStorms.GetAmount() * _targetsHit), GetCaster(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitConeEnemy104));
|
||||
AfterCast.Add(new CastHandler(TriggerCleaveBuff));
|
||||
}
|
||||
|
||||
int _targetsHit = 0;
|
||||
}
|
||||
|
||||
[Script] // 204288 - Earth Shield
|
||||
class spell_sha_earth_shield : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.EarthShieldHeal);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
if (eventInfo.GetDamageInfo() == null || !HasEffect(1) || eventInfo.GetDamageInfo().GetDamage() < GetTarget().CountPctFromMaxHealth(GetEffect(1).GetAmount()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.EarthShieldHeal, true, null, aurEff, GetCasterGUID());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 170374 - Earthen Rage (Passive)
|
||||
public class spell_sha_earthen_rage_passive : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.EarthenRagePeriodic, SpellIds.EarthenRageDamage);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
_procTargetGuid = eventInfo.GetProcTarget().GetGUID();
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetActor(), SpellIds.EarthenRagePeriodic, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
|
||||
public ObjectGuid GetProcTargetGuid()
|
||||
{
|
||||
return _procTargetGuid;
|
||||
}
|
||||
|
||||
ObjectGuid _procTargetGuid;
|
||||
}
|
||||
|
||||
[Script] // 170377 - Earthen Rage (Proc Aura)
|
||||
class spell_sha_earthen_rage_proc_aura : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.EarthenRagePassive, SpellIds.EarthenRageDamage);
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Aura aura = GetCaster().GetAura(SpellIds.EarthenRagePassive);
|
||||
if (aura != null)
|
||||
{
|
||||
var earthen_rage_script = aura.GetScript<spell_sha_earthen_rage_passive>("spell_sha_earthen_rage_passive");
|
||||
if (earthen_rage_script != null)
|
||||
{
|
||||
Unit procTarget = Global.ObjAccessor.GetUnit(GetCaster(), earthen_rage_script.GetProcTargetGuid());
|
||||
if (procTarget)
|
||||
GetTarget().CastSpell(procTarget, SpellIds.EarthenRageDamage, true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleEffectPeriodic, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 117014 - Elemental Blast
|
||||
class spell_sha_elemental_blast : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ElementalBlastCrit, SpellIds.ElementalBlastHaste, SpellIds.ElementalBlastMastery);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void TriggerBuff()
|
||||
{
|
||||
Player caster = GetCaster().ToPlayer();
|
||||
uint spellId = RandomHelper.RAND(SpellIds.ElementalBlastCrit, SpellIds.ElementalBlastHaste, SpellIds.ElementalBlastMastery);
|
||||
|
||||
caster.CastSpell(caster, spellId, TriggerCastFlags.FullMask);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new CastHandler(TriggerBuff));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 1535 Fire Nova
|
||||
class spell_sha_fire_nova : SpellScript
|
||||
{
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
if (target.HasAura(SpellIds.FlameShock))
|
||||
GetCaster().CastSpell(target, SpellIds.FireNovaTriggered, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 194084 - Flametongue
|
||||
class spell_sha_flametongue : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FlametongueAttack);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit attacker = eventInfo.GetActor();
|
||||
int damage = (int)(attacker.GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 0.12f / 2600 * attacker.GetBaseAttackTime(WeaponAttackType.BaseAttack));
|
||||
attacker.CastCustomSpell(SpellIds.FlametongueAttack, SpellValueMod.BasePoint0, damage, eventInfo.GetActionTarget(), TriggerCastFlags.FullMask, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 52042 - Healing Stream Totem
|
||||
class spell_sha_healing_stream_totem_heal : SpellScript
|
||||
{
|
||||
void SelectTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.RemoveAll(target =>
|
||||
{
|
||||
return !target.ToUnit() || target.ToUnit().IsFullHealth();
|
||||
});
|
||||
|
||||
targets.RandomResize(1);
|
||||
|
||||
if (targets.Empty())
|
||||
targets.Add(GetOriginalCaster());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(SelectTargets, 0, Targets.UnitDestAreaAlly));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 32182 - Heroism
|
||||
class spell_sha_heroism : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Exhaustion, SpellIds.HunterInsanity, SpellIds.MageTemporalDisplacement, SpellIds.PetNetherwindsFatigued);
|
||||
}
|
||||
|
||||
void RemoveInvalidTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.Exhaustion));
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.HunterInsanity));
|
||||
targets.RemoveAll(new UnitAuraCheck<WorldObject>(true, SpellIds.MageTemporalDisplacement));
|
||||
}
|
||||
|
||||
void ApplyDebuff()
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
target.CastSpell(target, SpellIds.Exhaustion, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(RemoveInvalidTargets, 0, Targets.UnitCasterAreaRaid));
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(RemoveInvalidTargets, 1, Targets.UnitCasterAreaRaid));
|
||||
AfterHit.Add(new HitHandler(ApplyDebuff));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 23551 - Lightning Shield T2 Bonus
|
||||
class spell_sha_item_lightning_shield : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ItemLightningShield);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastSpell(eventInfo.GetProcTarget(), SpellIds.ItemLightningShield, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 23552 - Lightning Shield T2 Bonus
|
||||
class spell_sha_item_lightning_shield_trigger : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ItemLightningShieldDamage);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.ItemLightningShieldDamage, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 23572 - Mana Surge
|
||||
class spell_sha_item_mana_surge : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ItemManaSurge);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetProcSpell() != null;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
var costs = eventInfo.GetProcSpell().GetPowerCost();
|
||||
var m = costs.Find(cost => cost.Power == PowerType.Mana);
|
||||
if (m != null)
|
||||
{
|
||||
int mana = MathFunctions.CalculatePct(m.Amount, 35);
|
||||
if (mana > 0)
|
||||
GetTarget().CastCustomSpell(SpellIds.ItemManaSurge, SpellValueMod.BasePoint0, mana, GetTarget(), true, null, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 40463 - Shaman Tier 6 Trinket
|
||||
class spell_sha_item_t6_trinket : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.EnergySurge, SpellIds.PowerSurge);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
uint spellId;
|
||||
int chance;
|
||||
|
||||
// Lesser Healing Wave
|
||||
if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000080u))
|
||||
{
|
||||
spellId = SpellIds.EnergySurge;
|
||||
chance = 10;
|
||||
}
|
||||
// Lightning Bolt
|
||||
else if (spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000001u))
|
||||
{
|
||||
spellId = SpellIds.EnergySurge;
|
||||
chance = 15;
|
||||
}
|
||||
// Stormstrike
|
||||
else if (spellInfo.SpellFamilyFlags[1].HasAnyFlag(0x00000010u))
|
||||
{
|
||||
spellId = SpellIds.PowerSurge;
|
||||
chance = 50;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (RandomHelper.randChance(chance))
|
||||
eventInfo.GetActor().CastSpell((Unit)null, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 70811 - Item - Shaman T10 Elemental 2P Bonus
|
||||
class spell_sha_item_t10_elemental_2p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ElementalMastery);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Player target = GetTarget().ToPlayer();
|
||||
if (target)
|
||||
target.GetSpellHistory().ModifyCooldown(SpellIds.ElementalMastery, -aurEff.GetAmount());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 189063 - Lightning Vortex (proc 185881 Item - Shaman T18 Elemental 4P Bonus)
|
||||
class spell_sha_item_t18_elemental_4p_bonus : AuraScript
|
||||
{
|
||||
void DiminishHaste(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
AuraEffect hasteBuff = GetEffect(0);
|
||||
if (hasteBuff != null)
|
||||
hasteBuff.ChangeAmount(hasteBuff.GetAmount() - aurEff.GetAmount());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(DiminishHaste, 1, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 51505 - Lava burst
|
||||
class spell_sha_lava_burst : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PathOfFlamesTalent, SpellIds.PathOfFlamesSpread);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
{
|
||||
Unit target = GetExplTargetUnit();
|
||||
if (target)
|
||||
if (caster.HasAura(SpellIds.PathOfFlamesTalent))
|
||||
caster.CastSpell(target, SpellIds.PathOfFlamesSpread, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 77756 - Lava Surge
|
||||
class spell_sha_lava_surge : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LavaSurge);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.LavaSurge, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 77762 - Lava Surge
|
||||
class spell_sha_lava_surge_proc : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LavaBurst);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void ResetCooldown()
|
||||
{
|
||||
GetCaster().GetSpellHistory().RestoreCharge(Global.SpellMgr.GetSpellInfo(SpellIds.LavaBurst).ChargeCategoryId);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterHit.Add(new HitHandler(ResetCooldown));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 210621 - Path of Flames Spread
|
||||
class spell_sha_path_of_flames_spread : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FlameShockMaelstrom);
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.Remove(GetExplTargetUnit());
|
||||
targets.RandomResize(target =>
|
||||
{
|
||||
return target.IsTypeId(TypeId.Unit) && !target.ToUnit().HasAura(SpellIds.FlameShockMaelstrom, GetCaster().GetGUID());
|
||||
}, 1);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit mainTarget = GetExplTargetUnit();
|
||||
if (mainTarget)
|
||||
{
|
||||
Aura flameShock = mainTarget.GetAura(SpellIds.FlameShockMaelstrom, GetCaster().GetGUID());
|
||||
if (flameShock != null)
|
||||
{
|
||||
Aura newAura = GetCaster().AddAura(SpellIds.FlameShockMaelstrom, GetHitUnit());
|
||||
if (newAura != null)
|
||||
{
|
||||
newAura.SetDuration(flameShock.GetDuration());
|
||||
newAura.SetMaxDuration(flameShock.GetDuration());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 1, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 51562 - Tidal Waves
|
||||
class spell_sha_tidal_waves : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TidalWaves);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
int basePoints0 = -aurEff.GetAmount();
|
||||
int basePoints1 = aurEff.GetAmount();
|
||||
|
||||
GetTarget().CastCustomSpell(GetTarget(), SpellIds.TidalWaves, basePoints0, basePoints1, 0, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 28823 - Totemic Power
|
||||
class spell_sha_t3_6p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TotemicPowerArmor, SpellIds.TotemicPowerAttackPower, SpellIds.TotemicPowerSpellPower, SpellIds.TotemicPowerMp5);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
uint spellId;
|
||||
Unit caster = eventInfo.GetActor();
|
||||
Unit target = eventInfo.GetProcTarget();
|
||||
|
||||
switch (target.GetClass())
|
||||
{
|
||||
case Class.Paladin:
|
||||
case Class.Priest:
|
||||
case Class.Shaman:
|
||||
case Class.Druid:
|
||||
spellId = SpellIds.TotemicPowerMp5;
|
||||
break;
|
||||
case Class.Mage:
|
||||
case Class.Warlock:
|
||||
spellId = SpellIds.TotemicPowerSpellPower;
|
||||
break;
|
||||
case Class.Hunter:
|
||||
case Class.Rogue:
|
||||
spellId = SpellIds.TotemicPowerAttackPower;
|
||||
break;
|
||||
case Class.Warrior:
|
||||
spellId = SpellIds.TotemicPowerArmor;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
caster.CastSpell(target, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 64928 - Item - Shaman T8 Elemental 4P Bonus
|
||||
class spell_sha_t8_elemental_4p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Electrified);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||
return;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.Electrified);
|
||||
int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount());
|
||||
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None);
|
||||
|
||||
// Add remaining ticks to healing done
|
||||
Unit caster = eventInfo.GetActor();
|
||||
Unit target = eventInfo.GetProcTarget();
|
||||
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.Electrified, AuraType.PeriodicDamage);
|
||||
|
||||
caster.CastCustomSpell(SpellIds.Electrified, SpellValueMod.BasePoint0, amount, target, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 67228 - Item - Shaman T9 Elemental 4P Bonus (Lava Burst)
|
||||
class spell_sha_t9_elemental_4p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LavaBurstBonusDamage);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||
return;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.LavaBurstBonusDamage);
|
||||
int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount());
|
||||
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None);
|
||||
|
||||
// Add remaining ticks to healing done
|
||||
Unit caster = eventInfo.GetActor();
|
||||
Unit target = eventInfo.GetProcTarget();
|
||||
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.LavaBurstBonusDamage, AuraType.PeriodicDamage);
|
||||
|
||||
caster.CastCustomSpell(SpellIds.LavaBurstBonusDamage, SpellValueMod.BasePoint0, amount, target, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 70817 - Item - Shaman T10 Elemental 4P Bonus
|
||||
class spell_sha_t10_elemental_4p_bonus : AuraScript
|
||||
{
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit caster = eventInfo.GetActor();
|
||||
Unit target = eventInfo.GetProcTarget();
|
||||
|
||||
// try to find spell Flame Shock on the target
|
||||
AuraEffect flameShock = target.GetAuraEffect(AuraType.PeriodicDamage, SpellFamilyNames.Shaman, new FlagArray128(0x10000000), caster.GetGUID());
|
||||
if (flameShock == null)
|
||||
return;
|
||||
|
||||
Aura flameShockAura = flameShock.GetBase();
|
||||
|
||||
int maxDuration = flameShockAura.GetMaxDuration();
|
||||
int newDuration = flameShockAura.GetDuration() + aurEff.GetAmount() * Time.InMilliseconds;
|
||||
|
||||
flameShockAura.SetDuration(newDuration);
|
||||
// is it blizzlike to change max duration for FS?
|
||||
if (newDuration > maxDuration)
|
||||
flameShockAura.SetMaxDuration(newDuration);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 70808 - Item - Shaman T10 Restoration 4P Bonus
|
||||
class spell_sha_t10_restoration_4p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ChainedHeal);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
HealInfo healInfo = eventInfo.GetHealInfo();
|
||||
if (healInfo == null || healInfo.GetHeal() == 0)
|
||||
return;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.ChainedHeal);
|
||||
int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());
|
||||
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None);
|
||||
|
||||
// Add remaining ticks to healing done
|
||||
Unit caster = eventInfo.GetActor();
|
||||
Unit target = eventInfo.GetProcTarget();
|
||||
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.ChainedHeal, AuraType.PeriodicHeal);
|
||||
|
||||
caster.CastCustomSpell(SpellIds.ChainedHeal, SpellValueMod.BasePoint0, amount, target, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 33757 - Windfury
|
||||
class spell_sha_windfury : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.WindfuryAttack);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
for (uint i = 0; i < 2; ++i)
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetProcTarget(), SpellIds.WindfuryAttack, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,928 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using Game.Movement;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Spells.Warrior
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint BladestormPeriodicWhirlwind = 50622;
|
||||
public const uint BloodthirstHeal = 117313;
|
||||
public const uint Charge = 34846;
|
||||
public const uint ChargeEffect = 218104;
|
||||
public const uint ChargeEffectBlazingTrail = 198337;
|
||||
public const uint ChargePauseRageDecay = 109128;
|
||||
public const uint ChargeRootEffect = 105771;
|
||||
public const uint ChargeSlowEffect = 236027;
|
||||
public const uint ColossusSmash = 86346;
|
||||
public const uint Execute = 20647;
|
||||
public const uint GlyphOfTheBlazingTrail = 123779;
|
||||
public const uint GlyphOfHeroicLeap = 159708;
|
||||
public const uint GlyphOfHeroicLeapBuff = 133278;
|
||||
public const uint HeroicLeapJump = 178368;
|
||||
public const uint ImpendingVictory = 202168;
|
||||
public const uint ImpendingVictoryHeal = 202166;
|
||||
public const uint ImprovedHeroicLeap = 157449;
|
||||
public const uint JuggernautCritBonusBuff = 65156;
|
||||
public const uint JuggernautCritBonusTalent = 64976;
|
||||
public const uint LastStandTriggered = 12976;
|
||||
public const uint MortalStrike = 12294;
|
||||
public const uint RallyingCry = 97463;
|
||||
public const uint Rend = 94009;
|
||||
public const uint RetaliationDamage = 22858;
|
||||
public const uint SecoundWindProcRank1 = 29834;
|
||||
public const uint SecoundWindProcRank2 = 29838;
|
||||
public const uint SecoundWindTriggerRank1 = 29841;
|
||||
public const uint SecoundWindTriggerRank2 = 29842;
|
||||
public const uint ShieldSlam = 23922;
|
||||
public const uint Shockwave = 46968;
|
||||
public const uint ShockwaveStun = 132168;
|
||||
public const uint Slam = 50782;
|
||||
public const uint Stoicism = 70845;
|
||||
public const uint StormBoltStun = 132169;
|
||||
public const uint SweepingStrikesExtraAttack1 = 12723;
|
||||
public const uint SweepingStrikesExtraAttack2 = 26654;
|
||||
public const uint Taunt = 355;
|
||||
public const uint TraumaEffect = 215537;
|
||||
public const uint UnrelentingAssaultRank1 = 46859;
|
||||
public const uint UnrelentingAssaultRank2 = 46860;
|
||||
public const uint UnrelentingAssaultTrigger1 = 64849;
|
||||
public const uint UnrelentingAssaultTrigger2 = 64850;
|
||||
public const uint Vengeance = 76691;
|
||||
public const uint Victorious = 32216;
|
||||
public const uint VictoriousRushHeal = 118779;
|
||||
}
|
||||
|
||||
struct Misc
|
||||
{
|
||||
public const uint SpellVisualBlazingCharge = 26423;
|
||||
}
|
||||
|
||||
[Script] // 23881 - Bloodthirst
|
||||
class spell_warr_bloodthirst : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BloodthirstHeal);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.BloodthirstHeal, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new EffectHandler(HandleDummy, 3, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 100 - Charge
|
||||
class spell_warr_charge : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ChargeEffect, SpellIds.ChargeEffectBlazingTrail);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
uint spellId = SpellIds.ChargeEffect;
|
||||
if (GetCaster().HasAura(SpellIds.GlyphOfTheBlazingTrail))
|
||||
spellId = SpellIds.ChargeEffectBlazingTrail;
|
||||
|
||||
GetCaster().CastSpell(GetHitUnit(), spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 126661 - Warrior Charge Drop Fire Periodic
|
||||
class spell_warr_charge_drop_fire_periodic : AuraScript
|
||||
{
|
||||
void DropFireVisual(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (GetTarget().IsSplineEnabled())
|
||||
{
|
||||
for (uint i = 0; i < 5; ++i)
|
||||
{
|
||||
int timeOffset = (int)(6 * i * aurEff.GetPeriod() / 25);
|
||||
Vector4 loc = GetTarget().moveSpline.ComputePosition(timeOffset);
|
||||
GetTarget().SendPlaySpellVisual(new Vector3(loc.X, loc.Y, loc.Z), 0.0f, Misc.SpellVisualBlazingCharge, 0, 0, 1.0f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(DropFireVisual, 0, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// 198337 - Charge Effect (dropping Blazing Trail)
|
||||
[Script] // 218104 - Charge Effect
|
||||
class spell_warr_charge_effect : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ChargePauseRageDecay, SpellIds.ChargeRootEffect, SpellIds.ChargeSlowEffect);
|
||||
}
|
||||
|
||||
void HandleCharge(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetHitUnit();
|
||||
caster.CastCustomSpell(SpellIds.ChargePauseRageDecay, SpellValueMod.BasePoint0, 0, caster, true);
|
||||
caster.CastSpell(target, SpellIds.ChargeRootEffect, true);
|
||||
caster.CastSpell(target, SpellIds.ChargeSlowEffect, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectLaunchTarget.Add(new EffectHandler(HandleCharge, 0, SpellEffectName.Charge));
|
||||
}
|
||||
}
|
||||
|
||||
// Updated 4.3.4
|
||||
[Script]
|
||||
class spell_warr_concussion_blow : SpellScript
|
||||
{
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
SetHitDamage((int)MathFunctions.CalculatePct(GetCaster().GetTotalAttackPowerValue(WeaponAttackType.BaseAttack), GetEffectValue()));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 2, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// Updated 4.3.4
|
||||
[Script] // 5308 - Execute
|
||||
class spell_warr_execute : SpellScript
|
||||
{
|
||||
void HandleEffect(uint effIndex)
|
||||
{
|
||||
/*
|
||||
Unit caster = GetCaster();
|
||||
if (GetHitUnit())
|
||||
{
|
||||
SpellInfo spellInfo = GetSpellInfo();
|
||||
int rageUsed = Math.Min(200 - spellInfo.CalcPowerCost(caster, spellInfo.SchoolMask), caster.GetPower(PowerType.Rage));
|
||||
int newRage = Math.Max(0, caster.GetPower(PowerType.Rage) - rageUsed);
|
||||
|
||||
// Sudden Death rage save
|
||||
AuraEffect aurEff = caster.GetAuraEffect(AuraType.ProcTriggerSpell, SpellFamilyNames.Generic, 1989, 0); // Icon SuddenDeath
|
||||
if (aurEff != null)
|
||||
{
|
||||
int ragesave = aurEff.GetSpellInfo().GetEffect(0).CalcValue() * 10;
|
||||
newRage = Math.Max(newRage, ragesave);
|
||||
}
|
||||
|
||||
caster.SetPower(PowerType.Rage, newRage);
|
||||
|
||||
// Formula taken from the DBC: "${10+$AP*0.437*$m1/100}"
|
||||
int baseDamage = (int)(10 + caster.GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 0.437f * GetEffectValue() / 100.0f);
|
||||
// Formula taken from the DBC: "${$ap*0.874*$m1/100-1} = 20 rage"
|
||||
int moreDamage = (int)(rageUsed * (caster.GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 0.874f * GetEffectValue() / 100.0f - 1) / 200);
|
||||
SetHitDamage(baseDamage + moreDamage);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Heroic leap - 6544
|
||||
class spell_warr_heroic_leap : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.HeroicLeapJump);
|
||||
}
|
||||
|
||||
SpellCastResult CheckElevation()
|
||||
{
|
||||
WorldLocation dest = GetExplTargetDest();
|
||||
if (dest != null)
|
||||
{
|
||||
if (GetCaster().HasUnitMovementFlag(MovementFlag.Root))
|
||||
return SpellCastResult.Rooted;
|
||||
|
||||
if (GetCaster().GetMap().Instanceable())
|
||||
{
|
||||
float range = GetSpellInfo().GetMaxRange(true, GetCaster()) * 1.5f;
|
||||
|
||||
PathGenerator generatedPath = new PathGenerator(GetCaster());
|
||||
generatedPath.SetPathLengthLimit(range);
|
||||
|
||||
bool result = generatedPath.CalculatePath(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), false, true);
|
||||
if (generatedPath.GetPathType().HasAnyFlag(PathType.Short))
|
||||
return SpellCastResult.OutOfRange;
|
||||
else if (!result || generatedPath.GetPathType().HasAnyFlag(PathType.NoPath))
|
||||
{
|
||||
result = generatedPath.CalculatePath(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), false, false);
|
||||
if (generatedPath.GetPathType().HasAnyFlag(PathType.Short))
|
||||
return SpellCastResult.OutOfRange;
|
||||
else if (!result || generatedPath.GetPathType().HasAnyFlag(PathType.NoPath))
|
||||
return SpellCastResult.NoPath;
|
||||
}
|
||||
}
|
||||
else if (dest.GetPositionZ() > GetCaster().GetPositionZ() + 4.0f)
|
||||
return SpellCastResult.NoPath;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
return SpellCastResult.NoValidTargets;
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
WorldLocation dest = GetHitDest();
|
||||
if (dest != null)
|
||||
GetCaster().CastSpell(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), SpellIds.HeroicLeapJump, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckElevation));
|
||||
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Heroic Leap (triggered by Heroic Leap (6544)) - 178368
|
||||
class spell_warr_heroic_leap_jump : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.GlyphOfHeroicLeap,
|
||||
SpellIds.GlyphOfHeroicLeapBuff,
|
||||
SpellIds.ImprovedHeroicLeap,
|
||||
SpellIds.Taunt);
|
||||
}
|
||||
|
||||
void AfterJump(uint effIndex)
|
||||
{
|
||||
if (GetCaster().HasAura(SpellIds.GlyphOfHeroicLeap))
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.GlyphOfHeroicLeapBuff, true);
|
||||
if (GetCaster().HasAura(SpellIds.ImprovedHeroicLeap))
|
||||
GetCaster().GetSpellHistory().ResetCooldown(SpellIds.Taunt, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new EffectHandler(AfterJump, 1, SpellEffectName.JumpDest));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 202168 - Impending Victory
|
||||
class spell_warr_impending_victory : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ImpendingVictoryHeal);
|
||||
}
|
||||
|
||||
void HandleAfterCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
caster.CastSpell(caster, SpellIds.ImpendingVictoryHeal, true);
|
||||
caster.RemoveAurasDueToSpell(SpellIds.Victorious);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new CastHandler(HandleAfterCast));
|
||||
}
|
||||
}
|
||||
|
||||
// 5246 - Intimidating Shout
|
||||
[Script]
|
||||
class spell_warr_intimidating_shout : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> unitList)
|
||||
{
|
||||
unitList.Remove(GetExplTargetWorldObject());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitSrcAreaEnemy));
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 2, Targets.UnitSrcAreaEnemy));
|
||||
}
|
||||
}
|
||||
|
||||
// 70844 - Item - Warrior T10 Protection 4P Bonus
|
||||
[Script] /// 7.1.5
|
||||
class spell_warr_item_t10_prot_4p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Stoicism);
|
||||
}
|
||||
|
||||
void HandleProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit target = eventInfo.GetActionTarget();
|
||||
int bp0 = (int)MathFunctions.CalculatePct(target.GetMaxHealth(), GetSpellInfo().GetEffect(1).CalcValue());
|
||||
target.CastCustomSpell(SpellIds.Stoicism, SpellValueMod.BasePoint0, bp0, (Unit)null, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnProc.Add(new AuraProcHandler(HandleProc));
|
||||
}
|
||||
}
|
||||
|
||||
// -84583 Lambs to the Slaughter
|
||||
[Script]
|
||||
class spell_warr_lambs_to_the_slaughter : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MortalStrike, SpellIds.Rend);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
Aura aur = eventInfo.GetProcTarget().GetAura(SpellIds.Rend, GetTarget().GetGUID());
|
||||
if (aur != null)
|
||||
aur.SetDuration(aur.GetSpellInfo().GetMaxDuration(), true);
|
||||
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// Updated 4.3.4
|
||||
// 12975 - Last Stand
|
||||
[Script]
|
||||
class spell_warr_last_stand : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LastStandTriggered);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
int healthModSpellBasePoints0 = (int)(caster.CountPctFromMaxHealth(GetEffectValue()));
|
||||
caster.CastCustomSpell(caster, SpellIds.LastStandTriggered, healthModSpellBasePoints0, 0, 0, true, null);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
// add dummy effect spell handler to Last Stand
|
||||
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 7384 - Overpower
|
||||
[Script]
|
||||
class spell_warr_overpower : SpellScript
|
||||
{
|
||||
void HandleEffect(uint effIndex)
|
||||
{
|
||||
uint spellId = 0;
|
||||
if (GetCaster().HasAura(SpellIds.UnrelentingAssaultRank1))
|
||||
spellId = SpellIds.UnrelentingAssaultTrigger1;
|
||||
else if (GetCaster().HasAura(SpellIds.UnrelentingAssaultRank2))
|
||||
spellId = SpellIds.UnrelentingAssaultTrigger2;
|
||||
|
||||
if (spellId == 0)
|
||||
return;
|
||||
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
if (target.IsNonMeleeSpellCast(false, false, true)) // UNIT_STATE_CASTING should not be used here, it's present during a tick for instant casts
|
||||
target.CastSpell(target, spellId, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.Any));
|
||||
}
|
||||
}
|
||||
|
||||
// 97462 - Rallying Cry
|
||||
[Script]
|
||||
class spell_warr_rallying_cry : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RallyingCry);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
int basePoints0 = (int)(GetHitUnit().CountPctFromMaxHealth(GetEffectValue()));
|
||||
|
||||
GetCaster().CastCustomSpell(GetHitUnit(), SpellIds.RallyingCry, basePoints0, 0, 0, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 94009 - Rend
|
||||
[Script]
|
||||
class spell_warr_rend : AuraScript
|
||||
{
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
{
|
||||
canBeRecalculated = false;
|
||||
|
||||
// $0.25 * (($MWB + $mwb) / 2 + $AP / 14 * $MWS) bonus per tick
|
||||
float ap = caster.GetTotalAttackPowerValue(WeaponAttackType.BaseAttack);
|
||||
int mws = (int)caster.GetBaseAttackTime(WeaponAttackType.BaseAttack);
|
||||
float mwbMin = caster.GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MinDamage);
|
||||
float mwbMax = caster.GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MaxDamage);
|
||||
float mwb = ((mwbMin + mwbMax) / 2 + ap * mws / 14000) * 0.25f;
|
||||
amount += (int)(caster.ApplyEffectModifiers(GetSpellInfo(), aurEff.GetEffIndex(), mwb));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.PeriodicDamage));
|
||||
}
|
||||
}
|
||||
|
||||
// 20230 - Retaliation
|
||||
[Script]
|
||||
class spell_warr_retaliation : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RetaliationDamage);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
// check attack comes not from behind and warrior is not stunned
|
||||
return GetTarget().isInFront(eventInfo.GetProcTarget(), MathFunctions.PI) && !GetTarget().HasUnitState(UnitState.Stunned);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget().CastSpell(eventInfo.GetProcTarget(), SpellIds.RetaliationDamage, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 64380, 65941 - Shattering Throw
|
||||
[Script]
|
||||
class spell_warr_shattering_throw : SpellScript
|
||||
{
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
// remove shields, will still display immune to damage part
|
||||
Unit target = GetHitUnit();
|
||||
if (target)
|
||||
target.RemoveAurasWithMechanic(1 << (int)Mechanics.Immune_Shield, AuraRemoveMode.EnemySpell);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
// Updated 4.3.4
|
||||
[Script]
|
||||
class spell_warr_slam : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Slam);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
if (GetHitUnit())
|
||||
GetCaster().CastCustomSpell(SpellIds.Slam, SpellValueMod.BasePoint0, GetEffectValue(), GetHitUnit(), TriggerCastFlags.FullMask);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_warr_second_wind_proc : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SecoundWindProcRank1, SpellIds.SecoundWindProcRank2, SpellIds.SecoundWindTriggerRank1, SpellIds.SecoundWindTriggerRank2);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
if (eventInfo.GetProcTarget() == GetTarget())
|
||||
return false;
|
||||
if (eventInfo.GetDamageInfo().GetSpellInfo() == null ||
|
||||
(eventInfo.GetDamageInfo().GetSpellInfo().GetAllEffectsMechanicMask() & ((1 << (int)Mechanics.Root) | (1 << (int)Mechanics.Stun))) == 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
uint spellId = 0;
|
||||
|
||||
if (GetSpellInfo().Id == SpellIds.SecoundWindProcRank1)
|
||||
spellId = SpellIds.SecoundWindTriggerRank1;
|
||||
else if (GetSpellInfo().Id == SpellIds.SecoundWindProcRank2)
|
||||
spellId = SpellIds.SecoundWindTriggerRank2;
|
||||
if (spellId == 0)
|
||||
return;
|
||||
|
||||
GetTarget().CastSpell(GetTarget(), spellId, true, null, aurEff);
|
||||
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_warr_second_wind_trigger : AuraScript
|
||||
{
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
amount = (int)(GetUnitOwner().CountPctFromMaxHealth(amount));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 1, AuraType.PeriodicHeal));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 46968 - Shockwave
|
||||
class spell_warr_shockwave : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
if (!ValidateSpellInfo(SpellIds.Shockwave, SpellIds.ShockwaveStun))
|
||||
return false;
|
||||
|
||||
return spellInfo.GetEffect(0) != null && spellInfo.GetEffect(3) != null;
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void HandleStun(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.ShockwaveStun, true);
|
||||
++_targetCount;
|
||||
}
|
||||
|
||||
// Cooldown reduced by 20 sec if it strikes at least 3 targets.
|
||||
void HandleAfterCast()
|
||||
{
|
||||
if (_targetCount >= (uint)GetSpellInfo().GetEffect(0).CalcValue())
|
||||
GetCaster().ToPlayer().GetSpellHistory().ModifyCooldown(GetSpellInfo().Id, -(GetSpellInfo().GetEffect(3).CalcValue() * Time.InMilliseconds));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleStun, 0, SpellEffectName.Dummy));
|
||||
AfterCast.Add(new CastHandler(HandleAfterCast));
|
||||
}
|
||||
|
||||
uint _targetCount = 0;
|
||||
}
|
||||
|
||||
[Script] // 107570 - Storm Bolt
|
||||
class spell_warr_storm_bolt : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.StormBoltStun);
|
||||
}
|
||||
|
||||
void HandleOnHit(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.StormBoltStun, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleOnHit, 1, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 52437 - Sudden Death
|
||||
[Script]
|
||||
class spell_warr_sudden_death : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ColossusSmash);
|
||||
}
|
||||
|
||||
void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
// Remove cooldown on Colossus Smash
|
||||
Player player = GetTarget().ToPlayer();
|
||||
if (player)
|
||||
player.GetSpellHistory().ResetCooldown(SpellIds.ColossusSmash, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); // correct?
|
||||
}
|
||||
}
|
||||
|
||||
// 12328, 18765, 35429 - Sweeping Strikes
|
||||
[Script]
|
||||
class spell_warr_sweeping_strikes : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SweepingStrikesExtraAttack1, SpellIds.SweepingStrikesExtraAttack2);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
_procTarget = eventInfo.GetActor().SelectNearbyTarget(eventInfo.GetProcTarget());
|
||||
return _procTarget;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo != null)
|
||||
{
|
||||
SpellInfo spellInfo = damageInfo.GetSpellInfo();
|
||||
if (spellInfo != null && (spellInfo.Id == SpellIds.BladestormPeriodicWhirlwind || (spellInfo.Id == SpellIds.Execute && !_procTarget.HasAuraState(AuraStateType.HealthLess20Percent))))
|
||||
{
|
||||
// If triggered by Execute (while target is not under 20% hp) or Bladestorm deals normalized weapon damage
|
||||
GetTarget().CastSpell(_procTarget, SpellIds.SweepingStrikesExtraAttack2, true, null, aurEff);
|
||||
}
|
||||
else
|
||||
{
|
||||
int damage = (int)damageInfo.GetDamage();
|
||||
GetTarget().CastCustomSpell(SpellIds.SweepingStrikesExtraAttack1, SpellValueMod.BasePoint0, damage, _procTarget, true, null, aurEff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
|
||||
Unit _procTarget;
|
||||
}
|
||||
|
||||
// -46951 - Sword and Board
|
||||
[Script]
|
||||
class spell_warr_sword_and_board : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ShieldSlam);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
// Remove cooldown on Shield Slam
|
||||
Player player = GetTarget().ToPlayer();
|
||||
if (player)
|
||||
player.GetSpellHistory().ResetCooldown(SpellIds.ShieldSlam, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 215538 - Trauma
|
||||
class spell_warr_trauma : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TraumaEffect);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
Unit target = eventInfo.GetActionTarget();
|
||||
//Get the Remaining Damage from the aura (if exist)
|
||||
int remainingDamage = (int)target.GetRemainingPeriodicAmount(target.GetGUID(), SpellIds.TraumaEffect, AuraType.PeriodicDamage);
|
||||
//Get 25% of damage from the spell casted (Slam & Whirlwind) plus Remaining Damage from Aura
|
||||
int damage = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount()) / Global.SpellMgr.GetSpellInfo(SpellIds.TraumaEffect).GetMaxTicks(Difficulty.None)) + remainingDamage;
|
||||
GetCaster().CastCustomSpell(SpellIds.TraumaEffect, SpellValueMod.BasePoint0, damage, target, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 28845 - Cheat Death
|
||||
class spell_warr_t3_prot_8p_bonus : AuraScript
|
||||
{
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
if (eventInfo.GetActionTarget().HealthBelowPct(20))
|
||||
return true;
|
||||
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo != null && damageInfo.GetDamage() != 0)
|
||||
if (GetTarget().HealthBelowPctDamaged(20, damageInfo.GetDamage()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 32215 - Victorious State
|
||||
class spell_warr_victorious_state : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ImpendingVictory);
|
||||
}
|
||||
|
||||
void HandleOnProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
if (procInfo.GetActor().GetTypeId() == TypeId.Player && procInfo.GetActor().GetUInt32Value(PlayerFields.CurrentSpecId) == (uint)TalentSpecialization.WarriorFury)
|
||||
PreventDefaultAction();
|
||||
|
||||
procInfo.GetActor().GetSpellHistory().ResetCooldown(SpellIds.ImpendingVictory, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleOnProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 34428 - Victory Rush
|
||||
class spell_warr_victory_rush : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Victorious, SpellIds.VictoriousRushHeal);
|
||||
}
|
||||
|
||||
void HandleHeal()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
|
||||
caster.CastSpell(caster, SpellIds.VictoriousRushHeal, true);
|
||||
caster.RemoveAurasDueToSpell(SpellIds.Victorious);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new CastHandler(HandleHeal));
|
||||
}
|
||||
}
|
||||
|
||||
// 50720 - Vigilance
|
||||
[Script]
|
||||
class spell_warr_vigilance : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Vengeance);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
//_procTarget = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
_procTarget = GetCaster();
|
||||
return _procTarget && eventInfo.GetDamageInfo() != null;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
int damage = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetSpellInfo().GetEffect(1).CalcValue()));
|
||||
|
||||
GetTarget().CastSpell(_procTarget, SpellIds.VigilanceProc, true, null, aurEff);
|
||||
_procTarget.CastCustomSpell(_procTarget, SpellIds.Vengeance, damage, damage, damage, true, null, aurEff);
|
||||
}*/
|
||||
|
||||
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
{
|
||||
if (caster.HasAura(SpellIds.Vengeance))
|
||||
caster.RemoveAurasDueToSpell(SpellIds.Vengeance);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
//DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
//OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
OnEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.ProcTriggerSpell, AuraEffectHandleModes.Real));
|
||||
}
|
||||
|
||||
//Unit _procTarget;
|
||||
}
|
||||
|
||||
// 50725 Vigilance
|
||||
[Script]
|
||||
class spell_warr_vigilance_trigger : SpellScript
|
||||
{
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
// Remove Taunt cooldown
|
||||
Player target = GetHitPlayer();
|
||||
if (target)
|
||||
target.GetSpellHistory().ResetCooldown(SpellIds.Taunt, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user