Scripts/Pets: Update Lil' K.T.
Port From (https://github.com/TrinityCore/TrinityCore/commit/d68abbf705a870009213d8558de2884950875029)
This commit is contained in:
@@ -3087,15 +3087,6 @@ namespace Game.Entities
|
||||
spellEffectInfo.ApplyAuraName = AuraType.PeriodicTriggerSpell;
|
||||
});
|
||||
});
|
||||
|
||||
// Lich Pet
|
||||
ApplySpellFix(new [] { 70050 }, spellInfo =>
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||
{
|
||||
spellEffectInfo.TriggerSpell = 70049;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Allows those to crit
|
||||
|
||||
+133
-16
@@ -19,6 +19,8 @@ using Framework.Constants;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Pets
|
||||
{
|
||||
@@ -34,9 +36,16 @@ namespace Scripts.Pets
|
||||
public const uint EtherealOnSummon = 50052;
|
||||
public const uint EtherealPetRemoveAura = 50055;
|
||||
|
||||
//LichPet
|
||||
public const uint LichOnSummon = 69735;
|
||||
public const uint LichRemoveAura = 69736;
|
||||
// LichPet
|
||||
public const uint LichPetAura = 69732;
|
||||
public const uint LichPetAuraOnkill = 69731;
|
||||
public const uint LichPetEmote = 70049;
|
||||
}
|
||||
|
||||
struct CreatureIds
|
||||
{
|
||||
// LichPet
|
||||
public const uint LichPet = 36979;
|
||||
}
|
||||
|
||||
struct TextIds
|
||||
@@ -72,25 +81,133 @@ namespace Scripts.Pets
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_pet_lich : ScriptedAI
|
||||
[Script] // 69735 - Lich Pet OnSummon
|
||||
class spell_gen_lich_pet_onsummon : SpellScript
|
||||
{
|
||||
public npc_pet_lich(Creature creature) : base(creature) { }
|
||||
|
||||
public override void OnDespawn()
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
Unit owner = me.GetOwner();
|
||||
if (owner != null)
|
||||
DoCast(owner, SpellIds.LichRemoveAura);
|
||||
return ValidateSpellInfo(SpellIds.LichPetAura);
|
||||
}
|
||||
|
||||
public override void JustAppeared()
|
||||
void HandleScriptEffect(uint effIndex)
|
||||
{
|
||||
Unit owner = me.GetOwner();
|
||||
if (owner != null)
|
||||
DoCast(owner, SpellIds.LichOnSummon);
|
||||
Unit target = GetHitUnit();
|
||||
target.CastSpell(target, SpellIds.LichPetAura, true);
|
||||
}
|
||||
|
||||
base.JustAppeared();
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 69736 - Lich Pet Aura Remove
|
||||
class spell_gen_lich_pet_aura_remove : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LichPetAura);
|
||||
}
|
||||
|
||||
void HandleScriptEffect(uint effIndex)
|
||||
{
|
||||
GetHitUnit().RemoveAurasDueToSpell(SpellIds.LichPetAura);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 69732 - Lich Pet Aura
|
||||
class spell_gen_lich_pet_aura : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LichPetAuraOnkill);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetProcTarget().IsPlayer();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
List<TempSummon> minionList = new();
|
||||
GetUnitOwner().GetAllMinionsByEntry(minionList, CreatureIds.LichPet);
|
||||
foreach (Creature minion in minionList)
|
||||
if (minion.IsAIEnabled())
|
||||
minion.GetAI().DoCastSelf(SpellIds.LichPetAuraOnkill);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 70050 - [DND] Lich Pet
|
||||
class spell_pet_gen_lich_pet_periodic_emote : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LichPetEmote);
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
// The chance to cast this spell is not 100%.
|
||||
// Triggered spell roots creature for 3 sec and plays anim and sound (doesn't require any script).
|
||||
// Emote and sound never shows up in sniffs because both comes from spell visual directly.
|
||||
// Both 69683 and 70050 can trigger spells at once and are not linked together in any way.
|
||||
// Effect of 70050 is overlapped by effect of 69683 but not instantly (69683 is a series of spell casts, takes longer to execute).
|
||||
// However, for some reason emote is not played if creature is idle and only if creature is moving or is already rooted.
|
||||
// For now it's scripted manually in script below to play emote always.
|
||||
if (RandomHelper.randChance(50))
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.LichPetEmote, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 70049 - [DND] Lich Pet
|
||||
class spell_pet_gen_lich_pet_emote : AuraScript
|
||||
{
|
||||
void AfterApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
GetTarget().HandleEmoteCommand(Emote.OneshotCustomSpell01);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(AfterApply, 0, AuraType.ModRoot, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 69682 - Lil' K.T. Focus
|
||||
class spell_pet_gen_lich_pet_focus : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue());
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), (uint)GetEffectValue());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,10 +136,6 @@ namespace Scripts.Spells.Generic
|
||||
// Interrupt
|
||||
public const uint GenThrowInterrupt = 32747;
|
||||
|
||||
// LichPet
|
||||
public const uint LichPetAura = 69732;
|
||||
public const uint LichPetAuraOnkill = 69731;
|
||||
|
||||
// Genericlifebloomspells
|
||||
public const uint HexlordMalacrass = 43422;
|
||||
public const uint TurragePaw = 52552;
|
||||
@@ -370,9 +366,6 @@ namespace Scripts.Spells.Generic
|
||||
public const uint Trollbane = 161707;
|
||||
public const uint Whitemane = 161708;
|
||||
public const uint Morgaine = 161709;
|
||||
|
||||
// LichPet
|
||||
public const uint LichPet = 36979;
|
||||
}
|
||||
|
||||
struct ModelIds
|
||||
@@ -2161,66 +2154,6 @@ namespace Scripts.Spells.Generic
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 69732 - Lich Pet Aura
|
||||
class spell_gen_lich_pet_aura : AuraScript
|
||||
{
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetProcTarget().IsPlayer();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
List<TempSummon> minionList = new();
|
||||
GetUnitOwner().GetAllMinionsByEntry(minionList, CreatureIds.LichPet);
|
||||
foreach (Creature minion in minionList)
|
||||
if (minion.IsAIEnabled())
|
||||
minion.GetAI().DoCastSelf(SpellIds.LichPetAuraOnkill);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 69735 - Lich Pet OnSummon
|
||||
class spell_gen_lich_pet_onsummon : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LichPetAura);
|
||||
}
|
||||
|
||||
void HandleScriptEffect(uint effIndex)
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
target.CastSpell(target, SpellIds.LichPetAura, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 69736 - Lich Pet Aura Remove
|
||||
class spell_gen_lich_pet_aura_remove : SpellScript
|
||||
{
|
||||
void HandleScriptEffect(uint effIndex)
|
||||
{
|
||||
GetHitUnit().RemoveAurasDueToSpell(SpellIds.LichPetAura);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script("spell_hexlord_lifebloom", SpellIds.HexlordMalacrass)]
|
||||
[Script("spell_tur_ragepaw_lifebloom", SpellIds.TurragePaw)]
|
||||
|
||||
Reference in New Issue
Block a user