Core/Spells: Implemented evoker empower spell mechanic

Port From (https://github.com/TrinityCore/TrinityCore/commit/a39d0db9ec64f6bf38716abaade5b7835f2db338)
This commit is contained in:
Hondacrx
2024-08-19 18:48:32 -04:00
parent 2405543be4
commit d231c06b8e
18 changed files with 616 additions and 89 deletions
+26
View File
@@ -174,6 +174,7 @@ namespace Game.Scripting
public delegate void SpellObjectAreaTargetSelectFnType(List<WorldObject> targets);
public delegate void SpellObjectTargetSelectFnType(ref WorldObject targets);
public delegate void SpellDestinationTargetSelectFnType(ref SpellDestination dest);
public delegate void SpellEmpowerStageFnType(int completedStagesCount);
public class CastHandler
{
@@ -232,6 +233,21 @@ namespace Game.Scripting
}
}
public class EmpowerStageCompletedHandler
{
SpellEmpowerStageFnType _callImpl;
public EmpowerStageCompletedHandler(SpellEmpowerStageFnType handler)
{
_callImpl = handler;
}
public void Call(int completedStagesCount)
{
_callImpl(completedStagesCount);
}
}
public class EffectHandler : EffectHook
{
SpellEffectName _effName;
@@ -572,6 +588,14 @@ namespace Game.Scripting
// where function is void function(DamageInfo damageInfo, ref uint resistAmount, ref int absorbAmount)
public List<OnCalculateResistAbsorbHandler> OnCalculateResistAbsorb = new();
// example: OnEmpowerStageCompleted += SpellOnEmpowerStageCompletedFn(class::function);
// where function is void function(int32 completedStages)
public List<EmpowerStageCompletedHandler> OnEmpowerStageCompleted = new();
// example: OnEmpowerCompleted += SpellOnEmpowerCompletedFn(class::function);
// where function is void function(int32 completedStages)
public List<EmpowerStageCompletedHandler> OnEmpowerCompleted = new();
// where function is void function(uint effIndex)
public List<EffectHandler> OnEffectLaunch = new();
public List<EffectHandler> OnEffectLaunchTarget = new();
@@ -621,6 +645,8 @@ namespace Game.Scripting
// 14. OnEffectHitTarget - executed just before specified effect handler call - called for each target from spell target map
// 15. OnHit - executed just before spell deals damage and procs auras - when spell hits target - called for each target from spell target map
// 16. AfterHit - executed just after spell finishes all it's jobs for target - called for each target from spell target map
// 17. OnEmpowerStageCompleted - executed when empowered spell completes each stage
// 18. OnEmpowerCompleted - executed when empowered spell is released
//
// methods allowing interaction with Spell object