More work on scripts.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
@@ -11,11 +11,11 @@ namespace Scripts.Shadowlands
|
||||
[Script] // 323916 - Sulfuric Emission
|
||||
class spell_soulbind_sulfuric_emission : AuraScript
|
||||
{
|
||||
static uint SPELL_SULFURIC_EMISSION_COOLDOWN_AURA = 347684;
|
||||
uint SpellSulfuricEmissionCooldownAura = 347684;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SPELL_SULFURIC_EMISSION_COOLDOWN_AURA);
|
||||
return ValidateSpellInfo(SpellSulfuricEmissionCooldownAura);
|
||||
}
|
||||
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
@@ -23,7 +23,7 @@ namespace Scripts.Shadowlands
|
||||
if (!procInfo.GetProcTarget().HealthBelowPct(aurEff.GetAmount()))
|
||||
return false;
|
||||
|
||||
if (procInfo.GetProcTarget().HasAura(SPELL_SULFURIC_EMISSION_COOLDOWN_AURA))
|
||||
if (procInfo.GetProcTarget().HasAura(SpellSulfuricEmissionCooldownAura))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -31,27 +31,27 @@ namespace Scripts.Shadowlands
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckProc, 0, AuraType.ProcTriggerSpell));
|
||||
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 332753 - Superior Tactics
|
||||
class spell_soulbind_superior_tactics : AuraScript
|
||||
{
|
||||
static uint SPELL_SUPERIOR_TACTICS_COOLDOWN_AURA = 332926;
|
||||
uint SpellSuperiorTacticsCooldownAura = 332926;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SPELL_SUPERIOR_TACTICS_COOLDOWN_AURA);
|
||||
return ValidateSpellInfo(SpellSuperiorTacticsCooldownAura);
|
||||
}
|
||||
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
if (GetTarget().HasAura(SPELL_SUPERIOR_TACTICS_COOLDOWN_AURA))
|
||||
if (GetTarget().HasAura(SpellSuperiorTacticsCooldownAura))
|
||||
return false;
|
||||
|
||||
// only dispels from friendly targets count
|
||||
if (procInfo.GetHitMask().HasFlag(ProcFlagsHit.Dispel) && !procInfo.GetTypeMask().HasFlag(ProcFlags.DealHelpfulAbility | ProcFlags.DealHelpfulSpell | ProcFlags.DealHelpfulPeriodic))
|
||||
if ((procInfo.GetHitMask() & ProcFlagsHit.Dispel) != 0 && !(procInfo.GetTypeMask() & new ProcFlagsInit(ProcFlags.DealHelpfulAbility | ProcFlags.DealHelpfulSpell | ProcFlags.DealHelpfulPeriodic)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -59,7 +59,7 @@ namespace Scripts.Shadowlands
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckProc, 0, AuraType.ProcTriggerSpell));
|
||||
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
@@ -6,11 +6,37 @@ using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using static Global;
|
||||
|
||||
namespace Scripts.Shadowlands.Torghast
|
||||
{
|
||||
[Script] // 297721 - Subjugator's Manacles
|
||||
class spell_torghast_subjugators_manacles : AuraScript
|
||||
{
|
||||
List<ObjectGuid> _triggeredTargets = new();
|
||||
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
if (_triggeredTargets.Contains(procInfo.GetProcTarget().GetGUID()))
|
||||
return false;
|
||||
|
||||
_triggeredTargets.Add(procInfo.GetProcTarget().GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
void ResetMarkedTargets(bool isNowInCombat)
|
||||
{
|
||||
if (!isNowInCombat)
|
||||
_triggeredTargets.Clear();
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpell));
|
||||
OnEnterLeaveCombat.Add(new(ResetMarkedTargets));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 300771 - Blade of the Lifetaker
|
||||
class spell_torghast_blade_of_the_lifetaker : AuraScript
|
||||
{
|
||||
@@ -25,23 +51,23 @@ namespace Scripts.Shadowlands.Torghast
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 300796 - Touch of the Unseen
|
||||
class spell_torghast_touch_of_the_unseen : AuraScript
|
||||
{
|
||||
static uint SPELL_DOOR_OF_SHADOWS = 300728;
|
||||
uint SpellDoorOfShadows = 300728;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SPELL_DOOR_OF_SHADOWS);
|
||||
return ValidateSpellInfo(SpellDoorOfShadows);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo procInfo)
|
||||
{
|
||||
return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().Id == SPELL_DOOR_OF_SHADOWS;
|
||||
return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().Id == SpellDoorOfShadows;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
@@ -55,48 +81,48 @@ namespace Scripts.Shadowlands.Torghast
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
DoCheckProc.Add(new(CheckProc));
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 305060 - Yel'Shir's Powerglove
|
||||
class spell_torghast_yelshirs_powerglove : SpellScript
|
||||
{
|
||||
void HandleEffect(uint effIndex)
|
||||
void CalculateDamage(Unit victim, ref int damage, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
SpellInfo triggeringSpell = GetTriggeringSpell();
|
||||
if (triggeringSpell != null)
|
||||
{
|
||||
Aura triggerAura = GetCaster().GetAura(triggeringSpell.Id);
|
||||
if (triggerAura != null)
|
||||
SetEffectValue(GetEffectValue() * triggerAura.GetStackAmount());
|
||||
pctMod *= triggerAura.GetStackAmount();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectLaunchTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.SchoolDamage));
|
||||
CalcDamage.Add(new(CalculateDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 321706 - Dimensional Blade
|
||||
class spell_torghast_dimensional_blade : SpellScript
|
||||
{
|
||||
static uint SPELL_MAGE_BLINK = 1953;
|
||||
static uint SPELL_MAGE_SHIMMER = 212653;
|
||||
uint SpellMageBlink = 1953;
|
||||
uint SpellMageShimmer = 212653;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SPELL_MAGE_BLINK, SPELL_MAGE_SHIMMER);
|
||||
return ValidateSpellInfo(SpellMageBlink, SpellMageShimmer);
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
if (!targets.Empty())
|
||||
{
|
||||
GetCaster().GetSpellHistory().RestoreCharge(SpellMgr.GetSpellInfo(SPELL_MAGE_BLINK, Difficulty.None).ChargeCategoryId);
|
||||
GetCaster().GetSpellHistory().RestoreCharge(SpellMgr.GetSpellInfo(SPELL_MAGE_SHIMMER, Difficulty.None).ChargeCategoryId);
|
||||
GetCaster().GetSpellHistory().RestoreCharge(SpellMgr.GetSpellInfo(SpellMageBlink, Difficulty.None).ChargeCategoryId);
|
||||
GetCaster().GetSpellHistory().RestoreCharge(SpellMgr.GetSpellInfo(SpellMageShimmer, Difficulty.None).ChargeCategoryId);
|
||||
}
|
||||
|
||||
// filter targets by entry here and not with conditions table because we need to know if any enemy was hit for charge restoration, not just mawrats
|
||||
@@ -118,7 +144,190 @@ namespace Scripts.Shadowlands.Torghast
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy));
|
||||
OnObjectAreaTargetSelect.Add(new(FilterTargets, 1, Targets.UnitDestAreaEnemy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 341324 - Uncontrolled Darkness
|
||||
class spell_torghast_uncontrolled_darkness : AuraScript
|
||||
{
|
||||
public int KillCounter;
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
// just a value holder, no hooks
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 343174 - Uncontrolled Darkness
|
||||
class spell_torghast_uncontrolled_darkness_proc : AuraScript
|
||||
{
|
||||
uint SpellUncontrolledDarkness = 341324;
|
||||
uint SpellUncontrolledDarknessBuff = 341375;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((SpellUncontrolledDarkness, 1))
|
||||
&& ValidateSpellInfo(SpellUncontrolledDarknessBuff);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
Aura uncontrolledDarkness = caster.GetAura(SpellUncontrolledDarkness, caster.GetGUID());
|
||||
if (uncontrolledDarkness == null)
|
||||
return;
|
||||
|
||||
var script = uncontrolledDarkness.GetScript<spell_torghast_uncontrolled_darkness>();
|
||||
if (script == null)
|
||||
return;
|
||||
|
||||
if (caster.HasAura(SpellUncontrolledDarknessBuff))
|
||||
{
|
||||
if (++script.KillCounter >= uncontrolledDarkness.GetSpellInfo().GetEffect(1).CalcValue())
|
||||
{
|
||||
caster.RemoveAura(SpellUncontrolledDarknessBuff);
|
||||
script.KillCounter = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++script.KillCounter >= uncontrolledDarkness.GetSpellInfo().GetEffect(0).CalcValue())
|
||||
{
|
||||
caster.CastSpell(caster, SpellUncontrolledDarknessBuff, true);
|
||||
script.KillCounter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 342632 - Malevolent Stitching
|
||||
class spell_torghast_fleshcraft_shield_proc : AuraScript
|
||||
{
|
||||
uint SpellLabelFleshcraftBuff = 1103;
|
||||
|
||||
bool CheckProc(ProcEventInfo procInfo)
|
||||
{
|
||||
return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().HasLabel(SpellLabelFleshcraftBuff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new(CheckProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 342779 - Crystallized Dreams
|
||||
class spell_torghast_soulshape_proc : AuraScript
|
||||
{
|
||||
uint SpellLabelSoulshape = 1100;
|
||||
|
||||
bool CheckProc(ProcEventInfo procInfo)
|
||||
{
|
||||
return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().HasLabel(SpellLabelSoulshape);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new(CheckProc));
|
||||
}
|
||||
}
|
||||
|
||||
// 342793 - Murmuring Shawl
|
||||
[Script] // 342799 - Gnarled Key
|
||||
class spell_torghast_door_of_shadows_proc : AuraScript
|
||||
{
|
||||
uint SpellLabelDoorOfShadows = 726;
|
||||
|
||||
bool CheckProc(ProcEventInfo procInfo)
|
||||
{
|
||||
return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().HasLabel(SpellLabelDoorOfShadows);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new(CheckProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 348908 - Ethereal Wildseed
|
||||
class spell_torghast_flicker_proc : AuraScript
|
||||
{
|
||||
uint SpellLabelFlicker = 1105;
|
||||
|
||||
bool CheckProc(ProcEventInfo procInfo)
|
||||
{
|
||||
return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().HasLabel(SpellLabelFlicker);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new(CheckProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 354569 - Potent Potion
|
||||
class spell_torghast_potent_potion_proc : AuraScript
|
||||
{
|
||||
uint SpellLabelRejuvenatingSiphonedEssence = 1290;
|
||||
|
||||
bool CheckProc(ProcEventInfo procInfo)
|
||||
{
|
||||
return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().HasLabel(SpellLabelRejuvenatingSiphonedEssence);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new(CheckProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 354706 - Spiritual Rejuvenation Potion
|
||||
class spell_torghast_potent_potion_calc : SpellScript
|
||||
{
|
||||
uint SpellLabelSpiritualRejuvenationPotion = 354568;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((SpellLabelSpiritualRejuvenationPotion, 1));
|
||||
}
|
||||
|
||||
void SetValue(uint effIndex)
|
||||
{
|
||||
SetEffectValue(SpellMgr.GetSpellInfo(SpellLabelSpiritualRejuvenationPotion, GetCastDifficulty()).GetEffect(effIndex)
|
||||
.CalcValue(GetCaster(), null, GetHitUnit()));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectLaunchTarget.Add(new(SetValue, 0, SpellEffectName.Heal));
|
||||
OnEffectHitTarget.Add(new(SetValue, 1, SpellEffectName.Energize));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 373761 - Poisonous Spores
|
||||
class spell_torghast_poisonous_spores : AuraScript
|
||||
{
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Spell procSpell = procInfo.GetProcSpell();
|
||||
procInfo.GetActor().CastSpell(procSpell.m_targets.GetDst(), aurEff.GetSpellEffectInfo().TriggerSpell,
|
||||
new CastSpellExtraArgs(aurEff).SetTriggeringSpell(procSpell));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user