Updated all spell scripts
This commit is contained in:
@@ -663,7 +663,7 @@ namespace Framework.Constants
|
||||
Hunter = 3,
|
||||
Rogue = 4,
|
||||
Priest = 5,
|
||||
Deathknight = 6,
|
||||
DeathKnight = 6,
|
||||
Shaman = 7,
|
||||
Mage = 8,
|
||||
Warlock = 9,
|
||||
@@ -675,7 +675,7 @@ namespace Framework.Constants
|
||||
Max = 15,
|
||||
|
||||
ClassMaskAllPlayable = ((1 << (Warrior - 1)) | (1 << (Paladin - 1)) | (1 << (Hunter - 1)) |
|
||||
(1 << (Rogue - 1)) | (1 << (Priest - 1)) | (1 << (Deathknight - 1)) | (1 << (Shaman - 1)) |
|
||||
(1 << (Rogue - 1)) | (1 << (Priest - 1)) | (1 << (DeathKnight - 1)) | (1 << (Shaman - 1)) |
|
||||
(1 << (Mage - 1)) | (1 << (Warlock - 1)) | (1 << (Monk - 1)) | (1 << (Druid - 1)) | (1 << (DemonHunter - 1)) | (1 << (Evoker - 1))),
|
||||
|
||||
ClassMaskAllCreatures = ((1 << (Warrior - 1)) | (1 << (Paladin - 1)) | (1 << (Rogue - 1)) | (1 << (Mage - 1))),
|
||||
|
||||
@@ -203,6 +203,33 @@ namespace System.Collections.Generic
|
||||
while (list.Count <= index)
|
||||
list.Add(defaultValue);
|
||||
}
|
||||
|
||||
public static void PartitionInPlace<T>(this IList<T> list, Func<T, bool> predicate)
|
||||
{
|
||||
int left = 0;
|
||||
int right = list.Count - 1;
|
||||
|
||||
while (left <= right)
|
||||
{
|
||||
while (left <= right && predicate(list[left]))
|
||||
{
|
||||
left++;
|
||||
}
|
||||
while (left <= right && !predicate(list[right]))
|
||||
{
|
||||
right--;
|
||||
}
|
||||
|
||||
if (left < right)
|
||||
{
|
||||
T temp = list[left];
|
||||
list[left] = list[right];
|
||||
list[right] = temp;
|
||||
left++;
|
||||
right--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICheck<in T>
|
||||
|
||||
@@ -845,7 +845,7 @@ namespace Game.DataStorage
|
||||
return row.Rogue;
|
||||
case Class.Priest:
|
||||
return row.Priest;
|
||||
case Class.Deathknight:
|
||||
case Class.DeathKnight:
|
||||
return row.DeathKnight;
|
||||
case Class.Shaman:
|
||||
return row.Shaman;
|
||||
@@ -884,7 +884,7 @@ namespace Game.DataStorage
|
||||
return row.Rogue;
|
||||
case (int)Class.Priest:
|
||||
return row.Priest;
|
||||
case (int)Class.Deathknight:
|
||||
case (int)Class.DeathKnight:
|
||||
return row.DeathKnight;
|
||||
case (int)Class.Shaman:
|
||||
return row.Shaman;
|
||||
|
||||
@@ -1842,7 +1842,7 @@ namespace Game.DataStorage
|
||||
{
|
||||
return playerClass switch
|
||||
{
|
||||
Class.Deathknight => numTalentsAtLevel.NumTalentsDeathKnight,
|
||||
Class.DeathKnight => numTalentsAtLevel.NumTalentsDeathKnight,
|
||||
Class.DemonHunter => numTalentsAtLevel.NumTalentsDemonHunter,
|
||||
_ => numTalentsAtLevel.NumTalents,
|
||||
};
|
||||
@@ -1897,7 +1897,7 @@ namespace Game.DataStorage
|
||||
{
|
||||
switch (class_)
|
||||
{
|
||||
case Class.Deathknight:
|
||||
case Class.DeathKnight:
|
||||
return _pvpTalentSlotUnlock[slot].DeathKnightLevelRequired;
|
||||
case Class.DemonHunter:
|
||||
return _pvpTalentSlotUnlock[slot].DemonHunterLevelRequired;
|
||||
|
||||
@@ -637,7 +637,7 @@ namespace Game.Entities
|
||||
var conditions = Global.ConditionMgr.GetConditionsForAreaTrigger(GetTemplate().Id.Id, GetTemplate().Id.IsCustom);
|
||||
targetList.RemoveAll(target =>
|
||||
{
|
||||
if (GetCasterGuid() == target.GetGUID())
|
||||
if (GetCasterGUID() == target.GetGUID())
|
||||
{
|
||||
if (HasActionSetFlag(AreaTriggerActionSetFlag.NotTriggeredbyCaster))
|
||||
return true;
|
||||
@@ -921,7 +921,7 @@ namespace Game.Entities
|
||||
|
||||
public Unit GetCaster()
|
||||
{
|
||||
return Global.ObjAccessor.GetUnit(this, GetCasterGuid());
|
||||
return Global.ObjAccessor.GetUnit(this, GetCasterGUID());
|
||||
}
|
||||
|
||||
Unit GetTarget()
|
||||
@@ -1015,7 +1015,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
float GetMaxSearchRadius()
|
||||
public float GetMaxSearchRadius()
|
||||
{
|
||||
return m_areaTriggerData.BoundsRadius2D * CalcCurrentScale();
|
||||
}
|
||||
@@ -1161,7 +1161,7 @@ namespace Game.Entities
|
||||
case AreaTriggerActionTypes.Cast:
|
||||
goto case AreaTriggerActionTypes.AddAura;
|
||||
case AreaTriggerActionTypes.AddAura:
|
||||
unit.RemoveAurasDueToSpell(action.Param, GetCasterGuid());
|
||||
unit.RemoveAurasDueToSpell(action.Param, GetCasterGUID());
|
||||
break;
|
||||
case AreaTriggerActionTypes.Tavern:
|
||||
Player player = unit.ToPlayer();
|
||||
@@ -1574,9 +1574,9 @@ namespace Game.Entities
|
||||
|
||||
public AreaTriggerCreateProperties GetCreateProperties() { return _areaTriggerCreateProperties; }
|
||||
|
||||
public override ObjectGuid GetCreatorGUID() { return GetCasterGuid(); }
|
||||
public override ObjectGuid GetOwnerGUID() { return GetCasterGuid(); }
|
||||
public ObjectGuid GetCasterGuid() { return m_areaTriggerData.Caster; }
|
||||
public override ObjectGuid GetCreatorGUID() { return GetCasterGUID(); }
|
||||
public override ObjectGuid GetOwnerGUID() { return GetCasterGUID(); }
|
||||
public ObjectGuid GetCasterGUID() { return m_areaTriggerData.Caster; }
|
||||
|
||||
public bool HasSplines() { return _spline != null && !_spline.Empty(); }
|
||||
public Spline<float> GetSpline() { return _spline; }
|
||||
|
||||
@@ -3902,6 +3902,18 @@ namespace Game.Entities
|
||||
command.Execute(m_goTypeImpl);
|
||||
}
|
||||
|
||||
public int GetControllingTeam()
|
||||
{
|
||||
if (GetGoType() != GameObjectTypes.ControlZone)
|
||||
return BattleGroundTeamId.Neutral;
|
||||
|
||||
var controlZone = (ControlZone)m_goTypeImpl;
|
||||
if (controlZone == null)
|
||||
return BattleGroundTeamId.Neutral;
|
||||
|
||||
return controlZone.GetControllingTeam();
|
||||
}
|
||||
|
||||
public void CreateModel()
|
||||
{
|
||||
m_model = GameObjectModel.Create(new GameObjectModelOwnerImpl(this));
|
||||
@@ -4600,7 +4612,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
int GetControllingTeam()
|
||||
public int GetControllingTeam()
|
||||
{
|
||||
if (_value < GetMaxHordeValue())
|
||||
return BattleGroundTeamId.Horde;
|
||||
|
||||
@@ -2454,7 +2454,7 @@ namespace Game.Entities
|
||||
return spell.Prepare(targets.Targets, args.TriggeringAura);
|
||||
}
|
||||
|
||||
void SendPlayOrphanSpellVisual(Position sourceLocation, ObjectGuid target, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
|
||||
public void SendPlayOrphanSpellVisual(Position sourceLocation, ObjectGuid target, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
|
||||
{
|
||||
PlayOrphanSpellVisual playOrphanSpellVisual = new();
|
||||
playOrphanSpellVisual.SourceLocation = sourceLocation;
|
||||
@@ -2479,7 +2479,7 @@ namespace Game.Entities
|
||||
SendMessageToSet(playOrphanSpellVisual, true);
|
||||
}
|
||||
|
||||
void SendPlayOrphanSpellVisual(Position sourceLocation, Position targetLocation, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
|
||||
public void SendPlayOrphanSpellVisual(Position sourceLocation, Position targetLocation, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
|
||||
{
|
||||
PlayOrphanSpellVisual playOrphanSpellVisual = new();
|
||||
playOrphanSpellVisual.SourceLocation = sourceLocation;
|
||||
|
||||
@@ -1325,7 +1325,7 @@ namespace Game.Entities
|
||||
{
|
||||
case Class.Warlock:
|
||||
return GetCreatureTemplate().CreatureType == CreatureType.Demon;
|
||||
case Class.Deathknight:
|
||||
case Class.DeathKnight:
|
||||
return GetCreatureTemplate().CreatureType == CreatureType.Undead;
|
||||
case Class.Mage:
|
||||
return GetCreatureTemplate().CreatureType == CreatureType.Elemental;
|
||||
|
||||
@@ -472,7 +472,7 @@ namespace Game.Entities
|
||||
opponent.UpdateCriteria(CriteriaType.WinDuel, 1);
|
||||
|
||||
// Credit for quest Death's Challenge
|
||||
if (GetClass() == Class.Deathknight && opponent.GetQuestStatus(12733) == QuestStatus.Incomplete)
|
||||
if (GetClass() == Class.DeathKnight && opponent.GetQuestStatus(12733) == QuestStatus.Incomplete)
|
||||
opponent.CastSpell(duel.Opponent, 52994, true);
|
||||
|
||||
// Honor points after duel (the winner) - ImpConfig
|
||||
|
||||
@@ -4276,7 +4276,7 @@ namespace Game.Entities
|
||||
// Define the required variables
|
||||
uint charDeleteMinLvl;
|
||||
|
||||
if (characterInfo.ClassId == Class.Deathknight)
|
||||
if (characterInfo.ClassId == Class.DeathKnight)
|
||||
charDeleteMinLvl = WorldConfig.GetUIntValue(WorldCfg.ChardeleteDeathKnightMinLevel);
|
||||
else if (characterInfo.ClassId == Class.DemonHunter)
|
||||
charDeleteMinLvl = WorldConfig.GetUIntValue(WorldCfg.ChardeleteDemonHunterMinLevel);
|
||||
|
||||
@@ -2088,7 +2088,7 @@ namespace Game.Entities
|
||||
ushort maxValue = GetMaxSkillValueForLevel();
|
||||
if (rcInfo.HasFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
|
||||
skillValue = maxValue;
|
||||
else if (GetClass() == Class.Deathknight)
|
||||
else if (GetClass() == Class.DeathKnight)
|
||||
skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue);
|
||||
|
||||
SetSkill(skillId, 0, skillValue, maxValue);
|
||||
@@ -2104,7 +2104,7 @@ namespace Game.Entities
|
||||
ushort skillValue = 1;
|
||||
if (rcInfo.HasFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
|
||||
skillValue = maxValue;
|
||||
else if (GetClass() == Class.Deathknight)
|
||||
else if (GetClass() == Class.DeathKnight)
|
||||
skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue);
|
||||
|
||||
SetSkill(skillId, 1, skillValue, maxValue);
|
||||
@@ -3394,7 +3394,7 @@ namespace Game.Entities
|
||||
|
||||
public void InitRunes()
|
||||
{
|
||||
if (GetClass() != Class.Deathknight)
|
||||
if (GetClass() != Class.DeathKnight)
|
||||
return;
|
||||
|
||||
uint runeIndex = GetPowerIndex(PowerType.Runes);
|
||||
@@ -3414,7 +3414,7 @@ namespace Game.Entities
|
||||
|
||||
public void UpdateAllRunesRegen()
|
||||
{
|
||||
if (GetClass() != Class.Deathknight)
|
||||
if (GetClass() != Class.DeathKnight)
|
||||
return;
|
||||
|
||||
uint runeIndex = GetPowerIndex(PowerType.Runes);
|
||||
|
||||
@@ -2072,7 +2072,7 @@ namespace Game.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetClass() == Class.Deathknight && GetMapId() == 609 && !IsGameMaster() && !HasSpell(50977))
|
||||
if (GetClass() == Class.DeathKnight && GetMapId() == 609 && !IsGameMaster() && !HasSpell(50977))
|
||||
{
|
||||
SendTransferAborted(teleportLocation.Location.GetMapId(), TransferAbortReason.UniqueMessage, 1);
|
||||
return false;
|
||||
@@ -2230,7 +2230,7 @@ namespace Game.Entities
|
||||
if (CliDB.ChrRacesStorage.LookupByKey(race).HasFlag(ChrRacesFlag.IsAlliedRace))
|
||||
startLevel = WorldConfig.GetUIntValue(WorldCfg.StartAlliedRaceLevel);
|
||||
|
||||
if (playerClass == Class.Deathknight)
|
||||
if (playerClass == Class.DeathKnight)
|
||||
{
|
||||
if (race == Race.PandarenAlliance || race == Race.PandarenHorde)
|
||||
startLevel = Math.Max(WorldConfig.GetUIntValue(WorldCfg.StartAlliedRaceLevel), startLevel);
|
||||
@@ -3587,7 +3587,7 @@ namespace Game.Entities
|
||||
Regenerate(power);
|
||||
|
||||
// Runes act as cooldowns, and they don't need to send any data
|
||||
if (GetClass() == Class.Deathknight)
|
||||
if (GetClass() == Class.DeathKnight)
|
||||
{
|
||||
uint regeneratedRunes = 0;
|
||||
int regenIndex = 0;
|
||||
@@ -7393,7 +7393,7 @@ namespace Game.Entities
|
||||
if (node.HasFlag(TaxiNodeFlags.UsePlayerFavoriteMount) && preferredMountDisplay != 0)
|
||||
mount_display_id = preferredMountDisplay;
|
||||
else
|
||||
mount_display_id = ObjectMgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == null || (sourcenode == 315 && GetClass() == Class.Deathknight));
|
||||
mount_display_id = ObjectMgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == null || (sourcenode == 315 && GetClass() == Class.DeathKnight));
|
||||
|
||||
// in spell case allow 0 model
|
||||
if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Game.Entities
|
||||
m_taximask = new byte[((CliDB.TaxiNodesStorage.GetNumRows() - 1) / (1 * 64) + 1) * 8];
|
||||
|
||||
// class specific initial known nodes
|
||||
if (chrClass == Class.Deathknight)
|
||||
if (chrClass == Class.DeathKnight)
|
||||
{
|
||||
var factionMask = Player.TeamForRace(race) == Team.Horde ? DB2Manager.HordeTaxiNodesMask : DB2Manager.AllianceTaxiNodesMask;
|
||||
m_taximask = new byte[factionMask.Length];
|
||||
|
||||
@@ -917,7 +917,7 @@ namespace Game.Entities
|
||||
return Math.Max(missChance, 0f);
|
||||
}
|
||||
|
||||
float GetUnitCriticalChanceDone(WeaponAttackType attackType)
|
||||
public float GetUnitCriticalChanceDone(WeaponAttackType attackType)
|
||||
{
|
||||
float chance = 0.0f;
|
||||
Player thisPlayer = ToPlayer();
|
||||
@@ -1585,7 +1585,7 @@ namespace Game.Entities
|
||||
ApplyAttackTimePercentMod(WeaponAttackType.OffAttack, oldVal, false);
|
||||
ApplyAttackTimePercentMod(WeaponAttackType.BaseAttack, newVal, true);
|
||||
ApplyAttackTimePercentMod(WeaponAttackType.OffAttack, newVal, true);
|
||||
if (GetClass() == Class.Deathknight)
|
||||
if (GetClass() == Class.DeathKnight)
|
||||
UpdateAllRunesRegen();
|
||||
break;
|
||||
case CombatRating.HasteRanged:
|
||||
|
||||
@@ -623,7 +623,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (GetOwner().GetClass() == Class.Warlock
|
||||
|| GetOwner().GetClass() == Class.Shaman // Fire Elemental
|
||||
|| GetOwner().GetClass() == Class.Deathknight) // Risen Ghoul
|
||||
|| GetOwner().GetClass() == Class.DeathKnight) // Risen Ghoul
|
||||
{
|
||||
petType = PetType.Summon;
|
||||
}
|
||||
|
||||
@@ -312,11 +312,23 @@ namespace Game.Entities
|
||||
m_hitMask |= ProcFlagsHit.Absorb;
|
||||
}
|
||||
|
||||
public void ModifyDamage(ref int amount)
|
||||
{
|
||||
amount = Math.Max(amount, -((int)GetDamage()));
|
||||
m_damage += (uint)amount;
|
||||
}
|
||||
public void ModifyDamage(int amount)
|
||||
{
|
||||
amount = Math.Max(amount, -((int)GetDamage()));
|
||||
m_damage += (uint)amount;
|
||||
}
|
||||
public void AbsorbDamage(ref uint amount)
|
||||
{
|
||||
amount = Math.Min(amount, GetDamage());
|
||||
m_absorb += amount;
|
||||
m_damage -= amount;
|
||||
m_hitMask |= ProcFlagsHit.Absorb;
|
||||
}
|
||||
public void AbsorbDamage(uint amount)
|
||||
{
|
||||
amount = Math.Min(amount, GetDamage());
|
||||
@@ -324,6 +336,17 @@ namespace Game.Entities
|
||||
m_damage -= amount;
|
||||
m_hitMask |= ProcFlagsHit.Absorb;
|
||||
}
|
||||
public void ResistDamage(ref uint amount)
|
||||
{
|
||||
amount = Math.Min(amount, GetDamage());
|
||||
m_resist += amount;
|
||||
m_damage -= amount;
|
||||
if (m_damage == 0)
|
||||
{
|
||||
m_hitMask |= ProcFlagsHit.FullResist;
|
||||
m_hitMask &= ~(ProcFlagsHit.Normal | ProcFlagsHit.Critical);
|
||||
}
|
||||
}
|
||||
public void ResistDamage(uint amount)
|
||||
{
|
||||
amount = Math.Min(amount, GetDamage());
|
||||
@@ -335,7 +358,7 @@ namespace Game.Entities
|
||||
m_hitMask &= ~(ProcFlagsHit.Normal | ProcFlagsHit.Critical);
|
||||
}
|
||||
}
|
||||
void BlockDamage(uint amount)
|
||||
public void BlockDamage(ref uint amount)
|
||||
{
|
||||
amount = Math.Min(amount, GetDamage());
|
||||
m_block += amount;
|
||||
|
||||
@@ -528,14 +528,17 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public void GetAllMinionsByEntry(List<TempSummon> Minions, uint entry)
|
||||
public List<TempSummon> GetAllMinionsByEntry(uint entry)
|
||||
{
|
||||
List<TempSummon> minions = new();
|
||||
for (var i = 0; i < m_Controlled.Count; ++i)
|
||||
{
|
||||
Unit unit = m_Controlled[i];
|
||||
if (unit.GetEntry() == entry && unit.IsSummon()) // minion, actually
|
||||
Minions.Add(unit.ToTempSummon());
|
||||
minions.Add(unit.ToTempSummon());
|
||||
}
|
||||
|
||||
return minions;
|
||||
}
|
||||
|
||||
public void RemoveAllMinionsByEntry(uint entry)
|
||||
|
||||
@@ -2685,6 +2685,11 @@ namespace Game.Entities
|
||||
return m_appliedAuras.KeyValueList;
|
||||
}
|
||||
|
||||
public List<AuraApplication> GetAppliedAuras(uint key)
|
||||
{
|
||||
return m_appliedAuras.LookupByKey(key);
|
||||
}
|
||||
|
||||
public Aura AddAura(uint spellId, Unit target)
|
||||
{
|
||||
if (target == null)
|
||||
|
||||
@@ -3568,7 +3568,7 @@ namespace Game.Entities
|
||||
if (spell != null)
|
||||
spell.CallScriptOnResistAbsorbCalculateHandlers(damageInfo, ref resistedDamage, ref absorbIgnoringDamage);
|
||||
|
||||
damageInfo.ResistDamage(resistedDamage);
|
||||
damageInfo.ResistDamage(ref resistedDamage);
|
||||
|
||||
// We're going to call functions which can modify content of the list during iteration over it's elements
|
||||
// Let's copy the list so we can prevent iterator invalidation
|
||||
@@ -3608,9 +3608,10 @@ namespace Game.Entities
|
||||
// absorb must be smaller than the damage itself
|
||||
currentAbsorb = MathFunctions.RoundToInterval(ref currentAbsorb, 0, damageInfo.GetDamage());
|
||||
|
||||
damageInfo.AbsorbDamage((uint)currentAbsorb);
|
||||
uint temp = (uint)currentAbsorb;
|
||||
damageInfo.AbsorbDamage(ref temp);
|
||||
tempAbsorb = temp;
|
||||
|
||||
tempAbsorb = (uint)currentAbsorb;
|
||||
absorbAurEff.GetBase().CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, damageInfo, ref tempAbsorb);
|
||||
|
||||
// Check if our aura is using amount to count heal
|
||||
@@ -3625,7 +3626,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
if (!absorbAurEff.GetSpellInfo().HasAttribute(SpellAttr6.AbsorbCannotBeIgnore))
|
||||
damageInfo.ModifyDamage(absorbIgnoringDamage);
|
||||
damageInfo.ModifyDamage(ref absorbIgnoringDamage);
|
||||
|
||||
if (currentAbsorb != 0)
|
||||
{
|
||||
|
||||
@@ -6139,7 +6139,7 @@ namespace Game
|
||||
switch ((SpellCategories)itemTemplate.Effects[0].SpellCategoryID)
|
||||
{
|
||||
case SpellCategories.Food: // food
|
||||
count = characterLoadout.ChrClassID == (int)Class.Deathknight ? 10 : 4u;
|
||||
count = characterLoadout.ChrClassID == (int)Class.DeathKnight ? 10 : 4u;
|
||||
break;
|
||||
case SpellCategories.Drink: // drink
|
||||
count = 2;
|
||||
@@ -6502,7 +6502,7 @@ namespace Game
|
||||
continue;
|
||||
|
||||
// skip expansion classes if not playing with expansion
|
||||
if (WorldConfig.GetIntValue(WorldCfg.Expansion) < (int)Expansion.WrathOfTheLichKing && _class == Class.Deathknight)
|
||||
if (WorldConfig.GetIntValue(WorldCfg.Expansion) < (int)Expansion.WrathOfTheLichKing && _class == Class.DeathKnight)
|
||||
continue;
|
||||
|
||||
if (WorldConfig.GetIntValue(WorldCfg.Expansion) < (int)Expansion.MistsOfPandaria && (race == Race.PandarenNeutral || race == Race.PandarenHorde || race == Race.PandarenAlliance))
|
||||
|
||||
@@ -2018,7 +2018,7 @@ namespace Game
|
||||
{
|
||||
// i = (315 - 1) / 8 = 39
|
||||
// m = 1 << ((315 - 1) % 8) = 4
|
||||
int deathKnightExtraNode = playerClass != Class.Deathknight || i != 39 ? 0 : 4;
|
||||
int deathKnightExtraNode = playerClass != Class.DeathKnight || i != 39 ? 0 : 4;
|
||||
taximaskstream += (uint)(factionMask[i] | deathKnightExtraNode) + ' ';
|
||||
}
|
||||
|
||||
|
||||
@@ -630,7 +630,7 @@ namespace Game
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (target.GetCasterGuid() != _player.GetGUID())
|
||||
if (target.GetCasterGUID() != _player.GetGUID())
|
||||
return;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(target.m_areaTriggerData.SpellForVisuals, _player.GetMap().GetDifficultyID());
|
||||
|
||||
@@ -687,6 +687,7 @@ namespace Game.Maps
|
||||
WorldObjectSearcherContinuation ShouldContinue();
|
||||
void Insert(T obj);
|
||||
T GetResult();
|
||||
bool HasResult();
|
||||
}
|
||||
|
||||
class SearcherFirstObjectResult<T>() : IResultInserter<T>
|
||||
@@ -703,6 +704,11 @@ namespace Game.Maps
|
||||
result = obj;
|
||||
}
|
||||
|
||||
public bool HasResult()
|
||||
{
|
||||
return result != null;
|
||||
}
|
||||
|
||||
public T GetResult()
|
||||
{
|
||||
return result;
|
||||
@@ -723,6 +729,11 @@ namespace Game.Maps
|
||||
result = obj;
|
||||
}
|
||||
|
||||
public bool HasResult()
|
||||
{
|
||||
return result != null;
|
||||
}
|
||||
|
||||
public T GetResult()
|
||||
{
|
||||
return result;
|
||||
@@ -743,6 +754,11 @@ namespace Game.Maps
|
||||
container.Add(obj);
|
||||
}
|
||||
|
||||
public bool HasResult()
|
||||
{
|
||||
return !container.Empty();
|
||||
}
|
||||
|
||||
public T GetResult()
|
||||
{
|
||||
return default;
|
||||
@@ -876,6 +892,11 @@ namespace Game.Maps
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasResult()
|
||||
{
|
||||
return resultInserter.HasResult();
|
||||
}
|
||||
|
||||
public T GetResult()
|
||||
{
|
||||
return resultInserter.GetResult();
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Game.Networking.Packets
|
||||
FirstLogin = atLoginFlags.HasAnyFlag(AtLoginFlags.FirstLogin);
|
||||
|
||||
// show pet at selection character in character list only for non-ghost character
|
||||
if (!playerFlags.HasAnyFlag(PlayerFlags.Ghost) && (ClassId == Class.Warlock || ClassId == Class.Hunter || ClassId == Class.Deathknight))
|
||||
if (!playerFlags.HasAnyFlag(PlayerFlags.Ghost) && (ClassId == Class.Warlock || ClassId == Class.Hunter || ClassId == Class.DeathKnight))
|
||||
{
|
||||
CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(fields.Read<uint>(14));
|
||||
if (creatureInfo != null)
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Game.Scripting
|
||||
var constructors = type.GetConstructors();
|
||||
if (constructors.Length == 0)
|
||||
{
|
||||
Log.outError(LogFilter.Scripts, "Script: {0} contains no Public Constructors. Can't load script.", type.Name);
|
||||
Log.outError(LogFilter.Scripts, $"Script: {type.Name} contains no Public Constructors. Can't load script.");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -84,16 +84,15 @@ namespace Game.Scripting
|
||||
string name = type.Name;
|
||||
|
||||
bool validArgs = true;
|
||||
int i = 0;
|
||||
foreach (var constructor in constructors)
|
||||
{
|
||||
var parameters = constructor.GetParameters();
|
||||
if (parameters.Length != attribute.Args.Length)
|
||||
continue;
|
||||
|
||||
foreach (var arg in constructor.GetParameters())
|
||||
for (var i = 0; i < parameters.Length; ++i)
|
||||
{
|
||||
if (arg.ParameterType != attribute.Args[i++].GetType())
|
||||
if (attribute.Args[i] != null && attribute.Args[i].GetType() != parameters[i].ParameterType)
|
||||
{
|
||||
validArgs = false;
|
||||
break;
|
||||
@@ -110,6 +109,9 @@ namespace Game.Scripting
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!attribute.Name.IsEmpty())
|
||||
name = attribute.Name;
|
||||
|
||||
switch (type.BaseType.Name)
|
||||
{
|
||||
case nameof(SpellScript):
|
||||
@@ -129,6 +131,9 @@ namespace Game.Scripting
|
||||
case nameof(ConversationAI):
|
||||
genericType = typeof(GenericConversationScript<>).MakeGenericType(type);
|
||||
break;
|
||||
case nameof(BattlegroundScript):
|
||||
genericType = typeof(GenericBattlegroundMapScript<>).MakeGenericType(type);
|
||||
break;
|
||||
case "SpellScriptLoader":
|
||||
case "AuraScriptLoader":
|
||||
case "WorldScript":
|
||||
@@ -161,22 +166,16 @@ namespace Game.Scripting
|
||||
case "AchievementScript":
|
||||
case "BattlefieldScript":
|
||||
case "EventScript":
|
||||
if (!attribute.Name.IsEmpty())
|
||||
name = attribute.Name;
|
||||
|
||||
if (attribute.Args.Empty())
|
||||
Activator.CreateInstance(genericType);
|
||||
else
|
||||
Activator.CreateInstance(genericType, new object[] { name }.Combine(attribute.Args));
|
||||
Activator.CreateInstance(genericType, name, attribute.Args);
|
||||
continue;
|
||||
default:
|
||||
genericType = typeof(GenericCreatureScript<>).MakeGenericType(type);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!attribute.Name.IsEmpty())
|
||||
name = attribute.Name;
|
||||
|
||||
Activator.CreateInstance(genericType, name, attribute.Args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Game.Scripting
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ValidateSpellInfo(params uint[] spellIds)
|
||||
public static bool ValidateSpellInfo(params uint[] spellIds)
|
||||
{
|
||||
bool allValid = true;
|
||||
foreach (uint spellId in spellIds)
|
||||
@@ -45,7 +45,7 @@ namespace Game.Scripting
|
||||
return allValid;
|
||||
}
|
||||
|
||||
public bool ValidateSpellEffect(params (uint spellId, uint effectIndex)[] pairs)
|
||||
public static bool ValidateSpellEffect(params (uint spellId, uint effectIndex)[] pairs)
|
||||
{
|
||||
bool allValid = true;
|
||||
foreach (var (spellId, effectIndex) in pairs)
|
||||
@@ -56,7 +56,7 @@ namespace Game.Scripting
|
||||
return allValid;
|
||||
}
|
||||
|
||||
public bool ValidateSpellEffect(uint spellId, uint effectIndex)
|
||||
public static bool ValidateSpellEffect(uint spellId, uint effectIndex)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
|
||||
@@ -4047,7 +4047,7 @@ namespace Game.Spells
|
||||
if ((m_caster.IsPlayer() || (m_caster.IsTypeId(TypeId.Unit) && m_caster.ToCreature().IsPet())) && m_powerCost.Any(cost => cost.Power != PowerType.Health))
|
||||
castFlags |= SpellCastFlags.PowerLeftSelf;
|
||||
|
||||
if (m_caster.IsPlayer() && m_caster.ToPlayer().GetClass() == Class.Deathknight &&
|
||||
if (m_caster.IsPlayer() && m_caster.ToPlayer().GetClass() == Class.DeathKnight &&
|
||||
HasPowerTypeCost(PowerType.Runes) && !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnorePowerCost))
|
||||
{
|
||||
castFlags |= SpellCastFlags.NoGCD; // not needed, but it's being sent according to sniffs
|
||||
@@ -4820,7 +4820,7 @@ namespace Game.Spells
|
||||
if (player == null)
|
||||
return SpellCastResult.SpellCastOk;
|
||||
|
||||
if (player.GetClass() != Class.Deathknight)
|
||||
if (player.GetClass() != Class.DeathKnight)
|
||||
return SpellCastResult.SpellCastOk;
|
||||
|
||||
int readyRunes = 0;
|
||||
@@ -4836,7 +4836,7 @@ namespace Game.Spells
|
||||
|
||||
void TakeRunePower(bool didHit)
|
||||
{
|
||||
if (!m_caster.IsTypeId(TypeId.Player) || m_caster.ToPlayer().GetClass() != Class.Deathknight)
|
||||
if (!m_caster.IsTypeId(TypeId.Player) || m_caster.ToPlayer().GetClass() != Class.DeathKnight)
|
||||
return;
|
||||
|
||||
Player player = m_caster.ToPlayer();
|
||||
@@ -4858,7 +4858,7 @@ namespace Game.Spells
|
||||
|
||||
void RefundRunePower()
|
||||
{
|
||||
if (!m_caster.IsPlayer() || m_caster.ToPlayer().GetClass() != Class.Deathknight)
|
||||
if (!m_caster.IsPlayer() || m_caster.ToPlayer().GetClass() != Class.DeathKnight)
|
||||
return;
|
||||
|
||||
Player player = m_caster.ToPlayer();
|
||||
@@ -6578,7 +6578,7 @@ namespace Game.Spells
|
||||
return unit.HasUnitMovementFlag(MovementFlag.Forward | MovementFlag.StrafeLeft | MovementFlag.StrafeRight | MovementFlag.Falling) && !unit.IsWalking();
|
||||
}
|
||||
|
||||
(float minRange, float maxRange) GetMinMaxRange(bool strict)
|
||||
public (float minRange, float maxRange) GetMinMaxRange(bool strict)
|
||||
{
|
||||
float rangeMod = 0.0f;
|
||||
float minRange = 0.0f;
|
||||
@@ -8421,7 +8421,7 @@ namespace Game.Spells
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
int CalculateDamage(SpellEffectInfo spellEffectInfo, Unit target)
|
||||
public int CalculateDamage(SpellEffectInfo spellEffectInfo, Unit target)
|
||||
{
|
||||
return CalculateDamage(spellEffectInfo, target, out _);
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ namespace Game.Spells
|
||||
_categoryCharges.Add(chargeCategoryId, new ChargeEntry(recoveryStart, TimeSpan.FromMilliseconds(chargeRecovery)));
|
||||
}
|
||||
|
||||
void ModifyChargeRecoveryTime(uint chargeCategoryId, TimeSpan cooldownMod)
|
||||
public void ModifyChargeRecoveryTime(uint chargeCategoryId, TimeSpan cooldownMod)
|
||||
{
|
||||
var chargeCategoryEntry = CliDB.SpellCategoryStorage.LookupByKey(chargeCategoryId);
|
||||
if (chargeCategoryEntry == null)
|
||||
@@ -1119,12 +1119,19 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
|
||||
void GetCooldownDurations(SpellInfo spellInfo, uint itemId, ref uint categoryId)
|
||||
public static void GetCooldownDurations(SpellInfo spellInfo, uint itemId, ref uint categoryId)
|
||||
{
|
||||
TimeSpan notUsed = TimeSpan.Zero;
|
||||
GetCooldownDurations(spellInfo, itemId, ref notUsed, ref categoryId, ref notUsed);
|
||||
}
|
||||
|
||||
public static void GetCooldownDurations(SpellInfo spellInfo, uint itemId, ref TimeSpan cooldown)
|
||||
{
|
||||
TimeSpan notUsed = TimeSpan.Zero;
|
||||
uint notUsedId = 0;
|
||||
GetCooldownDurations(spellInfo, itemId, ref cooldown, ref notUsedId, ref notUsed);
|
||||
}
|
||||
|
||||
public static void GetCooldownDurations(SpellInfo spellInfo, uint itemId, ref TimeSpan cooldown, ref uint categoryId, ref TimeSpan categoryCooldown)
|
||||
{
|
||||
TimeSpan tmpCooldown = TimeSpan.MinValue;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 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.
|
||||
// Licensed under the Gnu General Public License. See License file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
@@ -8,10 +8,29 @@ using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Scripts.Spells.Azerite
|
||||
namespace Scripts.Spells.Azerite;
|
||||
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint AgonySoulShardGain = 210067;
|
||||
public const uint BlessedPortentsHeal = 280052;
|
||||
public const uint BlessedPortentsTrait = 267889;
|
||||
public const uint BracingChill = 272276;
|
||||
public const uint BracingChillHeal = 272428;
|
||||
public const uint BracingChillSearchJumpTarget = 272436;
|
||||
public const uint BracingChillTrait = 267884;
|
||||
public const uint ConcentratedMendingTrait = 267882;
|
||||
public const uint DhSoulBarrier = 263648;
|
||||
public const uint EchoingBladesTrait = 287649;
|
||||
public const uint HunterCoordinatedAssault = 266779;
|
||||
public const uint MageFrozenOrb = 84714;
|
||||
public const uint StrengthInNumbersTrait = 271546;
|
||||
public const uint StrengthInNumbersBuff = 271550;
|
||||
public const uint TradewindsAllyBuff = 281844;
|
||||
public const uint WarriorIgnorePain = 190456;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_azerite_gen_aura_calc_from_2nd_effect_triggered_spell : AuraScript
|
||||
{
|
||||
@@ -27,7 +46,7 @@ namespace Scripts.Spells.Azerite
|
||||
{
|
||||
amount = 0;
|
||||
canBeRecalculated = false;
|
||||
foreach (var (_, aurApp) in caster.GetAppliedAuras().Where(pair => pair.Key == GetEffectInfo(1).TriggerSpell))
|
||||
foreach (var aurApp in caster.GetAppliedAuras(GetEffectInfo(1).TriggerSpell))
|
||||
if (aurApp.HasEffect(0))
|
||||
amount += aurApp.GetBase().GetEffect(0).GetAmount();
|
||||
}
|
||||
@@ -63,22 +82,19 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 271548 - Strength in Numbers
|
||||
class spell_item_strength_in_numbers : SpellScript
|
||||
{
|
||||
const uint SpellStrengthInNumbersTrait = 271546;
|
||||
const uint SpellStrengthInNumbersBuff = 271550;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellStrengthInNumbersTrait, SpellStrengthInNumbersBuff);
|
||||
return ValidateSpellInfo(SpellIds.StrengthInNumbersTrait, SpellIds.StrengthInNumbersBuff);
|
||||
}
|
||||
|
||||
void TriggerHealthBuff()
|
||||
{
|
||||
AuraEffect trait = GetCaster().GetAuraEffect(SpellStrengthInNumbersTrait, 0, GetCaster().GetGUID());
|
||||
AuraEffect trait = GetCaster().GetAuraEffect(SpellIds.StrengthInNumbersTrait, 0, GetCaster().GetGUID());
|
||||
if (trait != null)
|
||||
{
|
||||
long enemies = GetUnitTargetCountForEffect(0);
|
||||
if (enemies != 0)
|
||||
GetCaster().CastSpell(GetCaster(), SpellStrengthInNumbersBuff, new CastSpellExtraArgs(TriggerCastFlags.FullMask)
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.StrengthInNumbersBuff, new CastSpellExtraArgs(TriggerCastFlags.FullMask)
|
||||
.AddSpellMod(SpellValueMod.BasePoint0, trait.GetAmount())
|
||||
.AddSpellMod(SpellValueMod.AuraStack, (int)enemies));
|
||||
}
|
||||
@@ -93,12 +109,9 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 271843 - Blessed Portents
|
||||
class spell_item_blessed_portents : AuraScript
|
||||
{
|
||||
const uint SpellBlessedPortentsTrait = 267889;
|
||||
const uint SpellBlessedPortentsHeal = 280052;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellBlessedPortentsTrait, SpellBlessedPortentsHeal);
|
||||
return ValidateSpellInfo(SpellIds.BlessedPortentsTrait, SpellIds.BlessedPortentsHeal);
|
||||
}
|
||||
|
||||
void CheckProc(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
|
||||
@@ -108,9 +121,9 @@ namespace Scripts.Spells.Azerite
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
AuraEffect trait = caster.GetAuraEffect(SpellBlessedPortentsTrait, 0, caster.GetGUID());
|
||||
AuraEffect trait = caster.GetAuraEffect(SpellIds.BlessedPortentsTrait, 0, caster.GetGUID());
|
||||
if (trait != null)
|
||||
caster.CastSpell(GetTarget(), SpellBlessedPortentsHeal, new CastSpellExtraArgs(TriggerCastFlags.FullMask)
|
||||
caster.CastSpell(GetTarget(), SpellIds.BlessedPortentsHeal, new CastSpellExtraArgs(TriggerCastFlags.FullMask)
|
||||
.AddSpellMod(SpellValueMod.BasePoint0, trait.GetAmount()));
|
||||
}
|
||||
}
|
||||
@@ -127,11 +140,9 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 272260 - Concentrated Mending
|
||||
class spell_item_concentrated_mending : AuraScript
|
||||
{
|
||||
const uint SpellConcentratedMendingTrait = 267882;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellConcentratedMendingTrait);
|
||||
return ValidateSpellInfo(SpellIds.ConcentratedMendingTrait);
|
||||
}
|
||||
|
||||
void RecalculateHealAmount(AuraEffect aurEff)
|
||||
@@ -139,7 +150,7 @@ namespace Scripts.Spells.Azerite
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
AuraEffect trait = caster.GetAuraEffect(SpellConcentratedMendingTrait, 0, caster.GetGUID());
|
||||
AuraEffect trait = caster.GetAuraEffect(SpellIds.ConcentratedMendingTrait, 0, caster.GetGUID());
|
||||
if (trait != null)
|
||||
aurEff.ChangeAmount((int)(trait.GetAmount() * aurEff.GetTickNumber()));
|
||||
}
|
||||
@@ -154,13 +165,9 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 272276 - Bracing Chill
|
||||
class spell_item_bracing_chill_proc : AuraScript
|
||||
{
|
||||
const uint SpellBracingChillTrait = 267884;
|
||||
const uint SpellBracingChillHeal = 272428;
|
||||
const uint SpellBracingChillSearchJumpTarget = 272436;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellBracingChillTrait, SpellBracingChillHeal, SpellBracingChillSearchJumpTarget);
|
||||
return ValidateSpellInfo(SpellIds.BracingChillTrait, SpellIds.BracingChillHeal, SpellIds.BracingChillSearchJumpTarget);
|
||||
}
|
||||
|
||||
bool CheckHealCaster(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
@@ -174,13 +181,13 @@ namespace Scripts.Spells.Azerite
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
AuraEffect trait = caster.GetAuraEffect(SpellBracingChillTrait, 0, caster.GetGUID());
|
||||
AuraEffect trait = caster.GetAuraEffect(SpellIds.BracingChillTrait, 0, caster.GetGUID());
|
||||
if (trait != null)
|
||||
caster.CastSpell(procInfo.GetProcTarget(), SpellBracingChillHeal,
|
||||
caster.CastSpell(procInfo.GetProcTarget(), SpellIds.BracingChillHeal,
|
||||
new CastSpellExtraArgs(TriggerCastFlags.FullMask).AddSpellMod(SpellValueMod.BasePoint0, trait.GetAmount()));
|
||||
|
||||
if (GetStackAmount() > 1)
|
||||
caster.CastSpell(null, SpellBracingChillSearchJumpTarget,
|
||||
caster.CastSpell(null, SpellIds.BracingChillSearchJumpTarget,
|
||||
new CastSpellExtraArgs(TriggerCastFlags.FullMask).AddSpellMod(SpellValueMod.AuraStack, GetStackAmount() - 1));
|
||||
|
||||
Remove();
|
||||
@@ -196,15 +203,13 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 272436 - Bracing Chill
|
||||
class spell_item_bracing_chill_search_jump_target : SpellScript
|
||||
{
|
||||
const uint SpellBracingChill = 272276;
|
||||
|
||||
void FilterTarget(List<WorldObject> targets)
|
||||
{
|
||||
if (targets.Empty())
|
||||
return;
|
||||
|
||||
List<WorldObject> copy = new(targets);
|
||||
copy.RandomResize(target => target.IsUnit() && !target.ToUnit().HasAura(SpellBracingChill, GetCaster().GetGUID()), 1);
|
||||
copy.RandomResize(target => target.IsUnit() && !target.ToUnit().HasAura(SpellIds.BracingChill, GetCaster().GetGUID()), 1);
|
||||
|
||||
if (!copy.Empty())
|
||||
{
|
||||
@@ -220,7 +225,7 @@ namespace Scripts.Spells.Azerite
|
||||
|
||||
void MoveAura(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellBracingChill,
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.BracingChill,
|
||||
new CastSpellExtraArgs(TriggerCastFlags.FullMask).AddSpellMod(SpellValueMod.AuraStack, GetSpellValue().AuraStackAmount));
|
||||
}
|
||||
|
||||
@@ -248,13 +253,9 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 272892 - Wracking Brilliance
|
||||
class spell_item_wracking_brilliance : AuraScript
|
||||
{
|
||||
const uint SpellAgonySoulShardGain = 210067;
|
||||
|
||||
bool _canTrigger = true;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellAgonySoulShardGain);
|
||||
return ValidateSpellInfo(SpellIds.AgonySoulShardGain);
|
||||
}
|
||||
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
@@ -263,7 +264,7 @@ namespace Scripts.Spells.Azerite
|
||||
if (spellInfo == null)
|
||||
return false;
|
||||
|
||||
if (spellInfo.Id != SpellAgonySoulShardGain)
|
||||
if (spellInfo.Id != SpellIds.AgonySoulShardGain)
|
||||
return false;
|
||||
|
||||
_canTrigger = !_canTrigger; // every other soul shard gain
|
||||
@@ -274,21 +275,21 @@ namespace Scripts.Spells.Azerite
|
||||
{
|
||||
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
|
||||
bool _canTrigger = true;
|
||||
}
|
||||
|
||||
[Script] // 275514 - Orbital Precision
|
||||
class spell_item_orbital_precision : AuraScript
|
||||
{
|
||||
const uint SpellMageFrozenOrb = 84714;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellMageFrozenOrb);
|
||||
return ValidateSpellInfo(SpellIds.MageFrozenOrb);
|
||||
}
|
||||
|
||||
bool CheckFrozenOrbActive(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetActor().GetAreaTrigger(SpellMageFrozenOrb) != null;
|
||||
return eventInfo.GetActor().GetAreaTrigger(SpellIds.MageFrozenOrb) != null;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -300,16 +301,14 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 277966 - Blur of Talons
|
||||
class spell_item_blur_of_talons : AuraScript
|
||||
{
|
||||
const uint SpellHunterCoordinatedAssault = 266779;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellHunterCoordinatedAssault);
|
||||
return ValidateSpellInfo(SpellIds.HunterCoordinatedAssault);
|
||||
}
|
||||
|
||||
bool CheckCoordinatedAssaultActive(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetActor().HasAura(SpellHunterCoordinatedAssault, eventInfo.GetActor().GetGUID());
|
||||
return eventInfo.GetActor().HasAura(SpellIds.HunterCoordinatedAssault, eventInfo.GetActor().GetGUID());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -349,18 +348,16 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 281843 - Tradewinds
|
||||
class spell_item_tradewinds : AuraScript
|
||||
{
|
||||
const uint SpellTradewindsAllyBuff = 281844;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellTradewindsAllyBuff);
|
||||
return ValidateSpellInfo(SpellIds.TradewindsAllyBuff);
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
AuraEffect trait = GetTarget().GetAuraEffect(GetEffectInfo(1).TriggerSpell, 1);
|
||||
if (trait != null)
|
||||
GetTarget().CastSpell(null, SpellTradewindsAllyBuff,
|
||||
GetTarget().CastSpell(null, SpellIds.TradewindsAllyBuff,
|
||||
new CastSpellExtraArgs(aurEff).AddSpellMod(SpellValueMod.BasePoint0, trait.GetAmount()));
|
||||
}
|
||||
|
||||
@@ -373,16 +370,14 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 287379 - Bastion of Might
|
||||
class spell_item_bastion_of_might : SpellScript
|
||||
{
|
||||
const uint SpellWarriorIgnorePain = 190456;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellWarriorIgnorePain);
|
||||
return ValidateSpellInfo(SpellIds.WarriorIgnorePain);
|
||||
}
|
||||
|
||||
void TriggerIgnorePain()
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellWarriorIgnorePain, GetSpell());
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.WarriorIgnorePain, GetSpell());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -428,16 +423,14 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 287653 - Echoing Blades
|
||||
class spell_item_echoing_blades_damage : SpellScript
|
||||
{
|
||||
const uint SpellEchoingBladesTrait = 287649;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((SpellEchoingBladesTrait, 2));
|
||||
return ValidateSpellEffect((SpellIds.EchoingBladesTrait, 2));
|
||||
}
|
||||
|
||||
void CalculateDamage(SpellEffectInfo spellEffectInfo, Unit victim, ref int damage, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
AuraEffect trait = GetCaster().GetAuraEffect(SpellEchoingBladesTrait, 2);
|
||||
AuraEffect trait = GetCaster().GetAuraEffect(SpellIds.EchoingBladesTrait, 2);
|
||||
if (trait != null)
|
||||
damage = trait.GetAmount() * 2;
|
||||
}
|
||||
@@ -457,11 +450,9 @@ namespace Scripts.Spells.Azerite
|
||||
[Script] // 288882 - Hour of Reaping
|
||||
class spell_item_hour_of_reaping : AuraScript
|
||||
{
|
||||
const uint SpellDhSoulBarrier = 263648;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellDhSoulBarrier);
|
||||
return ValidateSpellInfo(SpellIds.DhSoulBarrier);
|
||||
}
|
||||
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
@@ -471,7 +462,7 @@ namespace Scripts.Spells.Azerite
|
||||
|
||||
void TriggerSoulBarrier(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
GetTarget().CastSpell(GetTarget(), SpellDhSoulBarrier, new CastSpellExtraArgs(aurEff));
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.DhSoulBarrier, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -505,7 +496,7 @@ namespace Scripts.Spells.Azerite
|
||||
{
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
if (eventInfo.GetHitMask().HasAnyFlag(ProcFlagsHit.Interrupt | ProcFlagsHit.Dispel))
|
||||
if ((eventInfo.GetHitMask() & (ProcFlagsHit.Interrupt | ProcFlagsHit.Dispel)) != 0)
|
||||
return true;
|
||||
|
||||
Spell procSpell = eventInfo.GetProcSpell();
|
||||
@@ -577,7 +568,7 @@ namespace Scripts.Spells.Azerite
|
||||
void CalcAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
Player player = GetUnitOwner().ToPlayer();
|
||||
amount = (int)MathFunctions.Clamp(10.0f + player.GetRatingBonusValue(CombatRating.Corruption) - player.GetRatingBonusValue(CombatRating.CorruptionResistance), 0.0f, 99.0f);
|
||||
amount = (int)Math.Clamp(10.0f + player.GetRatingBonusValue(CombatRating.Corruption) - player.GetRatingBonusValue(CombatRating.CorruptionResistance), 0.0f, 99.0f);
|
||||
canBeRecalculated = false;
|
||||
}
|
||||
|
||||
@@ -586,4 +577,3 @@ namespace Scripts.Spells.Azerite
|
||||
DoEffectCalcAmount.Add(new(CalcAmount, 0, AuraType.ModDecreaseSpeed));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
// 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.
|
||||
// Licensed under the Gnu General Public License. See License file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static Global;
|
||||
|
||||
namespace Scripts.Spells.DeathKnight
|
||||
{
|
||||
namespace Scripts.Spells.DeathKnight;
|
||||
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint AntiMagicBarrier = 205727;
|
||||
public const uint ArmyFleshBeastTransform = 127533;
|
||||
public const uint ArmyGeistTransform = 127534;
|
||||
public const uint ArmyNorthrendSkeletonTransform = 127528;
|
||||
@@ -24,18 +23,26 @@ namespace Scripts.Spells.DeathKnight
|
||||
public const uint ArmySuperZombieTransform = 127526;
|
||||
public const uint BlindingSleetSlow = 317898;
|
||||
public const uint Blood = 137008;
|
||||
public const uint BlooddrinkerDebuff = 458687;
|
||||
public const uint BloodPlague = 55078;
|
||||
public const uint BloodShieldAbsorb = 77535;
|
||||
public const uint BloodShieldMastery = 77513;
|
||||
public const uint BoneShield = 195181;
|
||||
public const uint BreathOfSindragosa = 152279;
|
||||
public const uint BrittleDebuff = 374557;
|
||||
public const uint CleavingStrikes = 316916;
|
||||
public const uint CorpseExplosionTriggered = 43999;
|
||||
public const uint CrimsonScourgeBuff = 81141;
|
||||
public const uint DarkSimulacrumBuff = 77616;
|
||||
public const uint DarkSimulacrumSpellpowerBuff = 94984;
|
||||
public const uint DeathAndDecay = 43265;
|
||||
public const uint DeathAndDecayDamage = 52212;
|
||||
public const uint DeathAndDecayIncreaseTargets = 188290;
|
||||
public const uint DeathCoilDamage = 47632;
|
||||
public const uint DeathGripDummy = 243912;
|
||||
public const uint DeathGripJump = 49575;
|
||||
public const uint DeathGripTaunt = 51399;
|
||||
public const uint DeathStrikeEnabler = 89832; // Server Side
|
||||
public const uint DeathStrikeHeal = 45470;
|
||||
public const uint DeathStrikeOffhand = 66188;
|
||||
public const uint FesteringWound = 194310;
|
||||
@@ -46,6 +53,11 @@ namespace Scripts.Spells.DeathKnight
|
||||
public const uint GlyphOfFoulMenagerie = 58642;
|
||||
public const uint GlyphOfTheGeist = 58640;
|
||||
public const uint GlyphOfTheSkeleton = 146652;
|
||||
public const uint GorefiendsGrasp = 108199;
|
||||
public const uint HeartbreakerEnergize = 210738;
|
||||
public const uint HeartbreakerTalent = 221536;
|
||||
public const uint IcePrisonRoot = 454787;
|
||||
public const uint IcePrisonTalent = 454786;
|
||||
public const uint KillingMachineProc = 51124;
|
||||
public const uint MarkOfBloodHeal = 206945;
|
||||
public const uint NecrosisEffect = 216974;
|
||||
@@ -53,20 +65,24 @@ namespace Scripts.Spells.DeathKnight
|
||||
public const uint ObliterationRuneEnergize = 281327;
|
||||
public const uint PillarOfFrost = 51271;
|
||||
public const uint RaiseDeadSummon = 52150;
|
||||
public const uint ReaperOfSoulsProc = 469172;
|
||||
public const uint RecentlyUsedDeathStrike = 180612;
|
||||
public const uint RunicCorruption = 51460;
|
||||
public const uint RunicPowerEnergize = 49088;
|
||||
public const uint RunicReturn = 61258;
|
||||
public const uint SanguineGroundTalent = 391458;
|
||||
public const uint SanguineGround = 391459;
|
||||
public const uint SludgeBelcher = 207313;
|
||||
public const uint SludgeBelcherSummon = 212027;
|
||||
public const uint DeathStrikeEnabler = 89832; // Server Side
|
||||
public const uint TighteningGrasp = 206970;
|
||||
//public const uint TighteningGraspSlow = 143375; // dropped in BfA
|
||||
public const uint SmotheringOffense = 435005;
|
||||
public const uint SoulReaper = 343294;
|
||||
public const uint SoulReaperDamage = 343295;
|
||||
public const uint SubduingGraspDebuff = 454824;
|
||||
public const uint SubduingGraspTalent = 454822;
|
||||
public const uint Unholy = 137007;
|
||||
public const uint UnholyGroundHaste = 374271;
|
||||
public const uint UnholyGroundTalent = 374265;
|
||||
public const uint UnholyVigor = 196263;
|
||||
public const uint VolatileShielding = 207188;
|
||||
public const uint VolatileShieldingDamage = 207194;
|
||||
public const uint DhVoraciousLeech = 274009;
|
||||
public const uint DhVoraciousTalent = 273953;
|
||||
}
|
||||
|
||||
[Script] // 70656 - Advantage (T10 4P Melee Bonus)
|
||||
@@ -78,7 +94,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
if (caster != null)
|
||||
{
|
||||
Player player = caster.ToPlayer();
|
||||
if (player == null || caster.GetClass() != Class.Deathknight)
|
||||
if (player == null || caster.GetClass() != Class.DeathKnight)
|
||||
return false;
|
||||
|
||||
for (byte i = 0; i < player.GetMaxPower(PowerType.Runes); ++i)
|
||||
@@ -101,34 +117,30 @@ namespace Scripts.Spells.DeathKnight
|
||||
class spell_dk_anti_magic_shell : AuraScript
|
||||
{
|
||||
int absorbPct;
|
||||
ulong maxHealth;
|
||||
int maxHealth;
|
||||
uint absorbedAmount;
|
||||
|
||||
public spell_dk_anti_magic_shell()
|
||||
{
|
||||
absorbPct = 0;
|
||||
maxHealth = 0;
|
||||
absorbedAmount = 0;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RunicPowerEnergize, SpellIds.VolatileShielding)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 1));
|
||||
return ValidateSpellInfo(SpellIds.RunicPowerEnergize)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 1), (SpellIds.AntiMagicBarrier, 2));
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
absorbPct = GetEffectInfo(1).CalcValue(GetCaster());
|
||||
maxHealth = GetCaster().GetMaxHealth();
|
||||
maxHealth = (int)GetCaster().GetMaxHealth();
|
||||
absorbedAmount = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
amount = (int)MathFunctions.CalculatePct(maxHealth, absorbPct);
|
||||
amount = MathFunctions.CalculatePct(maxHealth, absorbPct);
|
||||
AuraEffect antiMagicBarrier = GetCaster().GetAuraEffect(SpellIds.AntiMagicBarrier, 2);
|
||||
if (antiMagicBarrier != null)
|
||||
|
||||
MathFunctions.AddPct(ref amount, antiMagicBarrier.GetAmount());
|
||||
Player player = GetUnitOwner().ToPlayer();
|
||||
if (player != null)
|
||||
MathFunctions.AddPct(ref amount, player.GetRatingBonusValue(CombatRating.VersatilityDamageDone) + player.GetTotalAuraModifier(AuraType.ModVersatility));
|
||||
@@ -138,38 +150,58 @@ namespace Scripts.Spells.DeathKnight
|
||||
{
|
||||
absorbedAmount += absorbAmount;
|
||||
|
||||
if (!GetTarget().HasAura(SpellIds.VolatileShielding))
|
||||
{
|
||||
CastSpellExtraArgs args = new(aurEff);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(absorbAmount, 2 * absorbAmount * 100 / maxHealth));
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.RunicPowerEnergize, args);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
AuraEffect volatileShielding = GetTarget().GetAuraEffect(SpellIds.VolatileShielding, 1);
|
||||
if (volatileShielding != null)
|
||||
{
|
||||
CastSpellExtraArgs args = new(volatileShielding);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(absorbedAmount, volatileShielding.GetAmount()));
|
||||
GetTarget().CastSpell(null, SpellIds.VolatileShieldingDamage, args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new(CalculateAmount, 0, AuraType.SchoolAbsorb));
|
||||
AfterEffectAbsorb.Add(new(Trigger, 0));
|
||||
AfterEffectRemove.Add(new(HandleEffectRemove, 0, AuraType.SchoolAbsorb, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
// 195182 - Marrowrend
|
||||
// 195292 - Death's Caress
|
||||
[Script("spell_dk_marrowrend_apply_bone_shield", 2)]
|
||||
[Script("spell_dk_deaths_caress_apply_bone_shield", 2)]
|
||||
class spell_dk_apply_bone_shield : SpellScript
|
||||
{
|
||||
uint _effIndex;
|
||||
|
||||
public spell_dk_apply_bone_shield(uint effIndex)
|
||||
{
|
||||
_effIndex = effIndex;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BoneShield)
|
||||
&& ValidateSpellEffect((spellInfo.Id, _effIndex))
|
||||
&& spellInfo.GetEffect(_effIndex).CalcBaseValue(null, null, 0, 0) <= (int)Global.SpellMgr.GetSpellInfo(SpellIds.BoneShield, Difficulty.None).StackAmount;
|
||||
}
|
||||
|
||||
void HandleHitTarget(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
for (int i = 0; i < GetEffectValue(); ++i)
|
||||
caster.CastSpell(caster, SpellIds.BoneShield, new CastSpellExtraArgs()
|
||||
.SetTriggerFlags(TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError)
|
||||
.SetTriggeringSpell(GetSpell()));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new(HandleHitTarget, _effIndex, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 127517 - Army Transform
|
||||
[Script] /// 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.
|
||||
[Script] // 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
|
||||
{
|
||||
uint[] ArmyTransforms =
|
||||
static uint[] ArmyTransforms =
|
||||
{
|
||||
SpellIds.ArmyFleshBeastTransform,
|
||||
SpellIds.ArmyGeistTransform,
|
||||
@@ -227,7 +259,35 @@ namespace Scripts.Spells.DeathKnight
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(HandleOnRemove, 0, AuraType.ModConfuse, AuraEffectHandleModes.Real));
|
||||
AfterEffectRemove.Add(new(HandleOnRemove, 0, AuraType.ModConfuse, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 206931 - Blooddrinker
|
||||
class spell_dk_blooddrinker : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BlooddrinkerDebuff);
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Expire)
|
||||
return;
|
||||
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null)
|
||||
caster.CastSpell(GetTarget(), SpellIds.BlooddrinkerDebuff, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.PeriodicLeech, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,15 +310,64 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 374504 - Brittle
|
||||
class spell_dk_brittle : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BrittleDebuff);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
GetTarget().CastSpell(eventInfo.GetActionTarget(), SpellIds.BrittleDebuff, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 81136 - Crimson Scourge
|
||||
class spell_dk_crimson_scourge : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BloodPlague, SpellIds.CrimsonScourgeBuff, SpellIds.DeathAndDecay);
|
||||
}
|
||||
|
||||
static bool CheckProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
return procInfo.GetProcTarget().HasAura(SpellIds.BloodPlague, procInfo.GetActor().GetGUID());
|
||||
}
|
||||
|
||||
static void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
Unit actor = eventInfo.GetActor();
|
||||
actor.GetSpellHistory().RestoreCharge(Global.SpellMgr.GetSpellInfo(SpellIds.DeathAndDecay, Difficulty.None).ChargeCategoryId);
|
||||
actor.CastSpell(actor, SpellIds.CrimsonScourgeBuff, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.Dummy));
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 49028 - Dancing Rune Weapon
|
||||
[Script] /// 7.1.5
|
||||
[Script] // 7.1.5
|
||||
class spell_dk_dancing_rune_weapon : AuraScript
|
||||
{
|
||||
const uint NpcDkDancingRuneWeapon = 27893;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
if (ObjectMgr.GetCreatureTemplate(NpcDkDancingRuneWeapon) == null)
|
||||
if (Global.ObjectMgr.GetCreatureTemplate(NpcDkDancingRuneWeapon) == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -292,10 +401,10 @@ namespace Scripts.Spells.DeathKnight
|
||||
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||
return;
|
||||
|
||||
int amount = (int)damageInfo.GetDamage() / 2;
|
||||
SpellNonMeleeDamage log = new(drw, drw.GetVictim(), spellInfo, new SpellCastVisual(spellInfo.GetSpellXSpellVisualId(drw), 0), spellInfo.GetSchoolMask());
|
||||
int amount = (int)(damageInfo.GetDamage()) / 2;
|
||||
SpellNonMeleeDamage log = new(drw, drw.GetVictim(), spellInfo, new(spellInfo.GetSpellXSpellVisualId(drw), 0), spellInfo.GetSchoolMask());
|
||||
log.damage = (uint)amount;
|
||||
Unit.DealDamage(drw, drw.GetVictim(), (uint)amount, null, DamageEffectType.SpellDirect, spellInfo.GetSchoolMask(), spellInfo, true);
|
||||
Unit.DealDamage(drw, drw.GetVictim(), (uint)amount, null, DamageEffectType.Direct, spellInfo.GetSchoolMask(), spellInfo, true);
|
||||
drw.SendSpellNonMeleeDamageLog(log);
|
||||
}
|
||||
|
||||
@@ -371,7 +480,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43265 - Death and Decay
|
||||
[Script] // 43265 - Death and Decay (Aura)
|
||||
class spell_dk_death_and_decay : AuraScript
|
||||
{
|
||||
void HandleDummyTick(AuraEffect aurEff)
|
||||
@@ -383,7 +492,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummyTick, 2, AuraType.PeriodicDummy));
|
||||
OnEffectPeriodic.Add(new(HandleDummyTick, 2, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +524,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
{
|
||||
SpellCastResult CheckClass()
|
||||
{
|
||||
if (GetCaster().GetClass() != Class.Deathknight)
|
||||
if (GetCaster().GetClass() != Class.DeathKnight)
|
||||
{
|
||||
SetCustomCastResultMessage(SpellCustomErrors.MustBeDeathKnight);
|
||||
return SpellCastResult.CustomError;
|
||||
@@ -444,7 +553,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.DeathGripDummy, SpellIds.DeathGripJump, SpellIds.DeathGripTaunt, SpellIds.Blood);
|
||||
return ValidateSpellInfo(SpellIds.DeathGripDummy, SpellIds.DeathGripJump, SpellIds.Blood, SpellIds.DeathGripTaunt);
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
@@ -465,6 +574,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.DeathGripTaunt, true);
|
||||
}
|
||||
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new(CheckCast));
|
||||
@@ -505,7 +615,6 @@ namespace Scripts.Spells.DeathKnight
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
|
||||
AuraEffect enabler = caster.GetAuraEffect(SpellIds.DeathStrikeEnabler, 0, GetCaster().GetGUID());
|
||||
if (enabler != null)
|
||||
{
|
||||
@@ -542,7 +651,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
class spell_dk_death_strike_enabler : AuraScript
|
||||
{
|
||||
// Amount of seconds we calculate damage over
|
||||
const byte LastSeconds = 5;
|
||||
static byte LastSeconds = 5;
|
||||
|
||||
uint[] _damagePerSecond = new uint[LastSeconds];
|
||||
|
||||
@@ -561,7 +670,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
void HandleCalcAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
canBeRecalculated = true;
|
||||
amount = Enumerable.Range(1, _damagePerSecond.Length).Sum();
|
||||
amount = (int)_damagePerSecond.Aggregate(0u, (a, b) => a += b);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
@@ -597,6 +706,20 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 195621 - Frost Fever
|
||||
class spell_dk_frost_fever_proc : AuraScript
|
||||
{
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
return RandomHelper.randChance(aurEff.GetAmount());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 47496 - Explode, Ghoul spell for Corpse Explosion
|
||||
class spell_dk_ghoul_explode : SpellScript
|
||||
{
|
||||
@@ -640,8 +763,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
{
|
||||
SpellInfo spellInfo = aurEff.GetSpellInfo();
|
||||
// search our Blood Plague and Frost Fever on target
|
||||
if (spellInfo.SpellFamilyName == SpellFamilyNames.Deathknight && (spellInfo.SpellFamilyFlags[2] & 0x2) != 0 &&
|
||||
aurEff.GetCasterGUID() == caster.GetGUID())
|
||||
if (spellInfo.SpellFamilyName == SpellFamilyNames.Deathknight && (spellInfo.SpellFamilyFlags[2] & 0x2) != 0 && aurEff.GetCasterGUID() == caster.GetGUID())
|
||||
{
|
||||
int countMin = aurEff.GetBase().GetMaxDuration();
|
||||
int countMax = spellInfo.GetMaxDuration();
|
||||
@@ -664,6 +786,33 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Called by 206930 - Heart Strike
|
||||
class spell_dk_heartbreaker : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.HeartbreakerTalent, SpellIds.HeartbreakerEnergize);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.HeartbreakerTalent);
|
||||
}
|
||||
|
||||
|
||||
void HandleEnergize(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.HeartbreakerEnergize, new CastSpellExtraArgs()
|
||||
.SetTriggeringSpell(GetSpell())
|
||||
.SetTriggerFlags(TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleEnergize, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 49184 - Howling Blast
|
||||
class spell_dk_howling_blast : SpellScript
|
||||
{
|
||||
@@ -683,6 +832,102 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
}
|
||||
|
||||
// Called by 45524 - Chains of Ice
|
||||
[Script] // 454786 - Ice Prison
|
||||
class spell_dk_ice_prison : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.IcePrisonTalent, SpellIds.IcePrisonRoot);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.IcePrisonTalent);
|
||||
}
|
||||
|
||||
void HandleOnHit()
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.IcePrisonRoot, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnHit.Add(new(HandleOnHit));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 194878 - Icy Talons
|
||||
class spell_dk_icy_talons : AuraScript
|
||||
{
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
Spell procSpell = eventInfo.GetProcSpell();
|
||||
if (procSpell != null)
|
||||
return procSpell.GetPowerTypeCostAmount(PowerType.RunicPower) > 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpellWithValue));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 194879 - Icy Talons
|
||||
class spell_dk_icy_talons_buff : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SmotheringOffense);
|
||||
}
|
||||
|
||||
void HandleSmotheringOffense(ref WorldObject target)
|
||||
{
|
||||
if (!GetCaster().HasAura(SpellIds.SmotheringOffense))
|
||||
target = null;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectTargetSelect.Add(new(HandleSmotheringOffense, 1, Targets.UnitCaster));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 374277 - Improved Death Strike
|
||||
class spell_dk_improved_death_strike : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Blood)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 4));
|
||||
}
|
||||
|
||||
void CalcHealIncrease(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
if (GetUnitOwner().HasAura(SpellIds.Blood))
|
||||
amount = GetEffectInfo(3).CalcValue(GetCaster());
|
||||
}
|
||||
|
||||
void CalcPowerCostReduction(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
if (GetUnitOwner().HasAura(SpellIds.Blood))
|
||||
amount = GetEffectInfo(4).CalcValue(GetCaster());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new(CalcHealIncrease, 0, AuraType.AddPctModifier));
|
||||
DoEffectCalcAmount.Add(new(CalcHealIncrease, 1, AuraType.AddPctModifier));
|
||||
DoEffectCalcAmount.Add(new(CalcPowerCostReduction, 2, AuraType.AddFlatModifier));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 206940 - Mark of Blood
|
||||
class spell_dk_mark_of_blood : AuraScript
|
||||
{
|
||||
@@ -773,7 +1018,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
|
||||
// 121916 - Glyph of the Geist (Unholy)
|
||||
[Script] /// 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.
|
||||
[Script] // 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)
|
||||
@@ -803,7 +1048,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
|
||||
// 147157 Glyph of the Skeleton (Unholy)
|
||||
[Script] /// 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.
|
||||
[Script] // 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)
|
||||
@@ -828,7 +1073,7 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
|
||||
// 61257 - Runic Power Back on Snare/Root
|
||||
[Script] /// 7.1.5
|
||||
[Script] // 7.1.5
|
||||
class spell_dk_pvp_4p_bonus : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
@@ -863,15 +1108,12 @@ namespace Scripts.Spells.DeathKnight
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RaiseDeadSummon, SpellIds.SludgeBelcher, SpellIds.SludgeBelcherSummon);
|
||||
return ValidateSpellInfo(SpellIds.RaiseDeadSummon);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
uint spellId = SpellIds.RaiseDeadSummon;
|
||||
if (GetCaster().HasAura(SpellIds.SludgeBelcher))
|
||||
spellId = SpellIds.SludgeBelcherSummon;
|
||||
|
||||
GetCaster().CastSpell(null, spellId, true);
|
||||
}
|
||||
|
||||
@@ -881,6 +1123,41 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 440002 - Reaper of Souls (attached to 343294 - Soul Reaper)
|
||||
class spell_dk_reaper_of_souls : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ReaperOfSoulsProc);
|
||||
}
|
||||
|
||||
bool IsAffectedByReaperOfSouls()
|
||||
{
|
||||
Aura reaperOfSouls = GetCaster().GetAura(SpellIds.ReaperOfSoulsProc);
|
||||
if (reaperOfSouls != null)
|
||||
return GetSpell().m_appliedMods.Contains(reaperOfSouls);
|
||||
return false;
|
||||
}
|
||||
|
||||
void HandleDefault(ref WorldObject target)
|
||||
{
|
||||
if (IsAffectedByReaperOfSouls())
|
||||
target = null;
|
||||
}
|
||||
|
||||
void HandleReaperOfSouls(uint effIndex)
|
||||
{
|
||||
if (!IsAffectedByReaperOfSouls())
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectTargetSelect.Add(new(HandleDefault, 1, Targets.UnitTargetEnemy));
|
||||
OnEffectLaunch.Add(new(HandleReaperOfSouls, 3, SpellEffectName.TriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 59057 - Rime
|
||||
class spell_dk_rime : AuraScript
|
||||
{
|
||||
@@ -904,10 +1181,104 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
}
|
||||
|
||||
// 343294 - Soul Reaper
|
||||
// 469180 - Soul Reaper
|
||||
[Script("spell_dk_soul_reaper", 1, 2)]
|
||||
[Script("spell_dk_soul_reaper_reaper_of_souls", 0, null)]
|
||||
class spell_dk_soul_reaper : AuraScript
|
||||
{
|
||||
public spell_dk_soul_reaper(uint auraEffectIndex, uint? healthLimitEffectIndex)
|
||||
{
|
||||
_auraEffectIndex = (byte)auraEffectIndex;
|
||||
_healthLimitEffectIndex = healthLimitEffectIndex;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SoulReaper, SpellIds.SoulReaperDamage, SpellIds.RunicCorruption);
|
||||
}
|
||||
|
||||
void HandleOnTick(AuraEffect aurEff)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
Unit caster = GetCaster();
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
if (!_healthLimitEffectIndex.HasValue || target.GetHealthPct() < (float)GetEffectInfo(_healthLimitEffectIndex.Value).CalcValue(caster))
|
||||
{
|
||||
caster.CastSpell(target, SpellIds.SoulReaperDamage, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveEffect(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Death)
|
||||
return;
|
||||
|
||||
Player caster = GetCaster()?.ToPlayer();
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
if (caster.IsHonorOrXPTarget(GetTarget()))
|
||||
caster.CastSpell(caster, SpellIds.RunicCorruption, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new(HandleOnTick, _auraEffectIndex, AuraType.PeriodicDummy));
|
||||
AfterEffectRemove.Add(new(RemoveEffect, _auraEffectIndex, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
|
||||
|
||||
byte _auraEffectIndex;
|
||||
uint? _healthLimitEffectIndex;
|
||||
}
|
||||
|
||||
// Called by 383312 Abomination Limb and 49576 - Death Grip
|
||||
[Script] // 454822 - Subduing Grasp
|
||||
class spell_dk_subduing_grasp : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SubduingGraspTalent, SpellIds.SubduingGraspDebuff);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.SubduingGraspTalent);
|
||||
}
|
||||
|
||||
void HandleSubduingGrasp(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.SubduingGraspDebuff, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
if (m_scriptSpellId == SpellIds.GorefiendsGrasp)
|
||||
OnEffectHitTarget.Add(new(HandleSubduingGrasp, 1, SpellEffectName.ScriptEffect));
|
||||
else
|
||||
OnEffectHitTarget.Add(new(HandleSubduingGrasp, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 242057 - Rune Empowered
|
||||
class spell_dk_t20_2p_rune_empowered : AuraScript
|
||||
{
|
||||
int _runicPowerSpent;
|
||||
int _runicPowerSpent = 0;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -925,8 +1296,8 @@ namespace Scripts.Spells.DeathKnight
|
||||
return;
|
||||
|
||||
_runicPowerSpent += procSpell.GetPowerTypeCostAmount(PowerType.RunicPower).GetValueOrDefault(0);
|
||||
// Breath of Math.Sindragosa special case
|
||||
SpellInfo breathOfSindragosa = SpellMgr.GetSpellInfo(SpellIds.BreathOfSindragosa, Difficulty.None);
|
||||
// Breath of Sindragosa special case
|
||||
SpellInfo breathOfSindragosa = Global.SpellMgr.GetSpellInfo(SpellIds.BreathOfSindragosa, Difficulty.None);
|
||||
if (procSpell.IsTriggeredByAura(breathOfSindragosa))
|
||||
{
|
||||
var powerRecord = breathOfSindragosa.PowerCosts.ToList().Find(power => power.PowerType == PowerType.RunicPower && power.PowerPctPerSecond > 0.0f);
|
||||
@@ -961,27 +1332,64 @@ namespace Scripts.Spells.DeathKnight
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43265 - Death and Decay
|
||||
class at_dk_death_and_decay : AreaTriggerAI
|
||||
[Script] // 273953 - Voracious (attached to 49998 - Death Strike)
|
||||
class spell_dk_voracious : SpellScript
|
||||
{
|
||||
public at_dk_death_and_decay(AreaTrigger areatrigger) : base(areatrigger) { }
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.DhVoraciousTalent, SpellIds.DhVoraciousLeech);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.DhVoraciousTalent);
|
||||
}
|
||||
|
||||
void HandleHit(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
caster.CastSpell(caster, SpellIds.DhVoraciousLeech, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleHit, 0, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 43265 - Death and Decay
|
||||
class at_dk_death_and_decay(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
if (caster == unit)
|
||||
{
|
||||
if (caster.HasAura(SpellIds.UnholyGroundTalent))
|
||||
caster.CastSpell(caster, SpellIds.UnholyGroundHaste);
|
||||
}
|
||||
}
|
||||
if (unit.GetGUID() != at.GetCasterGUID())
|
||||
return;
|
||||
|
||||
if (unit.HasAura(SpellIds.CleavingStrikes))
|
||||
unit.CastSpell(unit, SpellIds.DeathAndDecayIncreaseTargets, TriggerCastFlags.DontReportCastError);
|
||||
|
||||
if (unit.HasAura(SpellIds.SanguineGroundTalent))
|
||||
unit.CastSpell(unit, SpellIds.SanguineGround);
|
||||
}
|
||||
|
||||
public override void OnUnitExit(Unit unit)
|
||||
{
|
||||
unit.RemoveAurasDueToSpell(SpellIds.UnholyGroundHaste);
|
||||
}
|
||||
if (unit.GetGUID() != at.GetCasterGUID())
|
||||
return;
|
||||
|
||||
Aura deathAndDecay = unit.GetAura(SpellIds.DeathAndDecayIncreaseTargets);
|
||||
if (deathAndDecay != null)
|
||||
{
|
||||
AuraEffect cleavingStrikes = unit.GetAuraEffect(SpellIds.CleavingStrikes, 3);
|
||||
if (cleavingStrikes != null)
|
||||
|
||||
deathAndDecay.SetDuration(cleavingStrikes.GetAmount());
|
||||
}
|
||||
|
||||
unit.RemoveAurasDueToSpell(SpellIds.SanguineGround);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+456
-141
File diff suppressed because it is too large
Load Diff
+473
-72
@@ -1,46 +1,69 @@
|
||||
// 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.
|
||||
// Licensed under the Gnu General Public License. See License file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.AI;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static Global;
|
||||
|
||||
namespace Scripts.Spells.Evoker
|
||||
{
|
||||
enum SpellIds
|
||||
{
|
||||
BlastFurnace = 375510,
|
||||
BlessingOfTheBronzeDk = 381732,
|
||||
BlessingOfTheBronzeDh = 381741,
|
||||
BlessingOfTheBronzeDruid = 381746,
|
||||
BlessingOfTheBronzeEvoker = 381748,
|
||||
BlessingOfTheBronzeHunter = 381749,
|
||||
BlessingOfTheBronzeMage = 381750,
|
||||
BlessingOfTheBronzeMonk = 381751,
|
||||
BlessingOfTheBronzePaladin = 381752,
|
||||
BlessingOfTheBronzePriest = 381753,
|
||||
BlessingOfTheBronzeRogue = 381754,
|
||||
BlessingOfTheBronzeShaman = 381756,
|
||||
BlessingOfTheBronzeWarlock = 381757,
|
||||
BlessingOfTheBronzeWarrior = 381758,
|
||||
EnergizingFlame = 400006,
|
||||
FireBreathDamage = 357209,
|
||||
GlideKnockback = 358736,
|
||||
Hover = 358267,
|
||||
LivingFlame = 361469,
|
||||
LivingFlameDamage = 361500,
|
||||
LivingFlameHeal = 361509,
|
||||
PermeatingChillTalent = 370897,
|
||||
PyreDamage = 357212,
|
||||
ScouringFlame = 378438,
|
||||
SoarRacial = 369536,
|
||||
namespace Scripts.Spells.Evoker;
|
||||
|
||||
LabelEvokerBlue = 1465
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint AzureEssenceBurst = 375721;
|
||||
public const uint BlastFurnace = 375510;
|
||||
public const uint BlessingOfTheBronzeDk = 381732;
|
||||
public const uint BlessingOfTheBronzeDh = 381741;
|
||||
public const uint BlessingOfTheBronzeDruid = 381746;
|
||||
public const uint BlessingOfTheBronzeEvoker = 381748;
|
||||
public const uint BlessingOfTheBronzeHunter = 381749;
|
||||
public const uint BlessingOfTheBronzeMage = 381750;
|
||||
public const uint BlessingOfTheBronzeMonk = 381751;
|
||||
public const uint BlessingOfTheBronzePaladin = 381752;
|
||||
public const uint BlessingOfTheBronzePriest = 381753;
|
||||
public const uint BlessingOfTheBronzeRogue = 381754;
|
||||
public const uint BlessingOfTheBronzeShaman = 381756;
|
||||
public const uint BlessingOfTheBronzeWarlock = 381757;
|
||||
public const uint BlessingOfTheBronzeWarrior = 381758;
|
||||
public const uint Burnout = 375802;
|
||||
public const uint CallOfYseraTalent = 373834;
|
||||
public const uint CallOfYsera = 373835;
|
||||
public const uint Causality = 375777;
|
||||
public const uint Disintegrate = 356995;
|
||||
public const uint EmeraldBlossomHeal = 355916;
|
||||
public const uint EnergizingFlame = 400006;
|
||||
public const uint EssenceBurst = 359618;
|
||||
public const uint FirestormDamage = 369374;
|
||||
public const uint EternitySurge = 359073;
|
||||
public const uint FireBreath = 357208;
|
||||
public const uint FireBreathDamage = 357209;
|
||||
public const uint GlideKnockback = 358736;
|
||||
public const uint Hover = 358267;
|
||||
public const uint LivingFlame = 361469;
|
||||
public const uint LivingFlameDamage = 361500;
|
||||
public const uint LivingFlameHeal = 361509;
|
||||
public const uint PanaceaHeal = 387763;
|
||||
public const uint PanaceaTalent = 387761;
|
||||
public const uint PermeatingChillTalent = 370897;
|
||||
public const uint PyreDamage = 357212;
|
||||
public const uint RubyEmbers = 365937;
|
||||
public const uint RubyEssenceBurst = 376872;
|
||||
public const uint ScouringFlame = 378438;
|
||||
public const uint Snapfire = 370818;
|
||||
public const uint SoarRacial = 369536;
|
||||
public const uint VerdantEmbraceHeal = 361195;
|
||||
public const uint VerdantEmbraceJump = 373514;
|
||||
|
||||
public const uint LabelEvokerBlue = 1465;
|
||||
|
||||
public const uint VisualKitEvokerVerdantEmbraceJump = 152557;
|
||||
|
||||
public static uint[] CausalityAffectedEmpowerSpells = [EternitySurge, FireBreath];
|
||||
}
|
||||
|
||||
[Script] // 362969 - Azure Strike (blue)
|
||||
@@ -82,23 +105,25 @@ namespace Scripts.Spells.Evoker
|
||||
if (unitTarget == null)
|
||||
return true;
|
||||
|
||||
return (SpellIds)GetSpellInfo().Id switch
|
||||
switch (GetSpellInfo().Id)
|
||||
{
|
||||
SpellIds.BlessingOfTheBronzeDk => unitTarget.GetClass() != Class.Deathknight,
|
||||
SpellIds.BlessingOfTheBronzeDh => unitTarget.GetClass() != Class.DemonHunter,
|
||||
SpellIds.BlessingOfTheBronzeDruid => unitTarget.GetClass() != Class.Druid,
|
||||
SpellIds.BlessingOfTheBronzeEvoker => unitTarget.GetClass() != Class.Evoker,
|
||||
SpellIds.BlessingOfTheBronzeHunter => unitTarget.GetClass() != Class.Hunter,
|
||||
SpellIds.BlessingOfTheBronzeMage => unitTarget.GetClass() != Class.Mage,
|
||||
SpellIds.BlessingOfTheBronzeMonk => unitTarget.GetClass() != Class.Monk,
|
||||
SpellIds.BlessingOfTheBronzePaladin => unitTarget.GetClass() != Class.Paladin,
|
||||
SpellIds.BlessingOfTheBronzePriest => unitTarget.GetClass() != Class.Priest,
|
||||
SpellIds.BlessingOfTheBronzeRogue => unitTarget.GetClass() != Class.Rogue,
|
||||
SpellIds.BlessingOfTheBronzeShaman => unitTarget.GetClass() != Class.Shaman,
|
||||
SpellIds.BlessingOfTheBronzeWarlock => unitTarget.GetClass() != Class.Warlock,
|
||||
SpellIds.BlessingOfTheBronzeWarrior => unitTarget.GetClass() != Class.Warrior,
|
||||
_ => true
|
||||
};
|
||||
case SpellIds.BlessingOfTheBronzeDk: return unitTarget.GetClass() != Class.DeathKnight;
|
||||
case SpellIds.BlessingOfTheBronzeDh: return unitTarget.GetClass() != Class.DemonHunter;
|
||||
case SpellIds.BlessingOfTheBronzeDruid: return unitTarget.GetClass() != Class.Druid;
|
||||
case SpellIds.BlessingOfTheBronzeEvoker: return unitTarget.GetClass() != Class.Evoker;
|
||||
case SpellIds.BlessingOfTheBronzeHunter: return unitTarget.GetClass() != Class.Hunter;
|
||||
case SpellIds.BlessingOfTheBronzeMage: return unitTarget.GetClass() != Class.Mage;
|
||||
case SpellIds.BlessingOfTheBronzeMonk: return unitTarget.GetClass() != Class.Monk;
|
||||
case SpellIds.BlessingOfTheBronzePaladin: return unitTarget.GetClass() != Class.Paladin;
|
||||
case SpellIds.BlessingOfTheBronzePriest: return unitTarget.GetClass() != Class.Priest;
|
||||
case SpellIds.BlessingOfTheBronzeRogue: return unitTarget.GetClass() != Class.Rogue;
|
||||
case SpellIds.BlessingOfTheBronzeShaman: return unitTarget.GetClass() != Class.Shaman;
|
||||
case SpellIds.BlessingOfTheBronzeWarlock: return unitTarget.GetClass() != Class.Warlock;
|
||||
case SpellIds.BlessingOfTheBronzeWarrior: return unitTarget.GetClass() != Class.Warrior;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -108,13 +133,126 @@ namespace Scripts.Spells.Evoker
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 375801 - Burnout
|
||||
class spell_evo_burnout : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Burnout);
|
||||
}
|
||||
|
||||
static bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
return RandomHelper.randChance(aurEff.GetAmount());
|
||||
}
|
||||
|
||||
static void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetActor(), SpellIds.Burnout, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.Dummy));
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 373834 - Call of Ysera (attached to 361195 - Verdant Embrace (Green))
|
||||
class spell_evo_call_of_ysera : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CallOfYseraTalent, SpellIds.CallOfYsera);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.CallOfYseraTalent);
|
||||
}
|
||||
|
||||
void HandleCallOfYsera()
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.CallOfYsera, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new(HandleCallOfYsera));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Called by 356995 - Disintegrate (Blue)
|
||||
class spell_evo_causality_disintegrate : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((SpellIds.Causality, 1));
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.Causality);
|
||||
}
|
||||
|
||||
void OnTick(AuraEffect aurEff)
|
||||
{
|
||||
AuraEffect causality = GetCaster().GetAuraEffect(SpellIds.Causality, 0);
|
||||
if (causality != null)
|
||||
{
|
||||
foreach (uint spell in SpellIds.CausalityAffectedEmpowerSpells)
|
||||
GetCaster().GetSpellHistory().ModifyCooldown(spell, TimeSpan.FromSeconds(causality.GetAmount()));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new(OnTick, 0, AuraType.PeriodicDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Called by 357212 - Pyre (Red)
|
||||
class spell_evo_causality_pyre : SpellScript
|
||||
{
|
||||
static long TargetLimit = 5;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((SpellIds.Causality, 1));
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.Causality);
|
||||
}
|
||||
|
||||
void HandleCooldown()
|
||||
{
|
||||
AuraEffect causality = GetCaster().GetAuraEffect(SpellIds.Causality, 1);
|
||||
if (causality == null)
|
||||
return;
|
||||
|
||||
TimeSpan cooldownReduction = TimeSpan.FromSeconds(Math.Min(GetUnitTargetCountForEffect(0), TargetLimit) * causality.GetAmount());
|
||||
foreach (uint spell in SpellIds.CausalityAffectedEmpowerSpells)
|
||||
GetCaster().GetSpellHistory().ModifyCooldown(spell, cooldownReduction);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new(HandleCooldown));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 370455 - Charged Blast
|
||||
class spell_evo_charged_blast : AuraScript
|
||||
{
|
||||
bool CheckProc(ProcEventInfo procInfo)
|
||||
{
|
||||
return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().HasLabel((uint)SpellIds.LabelEvokerBlue);
|
||||
return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().HasLabel(SpellIds.LabelEvokerBlue);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -123,23 +261,87 @@ namespace Scripts.Spells.Evoker
|
||||
}
|
||||
}
|
||||
|
||||
// 355913 - Emerald Blossom (Green)
|
||||
[Script] // Id - 23318
|
||||
class at_evo_emerald_blossom(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
public override void OnRemove()
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
caster.CastSpell(at.GetPosition(), SpellIds.EmeraldBlossomHeal, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 355916 - Emerald Blossom (Green)
|
||||
class spell_evo_emerald_blossom_heal : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((spellInfo.Id, 1));
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
uint maxTargets = (uint)GetSpellInfo().GetEffect(1).CalcValue(GetCaster());
|
||||
SelectRandomInjuredTargets(targets, maxTargets, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new(FilterTargets, 0, Targets.UnitDestAreaAlly));
|
||||
}
|
||||
}
|
||||
|
||||
// Called by 362969 - Azure Strike
|
||||
// Called by 361469 - Living Flame (Red)
|
||||
[Script("spell_evo_azure_essence_burst", SpellIds.AzureEssenceBurst)]
|
||||
[Script("spell_evo_ruby_essence_burst", SpellIds.RubyEssenceBurst)]
|
||||
class spell_evo_essence_burst_trigger(uint talentAuraId) : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(talentAuraId, SpellIds.EssenceBurst);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
AuraEffect aurEff = GetCaster().GetAuraEffect(talentAuraId, 0);
|
||||
return aurEff != null && RandomHelper.randChance(aurEff.GetAmount());
|
||||
}
|
||||
|
||||
void HandleEssenceBurst()
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.EssenceBurst, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new(HandleEssenceBurst));
|
||||
}
|
||||
}
|
||||
|
||||
// 357208 Fire Breath (Red)
|
||||
[Script] // 382266 Fire Breath (Red)
|
||||
class spell_evo_fire_breath : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo((uint)SpellIds.FireBreathDamage, (uint)SpellIds.BlastFurnace);
|
||||
return ValidateSpellInfo(SpellIds.FireBreathDamage, SpellIds.BlastFurnace);
|
||||
}
|
||||
|
||||
void OnComplete(int completedStageCount)
|
||||
{
|
||||
int dotTicks = 10 - (completedStageCount - 1) * 3;
|
||||
AuraEffect blastFurnace = GetCaster().GetAuraEffect((uint)SpellIds.BlastFurnace, 0);
|
||||
AuraEffect blastFurnace = GetCaster().GetAuraEffect(SpellIds.BlastFurnace, 0);
|
||||
if (blastFurnace != null)
|
||||
dotTicks += blastFurnace.GetAmount() / 2;
|
||||
|
||||
GetCaster().CastSpell(GetCaster(), (uint)SpellIds.FireBreathDamage, new CastSpellExtraArgs()
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.FireBreathDamage, new CastSpellExtraArgs()
|
||||
.SetTriggeringSpell(GetSpell())
|
||||
.SetTriggerFlags(TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError)
|
||||
.AddSpellMod(SpellValueModFloat.DurationPct, 100 * dotTicks)
|
||||
@@ -163,14 +365,14 @@ namespace Scripts.Spells.Evoker
|
||||
|
||||
void AddBonusUpfrontDamage(SpellEffectInfo spellEffectInfo, Unit victim, ref int damage, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
int empowerLevel = (int)GetSpell().m_customArg;
|
||||
var empowerLevel = (int)GetSpell().m_customArg;
|
||||
if (empowerLevel == 0)
|
||||
return;
|
||||
|
||||
// damage is done after aura is applied, grab periodic amount
|
||||
AuraEffect fireBreath = victim.GetAuraEffect(GetSpellInfo().Id, 1, GetCaster().GetGUID());
|
||||
if (fireBreath != null)
|
||||
flatMod += (int)(fireBreath.GetEstimatedAmount().GetValueOrDefault(fireBreath.GetAmount()) * (empowerLevel - 1) * 3);
|
||||
flatMod += (int)fireBreath.GetEstimatedAmount().GetValueOrDefault(fireBreath.GetAmount()) * (empowerLevel - 1) * 3;
|
||||
}
|
||||
|
||||
void RemoveUnusedEffect(List<WorldObject> targets)
|
||||
@@ -185,12 +387,59 @@ namespace Scripts.Spells.Evoker
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 369372 - Firestorm (Red)
|
||||
class at_evo_firestorm(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
TaskScheduler _scheduler = new();
|
||||
object _damageSpellCustomArg;
|
||||
|
||||
public class extra_create_data
|
||||
{
|
||||
public float SnapshotDamageMultipliers = 1.0f;
|
||||
}
|
||||
|
||||
public static extra_create_data GetOrCreateExtraData(Spell firestorm)
|
||||
{
|
||||
if (firestorm.m_customArg.GetType() != typeof(extra_create_data))
|
||||
firestorm.m_customArg = new extra_create_data();
|
||||
|
||||
return (extra_create_data)firestorm.m_customArg;
|
||||
}
|
||||
|
||||
public override void OnCreate(Spell creatingSpell)
|
||||
{
|
||||
_damageSpellCustomArg = creatingSpell.m_customArg;
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(0), task =>
|
||||
{
|
||||
TimeSpan period = TimeSpan.FromSeconds(2); // TimeSpan.FromSeconds(2), affected by haste
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
period *= caster.m_unitData.ModCastingSpeed;
|
||||
caster.CastSpell(at.GetPosition(), SpellIds.FirestormDamage, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
CustomArg = _damageSpellCustomArg
|
||||
});
|
||||
}
|
||||
|
||||
task.Repeat(period);
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnUpdate(uint diff)
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 358733 - Glide (Racial)
|
||||
class spell_evo_glide : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo((uint)SpellIds.GlideKnockback, (uint)SpellIds.Hover, (uint)SpellIds.SoarRacial);
|
||||
return ValidateSpellInfo(SpellIds.GlideKnockback, SpellIds.Hover, SpellIds.SoarRacial);
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
@@ -209,10 +458,10 @@ namespace Scripts.Spells.Evoker
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
caster.CastSpell(caster, (uint)SpellIds.GlideKnockback, true);
|
||||
caster.CastSpell(caster, SpellIds.GlideKnockback, true);
|
||||
|
||||
caster.GetSpellHistory().StartCooldown(SpellMgr.GetSpellInfo((uint)SpellIds.Hover, GetCastDifficulty()), 0, null, false, TimeSpan.FromMilliseconds(250));
|
||||
caster.GetSpellHistory().StartCooldown(SpellMgr.GetSpellInfo((uint)SpellIds.SoarRacial, GetCastDifficulty()), 0, null, false, TimeSpan.FromMilliseconds(250));
|
||||
caster.GetSpellHistory().StartCooldown(Global.SpellMgr.GetSpellInfo(SpellIds.Hover, GetCastDifficulty()), 0, null, false, TimeSpan.FromSeconds(250));
|
||||
caster.GetSpellHistory().StartCooldown(Global.SpellMgr.GetSpellInfo(SpellIds.SoarRacial, GetCastDifficulty()), 0, null, false, TimeSpan.FromSeconds(250));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -227,26 +476,26 @@ namespace Scripts.Spells.Evoker
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo((uint)SpellIds.LivingFlameDamage, (uint)SpellIds.LivingFlameHeal, (uint)SpellIds.EnergizingFlame);
|
||||
return ValidateSpellInfo(SpellIds.LivingFlameDamage, SpellIds.LivingFlameHeal, SpellIds.EnergizingFlame);
|
||||
}
|
||||
|
||||
void HandleHitTarget(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit hitUnit = GetHitUnit();
|
||||
if (caster.IsFriendlyTo(hitUnit))
|
||||
caster.CastSpell(hitUnit, (uint)SpellIds.LivingFlameHeal, true);
|
||||
if (caster.IsValidAssistTarget(hitUnit))
|
||||
caster.CastSpell(hitUnit, SpellIds.LivingFlameHeal, true);
|
||||
else
|
||||
caster.CastSpell(hitUnit, (uint)SpellIds.LivingFlameDamage, true);
|
||||
caster.CastSpell(hitUnit, SpellIds.LivingFlameDamage, true);
|
||||
}
|
||||
|
||||
void HandleLaunchTarget(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.IsFriendlyTo(GetHitUnit()))
|
||||
if (caster.IsValidAssistTarget(GetHitUnit()))
|
||||
return;
|
||||
|
||||
AuraEffect auraEffect = caster.GetAuraEffect((uint)SpellIds.EnergizingFlame, 0);
|
||||
AuraEffect auraEffect = caster.GetAuraEffect(SpellIds.EnergizingFlame, 0);
|
||||
if (auraEffect != null)
|
||||
{
|
||||
int manaCost = GetSpell().GetPowerTypeCostAmount(PowerType.Mana).GetValueOrDefault(0);
|
||||
@@ -255,6 +504,7 @@ namespace Scripts.Spells.Evoker
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleHitTarget, 0, SpellEffectName.Dummy));
|
||||
@@ -262,12 +512,40 @@ namespace Scripts.Spells.Evoker
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 387761 Panacea (Green) (attached to 355913 - Emerald Blossom (Green) and 360995 - Verdant Embrace (Green))
|
||||
class spell_evo_panacea : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PanaceaTalent, SpellIds.PanaceaHeal);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.PanaceaTalent);
|
||||
}
|
||||
|
||||
void HandlePanacea()
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.PanaceaHeal, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new(HandlePanacea));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 381773 - Permeating Chill
|
||||
class spell_evo_permeating_chill : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo((uint)SpellIds.PermeatingChillTalent);
|
||||
return ValidateSpellInfo(SpellIds.PermeatingChillTalent);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo procInfo)
|
||||
@@ -276,11 +554,11 @@ namespace Scripts.Spells.Evoker
|
||||
if (spellInfo == null)
|
||||
return false;
|
||||
|
||||
if (spellInfo.HasLabel((uint)SpellIds.LabelEvokerBlue))
|
||||
if (!spellInfo.HasLabel(SpellIds.LabelEvokerBlue))
|
||||
return false;
|
||||
|
||||
if (!procInfo.GetActor().HasAura((uint)SpellIds.PermeatingChillTalent))
|
||||
if (spellInfo.IsAffected(SpellFamilyNames.Evoker, new FlagArray128(0x40, 0, 0, 0))) // disintegrate
|
||||
if (!procInfo.GetActor().HasAura(SpellIds.PermeatingChillTalent))
|
||||
if (!spellInfo.IsAffected(SpellFamilyNames.Evoker, new FlagArray128(0x40, 0, 0, 0))) // disintegrate
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -297,31 +575,61 @@ namespace Scripts.Spells.Evoker
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo((uint)SpellIds.PyreDamage);
|
||||
return ValidateSpellInfo(SpellIds.PyreDamage);
|
||||
}
|
||||
|
||||
void HandleDamage(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit().GetPosition(), (uint)SpellIds.PyreDamage, true);
|
||||
GetCaster().CastSpell(GetHitUnit().GetPosition(), SpellIds.PyreDamage, true);
|
||||
}
|
||||
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleDamage, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 361500 Living Flame (Red)
|
||||
[Script] // 361509 Living Flame (Red)
|
||||
class spell_evo_ruby_embers : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RubyEmbers)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 1))
|
||||
&& spellInfo.GetEffect(1).IsEffect(SpellEffectName.ApplyAura)
|
||||
&& spellInfo.GetEffect(1).ApplyAuraPeriod != 0;
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return !GetCaster().HasAura(SpellIds.RubyEmbers);
|
||||
}
|
||||
|
||||
|
||||
static void PreventPeriodic(ref WorldObject target)
|
||||
{
|
||||
target = null;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectTargetSelect.Add(new(PreventPeriodic, 1, m_scriptSpellId == SpellIds.LivingFlameDamage ? Targets.UnitTargetEnemy : Targets.UnitTargetAlly));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 357209 Fire Breath (Red)
|
||||
class spell_evo_scouring_flame : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo((uint)SpellIds.ScouringFlame);
|
||||
return ValidateSpellInfo(SpellIds.ScouringFlame);
|
||||
}
|
||||
|
||||
void HandleScouringFlame(List<WorldObject> targets)
|
||||
{
|
||||
if (!GetCaster().HasAura((uint)SpellIds.ScouringFlame))
|
||||
if (!GetCaster().HasAura(SpellIds.ScouringFlame))
|
||||
targets.Clear();
|
||||
}
|
||||
|
||||
@@ -338,4 +646,97 @@ namespace Scripts.Spells.Evoker
|
||||
OnEffectHitTarget.Add(new(CalcDispelCount, 3, SpellEffectName.Dispel));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Called by 368847 - Firestorm (Red)
|
||||
class spell_evo_snapfire : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((SpellIds.Snapfire, 1));
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.Snapfire);
|
||||
}
|
||||
|
||||
public override void OnPrecast()
|
||||
{
|
||||
AuraEffect snapfire = GetCaster().GetAuraEffect(SpellIds.Snapfire, 1);
|
||||
if (snapfire != null)
|
||||
if (GetSpell().m_appliedMods.Contains(snapfire.GetBase()))
|
||||
MathFunctions.AddPct(ref at_evo_firestorm.GetOrCreateExtraData(GetSpell()).SnapshotDamageMultipliers, snapfire.GetAmount());
|
||||
}
|
||||
|
||||
public override void Register() { }
|
||||
}
|
||||
|
||||
[Script] // Called by 369374 - Firestorm (Red)
|
||||
class spell_evo_snapfire_bonus_damage : SpellScript
|
||||
{
|
||||
void CalculateDamageBonus(SpellEffectInfo spellEffectInfo, Unit victim, ref int damage, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
if (GetSpell().m_customArg is at_evo_firestorm.extra_create_data bonus)
|
||||
pctMod *= bonus.SnapshotDamageMultipliers;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
CalcDamage.Add(new(CalculateDamageBonus));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 360995 - Verdant Embrace (Green)
|
||||
class spell_evo_verdant_embrace : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.VerdantEmbraceHeal, SpellIds.VerdantEmbraceJump)
|
||||
&& CliDB.SpellVisualKitStorage.HasRecord(SpellIds.VisualKitEvokerVerdantEmbraceJump);
|
||||
}
|
||||
|
||||
void HandleLaunchTarget(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetHitUnit();
|
||||
CastSpellExtraArgs args = new();
|
||||
args.SetTriggerFlags(TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
args.SetTriggeringSpell(GetSpell());
|
||||
|
||||
if (target != caster)
|
||||
{
|
||||
caster.CastSpell(target, SpellIds.VerdantEmbraceJump, args);
|
||||
caster.SendPlaySpellVisualKit(SpellIds.VisualKitEvokerVerdantEmbraceJump, 0, 0);
|
||||
}
|
||||
else
|
||||
caster.CastSpell(caster, SpellIds.VerdantEmbraceHeal, args);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectLaunchTarget.Add(new(HandleLaunchTarget, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 396557 - Verdant Embrace
|
||||
class spell_evo_verdant_embrace_trigger_heal : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.VerdantEmbraceHeal);
|
||||
}
|
||||
|
||||
void HandleHitTarget(uint effIndex)
|
||||
{
|
||||
GetHitUnit().CastSpell(GetExplTargetUnit(), SpellIds.VerdantEmbraceHeal, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleHitTarget, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
+1358
-1084
File diff suppressed because it is too large
Load Diff
+687
-26
@@ -1,32 +1,57 @@
|
||||
// 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.
|
||||
// Licensed under the Gnu General Public License. See License file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using static Global;
|
||||
using System.Linq;
|
||||
|
||||
namespace Scripts.Spells.Hunter;
|
||||
|
||||
namespace Scripts.Spells.Hunter
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint AMurderOfCrowsDamage = 131900;
|
||||
public const uint AMurderOfCrowsVisual1 = 131637;
|
||||
public const uint AMurderOfCrowsVisual2 = 131951;
|
||||
public const uint AMurderOfCrowsVisual3 = 131952;
|
||||
public const uint AimedShot = 19434;
|
||||
public const uint AspectCheetahSlow = 186258;
|
||||
public const uint AspectOfTheFox = 1219162;
|
||||
public const uint AspectOfTheTurtlePacifyAura = 205769;
|
||||
public const uint BindingShot = 109248;
|
||||
public const uint BindingShotImmune = 117553;
|
||||
public const uint BindingShotMarker = 117405;
|
||||
public const uint BindingShotStun = 117526;
|
||||
public const uint BindingShotVisual = 117614;
|
||||
public const uint BindingShotVisualArrow = 118306;
|
||||
public const uint ConcussiveShot = 5116;
|
||||
public const uint EmergencySalveTalent = 459517;
|
||||
public const uint EmergencySalveDispel = 459521;
|
||||
public const uint EntrapmentTalent = 393344;
|
||||
public const uint EntrapmentRoot = 393456;
|
||||
public const uint Exhilaration = 109304;
|
||||
public const uint ExhilarationPet = 128594;
|
||||
public const uint ExhilarationR2 = 231546;
|
||||
public const uint ExplosiveShotDamage = 212680;
|
||||
public const uint GreviousInjury = 1217789;
|
||||
public const uint HighExplosiveTrap = 236775;
|
||||
public const uint HighExplosiveTrapDamage = 236777;
|
||||
public const uint ImplosiveTrap = 462032;
|
||||
public const uint ImplosiveTrapDamage = 462033;
|
||||
public const uint Intimidation = 19577;
|
||||
public const uint IntimidationMarksmanship = 474421;
|
||||
public const uint LatentPoisonStack = 378015;
|
||||
public const uint LatentPoisonDamage = 378016;
|
||||
public const uint LatentPoisonInjectorsStack = 336903;
|
||||
public const uint LatentPoisonInjectorsDamage = 336904;
|
||||
public const uint LockAndLoad = 194594;
|
||||
public const uint LoneWolf = 155228;
|
||||
public const uint MarksmanshipHunterAura = 137016;
|
||||
public const uint MasterMarksman = 269576;
|
||||
public const uint MastersCallTriggered = 62305;
|
||||
public const uint Misdirection = 34477;
|
||||
public const uint MisdirectionProc = 35079;
|
||||
@@ -36,12 +61,27 @@ namespace Scripts.Spells.Hunter
|
||||
public const uint PetHeartOfThePhoenixDebuff = 55711;
|
||||
public const uint PosthasteIncreaseSpeed = 118922;
|
||||
public const uint PosthasteTalent = 109215;
|
||||
public const uint PreciseShots = 260242;
|
||||
public const uint RapidFire = 257044;
|
||||
public const uint RapidFireDamage = 257045;
|
||||
public const uint RapidFireEnergize = 263585;
|
||||
public const uint RejuvenatingWindHeal = 385540;
|
||||
public const uint ScoutsInstincts = 459455;
|
||||
public const uint ShrapnelShotTalent = 473520;
|
||||
public const uint ShrapnelShotDebuff = 474310;
|
||||
public const uint SteadyShot = 56641;
|
||||
public const uint SteadyShotFocus = 77443;
|
||||
public const uint T94PGreatness = 68130;
|
||||
public const uint T292PMarksmanshipDamage = 394371;
|
||||
public const uint StreamlineTalent = 260367;
|
||||
public const uint StreamlineBuff = 342076;
|
||||
public const uint T9_4PGreatness = 68130;
|
||||
public const uint T29_2PMarksmanshipDamage = 394371;
|
||||
public const uint TarTrap = 187699;
|
||||
public const uint TarTrapAreatrigger = 187700;
|
||||
public const uint TarTrapSlow = 135299;
|
||||
public const uint WildernessMedicineTalent = 343242;
|
||||
public const uint WildernessMedicineDispel = 384784;
|
||||
public const uint RoarOfSacrificeTriggered = 67481;
|
||||
|
||||
public const uint DraeneiGiftOfTheNaaru = 59543;
|
||||
}
|
||||
|
||||
@@ -77,6 +117,7 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new(HandleDummyTick, 0, AuraType.PeriodicDummy));
|
||||
@@ -98,12 +139,39 @@ namespace Scripts.Spells.Hunter
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.AspectCheetahSlow, true);
|
||||
}
|
||||
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new(HandleOnRemove, 0, AuraType.ModIncreaseSpeed, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 1219162 - Aspect of the Fox (attached to 186257 - Aspect of the Cheetah)
|
||||
class spell_hun_aspect_of_the_fox : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.AspectOfTheFox)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 2))
|
||||
&& spellInfo.GetEffect(2).IsAura(AuraType.CastWhileWalking);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return !GetCaster().HasAura(SpellIds.AspectOfTheFox);
|
||||
}
|
||||
|
||||
static void HandleCastWhileWalking(ref WorldObject target)
|
||||
{
|
||||
target = null;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectTargetSelect.Add(new(HandleCastWhileWalking, 2, Targets.UnitCaster));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 186265 - Aspect of the Turtle
|
||||
class spell_hun_aspect_of_the_turtle : AuraScript
|
||||
{
|
||||
@@ -124,8 +192,112 @@ namespace Scripts.Spells.Hunter
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ModAttackerMeleeHitChance, AuraEffectHandleModes.Real));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModAttackerMeleeHitChance, AuraEffectHandleModes.Real));
|
||||
AfterEffectApply.Add(new(OnApply, 0, AuraType.ModAttackerMeleeHitChance, AuraEffectHandleModes.Real));
|
||||
AfterEffectRemove.Add(new(OnRemove, 0, AuraType.ModAttackerMeleeHitChance, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 109248 - Binding Shot
|
||||
class spell_hun_binding_shot : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BindingShotVisualArrow);
|
||||
}
|
||||
|
||||
void HandleCast()
|
||||
{
|
||||
GetCaster().CastSpell(GetExplTargetDest().GetPosition(), SpellIds.BindingShotVisualArrow, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCast.Add(new(HandleCast));
|
||||
}
|
||||
}
|
||||
|
||||
// 109248 - Binding Shot
|
||||
[Script] // Id - 1524
|
||||
class at_hun_binding_shot(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
TaskScheduler _scheduler = new();
|
||||
|
||||
public override void OnInitialize()
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
foreach (AreaTrigger other in caster.GetAreaTriggers(SpellIds.BindingShot))
|
||||
other.SetDuration(0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCreate(Spell creatingSpell)
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
|
||||
{
|
||||
foreach (ObjectGuid guid in at.GetInsideUnits())
|
||||
{
|
||||
Unit unit = Global.ObjAccessor.GetUnit(at, guid);
|
||||
if (!unit.HasAura(SpellIds.BindingShotMarker))
|
||||
continue;
|
||||
|
||||
unit.CastSpell(at.GetPosition(), SpellIds.BindingShotVisual, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
|
||||
task.Repeat();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
if (caster.IsValidAttackTarget(unit) && !unit.HasAura(SpellIds.BindingShotImmune, caster.GetGUID()))
|
||||
{
|
||||
caster.CastSpell(unit, SpellIds.BindingShotMarker, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
unit.CastSpell(at.GetPosition(), SpellIds.BindingShotVisual, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnUnitExit(Unit unit)
|
||||
{
|
||||
unit.RemoveAurasDueToSpell(SpellIds.BindingShotMarker, at.GetCasterGUID());
|
||||
|
||||
if (at.IsRemoved())
|
||||
return;
|
||||
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
if (caster.IsValidAttackTarget(unit) && !unit.HasAura(SpellIds.BindingShotImmune, caster.GetGUID()))
|
||||
{
|
||||
caster.CastSpell(unit, SpellIds.BindingShotStun, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
caster.CastSpell(unit, SpellIds.BindingShotImmune, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnUpdate(uint diff)
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 204089 - Bullseye
|
||||
class spell_hun_bullseye : AuraScript
|
||||
{
|
||||
static bool CheckEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetActionTarget().HealthBelowPct(aurEff.GetAmount());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new(CheckEffectProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +320,64 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 5116 - Concussive Shot (attached to 193455 - Cobra Shot and 56641 - Steady Shot)
|
||||
class spell_hun_concussive_shot : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ConcussiveShot)
|
||||
&& ValidateSpellEffect((SpellIds.SteadyShot, 2));
|
||||
}
|
||||
|
||||
void HandleDuration(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
|
||||
Aura concussiveShot = GetHitUnit().GetAura(SpellIds.ConcussiveShot, caster.GetGUID());
|
||||
if (concussiveShot != null)
|
||||
{
|
||||
SpellInfo steadyShot = Global.SpellMgr.GetSpellInfo(SpellIds.SteadyShot, GetCastDifficulty());
|
||||
TimeSpan extraDuration = TimeSpan.FromSeconds(steadyShot.GetEffect(2).CalcValue(caster) / 10);
|
||||
TimeSpan newDuration = TimeSpan.FromSeconds(concussiveShot.GetDuration()) + extraDuration;
|
||||
concussiveShot.SetDuration((int)newDuration.TotalMicroseconds);
|
||||
concussiveShot.SetMaxDuration((int)newDuration.TotalMicroseconds);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleDuration, SpellConst.EffectFirstFound, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 459517 - Concussive Shot (attached to 186265 - Aspect of the Turtle and 5384 - Feign Death)
|
||||
class spell_hun_emergency_salve : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.EmergencySalveTalent, SpellIds.EmergencySalveDispel);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.EmergencySalveTalent);
|
||||
}
|
||||
|
||||
void HandleAfterCast()
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.EmergencySalveDispel, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new(HandleAfterCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 109304 - Exhilaration
|
||||
class spell_hun_exhilaration : SpellScript
|
||||
{
|
||||
@@ -189,6 +419,34 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
// 236775 - High Explosive Trap
|
||||
[Script] // 9810 - AreatriggerId
|
||||
class areatrigger_hun_high_explosive_trap(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
public override void OnInitialize()
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
foreach (AreaTrigger other in caster.GetAreaTriggers(SpellIds.HighExplosiveTrap))
|
||||
other.SetDuration(0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
if (caster.IsValidAttackTarget(unit))
|
||||
{
|
||||
caster.CastSpell(at.GetPosition(), SpellIds.HighExplosiveTrapDamage, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
at.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 212658 - Hunting Party
|
||||
class spell_hun_hunting_party : AuraScript
|
||||
{
|
||||
@@ -210,6 +468,34 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
// 462032 - Implosive Trap
|
||||
[Script] // 34378 - AreatriggerId
|
||||
class areatrigger_hun_implosive_trap(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
public override void OnInitialize()
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
foreach (AreaTrigger other in caster.GetAreaTriggers(SpellIds.ImplosiveTrap))
|
||||
other.SetDuration(0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
if (caster.IsValidAttackTarget(unit))
|
||||
{
|
||||
caster.CastSpell(at.GetPosition(), SpellIds.ImplosiveTrapDamage, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
at.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 53478 - Last Stand Pet
|
||||
class spell_hun_last_stand_pet : SpellScript
|
||||
{
|
||||
@@ -324,6 +610,64 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 1217788 - Manhunter
|
||||
class spell_hun_manhunter : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.GreviousInjury);
|
||||
}
|
||||
|
||||
static bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetProcTarget().IsPlayer();
|
||||
}
|
||||
|
||||
static void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetActionTarget(), SpellIds.GreviousInjury, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new(CheckProc));
|
||||
OnEffectProc.Add(new(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 260309 - Master Marksman
|
||||
class spell_hun_master_marksman : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MasterMarksman);
|
||||
}
|
||||
|
||||
static void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
uint ticks = Global.SpellMgr.GetSpellInfo(SpellIds.MasterMarksman, Difficulty.None).GetMaxTicks();
|
||||
if (ticks == 0)
|
||||
return;
|
||||
|
||||
int damage = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount()) / ticks);
|
||||
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetActionTarget(), SpellIds.MasterMarksman, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
SpellValueOverrides = { new(SpellValueMod.BasePoint0, damage) }
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 53271 - Masters Call
|
||||
class spell_hun_masters_call : SpellScript
|
||||
{
|
||||
@@ -341,21 +685,21 @@ namespace Scripts.Spells.Hunter
|
||||
SpellCastResult DoCheckCast()
|
||||
{
|
||||
Guardian pet = GetCaster().ToPlayer().GetGuardianPet();
|
||||
Cypher.Assert(pet != null); // checked in Spell.CheckCast
|
||||
Cypher.Assert(pet != null); // checked in Spell::CheckCast
|
||||
|
||||
if (!pet.IsPet() || !pet.IsAlive())
|
||||
return SpellCastResult.NoPet;
|
||||
|
||||
// Do a mini Spell.CheckCasterAuras on the pet, no other way of doing this
|
||||
// Do a mini Spell::CheckCasterAuras on the pet, no other way of doing this
|
||||
SpellCastResult result = SpellCastResult.SpellCastOk;
|
||||
UnitFlags unitflag = (UnitFlags)(uint)pet.m_unitData.Flags;
|
||||
UnitFlags unitflag = (UnitFlags)pet.m_unitData.Flags._value;
|
||||
if (!pet.GetCharmerGUID().IsEmpty())
|
||||
result = SpellCastResult.Charmed;
|
||||
else if (unitflag.HasFlag(UnitFlags.Stunned))
|
||||
else if (unitflag.HasAnyFlag(UnitFlags.Stunned))
|
||||
result = SpellCastResult.Stunned;
|
||||
else if (unitflag.HasFlag(UnitFlags.Fleeing))
|
||||
else if (unitflag.HasAnyFlag(UnitFlags.Fleeing))
|
||||
result = SpellCastResult.Fleeing;
|
||||
else if (unitflag.HasFlag(UnitFlags.Confused))
|
||||
else if (unitflag.HasAnyFlag(UnitFlags.Confused))
|
||||
result = SpellCastResult.Confused;
|
||||
|
||||
if (result != SpellCastResult.SpellCastOk)
|
||||
@@ -460,6 +804,33 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 459783 - Penetrating Shots
|
||||
class spell_hun_penetrating_shots : AuraScript
|
||||
{
|
||||
void CalcAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
AuraEffect amountHolder = GetEffect(1);
|
||||
if (amountHolder != null)
|
||||
{
|
||||
float critChanceDone = GetUnitOwner().GetUnitCriticalChanceDone(WeaponAttackType.BaseAttack);
|
||||
amount = (int)MathFunctions.CalculatePct(critChanceDone, amountHolder.GetAmount());
|
||||
}
|
||||
}
|
||||
|
||||
void UpdatePeriodic(AuraEffect aurEff)
|
||||
{
|
||||
AuraEffect bonus = GetEffect(0);
|
||||
if (bonus != null)
|
||||
bonus.RecalculateAmount(aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new(CalcAmount, 0, AuraType.ModCritDamageBonus));
|
||||
OnEffectPeriodic.Add(new(UpdatePeriodic, 1, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 55709 - Pet Heart of the Phoenix
|
||||
class spell_hun_pet_heart_of_the_phoenix : SpellScript
|
||||
{
|
||||
@@ -520,6 +891,29 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 260240 - Precise Shots
|
||||
class spell_hun_precise_shots : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PreciseShots);
|
||||
}
|
||||
|
||||
void HandleProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetActor(), SpellIds.PreciseShots, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = eventInfo.GetProcSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnProc.Add(new(HandleProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 257044 - Rapid Fire
|
||||
class spell_hun_rapid_fire : AuraScript
|
||||
{
|
||||
@@ -560,6 +954,37 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 385539 - Rejuvenating Wind
|
||||
class spell_hun_rejuvenating_wind : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RejuvenatingWindHeal)
|
||||
&& Global.SpellMgr.GetSpellInfo(SpellIds.RejuvenatingWindHeal, Difficulty.None).GetMaxTicks() > 0;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo procEvent)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit caster = GetTarget();
|
||||
|
||||
uint ticks = Global.SpellMgr.GetSpellInfo(SpellIds.RejuvenatingWindHeal, Difficulty.None).GetMaxTicks();
|
||||
int heal = (int)(MathFunctions.CalculatePct(caster.GetMaxHealth(), aurEff.GetAmount()) / ticks);
|
||||
|
||||
caster.CastSpell(caster, SpellIds.RejuvenatingWindHeal, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
SpellValueOverrides = { new(SpellValueMod.BasePoint0, heal) }
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 53480 - Roar of Sacrifice
|
||||
class spell_hun_roar_of_sacrifice : AuraScript
|
||||
{
|
||||
@@ -571,7 +996,7 @@ namespace Scripts.Spells.Hunter
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo == null || (damageInfo.GetSchoolMask() & (SpellSchoolMask)aurEff.GetMiscValue()) == 0)
|
||||
if (damageInfo == null || ((int)damageInfo.GetSchoolMask() & aurEff.GetMiscValue()) == 0)
|
||||
return false;
|
||||
|
||||
if (GetCaster() == null)
|
||||
@@ -607,7 +1032,7 @@ namespace Scripts.Spells.Hunter
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Player caster = GetCaster().ToPlayer();
|
||||
// break var Shot and autohit
|
||||
// break Auto Shot and autohit
|
||||
caster.InterruptSpell(CurrentSpellTypes.AutoRepeat);
|
||||
caster.AttackStop();
|
||||
caster.SendAttackSwingCancelAttack();
|
||||
@@ -619,12 +1044,85 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 459455 - Scout's Instincts (attached to 186257 - Aspect of the Cheetah)
|
||||
class spell_hun_scouts_instincts : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ScoutsInstincts)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 1))
|
||||
&& spellInfo.GetEffect(1).IsAura(AuraType.ModMinimumSpeed);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return !GetCaster().HasAura(SpellIds.ScoutsInstincts);
|
||||
}
|
||||
|
||||
static void HandleMinSpeed(ref WorldObject target)
|
||||
{
|
||||
target = null;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectTargetSelect.Add(new(HandleMinSpeed, 1, Targets.UnitCaster));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 459533 - Scrappy
|
||||
class spell_hun_scrappy : AuraScript
|
||||
{
|
||||
static uint[] AffectedSpellIds = [SpellIds.BindingShot, SpellIds.Intimidation, SpellIds.IntimidationMarksmanship];
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(AffectedSpellIds);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
foreach (uint spellId in AffectedSpellIds)
|
||||
GetTarget().GetSpellHistory().ModifyCooldown(spellId, -TimeSpan.FromSeconds(aurEff.GetAmount()));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 473520 - Shrapnel Shot
|
||||
class spell_hun_shrapnel_shot : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LockAndLoad);
|
||||
}
|
||||
|
||||
void HandleProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
if (!RandomHelper.randChance(GetEffect(0).GetAmount()))
|
||||
return;
|
||||
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.LockAndLoad, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnProc.Add(new(HandleProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 56641 - Steady Shot
|
||||
class spell_hun_steady_shot : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SteadyShotFocus);
|
||||
return ValidateSpellInfo(SpellIds.SteadyShotFocus, SpellIds.AimedShot, SpellIds.MarksmanshipHunterAura);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
@@ -634,7 +1132,14 @@ namespace Scripts.Spells.Hunter
|
||||
|
||||
void HandleOnHit()
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.SteadyShotFocus, true);
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.SteadyShotFocus, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
|
||||
if (GetCaster().HasAura(SpellIds.MarksmanshipHunterAura))
|
||||
GetCaster().GetSpellHistory().ModifyCooldown(SpellIds.AimedShot, TimeSpan.FromSeconds(-GetEffectInfo(1).CalcValue()));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -643,10 +1148,64 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 260367 - Streamline (attached to 257044 - Rapid Fire)
|
||||
class spell_hun_streamline : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.StreamlineTalent, SpellIds.StreamlineBuff);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.StreamlineTalent);
|
||||
}
|
||||
|
||||
void HandleAfterCast()
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.StreamlineBuff, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new(HandleAfterCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 391559 - Surging Shots
|
||||
class spell_hun_surging_shots : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.RapidFire);
|
||||
}
|
||||
|
||||
void HandleProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
GetTarget().GetSpellHistory().ResetCooldown(SpellIds.RapidFire, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnProc.Add(new(HandleProc));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 1515 - Tame Beast
|
||||
class spell_hun_tame_beast : SpellScript
|
||||
{
|
||||
uint[] CallPetSpellIds = { 883, 83242, 83243, 83244, 83245, };
|
||||
static uint[] CallPetSpellIds =
|
||||
[
|
||||
883,
|
||||
83242,
|
||||
83243,
|
||||
83244,
|
||||
83245,
|
||||
];
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
@@ -673,7 +1232,7 @@ namespace Scripts.Spells.Hunter
|
||||
if (petStable.CurrentPetIndex.HasValue)
|
||||
return SpellCastResult.AlreadyHaveSummon;
|
||||
|
||||
var freeSlotIndex = Array.FindIndex(petStable.ActivePets, petInfo => petInfo == null);
|
||||
var freeSlotIndex = petStable.ActivePets.ToList().FindIndex(petInfo => petInfo == null);
|
||||
if (freeSlotIndex == -1)
|
||||
{
|
||||
caster.SendTameFailure(PetTameResult.TooMany);
|
||||
@@ -697,6 +1256,7 @@ namespace Scripts.Spells.Hunter
|
||||
return SpellCastResult.DontReport;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
return SpellCastResult.BadImplicitTargets;
|
||||
|
||||
@@ -709,12 +1269,68 @@ namespace Scripts.Spells.Hunter
|
||||
}
|
||||
}
|
||||
|
||||
// 187700 - Tar Trap
|
||||
[Script] // 4436 - AreatriggerId
|
||||
class areatrigger_hun_tar_trap(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
public override void OnCreate(Spell creatingSpell)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
if (caster.HasAura(SpellIds.EntrapmentTalent))
|
||||
caster.CastSpell(at.GetPosition(), SpellIds.EntrapmentRoot, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
if (caster.IsValidAttackTarget(unit))
|
||||
caster.CastSpell(unit, SpellIds.TarTrapSlow, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnUnitExit(Unit unit)
|
||||
{
|
||||
unit.RemoveAurasDueToSpell(SpellIds.TarTrapSlow, at.GetCasterGUID());
|
||||
}
|
||||
}
|
||||
|
||||
// 187699 - Tar Trap
|
||||
[Script] // 4435 - AreatriggerId
|
||||
class areatrigger_hun_tar_trap_activate(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
public override void OnInitialize()
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
foreach (AreaTrigger other in caster.GetAreaTriggers(SpellIds.TarTrap))
|
||||
other.SetDuration(0);
|
||||
}
|
||||
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
if (caster.IsValidAttackTarget(unit))
|
||||
{
|
||||
caster.CastSpell(at.GetPosition(), SpellIds.TarTrapAreatrigger, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
at.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[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);
|
||||
return ValidateSpellInfo(SpellIds.T9_4PGreatness);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
@@ -729,7 +1345,7 @@ namespace Scripts.Spells.Hunter
|
||||
PreventDefaultAction();
|
||||
Unit caster = eventInfo.GetActor();
|
||||
|
||||
caster.CastSpell(caster.ToPlayer().GetPet(), SpellIds.T94PGreatness, aurEff);
|
||||
caster.CastSpell(caster.ToPlayer().GetPet(), SpellIds.T9_4PGreatness, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -744,8 +1360,8 @@ namespace Scripts.Spells.Hunter
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((SpellIds.T292PMarksmanshipDamage, 0))
|
||||
&& SpellMgr.GetSpellInfo(SpellIds.T292PMarksmanshipDamage, Difficulty.None).GetMaxTicks() != 0;
|
||||
return ValidateSpellEffect((SpellIds.T29_2PMarksmanshipDamage, 0))
|
||||
&& Global.SpellMgr.GetSpellInfo(SpellIds.T29_2PMarksmanshipDamage, Difficulty.None).GetMaxTicks() != 0;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
@@ -753,10 +1369,10 @@ namespace Scripts.Spells.Hunter
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit caster = eventInfo.GetActor();
|
||||
uint ticks = SpellMgr.GetSpellInfo(SpellIds.T292PMarksmanshipDamage, Difficulty.None).GetMaxTicks();
|
||||
uint ticks = Global.SpellMgr.GetSpellInfo(SpellIds.T29_2PMarksmanshipDamage, Difficulty.None).GetMaxTicks();
|
||||
uint damage = MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetOriginalDamage(), aurEff.GetAmount()) / ticks;
|
||||
|
||||
caster.CastSpell(eventInfo.GetActionTarget(), SpellIds.T292PMarksmanshipDamage, new CastSpellExtraArgs(aurEff)
|
||||
caster.CastSpell(eventInfo.GetActionTarget(), SpellIds.T29_2PMarksmanshipDamage, new CastSpellExtraArgs(aurEff)
|
||||
.SetTriggeringSpell(eventInfo.GetProcSpell())
|
||||
.AddSpellMod(SpellValueMod.BasePoint0, (int)damage));
|
||||
}
|
||||
@@ -766,4 +1382,49 @@ namespace Scripts.Spells.Hunter
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Called by 136 - Mend Pet
|
||||
class spell_hun_wilderness_medicine : AuraScript
|
||||
{
|
||||
int _dispelChance = 0;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.WildernessMedicineTalent, SpellIds.WildernessMedicineDispel);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster == null)
|
||||
return false;
|
||||
|
||||
AuraEffect wildernessMedicine = GetCaster().GetAuraEffect(SpellIds.WildernessMedicineTalent, 1);
|
||||
if (wildernessMedicine == null)
|
||||
return false;
|
||||
|
||||
_dispelChance = wildernessMedicine.GetAmount();
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect aurEff)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null)
|
||||
{
|
||||
if (RandomHelper.randChance(_dispelChance))
|
||||
{
|
||||
caster.CastSpell(GetTarget(), SpellIds.WildernessMedicineDispel, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new(OnPeriodic, 0, AuraType.ObsModHealth));
|
||||
}
|
||||
}
|
||||
+1125
-953
File diff suppressed because it is too large
Load Diff
+428
-120
@@ -1,5 +1,5 @@
|
||||
// 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.
|
||||
// Licensed under the Gnu General Public License. See License file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
@@ -11,10 +11,9 @@ using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static Global;
|
||||
|
||||
namespace Scripts.Spells.Mage
|
||||
{
|
||||
namespace Scripts.Spells.Mage;
|
||||
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint AlterTimeAura = 110909;
|
||||
@@ -43,18 +42,29 @@ namespace Scripts.Spells.Mage
|
||||
public const uint FeelTheBurn = 383391;
|
||||
public const uint FingersOfFrost = 44544;
|
||||
public const uint FireBlast = 108853;
|
||||
public const uint FlurryDamage = 228596;
|
||||
public const uint Firestarter = 205026;
|
||||
public const uint FlamePatchAreatrigger = 205470;
|
||||
public const uint FlamePatchDamage = 205472;
|
||||
public const uint FlamePatchTalent = 205037;
|
||||
public const uint FlurryDamage = 228596;
|
||||
public const uint FreneticSpeed = 236060;
|
||||
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 ImprovedCombustion = 383967;
|
||||
public const uint ImprovedScorch = 383608;
|
||||
public const uint IncantersFlow = 116267;
|
||||
public const uint LivingBombExplosion = 44461;
|
||||
public const uint LivingBombPeriodic = 217694;
|
||||
public const uint ManaSurge = 37445;
|
||||
public const uint MasterOfTime = 342249;
|
||||
public const uint MeteorAreatrigger = 177345;
|
||||
public const uint MeteorBurnDamage = 155158;
|
||||
public const uint MeteorMissile = 153564;
|
||||
public const uint MoltenFury = 458910;
|
||||
public const uint PhoenixFlames = 257541;
|
||||
public const uint RadiantSparkProcBlocker = 376105;
|
||||
public const uint RayOfFrostBonus = 208141;
|
||||
public const uint RayOfFrostFingersOfFrost = 269748;
|
||||
@@ -62,14 +72,17 @@ namespace Scripts.Spells.Mage
|
||||
public const uint RingOfFrostDummy = 91264;
|
||||
public const uint RingOfFrostFreeze = 82691;
|
||||
public const uint RingOfFrostSummon = 113724;
|
||||
public const uint Scald = 450746;
|
||||
public const uint SerpentForm = 32817;
|
||||
public const uint SheepForm = 32820;
|
||||
public const uint Shimmer = 212653;
|
||||
public const uint Slow = 31589;
|
||||
public const uint SpontaneousCombustion = 451875;
|
||||
public const uint SquirrelForm = 32813;
|
||||
public const uint Supernova = 157980;
|
||||
public const uint TempestBarrierAbsorb = 382290;
|
||||
public const uint WorgenForm = 32819;
|
||||
public const uint PetNetherwindsFatigued = 160455;
|
||||
public const uint SpellPetNetherwindsFatigued = 160455;
|
||||
public const uint IceLanceTrigger = 228598;
|
||||
public const uint ThermalVoid = 155149;
|
||||
public const uint IcyVeins = 12472;
|
||||
@@ -81,7 +94,7 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
// 110909 - Alter Time Aura
|
||||
[Script] // 342246 - Alter Time Aura
|
||||
class spell_mage_alter_time_AuraScript : AuraScript
|
||||
class spell_mage_alter_time_aura : AuraScript
|
||||
{
|
||||
ulong _health;
|
||||
Position _pos;
|
||||
@@ -108,7 +121,7 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
if (unit.HasAura(SpellIds.MasterOfTime))
|
||||
{
|
||||
SpellInfo blink = SpellMgr.GetSpellInfo(SpellIds.Blink, Difficulty.None);
|
||||
SpellInfo blink = Global.SpellMgr.GetSpellInfo(SpellIds.Blink, Difficulty.None);
|
||||
unit.GetSpellHistory().ResetCharges(blink.ChargeCategoryId);
|
||||
}
|
||||
unit.CastSpell(unit, SpellIds.AlterTimeVisual);
|
||||
@@ -147,11 +160,10 @@ namespace Scripts.Spells.Mage
|
||||
[Script] // 44425 - Arcane Barrage
|
||||
class spell_mage_arcane_barrage : SpellScript
|
||||
{
|
||||
ObjectGuid _primaryTarget;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ArcaneBarrageR3, SpellIds.ArcaneBarrageEnergize) && ValidateSpellEffect((spellInfo.Id, 1));
|
||||
return ValidateSpellInfo(SpellIds.ArcaneBarrageR3, SpellIds.ArcaneBarrageEnergize)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 1));
|
||||
}
|
||||
|
||||
void ConsumeArcaneCharges()
|
||||
@@ -185,6 +197,8 @@ namespace Scripts.Spells.Mage
|
||||
OnEffectLaunchTarget.Add(new(MarkPrimaryTarget, 1, SpellEffectName.Dummy));
|
||||
AfterCast.Add(new(ConsumeArcaneCharges));
|
||||
}
|
||||
|
||||
ObjectGuid _primaryTarget;
|
||||
}
|
||||
|
||||
[Script] // 195302 - Arcane Charge
|
||||
@@ -241,6 +255,7 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
return GetUnitTargetCountForEffect(1) >= requiredTargets.GetAmount() && RandomHelper.randChance(triggerChance.GetAmount());
|
||||
}
|
||||
;
|
||||
|
||||
if (!procTriggered())
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
@@ -288,22 +303,17 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
// 190356 - Blizzard
|
||||
[Script] // 4658 - AreaTrigger Create Properties
|
||||
class areatrigger_mage_blizzard : AreaTriggerAI
|
||||
class areatrigger_mage_blizzard(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
TimeSpan TickPeriod = TimeSpan.FromMilliseconds(1000);
|
||||
static TimeSpan TickPeriod = TimeSpan.FromSeconds(1000);
|
||||
|
||||
TimeSpan _tickTimer;
|
||||
|
||||
public areatrigger_mage_blizzard(AreaTrigger areatrigger) : base(areatrigger)
|
||||
{
|
||||
_tickTimer = TickPeriod;
|
||||
}
|
||||
TimeSpan _tickTimer = TickPeriod;
|
||||
|
||||
public override void OnUpdate(uint diff)
|
||||
{
|
||||
_tickTimer -= TimeSpan.FromMilliseconds(diff);
|
||||
_tickTimer -= TimeSpan.FromSeconds(diff);
|
||||
|
||||
while (_tickTimer <= TimeSpan.FromSeconds(0))
|
||||
while (_tickTimer <= TimeSpan.Zero)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
@@ -339,7 +349,8 @@ namespace Scripts.Spells.Mage
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo != null && (spellInfo.GetAllEffectsMechanicMask() & ((1 << (int)Mechanics.Interrupt) | (1 << (int)Mechanics.Silence))) != 0)
|
||||
if (spellInfo != null)
|
||||
if ((spellInfo.GetAllEffectsMechanicMask() & ((1 << (int)Mechanics.Interrupt) | (1 << (int)Mechanics.Silence))) != 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -370,13 +381,14 @@ namespace Scripts.Spells.Mage
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((spellInfo.Id, 2)) && ValidateSpellInfo(SpellIds.CauterizeDot, SpellIds.Cauterized, spellInfo.GetEffect(2).TriggerSpell);
|
||||
return ValidateSpellEffect((spellInfo.Id, 2)) && 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 ||
|
||||
AuraEffect aura = GetEffect(1);
|
||||
if (aura == null ||
|
||||
!GetTargetApplication().HasEffect(1) ||
|
||||
dmgInfo.GetDamage() < GetTarget().GetHealth() ||
|
||||
dmgInfo.GetDamage() > GetTarget().GetMaxHealth() * 2 ||
|
||||
@@ -386,7 +398,7 @@ namespace Scripts.Spells.Mage
|
||||
return;
|
||||
}
|
||||
|
||||
GetTarget().SetHealth(GetTarget().CountPctFromMaxHealth(effect1.GetAmount()));
|
||||
GetTarget().SetHealth(GetTarget().CountPctFromMaxHealth(aura.GetAmount()));
|
||||
GetTarget().CastSpell(GetTarget(), GetEffectInfo(2).TriggerSpell, TriggerCastFlags.FullMask);
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.CauterizeDot, TriggerCastFlags.FullMask);
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.Cauterized, TriggerCastFlags.FullMask);
|
||||
@@ -401,12 +413,7 @@ namespace Scripts.Spells.Mage
|
||||
[Script] // 235219 - Cold Snap
|
||||
class spell_mage_cold_snap : SpellScript
|
||||
{
|
||||
uint[] SpellsToReset =
|
||||
{
|
||||
SpellIds.ConeOfCold,
|
||||
SpellIds.IceBarrier,
|
||||
SpellIds.IceBlock,
|
||||
};
|
||||
static uint[] SpellsToReset = [SpellIds.ConeOfCold, SpellIds.IceBarrier, SpellIds.IceBlock,];
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -418,7 +425,7 @@ namespace Scripts.Spells.Mage
|
||||
foreach (uint spellId in SpellsToReset)
|
||||
GetCaster().GetSpellHistory().ResetCooldown(spellId, true);
|
||||
|
||||
GetCaster().GetSpellHistory().RestoreCharge(SpellMgr.GetSpellInfo(SpellIds.FrostNova, GetCastDifficulty()).ChargeCategoryId);
|
||||
GetCaster().GetSpellHistory().RestoreCharge(Global.SpellMgr.GetSpellInfo(SpellIds.FrostNova, GetCastDifficulty()).ChargeCategoryId);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -427,35 +434,6 @@ namespace Scripts.Spells.Mage
|
||||
}
|
||||
}
|
||||
|
||||
class CometStormEvent : BasicEvent
|
||||
{
|
||||
Unit _caster;
|
||||
ObjectGuid _originalCastId;
|
||||
Position _dest;
|
||||
byte _count;
|
||||
|
||||
public CometStormEvent(Unit caster, ObjectGuid originalCastId, Position dest)
|
||||
{
|
||||
_caster = caster;
|
||||
_originalCastId = originalCastId;
|
||||
_dest = dest;
|
||||
}
|
||||
|
||||
public override bool Execute(ulong time, uint diff)
|
||||
{
|
||||
Position destPosition = new(_dest.GetPositionX() + RandomHelper.FRand(-3.0f, 3.0f), _dest.GetPositionY() + RandomHelper.FRand(-3.0f, 3.0f), _dest.GetPositionZ());
|
||||
_caster.CastSpell(destPosition, SpellIds.CometStormVisual,
|
||||
new CastSpellExtraArgs(TriggerCastFlags.IgnoreCastInProgress).SetOriginalCastId(_originalCastId));
|
||||
++_count;
|
||||
|
||||
if (_count >= 7)
|
||||
return true;
|
||||
|
||||
_caster.m_Events.AddEvent(this, TimeSpan.FromMilliseconds(time) + RandomHelper.RandTime(TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(275)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 153595 - Comet Storm (launch)
|
||||
class spell_mage_comet_storm : SpellScript
|
||||
{
|
||||
@@ -466,13 +444,32 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
void EffectHit(uint effIndex)
|
||||
{
|
||||
GetCaster().m_Events.AddEventAtOffset(new CometStormEvent(GetCaster(), GetSpell().m_castId, GetHitDest()), RandomHelper.RandTime(TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(275)));
|
||||
GetCaster().m_Events.AddEventAtOffset(new CometStormEvent(GetCaster(), GetSpell().m_castId, GetHitDest()), RandomHelper.RandTime(TimeSpan.FromSeconds(100), TimeSpan.FromSeconds(275)));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new(EffectHit, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
|
||||
class CometStormEvent(Unit caster, ObjectGuid originalCastId, Position dest) : BasicEvent
|
||||
{
|
||||
byte _count;
|
||||
|
||||
public override bool Execute(ulong time, uint diff)
|
||||
{
|
||||
Position destPosition = new(dest.GetPositionX() + RandomHelper.FRand(-3.0f, 3.0f), dest.GetPositionY() + RandomHelper.FRand(-3.0f, 3.0f), dest.GetPositionZ());
|
||||
caster.CastSpell(destPosition, SpellIds.CometStormVisual,
|
||||
new CastSpellExtraArgs(TriggerCastFlags.IgnoreCastInProgress).SetOriginalCastId(originalCastId));
|
||||
++_count;
|
||||
|
||||
if (_count >= 7)
|
||||
return true;
|
||||
|
||||
caster.m_Events.AddEvent(this, TimeSpan.FromSeconds(time) + RandomHelper.RandTime(TimeSpan.FromSeconds(100), TimeSpan.FromSeconds(275)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 228601 - Comet Storm (damage)
|
||||
@@ -570,7 +567,8 @@ namespace Scripts.Spells.Mage
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Blink, SpellIds.Shimmer, SpellIds.Slow) && ValidateSpellEffect((SpellIds.EtherealBlink, 3));
|
||||
return ValidateSpellInfo(SpellIds.Blink, SpellIds.Shimmer, SpellIds.Slow)
|
||||
&& ValidateSpellEffect((SpellIds.EtherealBlink, 3));
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
@@ -596,7 +594,7 @@ namespace Scripts.Spells.Mage
|
||||
if (reduction > TimeSpan.FromSeconds(cap.GetAmount()))
|
||||
reduction = TimeSpan.FromSeconds(cap.GetAmount());
|
||||
|
||||
if (reduction > TimeSpan.FromSeconds(0))
|
||||
if (reduction > TimeSpan.Zero)
|
||||
{
|
||||
GetCaster().GetSpellHistory().ModifyCooldown(SpellIds.Blink, -reduction);
|
||||
GetCaster().GetSpellHistory().ModifyCooldown(SpellIds.Shimmer, -reduction);
|
||||
@@ -610,7 +608,7 @@ namespace Scripts.Spells.Mage
|
||||
if (effectivenessEffect != null)
|
||||
effectivenessPct = effectivenessEffect.GetAmount();
|
||||
|
||||
int slowPct = SpellMgr.GetSpellInfo(SpellIds.Slow, Difficulty.None).GetEffect(0).CalcBaseValue(GetCaster(), GetHitUnit(), 0, -1);
|
||||
int slowPct = Global.SpellMgr.GetSpellInfo(SpellIds.Slow, Difficulty.None).GetEffect(0).CalcBaseValue(GetCaster(), GetHitUnit(), 0, -1);
|
||||
MathFunctions.ApplyPct(ref slowPct, effectivenessPct);
|
||||
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.Slow, new CastSpellExtraArgs(GetSpell())
|
||||
@@ -697,7 +695,8 @@ namespace Scripts.Spells.Mage
|
||||
void CalcCritChance(Unit victim, ref float critChance)
|
||||
{
|
||||
AuraEffect aurEff = GetCaster().GetAuraEffect(SpellIds.Firestarter, 0);
|
||||
if (aurEff != null && victim.GetHealthPct() >= aurEff.GetAmount())
|
||||
if (aurEff != null)
|
||||
if (victim.GetHealthPct() >= aurEff.GetAmount())
|
||||
critChance = 100.0f;
|
||||
}
|
||||
|
||||
@@ -717,8 +716,9 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
void CalcCritChance(AuraEffect aurEff, Unit victim, ref float critChance)
|
||||
{
|
||||
AuraEffect fireStarterEff = GetCaster().GetAuraEffect(SpellIds.Firestarter, 0);
|
||||
if (fireStarterEff != null && victim.GetHealthPct() >= aurEff.GetAmount())
|
||||
AuraEffect aurEff1 = GetCaster().GetAuraEffect(SpellIds.Firestarter, 0);
|
||||
if (aurEff1 != null)
|
||||
if (victim.GetHealthPct() >= aurEff1.GetAmount())
|
||||
critChance = 100.0f;
|
||||
}
|
||||
|
||||
@@ -728,20 +728,34 @@ namespace Scripts.Spells.Mage
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 108853 - Fire Blast
|
||||
class spell_mage_fire_blast : SpellScript
|
||||
{
|
||||
void CalcCritChance(Unit victim, ref float critChance)
|
||||
{
|
||||
critChance = 100.0f;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCalcCritChance.Add(new(CalcCritChance));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 205029 - Flame On
|
||||
class spell_mage_flame_on : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FireBlast)
|
||||
&& CliDB.SpellCategoryStorage.HasRecord(SpellMgr.GetSpellInfo(SpellIds.FireBlast, Difficulty.None).ChargeCategoryId)
|
||||
&& CliDB.SpellCategoryStorage.HasRecord(Global.SpellMgr.GetSpellInfo(SpellIds.FireBlast, Difficulty.None).ChargeCategoryId)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 2));
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
canBeRecalculated = false;
|
||||
amount = -(int)MathFunctions.GetPctOf(GetEffectInfo(2).CalcValue() * Time.InMilliseconds, CliDB.SpellCategoryStorage.LookupByKey(SpellMgr.GetSpellInfo(SpellIds.FireBlast, Difficulty.None).ChargeCategoryId).ChargeRecoveryTime);
|
||||
amount = (int)(-MathFunctions.GetPctOf(GetEffectInfo(2).CalcValue() * Time.InMilliseconds, CliDB.SpellCategoryStorage.LookupByKey(Global.SpellMgr.GetSpellInfo(SpellIds.FireBlast, Difficulty.None).ChargeCategoryId).ChargeRecoveryTime));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -750,37 +764,75 @@ namespace Scripts.Spells.Mage
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 205037 - Flame Patch (attached to 2120 - Flamestrike)
|
||||
class spell_mage_flame_patch : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FlamePatchTalent, SpellIds.FlamePatchAreatrigger);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.FlamePatchTalent);
|
||||
}
|
||||
|
||||
void HandleFlamePatch()
|
||||
{
|
||||
GetCaster().CastSpell(GetExplTargetDest().GetPosition(), SpellIds.FlamePatchAreatrigger, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new(HandleFlamePatch));
|
||||
}
|
||||
}
|
||||
|
||||
// 205470 - Flame Patch
|
||||
[Script] // Id - 6122
|
||||
class at_mage_flame_patch(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
TaskScheduler _scheduler = new();
|
||||
|
||||
public override void OnCreate(Spell creatingSpell)
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
caster.CastSpell(at.GetPosition(), SpellIds.FlamePatchDamage, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
|
||||
task.Repeat();
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnUpdate(uint diff)
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 44614 - Flurry
|
||||
class spell_mage_flurry : SpellScript
|
||||
{
|
||||
class FlurryEvent : BasicEvent
|
||||
class FlurryEvent(Unit caster, ObjectGuid target, ObjectGuid originalCastId, int count) : BasicEvent
|
||||
{
|
||||
Unit _caster;
|
||||
ObjectGuid _target;
|
||||
ObjectGuid _originalCastId;
|
||||
int _count;
|
||||
|
||||
public FlurryEvent(Unit caster, ObjectGuid target, ObjectGuid originalCastId, int count)
|
||||
{
|
||||
_caster = caster;
|
||||
_target = target;
|
||||
_originalCastId = originalCastId;
|
||||
_count = count;
|
||||
}
|
||||
|
||||
public override bool Execute(ulong time, uint diff)
|
||||
{
|
||||
Unit target = ObjAccessor.GetUnit(_caster, _target);
|
||||
|
||||
if (target == null)
|
||||
Unit target1 = Global.ObjAccessor.GetUnit(caster, target);
|
||||
if (target1 == null)
|
||||
return true;
|
||||
|
||||
_caster.CastSpell(target, SpellIds.FlurryDamage, new CastSpellExtraArgs(TriggerCastFlags.IgnoreCastInProgress).SetOriginalCastId(_originalCastId));
|
||||
caster.CastSpell(target1, SpellIds.FlurryDamage, new CastSpellExtraArgs(TriggerCastFlags.IgnoreCastInProgress).SetOriginalCastId(originalCastId));
|
||||
|
||||
if (--_count == 0)
|
||||
if (--count == 0)
|
||||
return true;
|
||||
|
||||
_caster.m_Events.AddEvent(this, TimeSpan.FromMilliseconds(time) + RandomHelper.RandTime(TimeSpan.FromMilliseconds(300), TimeSpan.FromMilliseconds(400)));
|
||||
caster.m_Events.AddEvent(this, TimeSpan.FromSeconds(time) + RandomHelper.RandTime(TimeSpan.FromSeconds(300), TimeSpan.FromSeconds(400)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -792,7 +844,7 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
void EffectHit(uint effIndex)
|
||||
{
|
||||
GetCaster().m_Events.AddEventAtOffset(new FlurryEvent(GetCaster(), GetHitUnit().GetGUID(), GetSpell().m_castId, GetEffectValue() - 1), RandomHelper.RandTime(TimeSpan.FromMilliseconds(300), TimeSpan.FromMilliseconds(400)));
|
||||
GetCaster().m_Events.AddEventAtOffset(new FlurryEvent(GetCaster(), GetHitUnit().GetGUID(), GetSpell().m_castId, GetEffectValue() - 1), RandomHelper.RandTime(TimeSpan.FromSeconds(300), TimeSpan.FromSeconds(400)));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -871,9 +923,10 @@ namespace Scripts.Spells.Mage
|
||||
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
canBeRecalculated = false;
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null)
|
||||
amount += (int)(caster.SpellBaseHealingBonusDone(GetSpellInfo().GetSchoolMask()) * 10.0f);
|
||||
amount = (int)MathFunctions.CalculatePct(GetUnitOwner().GetMaxHealth(), GetEffectInfo(1).CalcValue());
|
||||
Player player = GetUnitOwner().ToPlayer();
|
||||
if (player != null)
|
||||
MathFunctions.AddPct(ref amount, player.GetRatingBonusValue(CombatRating.VersatilityDamageDone) + player.GetTotalAuraModifier(AuraType.ModVersatility));
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
@@ -923,8 +976,6 @@ namespace Scripts.Spells.Mage
|
||||
[Script] // Ice Lance - 30455
|
||||
class spell_mage_ice_lance : SpellScript
|
||||
{
|
||||
List<ObjectGuid> _orderedTargets = new();
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.IceLanceTrigger, SpellIds.ThermalVoid, SpellIds.IcyVeins, SpellIds.ChainReactionDummy, SpellIds.ChainReaction, SpellIds.FingersOfFrost);
|
||||
@@ -940,22 +991,19 @@ namespace Scripts.Spells.Mage
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetHitUnit();
|
||||
|
||||
var index = _orderedTargets.IndexOf(target.GetGUID());
|
||||
int index = _orderedTargets.IndexOf(target.GetGUID());
|
||||
|
||||
if (index == 0 // only primary target triggers these benefits
|
||||
&& target.HasAuraState(AuraStateType.Frozen, GetSpellInfo(), caster))
|
||||
{
|
||||
// Thermal Void
|
||||
Aura thermalVoid = caster.GetAura(SpellIds.ThermalVoid);
|
||||
if (thermalVoid != null)
|
||||
{
|
||||
if (!thermalVoid.GetSpellInfo().GetEffects().Empty())
|
||||
if (thermalVoid != null && !thermalVoid.GetSpellInfo().GetEffects().Empty())
|
||||
{
|
||||
Aura icyVeins = caster.GetAura(SpellIds.IcyVeins);
|
||||
if (icyVeins != null)
|
||||
icyVeins.SetDuration(icyVeins.GetDuration() + thermalVoid.GetSpellInfo().GetEffect(0).CalcValue(caster) * Time.InMilliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
// Chain Reaction
|
||||
if (caster.HasAura(SpellIds.ChainReactionDummy))
|
||||
@@ -963,7 +1011,8 @@ namespace Scripts.Spells.Mage
|
||||
}
|
||||
|
||||
// put target index for chain value multiplier into 1 base points, otherwise triggered spell doesn't know which damage multiplier to apply
|
||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||
CastSpellExtraArgs args = new();
|
||||
args.TriggerFlags = TriggerCastFlags.FullMask;
|
||||
args.AddSpellMod(SpellValueMod.BasePoint1, index);
|
||||
caster.CastSpell(target, SpellIds.IceLanceTrigger, args);
|
||||
}
|
||||
@@ -973,6 +1022,8 @@ namespace Scripts.Spells.Mage
|
||||
OnEffectLaunchTarget.Add(new(IndexTarget, 0, SpellEffectName.ScriptEffect));
|
||||
OnEffectHitTarget.Add(new(HandleOnHit, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
|
||||
List<ObjectGuid> _orderedTargets;
|
||||
}
|
||||
|
||||
[Script] // 228598 - Ice Lance
|
||||
@@ -984,7 +1035,7 @@ namespace Scripts.Spells.Mage
|
||||
if ((spellValue.CustomBasePointsMask & (1 << 1)) != 0)
|
||||
{
|
||||
int originalDamage = GetHitDamage();
|
||||
float targetIndex = (float)(spellValue.EffectBasePoints[1]);
|
||||
float targetIndex = (float)spellValue.EffectBasePoints[1];
|
||||
float multiplier = MathF.Pow(GetEffectInfo().CalcDamageMultiplier(GetCaster(), GetSpell()), targetIndex);
|
||||
SetHitDamage((int)(originalDamage * multiplier));
|
||||
}
|
||||
@@ -1013,7 +1064,7 @@ namespace Scripts.Spells.Mage
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
SpellInfo igniteDot = SpellMgr.GetSpellInfo(SpellIds.Ignite, GetCastDifficulty());
|
||||
SpellInfo igniteDot = Global.SpellMgr.GetSpellInfo(SpellIds.Ignite, GetCastDifficulty());
|
||||
int pct = aurEff.GetAmount();
|
||||
|
||||
Cypher.Assert(igniteDot.GetMaxTicks() > 0);
|
||||
@@ -1052,10 +1103,71 @@ namespace Scripts.Spells.Mage
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 383967 - Improved Combustion (attached to 190319 - Combustion)
|
||||
class spell_mage_improved_combustion : AuraScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return GetUnitOwner().HasAura(SpellIds.ImprovedCombustion);
|
||||
}
|
||||
|
||||
void CalcAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
AuraEffect amountHolder = GetEffect(2);
|
||||
if (amountHolder != null)
|
||||
{
|
||||
int critRating = (int)GetUnitOwner().ToPlayer().m_activePlayerData.CombatRatings[(int)CombatRating.CritSpell];
|
||||
amount = MathFunctions.CalculatePct(critRating, amountHolder.GetAmount());
|
||||
}
|
||||
}
|
||||
|
||||
void UpdatePeriodic(AuraEffect aurEff)
|
||||
{
|
||||
AuraEffect bonus = GetEffect(1);
|
||||
if (bonus != null)
|
||||
bonus.RecalculateAmount(aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoEffectCalcAmount.Add(new(CalcAmount, 1, AuraType.ModRating));
|
||||
OnEffectPeriodic.Add(new(UpdatePeriodic, 2, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 383604 - Improved Scorch
|
||||
class spell_mage_improved_scorch : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ImprovedScorch);
|
||||
}
|
||||
|
||||
static bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetProcTarget().HealthBelowPct(aurEff.GetAmount());
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetActionTarget(), SpellIds.ImprovedScorch, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.Dummy));
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 1463 - Incanter's Flow
|
||||
class spell_mage_incanters_flow : AuraScript
|
||||
{
|
||||
int modifier = 1;
|
||||
sbyte modifier = 1;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -1162,6 +1274,85 @@ namespace Scripts.Spells.Mage
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 153561 - Meteor
|
||||
class spell_mage_meteor : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MeteorAreatrigger);
|
||||
}
|
||||
|
||||
void EffectHit(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitDest(), SpellIds.MeteorAreatrigger, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHit.Add(new(EffectHit, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
// 177345 - Meteor
|
||||
[Script] // Id - 3467
|
||||
class at_mage_meteor(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
public override void OnRemove()
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
caster.CastSpell(at.GetPosition(), SpellIds.MeteorMissile);
|
||||
}
|
||||
}
|
||||
|
||||
// 175396 - Meteor Burn
|
||||
[Script] // Id - 1712
|
||||
class at_mage_meteor_burn(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
if (caster.IsValidAttackTarget(unit))
|
||||
caster.CastSpell(unit, SpellIds.MeteorBurnDamage, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
|
||||
public override void OnUnitExit(Unit unit)
|
||||
{
|
||||
unit.RemoveAurasDueToSpell(SpellIds.MeteorBurnDamage, at.GetCasterGUID());
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 457803 - Molten Fury
|
||||
class spell_mage_molten_fury : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MoltenFury);
|
||||
}
|
||||
|
||||
static void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
if (!eventInfo.GetActionTarget().HealthAbovePct(aurEff.GetAmount()))
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetActionTarget(), SpellIds.MoltenFury, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff
|
||||
});
|
||||
else
|
||||
eventInfo.GetActionTarget().RemoveAurasDueToSpell(SpellIds.MoltenFury, eventInfo.GetActor().GetGUID());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
/// @todo move out of here and rename - not a mage spell
|
||||
[Script] // 32826 - Polymorph (Visual)
|
||||
class spell_mage_polymorph_visual : SpellScript
|
||||
@@ -1169,14 +1360,14 @@ namespace Scripts.Spells.Mage
|
||||
const uint NpcAurosalia = 18744;
|
||||
|
||||
uint[] PolymorhForms =
|
||||
{
|
||||
[
|
||||
SpellIds.SquirrelForm,
|
||||
SpellIds.GiraffeForm,
|
||||
SpellIds.SerpentForm,
|
||||
SpellIds.DragonhawkForm,
|
||||
SpellIds.WorgenForm,
|
||||
SpellIds.SheepForm
|
||||
};
|
||||
];
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -1187,7 +1378,7 @@ namespace Scripts.Spells.Mage
|
||||
{
|
||||
Unit target = GetCaster().FindNearestCreature(NpcAurosalia, 30.0f);
|
||||
if (target != null)
|
||||
if (target.GetTypeId() == TypeId.Unit)
|
||||
if (target.IsTypeId(TypeId.Unit))
|
||||
target.CastSpell(target, PolymorhForms[RandomHelper.IRand(0, 5)], true);
|
||||
}
|
||||
|
||||
@@ -1228,6 +1419,11 @@ namespace Scripts.Spells.Mage
|
||||
return ValidateSpellInfo(SpellIds.RadiantSparkProcBlocker);
|
||||
}
|
||||
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
return !procInfo.GetProcTarget().HasAura(SpellIds.RadiantSparkProcBlocker, GetCasterGUID());
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
Aura vulnerability = procInfo.GetProcTarget().GetAura(aurEff.GetSpellEffectInfo().TriggerSpell, GetCasterGUID());
|
||||
@@ -1267,7 +1463,7 @@ namespace Scripts.Spells.Mage
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_mage_ray_of_frost_AuraScript : AuraScript
|
||||
class spell_mage_ray_of_frost_aura : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -1301,7 +1497,7 @@ namespace Scripts.Spells.Mage
|
||||
[Script] // 136511 - Ring of Frost
|
||||
class spell_mage_ring_of_frost : AuraScript
|
||||
{
|
||||
ObjectGuid _ringOfFrostGUID;
|
||||
ObjectGuid _ringOfFrostGuid;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -1318,8 +1514,7 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
void Apply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
List<TempSummon> minions = new();
|
||||
GetTarget().GetAllMinionsByEntry(minions, (uint)SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffect(0).MiscValue);
|
||||
List<TempSummon> minions = GetTarget().GetAllMinionsByEntry((uint)Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffect(0).MiscValue);
|
||||
|
||||
// Get the last summoned RoF, save it and despawn older ones
|
||||
foreach (TempSummon summon in minions)
|
||||
@@ -1330,13 +1525,13 @@ namespace Scripts.Spells.Mage
|
||||
if (summon.GetTimer() > ringOfFrost.GetTimer())
|
||||
{
|
||||
ringOfFrost.DespawnOrUnsummon();
|
||||
_ringOfFrostGUID = summon.GetGUID();
|
||||
_ringOfFrostGuid = summon.GetGUID();
|
||||
}
|
||||
else
|
||||
summon.DespawnOrUnsummon();
|
||||
}
|
||||
else
|
||||
_ringOfFrostGUID = summon.GetGUID();
|
||||
_ringOfFrostGuid = summon.GetGUID();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1348,7 +1543,7 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
TempSummon GetRingOfFrostMinion()
|
||||
{
|
||||
Creature creature = ObjectAccessor.GetCreature(GetOwner(), _ringOfFrostGUID);
|
||||
Creature creature = ObjectAccessor.GetCreature(GetOwner(), _ringOfFrostGuid);
|
||||
if (creature != null)
|
||||
return creature.ToTempSummon();
|
||||
return null;
|
||||
@@ -1367,7 +1562,7 @@ namespace Scripts.Spells.Mage
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
WorldLocation dest = GetExplTargetDest();
|
||||
float outRadius = SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffect(0).CalcRadius(null, SpellTargetIndex.TargetB);
|
||||
float outRadius = Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffect(0).CalcRadius(null, SpellTargetIndex.TargetB);
|
||||
float inRadius = 6.5f;
|
||||
|
||||
targets.RemoveAll(target =>
|
||||
@@ -1406,6 +1601,93 @@ namespace Scripts.Spells.Mage
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 450746 - Scald (attached to 2948 - Scorch)
|
||||
class spell_mage_scald : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Scald)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 1));
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.Scald);
|
||||
}
|
||||
|
||||
void CalculateDamage(SpellEffectInfo spellEffectInfo, Unit victim, ref int damage, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
if (!victim.HealthBelowPct(GetEffectInfo(1).CalcValue(GetCaster())))
|
||||
return;
|
||||
|
||||
AuraEffect aurEff = GetCaster().GetAuraEffect(SpellIds.Scald, 0);
|
||||
if (aurEff != null)
|
||||
MathFunctions.AddPct(ref pctMod, aurEff.GetAmount());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
CalcDamage.Add(new(CalculateDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 2948 - Scorch
|
||||
class spell_mage_scorch : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FreneticSpeed);
|
||||
}
|
||||
|
||||
void CalcCritChance(Unit victim, ref float critChance)
|
||||
{
|
||||
if (victim.GetHealthPct() < GetEffectInfo(1).CalcValue(GetCaster()))
|
||||
critChance = 100.0f;
|
||||
}
|
||||
|
||||
void HandleFreneticSpeed(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (GetHitUnit().GetHealthPct() < GetEffectInfo(1).CalcValue(GetCaster()))
|
||||
caster.CastSpell(caster, SpellIds.FreneticSpeed, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCalcCritChance.Add(new(CalcCritChance));
|
||||
OnEffectHitTarget.Add(new(HandleFreneticSpeed, 0, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 451875 - Spontaneous Combustion (attached to 190319 - Combustion)
|
||||
class spell_mage_spontaneous_combustion : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SpontaneousCombustion, SpellIds.FireBlast, SpellIds.PhoenixFlames);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.SpontaneousCombustion);
|
||||
}
|
||||
|
||||
void HandleCharges()
|
||||
{
|
||||
GetCaster().GetSpellHistory().ResetCharges(Global.SpellMgr.GetSpellInfo(SpellIds.FireBlast, Difficulty.None).ChargeCategoryId);
|
||||
GetCaster().GetSpellHistory().ResetCharges(Global.SpellMgr.GetSpellInfo(SpellIds.PhoenixFlames, Difficulty.None).ChargeCategoryId);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new(HandleCharges));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 157980 - Supernova
|
||||
class spell_mage_supernova : SpellScript
|
||||
{
|
||||
@@ -1425,8 +1707,35 @@ namespace Scripts.Spells.Mage
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 382289 - Tempest Barrier
|
||||
class spell_mage_tempest_barrier : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.TempestBarrierAbsorb);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Unit target = GetTarget();
|
||||
int amount = (int)MathFunctions.CalculatePct(target.GetMaxHealth(), aurEff.GetAmount());
|
||||
target.CastSpell(target, SpellIds.TempestBarrierAbsorb, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff,
|
||||
SpellValueOverrides = { new(SpellValueMod.BasePoint0, amount) }
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleEffectProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 210824 - Touch of the Magi (Aura)
|
||||
class spell_mage_touch_of_the_magi : AuraScript
|
||||
class spell_mage_touch_of_the_magi_aura : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -1442,7 +1751,7 @@ namespace Scripts.Spells.Mage
|
||||
{
|
||||
uint extra = MathFunctions.CalculatePct(damageInfo.GetDamage(), 25);
|
||||
if (extra > 0)
|
||||
aurEff.ChangeAmount(aurEff.GetAmount() + (int)extra);
|
||||
aurEff.ChangeAmount((int)(aurEff.GetAmount() + extra));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1487,4 +1796,3 @@ namespace Scripts.Spells.Mage
|
||||
AfterHit.Add(new(HandleImprovedFreeze));
|
||||
}
|
||||
}
|
||||
}
|
||||
+301
-52
@@ -1,29 +1,42 @@
|
||||
// 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.
|
||||
// Licensed under the Gnu General Public License. See License file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Movement;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using static Global;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.Spells.Monk;
|
||||
|
||||
namespace Scripts.Spells.Monk
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint BurstOfLifeTalent = 399226;
|
||||
public const uint BurstOfLifeHeal = 399230;
|
||||
public const uint CalmingCoalescence = 388220;
|
||||
public const uint CombatConditioning = 128595;
|
||||
public const uint CracklingJadeLightningChannel = 117952;
|
||||
public const uint CracklingJadeLightningChiProc = 123333;
|
||||
public const uint CracklingJadeLightningKnockback = 117962;
|
||||
public const uint CracklingJadeLightningKnockbackCd = 117953;
|
||||
public const uint EnvelopingMist = 124682;
|
||||
public const uint JadeWalk = 450552;
|
||||
public const uint MistsOfLife = 388548;
|
||||
public const uint MortalWounds = 115804;
|
||||
public const uint PowerStrikeProc = 129914;
|
||||
public const uint PowerStrikeEnergize = 121283;
|
||||
public const uint PressurePoints = 450432;
|
||||
public const uint ProvokeSingleTarget = 116189;
|
||||
public const uint ProvokeAoe = 118635;
|
||||
public const uint NoFeatherFall = 79636;
|
||||
public const uint OpenPalmStrikesTalent = 392970;
|
||||
public const uint RenewingMist = 119611;
|
||||
public const uint RollBackward = 109131;
|
||||
public const uint RollForward = 107427;
|
||||
public const uint SaveThemAllHealBonus = 390105;
|
||||
public const uint SongOfChiJiStun = 198909;
|
||||
public const uint SoothingMist = 115175;
|
||||
public const uint StanceOfTheSpiritedCrane = 154436;
|
||||
public const uint StaggerDamageAura = 124255;
|
||||
@@ -31,22 +44,17 @@ namespace Scripts.Spells.Monk
|
||||
public const uint StaggerLight = 124275;
|
||||
public const uint StaggerModerate = 124274;
|
||||
public const uint SurgingMistHeal = 116995;
|
||||
}
|
||||
|
||||
struct MonkUtility
|
||||
{
|
||||
// Utility for stagger scripts
|
||||
public static Aura FindExistingStaggerEffect(Unit unit)
|
||||
{
|
||||
Aura auraLight = unit.GetAura(SpellIds.StaggerLight);
|
||||
Aura auraLight = unit.GetAura(StaggerLight);
|
||||
if (auraLight != null)
|
||||
return auraLight;
|
||||
|
||||
Aura auraModerate = unit.GetAura(SpellIds.StaggerModerate);
|
||||
Aura auraModerate = unit.GetAura(StaggerModerate);
|
||||
if (auraModerate != null)
|
||||
return auraModerate;
|
||||
|
||||
Aura auraHeavy = unit.GetAura(SpellIds.StaggerHeavy);
|
||||
Aura auraHeavy = unit.GetAura(StaggerHeavy);
|
||||
if (auraHeavy != null)
|
||||
return auraHeavy;
|
||||
|
||||
@@ -54,6 +62,62 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 399226 - Burst of Life (attached to 116849 - Life Cocoon)
|
||||
class spell_monk_burst_of_life : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BurstOfLifeHeal)
|
||||
&& ValidateSpellEffect((SpellIds.BurstOfLifeTalent, 0));
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
return caster != null && caster.HasAuraEffect(SpellIds.BurstOfLifeTalent, 0);
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
AuraRemoveMode removeMode = GetTargetApplication().GetRemoveMode();
|
||||
if (removeMode != AuraRemoveMode.Expire && (removeMode != AuraRemoveMode.EnemySpell || aurEff.GetAmount() != 0))
|
||||
return;
|
||||
|
||||
Unit caster = GetCaster();
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
AuraEffect burstOfLife = caster.GetAuraEffect(SpellIds.BurstOfLifeTalent, 0);
|
||||
if (burstOfLife == null)
|
||||
return;
|
||||
|
||||
caster.CastSpell(GetTarget(), SpellIds.BurstOfLifeHeal, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
SpellValueOverrides = [new(SpellValueMod.MaxTargets, burstOfLife.GetAmount())]
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.SchoolAbsorb, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 399230 - Burst of Life
|
||||
class spell_monk_burst_of_life_heal : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
SelectRandomInjuredTargets(targets, GetSpellValue().MaxAffectedTargets, true, GetExplTargetUnit());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new(FilterTargets, 1, Targets.UnitDestAreaAlly));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 117952 - Crackling Jade Lightning
|
||||
class spell_monk_crackling_jade_lightning : AuraScript
|
||||
{
|
||||
@@ -77,13 +141,11 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
|
||||
[Script] // 117959 - Crackling Jade Lightning
|
||||
class spell_monk_crackling_jade_lightning_knockback_proc : AuraScript
|
||||
class spell_monk_crackling_jade_lightning_knockback_proc_aura : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CracklingJadeLightningKnockback,
|
||||
SpellIds.CracklingJadeLightningKnockbackCd
|
||||
);
|
||||
return ValidateSpellInfo(SpellIds.CracklingJadeLightningKnockback, SpellIds.CracklingJadeLightningKnockbackCd);
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
@@ -114,6 +176,35 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 450553 - Jade Walk
|
||||
class spell_monk_jade_walk : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.JadeWalk);
|
||||
}
|
||||
|
||||
void HandlePeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (!target.IsInCombat())
|
||||
{
|
||||
target.CastSpell(target, SpellIds.JadeWalk, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff,
|
||||
});
|
||||
}
|
||||
else
|
||||
target.RemoveAurasDueToSpell(SpellIds.JadeWalk);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new(HandlePeriodicTick, 0, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 116849 - Life Cocoon
|
||||
class spell_monk_life_cocoon : SpellScript
|
||||
{
|
||||
@@ -136,7 +227,7 @@ namespace Scripts.Spells.Monk
|
||||
calmingCoalescence.GetBase().Remove();
|
||||
}
|
||||
|
||||
GetSpell().SetSpellValue(new((int)SpellValueMod.BasePoint0, absorb));
|
||||
GetSpell().SetSpellValue(new(SpellValueMod.BasePoint0, absorb));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -145,6 +236,38 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 388548 - Mists of Life (attached to 116849 - Life Cocoon)
|
||||
class spell_monk_mists_of_life : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.MistsOfLife, SpellIds.RenewingMist, SpellIds.EnvelopingMist);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAuraEffect(SpellIds.MistsOfLife, 0);
|
||||
}
|
||||
|
||||
void HandleEffectApply(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetHitUnit();
|
||||
|
||||
CastSpellExtraArgs args = new();
|
||||
args.SetTriggerFlags(TriggerCastFlags.IgnoreGCD | TriggerCastFlags.IgnorePowerCost | TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.IgnoreCastTime | TriggerCastFlags.DontReportCastError);
|
||||
args.SetTriggeringSpell(GetSpell());
|
||||
|
||||
caster.CastSpell(target, SpellIds.RenewingMist, args);
|
||||
caster.CastSpell(target, SpellIds.EnvelopingMist, args);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleEffectApply, 0, SpellEffectName.ApplyAura));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 392972 - Open Palm Strikes
|
||||
class spell_monk_open_palm_strikes : AuraScript
|
||||
{
|
||||
@@ -203,6 +326,32 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 115078 - Paralysis
|
||||
class spell_monk_pressure_points : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.PressurePoints)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 2))
|
||||
&& spellInfo.GetEffect(2).IsEffect(SpellEffectName.Dispel);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return !GetCaster().HasAura(SpellIds.PressurePoints);
|
||||
}
|
||||
|
||||
static void PreventDispel(ref WorldObject target)
|
||||
{
|
||||
target = null;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectTargetSelect.Add(new(PreventDispel, 2, Targets.UnitTargetEnemy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 115546 - Provoke
|
||||
class spell_monk_provoke : SpellScript
|
||||
{
|
||||
@@ -210,18 +359,16 @@ namespace Scripts.Spells.Monk
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
if (!spellInfo.GetExplicitTargetMask().HasFlag(SpellCastTargetFlags.UnitMask)) // ensure GetExplTargetUnit() will return something meaningful during CheckCast
|
||||
if ((spellInfo.GetExplicitTargetMask() & SpellCastTargetFlags.UnitMask) == 0) // ensure GetExplTargetUnit() will return something meaningful during CheckCast
|
||||
return false;
|
||||
return ValidateSpellInfo(SpellIds.ProvokeSingleTarget,
|
||||
SpellIds.ProvokeAoe
|
||||
);
|
||||
return ValidateSpellInfo(SpellIds.ProvokeSingleTarget, SpellIds.ProvokeAoe);
|
||||
}
|
||||
|
||||
SpellCastResult CheckExplicitTarget()
|
||||
{
|
||||
if (GetExplTargetUnit().GetEntry() != BlackOxStatusEntry)
|
||||
{
|
||||
SpellInfo singleTarget = SpellMgr.GetSpellInfo(SpellIds.ProvokeSingleTarget, GetCastDifficulty());
|
||||
SpellInfo singleTarget = Global.SpellMgr.GetSpellInfo(SpellIds.ProvokeSingleTarget, GetCastDifficulty());
|
||||
SpellCastResult singleTargetExplicitResult = singleTarget.CheckExplicitTarget(GetCaster(), GetExplTargetUnit());
|
||||
if (singleTargetExplicitResult != SpellCastResult.SpellCastOk)
|
||||
return singleTargetExplicitResult;
|
||||
@@ -248,6 +395,34 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 107428 - Rising Sun Kick
|
||||
class spell_monk_rising_sun_kick : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.CombatConditioning, SpellIds.MortalWounds);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.CombatConditioning);
|
||||
}
|
||||
|
||||
void HandleOnHit(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.MortalWounds, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectLaunchTarget.Add(new(HandleOnHit, 0, SpellEffectName.TriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 109132 - Roll
|
||||
class spell_monk_roll : SpellScript
|
||||
{
|
||||
@@ -265,8 +440,7 @@ namespace Scripts.Spells.Monk
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), GetCaster().HasUnitMovementFlag(MovementFlag.Backward) ? SpellIds.RollBackward : SpellIds.RollForward,
|
||||
TriggerCastFlags.IgnoreCastInProgress);
|
||||
GetCaster().CastSpell(GetCaster(), GetCaster().HasUnitMovementFlag(MovementFlag.Backward) ? SpellIds.RollBackward : SpellIds.RollForward, TriggerCastFlags.IgnoreCastInProgress);
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.NoFeatherFall, true);
|
||||
}
|
||||
|
||||
@@ -279,7 +453,7 @@ namespace Scripts.Spells.Monk
|
||||
|
||||
// 107427 - Roll
|
||||
[Script] // 109131 - Roll (backward)
|
||||
class spell_monk_roll_AuraScript : AuraScript
|
||||
class spell_monk_roll_aura : AuraScript
|
||||
{
|
||||
void CalcMovementAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||
{
|
||||
@@ -315,6 +489,66 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 389579 - Save Them All
|
||||
class spell_monk_save_them_all : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.SaveThemAllHealBonus)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 2));
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetActionTarget().HealthBelowPct(GetEffectInfo(2).CalcValue(eventInfo.GetActor()));
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.SaveThemAllHealBonus, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
DoCheckProc.Add(new(CheckProc));
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 198898 - Song of Chi-Ji
|
||||
class at_monk_song_of_chi_ji(AreaTrigger areatrigger) : AreaTriggerAI(areatrigger)
|
||||
{
|
||||
public override void OnInitialize()
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(at.GetSpellId(), Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
Position destPos = at.GetFirstCollisionPosition(spellInfo.GetMaxRange(false, caster), 0.0f);
|
||||
PathGenerator path = new(at);
|
||||
|
||||
path.CalculatePath(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ(), false);
|
||||
|
||||
at.InitSplines(path.GetPath());
|
||||
}
|
||||
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
if (caster.IsValidAttackTarget(unit))
|
||||
caster.CastSpell(unit, SpellIds.SongOfChiJiStun, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 115069 - Stagger
|
||||
class spell_monk_stagger : AuraScript
|
||||
{
|
||||
@@ -334,17 +568,18 @@ namespace Scripts.Spells.Monk
|
||||
if (effect == null)
|
||||
return;
|
||||
|
||||
Absorb(dmgInfo, (float)(effect.GetAmount()) / 100.0f);
|
||||
Absorb(dmgInfo, (float)effect.GetAmount() / 100.0f);
|
||||
}
|
||||
|
||||
void Absorb(DamageInfo dmgInfo, float multiplier)
|
||||
{
|
||||
// Prevent default action (which would Remove the aura)
|
||||
// Prevent default action (which would remove the aura)
|
||||
PreventDefaultAction();
|
||||
|
||||
// make sure damage doesn't come from stagger damage spell SpellIds.StaggerDamageAura
|
||||
// make sure damage doesn't come from stagger damage spell StaggerDamageAura
|
||||
SpellInfo dmgSpellInfo = dmgInfo.GetSpellInfo();
|
||||
if (dmgSpellInfo != null && dmgSpellInfo.Id == SpellIds.StaggerDamageAura)
|
||||
if (dmgSpellInfo != null)
|
||||
if (dmgSpellInfo.Id == SpellIds.StaggerDamageAura)
|
||||
return;
|
||||
|
||||
AuraEffect effect = GetEffect(0);
|
||||
@@ -353,17 +588,19 @@ namespace Scripts.Spells.Monk
|
||||
|
||||
Unit target = GetTarget();
|
||||
float agility = target.GetStat(Stats.Agility);
|
||||
float baseAmount = MathFunctions.CalculatePct(agility, (float)(effect.GetAmount()));
|
||||
float K = DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, target.GetLevel(), -2, 0, target.GetClass(), 0);
|
||||
float base1 = MathFunctions.CalculatePct(agility, (float)effect.GetAmount());
|
||||
float K = Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, target.GetLevel(), -2, 0, target.GetClass(), 0);
|
||||
|
||||
float newAmount = (baseAmount / (baseAmount + K));
|
||||
float newAmount = (base1 / (base1 + K));
|
||||
newAmount *= multiplier;
|
||||
|
||||
// Absorb X percentage of the damage
|
||||
float absorbAmount = (float)(dmgInfo.GetDamage()) * newAmount;
|
||||
float absorbAmount = (float)dmgInfo.GetDamage() * newAmount;
|
||||
if (absorbAmount > 0)
|
||||
{
|
||||
dmgInfo.AbsorbDamage((uint)absorbAmount);
|
||||
uint tempAbsorb = (uint)absorbAmount;
|
||||
dmgInfo.AbsorbDamage(ref tempAbsorb);
|
||||
absorbAmount = tempAbsorb;
|
||||
|
||||
// Cast stagger and make it tick on each tick
|
||||
AddAndRefreshStagger(absorbAmount);
|
||||
@@ -379,7 +616,7 @@ namespace Scripts.Spells.Monk
|
||||
void AddAndRefreshStagger(float amount)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
Aura auraStagger = MonkUtility.FindExistingStaggerEffect(target);
|
||||
Aura auraStagger = SpellIds.FindExistingStaggerEffect(target);
|
||||
if (auraStagger != null)
|
||||
{
|
||||
AuraEffect effStaggerRemaining = auraStagger.GetEffect(1);
|
||||
@@ -406,13 +643,12 @@ namespace Scripts.Spells.Monk
|
||||
|
||||
uint GetStaggerSpellId(Unit unit, float amount)
|
||||
{
|
||||
float StaggerHeavy = 0.6f;
|
||||
float StaggerModerate = 0.3f;
|
||||
const float StaggerHeavy = 0.6f;
|
||||
const float StaggerModerate = 0.3f;
|
||||
|
||||
float staggerPct = amount / (float)(unit.GetMaxHealth());
|
||||
float staggerPct = amount / (float)unit.GetMaxHealth();
|
||||
return (staggerPct >= StaggerHeavy) ? SpellIds.StaggerHeavy :
|
||||
(staggerPct >= StaggerModerate) ? SpellIds.StaggerModerate :
|
||||
SpellIds.StaggerLight;
|
||||
(staggerPct >= StaggerModerate) ? SpellIds.StaggerModerate : SpellIds.StaggerLight;
|
||||
}
|
||||
|
||||
void AddNewStagger(Unit unit, uint staggerSpellId, float staggerAmount)
|
||||
@@ -422,8 +658,8 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 124255 - Stagger - SpellIds.StaggerDamageAura
|
||||
class spell_monk_stagger_damage : AuraScript
|
||||
[Script] // 124255 - Stagger - StaggerDamageAura
|
||||
class spell_monk_stagger_damage_aura : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -433,14 +669,14 @@ namespace Scripts.Spells.Monk
|
||||
void OnPeriodicDamage(AuraEffect aurEff)
|
||||
{
|
||||
// Update our light/medium/heavy stagger with the correct stagger amount left
|
||||
Aura auraStagger = MonkUtility.FindExistingStaggerEffect(GetTarget());
|
||||
Aura auraStagger = SpellIds.FindExistingStaggerEffect(GetTarget());
|
||||
if (auraStagger != null)
|
||||
{
|
||||
AuraEffect auraEff = auraStagger.GetEffect(1);
|
||||
if (auraEff != null)
|
||||
{
|
||||
float total = (float)(auraEff.GetAmount());
|
||||
float tickDamage = (float)(aurEff.GetAmount());
|
||||
float total = (float)auraEff.GetAmount();
|
||||
float tickDamage = (float)aurEff.GetAmount();
|
||||
auraEff.ChangeAmount((int)(total - tickDamage));
|
||||
}
|
||||
}
|
||||
@@ -452,11 +688,9 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 124273, 124274, 124275 - Light/Moderate/Heavy Stagger - SpellIds.StaggerLight / SpellIds.StaggerModerate / SpellIds.StaggerHeavy
|
||||
class spell_monk_stagger_debuff : AuraScript
|
||||
[Script] // 124273, 124274, 124275 - Light/Moderate/Heavy Stagger - StaggerLight / StaggerModerate / StaggerHeavy
|
||||
class spell_monk_stagger_debuff_aura : AuraScript
|
||||
{
|
||||
float _period;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.StaggerDamageAura) && ValidateSpellEffect((SpellIds.StaggerDamageAura, 0));
|
||||
@@ -464,15 +698,15 @@ namespace Scripts.Spells.Monk
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
_period = (float)(SpellMgr.GetSpellInfo(SpellIds.StaggerDamageAura, GetCastDifficulty()).GetEffect(0).ApplyAuraPeriod);
|
||||
_period = (float)Global.SpellMgr.GetSpellInfo(SpellIds.StaggerDamageAura, GetCastDifficulty()).GetEffect(0).ApplyAuraPeriod;
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnReapply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
// Calculate damage per tick
|
||||
float total = (float)(aurEff.GetAmount());
|
||||
float perTick = total * _period / (float)(GetDuration()); // should be same as GetMaxDuration() Todo: verify
|
||||
float total = (float)aurEff.GetAmount();
|
||||
float perTick = total * _period / (float)GetDuration(); // should be same as GetMaxDuration() Todo: verify
|
||||
|
||||
// Set amount on effect for tooltip
|
||||
AuraEffect effInfo = GetAura().GetEffect(0);
|
||||
@@ -498,6 +732,8 @@ namespace Scripts.Spells.Monk
|
||||
AfterEffectRemove.Add(new(OnRemove, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
|
||||
float _period = 0.0f;
|
||||
|
||||
void CastOrChangeTickDamage(float tickDamage)
|
||||
{
|
||||
Unit unit = GetTarget();
|
||||
@@ -516,4 +752,17 @@ namespace Scripts.Spells.Monk
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 116841 - Tiger's Lust
|
||||
class spell_monk_tigers_lust : SpellScript
|
||||
{
|
||||
void HandleRemoveImpairingAuras(uint effIndex)
|
||||
{
|
||||
GetHitUnit().RemoveMovementImpairingAuras(true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleRemoveImpairingAuras, 0, SpellEffectName.ApplyAura));
|
||||
}
|
||||
}
|
||||
|
||||
+399
-136
@@ -1,5 +1,5 @@
|
||||
// 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.
|
||||
// Licensed under the Gnu General Public License. See License file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
@@ -12,12 +12,12 @@ using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static Global;
|
||||
|
||||
namespace Scripts.Spells.Paladin
|
||||
{
|
||||
namespace Scripts.Spells.Paladin;
|
||||
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint AJustRewardHeal = 469413;
|
||||
public const uint ArdentDefenderHeal = 66235;
|
||||
public const uint ArtOfWarTriggered = 231843;
|
||||
public const uint AvengersShield = 31935;
|
||||
@@ -25,6 +25,8 @@ namespace Scripts.Spells.Paladin
|
||||
public const uint BeaconOfLight = 53563;
|
||||
public const uint BeaconOfLightHeal = 53652;
|
||||
public const uint BladeOfJustice = 184575;
|
||||
public const uint BladeOfVengeance = 403826;
|
||||
public const uint BlessingOfFreedom = 1044;
|
||||
public const uint BlindingLightEffect = 105421;
|
||||
public const uint ConcentractionAura = 19746;
|
||||
public const uint ConsecratedGroundPassive = 204054;
|
||||
@@ -33,6 +35,8 @@ namespace Scripts.Spells.Paladin
|
||||
public const uint ConsecrationDamage = 81297;
|
||||
public const uint ConsecrationProtectionAura = 188370;
|
||||
public const uint CrusadingStrikesEnergize = 406834;
|
||||
public const uint DivineAuxiliaryEnergize = 408386;
|
||||
public const uint DivineAuxiliaryTalent = 406158;
|
||||
public const uint DivinePurposeTriggered = 223819;
|
||||
public const uint DivineSteedHuman = 221883;
|
||||
public const uint DivineSteedDwarf = 276111;
|
||||
@@ -45,9 +49,14 @@ namespace Scripts.Spells.Paladin
|
||||
public const uint DivineStormDamage = 224239;
|
||||
public const uint EnduringLight = 40471;
|
||||
public const uint EnduringJudgement = 40472;
|
||||
public const uint ExecutionSentenceDamage = 387113;
|
||||
public const uint ExecutionSentence11_Seconds = 406919;
|
||||
public const uint ExecutionSentence8_Seconds = 386579;
|
||||
public const uint ExecutionersWill = 406940;
|
||||
public const uint EyeForAnEyeTriggered = 205202;
|
||||
public const uint FinalStand = 204077;
|
||||
public const uint FinalStandEffect = 204079;
|
||||
public const uint FinalVerdict = 383329;
|
||||
public const uint Forbearance = 25771;
|
||||
public const uint GuardianOfAncientKings = 86659;
|
||||
public const uint HammerOfJustice = 853;
|
||||
@@ -57,7 +66,7 @@ namespace Scripts.Spells.Paladin
|
||||
public const uint HolyPowerArmor = 28790;
|
||||
public const uint HolyPowerAttackPower = 28791;
|
||||
public const uint HolyPowerSpellPower = 28793;
|
||||
public const uint HolyPowerMp5 = 28795;
|
||||
public const uint HolyPowerMP5 = 28795;
|
||||
public const uint HolyPrismAreaBeamVisual = 121551;
|
||||
public const uint HolyPrismTargetAlly = 114871;
|
||||
public const uint HolyPrismTargetEnemy = 114852;
|
||||
@@ -67,11 +76,11 @@ namespace Scripts.Spells.Paladin
|
||||
public const uint HolyShockHealing = 25914;
|
||||
public const uint HolyLight = 82326;
|
||||
public const uint InfusionOfLightEnergize = 356717;
|
||||
public const uint ImmuneShieldMarker = 61988;
|
||||
public const uint ImmuneShieldMarker = 61988; // Serverside
|
||||
public const uint ItemHealingTrance = 37706;
|
||||
public const uint JudgmentGainHolyPower = 220637;
|
||||
public const uint JudgmentHolyR3 = 231644;
|
||||
public const uint JudgmentHolyR3Debuff = 214222;
|
||||
public const uint JudgmentHolyR3_Debuff = 214222;
|
||||
public const uint JudgmentProtRetR3 = 315867;
|
||||
public const uint LightHammerCosmetic = 122257;
|
||||
public const uint LightHammerDamage = 114919;
|
||||
@@ -80,17 +89,50 @@ namespace Scripts.Spells.Paladin
|
||||
public const uint RighteousDefenseTaunt = 31790;
|
||||
public const uint RighteousVerdictAura = 267611;
|
||||
public const uint SealOfRighteousness = 25742;
|
||||
public const uint ShieldOfTheRightrousArmor = 132403;
|
||||
public const uint ShieldOfTheRighteousArmor = 132403;
|
||||
public const uint ShieldOfVengeanceDamage = 184689;
|
||||
public const uint TemplarVerdictDamage = 224266;
|
||||
public const uint T302PHeartfireDamage = 408399;
|
||||
public const uint T302PHeartfireHeal = 408400;
|
||||
public const uint T30_2PHeartfireDamage = 408399;
|
||||
public const uint T30_2PHeartfireHeal = 408400;
|
||||
public const uint WakeOfAshesStun = 255941;
|
||||
public const uint ZealAura = 269571;
|
||||
|
||||
//CovenantSpells
|
||||
public const uint AshenHallow = 316958;
|
||||
public const uint AshenHallowDamage = 317221;
|
||||
public const uint AshenHallowHeal = 317223;
|
||||
public const uint AshenHallowAllowHammer = 330382;
|
||||
|
||||
public const uint VisualKitDivineStorm = 73892;
|
||||
public const uint VisualSpellHolyShockDamage = 83731;
|
||||
public const uint VisualSpellHolyShockDamageCrit = 83881;
|
||||
public const uint VisualSpellHolyShockHeal = 83732;
|
||||
public const uint VisualSpellHolyShockHealCrit = 83880;
|
||||
|
||||
public const uint LabelPaladinT30_2PHeartfire = 2598;
|
||||
}
|
||||
|
||||
[Script] // 469411 - A Just Reward
|
||||
class spell_pal_a_just_reward : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.AJustRewardHeal);
|
||||
}
|
||||
|
||||
static void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
eventInfo.GetActor().CastSpell(eventInfo.GetActionTarget(), SpellIds.AJustRewardHeal, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleEffectProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 31850 - Ardent Defender
|
||||
@@ -107,7 +149,7 @@ namespace Scripts.Spells.Paladin
|
||||
PreventDefaultAction();
|
||||
|
||||
int targetHealthPercent = GetEffectInfo(1).CalcValue(GetTarget());
|
||||
ulong targetHealth = (ulong)GetTarget().CountPctFromMaxHealth(targetHealthPercent);
|
||||
ulong targetHealth = GetTarget().CountPctFromMaxHealth(targetHealthPercent);
|
||||
if (GetTarget().HealthBelowPct(targetHealthPercent))
|
||||
{
|
||||
// we are currently below desired health
|
||||
@@ -120,7 +162,7 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
// we are currently above desired health
|
||||
// just absorb enough to reach that percentage
|
||||
absorbAmount = (uint)(dmgInfo.GetDamage() - (int)(GetTarget().GetHealth() - targetHealth));
|
||||
absorbAmount = (uint)(dmgInfo.GetDamage() - (GetTarget().GetHealth() - targetHealth));
|
||||
}
|
||||
|
||||
Remove();
|
||||
@@ -159,13 +201,11 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
|
||||
[Script] // 19042 - Ashen Hallow
|
||||
class areatrigger_pal_ashen_hallow : AreaTriggerAI
|
||||
class areatrigger_pal_ashen_hallow(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
TimeSpan _refreshTimer;
|
||||
TimeSpan _period;
|
||||
|
||||
public areatrigger_pal_ashen_hallow(AreaTrigger areatrigger) : base(areatrigger) { }
|
||||
|
||||
void RefreshPeriod()
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
@@ -173,7 +213,7 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
AuraEffect ashen = caster.GetAuraEffect(SpellIds.AshenHallow, 1);
|
||||
if (ashen != null)
|
||||
_period = TimeSpan.FromMilliseconds(ashen.GetPeriod());
|
||||
_period = TimeSpan.FromSeconds(ashen.GetPeriod());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,9 +225,9 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
public override void OnUpdate(uint diff)
|
||||
{
|
||||
_refreshTimer -= TimeSpan.FromMilliseconds(diff);
|
||||
_refreshTimer -= TimeSpan.FromSeconds(diff);
|
||||
|
||||
while (_refreshTimer <= TimeSpan.FromSeconds(0))
|
||||
while (_refreshTimer <= TimeSpan.Zero)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
if (caster != null)
|
||||
@@ -204,13 +244,13 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
if (unit.GetGUID() == at.GetCasterGuid())
|
||||
if (unit.GetGUID() == at.GetCasterGUID())
|
||||
unit.CastSpell(unit, SpellIds.AshenHallowAllowHammer, true);
|
||||
}
|
||||
|
||||
public override void OnUnitExit(Unit unit)
|
||||
{
|
||||
if (unit.GetGUID() == at.GetCasterGuid())
|
||||
if (unit.GetGUID() == at.GetCasterGUID())
|
||||
unit.RemoveAura(SpellIds.AshenHallowAllowHammer);
|
||||
}
|
||||
}
|
||||
@@ -231,7 +271,7 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
TimeSpan extraDuration = TimeSpan.FromMilliseconds(0);
|
||||
TimeSpan extraDuration = TimeSpan.FromSeconds(0);
|
||||
AuraEffect durationEffect = GetEffect(1);
|
||||
if (durationEffect != null)
|
||||
extraDuration = TimeSpan.FromSeconds(durationEffect.GetAmount());
|
||||
@@ -239,8 +279,8 @@ namespace Scripts.Spells.Paladin
|
||||
Aura avengingWrath = GetTarget().GetAura(SpellIds.AvengingWrath);
|
||||
if (avengingWrath != null)
|
||||
{
|
||||
avengingWrath.SetDuration(avengingWrath.GetDuration() + (int)extraDuration.TotalMilliseconds);
|
||||
avengingWrath.SetMaxDuration(avengingWrath.GetMaxDuration() + (int)extraDuration.TotalMilliseconds);
|
||||
avengingWrath.SetDuration((int)(avengingWrath.GetDuration() + extraDuration.TotalMilliseconds));
|
||||
avengingWrath.SetMaxDuration((int)(avengingWrath.GetMaxDuration() + extraDuration.TotalMilliseconds));
|
||||
}
|
||||
else
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.AvengingWrath,
|
||||
@@ -256,6 +296,46 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Called by 184575 - Blade of Justice
|
||||
class spell_pal_blade_of_vengeance : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BladeOfVengeance)
|
||||
&& ValidateSpellEffect((spellInfo.Id, 2))
|
||||
&& spellInfo.GetEffect(2).IsEffect(SpellEffectName.TriggerSpell);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return !GetCaster().HasAura(SpellIds.BladeOfVengeance);
|
||||
}
|
||||
|
||||
static void PreventProc(ref WorldObject target)
|
||||
{
|
||||
target = null;
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectTargetSelect.Add(new(PreventProc, 2, Targets.UnitTargetEnemy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 404358 - Blade of Justice
|
||||
class spell_pal_blade_of_vengeance_aoe_target_selector : SpellScript
|
||||
{
|
||||
void RemoveExplicitTarget(List<WorldObject> targets)
|
||||
{
|
||||
targets.Remove(GetExplTargetWorldObject());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new(RemoveExplicitTarget, 0, Targets.UnitDestAreaEnemy));
|
||||
}
|
||||
}
|
||||
|
||||
// 1022 - Blessing of Protection
|
||||
[Script] // 204018 - Blessing of Spellwarding
|
||||
class spell_pal_blessing_of_protection : SpellScript
|
||||
@@ -265,28 +345,17 @@ namespace Scripts.Spells.Paladin
|
||||
return ValidateSpellInfo(SpellIds.Forbearance, SpellIds.ImmuneShieldMarker) && spellInfo.ExcludeTargetAuraSpell == SpellIds.ImmuneShieldMarker;
|
||||
}
|
||||
|
||||
SpellCastResult CheckForbearance()
|
||||
{
|
||||
Unit target = GetExplTargetUnit();
|
||||
if (target == null || target.HasAura(SpellIds.Forbearance))
|
||||
return SpellCastResult.TargetAurastate;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
}
|
||||
|
||||
void TriggerForbearance()
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
if (target != null)
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.Forbearance, new CastSpellExtraArgs()
|
||||
{
|
||||
GetCaster().CastSpell(target, SpellIds.Forbearance, true);
|
||||
GetCaster().CastSpell(target, SpellIds.ImmuneShieldMarker, true);
|
||||
}
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new(CheckForbearance));
|
||||
AfterHit.Add(new(TriggerForbearance));
|
||||
}
|
||||
}
|
||||
@@ -301,14 +370,16 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
if (target != null)
|
||||
GetCaster().CastSpell(target, SpellIds.BlindingLightEffect, true);
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.BlindingLightEffect, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.ApplyAura));
|
||||
OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +388,13 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ConsecrationDamage, SpellIds.ConsecrationProtectionAura, SpellIds.ConsecratedGroundPassive, SpellIds.ConsecratedGroundSlow);
|
||||
return ValidateSpellInfo
|
||||
(SpellIds.ConsecrationDamage,
|
||||
// validate for areatrigger_pal_consecration
|
||||
SpellIds.ConsecrationProtectionAura,
|
||||
SpellIds.ConsecratedGroundPassive,
|
||||
SpellIds.ConsecratedGroundSlow
|
||||
);
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect aurEff)
|
||||
@@ -335,10 +412,8 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
// 26573 - Consecration
|
||||
[Script] // 9228 - AreaTriggerId
|
||||
class areatrigger_pal_consecration : AreaTriggerAI
|
||||
class areatrigger_pal_consecration(AreaTrigger areaTrigger) : AreaTriggerAI(areaTrigger)
|
||||
{
|
||||
public areatrigger_pal_consecration(AreaTrigger areatrigger) : base(areatrigger) { }
|
||||
|
||||
public override void OnUnitEnter(Unit unit)
|
||||
{
|
||||
Unit caster = at.GetCaster();
|
||||
@@ -356,10 +431,10 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
public override void OnUnitExit(Unit unit)
|
||||
{
|
||||
if (at.GetCasterGuid() == unit.GetGUID())
|
||||
unit.RemoveAurasDueToSpell(SpellIds.ConsecrationProtectionAura, at.GetCasterGuid());
|
||||
if (at.GetCasterGUID() == unit.GetGUID())
|
||||
unit.RemoveAurasDueToSpell(SpellIds.ConsecrationProtectionAura, at.GetCasterGUID());
|
||||
|
||||
unit.RemoveAurasDueToSpell(SpellIds.ConsecratedGroundSlow, at.GetCasterGuid());
|
||||
unit.RemoveAurasDueToSpell(SpellIds.ConsecratedGroundSlow, at.GetCasterGUID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +448,7 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.HolyShock, TimeSpan.FromMilliseconds(aurEff.GetAmount()));
|
||||
GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.HolyShock, TimeSpan.FromSeconds(aurEff.GetAmount()));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -407,6 +482,35 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 406158 - Divine Auxiliary (attached to 343721 - Final Reckoning and 343527 - Execution Sentence)
|
||||
class spell_pal_divine_auxiliary : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.DivineAuxiliaryEnergize, SpellIds.DivineAuxiliaryTalent);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().HasAura(SpellIds.DivineAuxiliaryTalent);
|
||||
}
|
||||
|
||||
void HandleEnergize()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
caster.CastSpell(caster, SpellIds.DivineAuxiliaryEnergize, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new(HandleEnergize));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 223817 - Divine Purpose
|
||||
class spell_pal_divine_purpose : AuraScript
|
||||
{
|
||||
@@ -445,15 +549,8 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FinalStand, SpellIds.FinalStandEffect, SpellIds.Forbearance, SpellIds.ImmuneShieldMarker) && spellInfo.ExcludeCasterAuraSpell == SpellIds.ImmuneShieldMarker;
|
||||
}
|
||||
|
||||
SpellCastResult CheckForbearance()
|
||||
{
|
||||
if (GetCaster().HasAura(SpellIds.Forbearance))
|
||||
return SpellCastResult.TargetAurastate;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
return ValidateSpellInfo(SpellIds.FinalStand, SpellIds.FinalStandEffect, SpellIds.Forbearance, SpellIds.ImmuneShieldMarker)
|
||||
&& spellInfo.ExcludeCasterAuraSpell == SpellIds.ImmuneShieldMarker;
|
||||
}
|
||||
|
||||
void HandleFinalStand()
|
||||
@@ -464,16 +561,17 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
void TriggerForbearance()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
caster.CastSpell(caster, SpellIds.Forbearance, true);
|
||||
caster.CastSpell(caster, SpellIds.ImmuneShieldMarker, true);
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.Forbearance, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new(CheckForbearance));
|
||||
AfterCast.Add(new(HandleFinalStand));
|
||||
AfterCast.Add(new(TriggerForbearance));
|
||||
AfterHit.Add(new(TriggerForbearance));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,26 +580,44 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.DivineSteedHuman, SpellIds.DivineSteedDwarf, SpellIds.DivineSteedDraenei, SpellIds.DivineSteedDarkIronDwarf,
|
||||
SpellIds.DivineSteedBloodelf, SpellIds.DivineSteedTauren, SpellIds.DivineSteedZandalariTroll, SpellIds.DivineSteedLfDraenei);
|
||||
return ValidateSpellInfo(SpellIds.DivineSteedHuman, SpellIds.DivineSteedDwarf, SpellIds.DivineSteedDraenei, SpellIds.DivineSteedDarkIronDwarf, SpellIds.DivineSteedBloodelf,
|
||||
SpellIds.DivineSteedTauren, SpellIds.DivineSteedZandalariTroll, SpellIds.DivineSteedLfDraenei);
|
||||
}
|
||||
|
||||
void HandleOnCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
|
||||
uint spellId = caster.GetRace() switch
|
||||
uint spellId = SpellIds.DivineSteedHuman;
|
||||
switch (caster.GetRace())
|
||||
{
|
||||
Race.Human => SpellIds.DivineSteedHuman,
|
||||
Race.Dwarf => SpellIds.DivineSteedDwarf,
|
||||
Race.Draenei => SpellIds.DivineSteedDraenei,
|
||||
Race.LightforgedDraenei => SpellIds.DivineSteedLfDraenei,
|
||||
Race.DarkIronDwarf => SpellIds.DivineSteedDarkIronDwarf,
|
||||
Race.BloodElf => SpellIds.DivineSteedBloodelf,
|
||||
Race.Tauren => SpellIds.DivineSteedTauren,
|
||||
Race.ZandalariTroll => SpellIds.DivineSteedZandalariTroll,
|
||||
_ => SpellIds.DivineSteedHuman
|
||||
};
|
||||
case Race.Human:
|
||||
spellId = SpellIds.DivineSteedHuman;
|
||||
break;
|
||||
case Race.Dwarf:
|
||||
spellId = SpellIds.DivineSteedDwarf;
|
||||
break;
|
||||
case Race.Draenei:
|
||||
spellId = SpellIds.DivineSteedDraenei;
|
||||
break;
|
||||
case Race.LightforgedDraenei:
|
||||
spellId = SpellIds.DivineSteedLfDraenei;
|
||||
break;
|
||||
case Race.DarkIronDwarf:
|
||||
spellId = SpellIds.DivineSteedDarkIronDwarf;
|
||||
break;
|
||||
case Race.BloodElf:
|
||||
spellId = SpellIds.DivineSteedBloodelf;
|
||||
break;
|
||||
case Race.Tauren:
|
||||
spellId = SpellIds.DivineSteedTauren;
|
||||
break;
|
||||
case Race.ZandalariTroll:
|
||||
spellId = SpellIds.DivineSteedZandalariTroll;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
caster.CastSpell(caster, spellId, true);
|
||||
}
|
||||
@@ -515,16 +631,14 @@ namespace Scripts.Spells.Paladin
|
||||
[Script] // 53385 - Divine Storm
|
||||
class spell_pal_divine_storm : SpellScript
|
||||
{
|
||||
const uint PaladinVisualKitDivineStorm = 73892;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return CliDB.SpellVisualKitStorage.HasRecord(PaladinVisualKitDivineStorm);
|
||||
return CliDB.SpellVisualKitStorage.HasRecord(SpellIds.VisualKitDivineStorm);
|
||||
}
|
||||
|
||||
void HandleOnCast()
|
||||
{
|
||||
GetCaster().SendPlaySpellVisualKit(PaladinVisualKitDivineStorm, 0, 0);
|
||||
GetCaster().SendPlaySpellVisualKit(SpellIds.VisualKitDivineStorm, 0, 0);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -533,6 +647,72 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 343527 - Execution Sentence
|
||||
class spell_pal_execution_sentence : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ExecutionSentenceDamage, SpellIds.ExecutionersWill, SpellIds.ExecutionSentence11_Seconds, SpellIds.ExecutionSentence8_Seconds);
|
||||
}
|
||||
|
||||
void HandleVisual(uint effIndex)
|
||||
{
|
||||
uint visualSpellId = GetCaster().HasAura(SpellIds.ExecutionersWill)
|
||||
? SpellIds.ExecutionSentence11_Seconds
|
||||
: SpellIds.ExecutionSentence8_Seconds;
|
||||
GetCaster().CastSpell(GetHitUnit(), visualSpellId,
|
||||
new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleVisual, 0, SpellEffectName.ApplyAura));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_pal_execution_sentence_aura : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((spellInfo.Id, 1))
|
||||
&& spellInfo.GetEffect(1).IsAura();
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||
if (damageInfo != null)
|
||||
aurEff.ChangeAmount((int)(aurEff.GetAmount() + MathFunctions.CalculatePct(damageInfo.GetDamage(), GetEffect(1).GetAmount())));
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
int amount = aurEff.GetAmount();
|
||||
if (amount == 0 || GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Expire)
|
||||
return;
|
||||
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null)
|
||||
caster.CastSpell(GetTarget(), SpellIds.ExecutionSentenceDamage, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff,
|
||||
SpellValueOverrides = { new(SpellValueMod.BasePoint0, amount) }
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 205191 - Eye for an Eye
|
||||
class spell_pal_eye_for_an_eye : AuraScript
|
||||
{
|
||||
@@ -552,6 +732,33 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 383328 - Final Verdict
|
||||
class spell_pal_final_verdict : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FinalVerdict);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
if (!RandomHelper.randChance(GetEffectValue()))
|
||||
return;
|
||||
|
||||
Unit caster = GetCaster();
|
||||
caster.CastSpell(caster, SpellIds.FinalVerdict, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleDummy, 1, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 234299 - Fist of Justice
|
||||
class spell_pal_fist_of_justice : AuraScript
|
||||
{
|
||||
@@ -683,7 +890,7 @@ namespace Scripts.Spells.Paladin
|
||||
[Script] // 54149 - Infusion of Light
|
||||
class spell_pal_infusion_of_light : AuraScript
|
||||
{
|
||||
FlagArray128 HolyLightSpellClassMask = new(0, 0, 0x400);
|
||||
static FlagArray128 HolyLightSpellClassMask = new(0, 0, 0x400);
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -692,7 +899,7 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
bool CheckFlashOfLightProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetProcSpell() != null && eventInfo.GetProcSpell().m_appliedMods.Contains(GetAura());
|
||||
return eventInfo.GetProcSpell() != null && eventInfo.GetProcSpell().m_appliedMods.Find(p => p == GetAura()) != null;
|
||||
}
|
||||
|
||||
bool CheckHolyLightProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
@@ -740,7 +947,7 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.JudgmentProtRetR3, SpellIds.JudgmentGainHolyPower, SpellIds.JudgmentHolyR3, SpellIds.JudgmentHolyR3Debuff);
|
||||
return ValidateSpellInfo(SpellIds.JudgmentProtRetR3, SpellIds.JudgmentGainHolyPower, SpellIds.JudgmentHolyR3, SpellIds.JudgmentHolyR3_Debuff);
|
||||
}
|
||||
|
||||
void HandleOnHit()
|
||||
@@ -751,7 +958,7 @@ namespace Scripts.Spells.Paladin
|
||||
caster.CastSpell(caster, SpellIds.JudgmentGainHolyPower, GetSpell());
|
||||
|
||||
if (caster.HasSpell(SpellIds.JudgmentHolyR3))
|
||||
caster.CastSpell(GetHitUnit(), SpellIds.JudgmentHolyR3Debuff, GetSpell());
|
||||
caster.CastSpell(GetHitUnit(), SpellIds.JudgmentHolyR3_Debuff, GetSpell());
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -760,6 +967,26 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 215661 - Justicar's Vengeance
|
||||
class spell_pal_justicars_vengeance : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellEffect((spellInfo.Id, 1));
|
||||
}
|
||||
|
||||
void HandleDamage(SpellEffectInfo spellEffectInfo, Unit victim, ref int damage, ref int flatMod, ref float pctMod)
|
||||
{
|
||||
if (victim.HasUnitState(UnitState.Stunned))
|
||||
MathFunctions.AddPct(ref pctMod, GetEffectInfo(1).CalcValue(GetCaster()));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
CalcDamage.Add(new(HandleDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 114165 - Holy Prism
|
||||
class spell_pal_holy_prism : SpellScript
|
||||
{
|
||||
@@ -789,7 +1016,7 @@ namespace Scripts.Spells.Paladin
|
||||
class spell_pal_holy_prism_selector : SpellScript
|
||||
{
|
||||
List<WorldObject> _sharedTargets = new();
|
||||
ObjectGuid _targetGUID;
|
||||
ObjectGuid _targetGuid;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -798,7 +1025,7 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
void SaveTargetGuid(uint effIndex)
|
||||
{
|
||||
_targetGUID = GetHitUnit().GetGUID();
|
||||
_targetGuid = GetHitUnit().GetGUID();
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
@@ -827,7 +1054,7 @@ namespace Scripts.Spells.Paladin
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
Unit initialTarget = ObjAccessor.GetUnit(GetCaster(), _targetGUID);
|
||||
Unit initialTarget = Global.ObjAccessor.GetUnit(GetCaster(), _targetGuid);
|
||||
if (initialTarget != null)
|
||||
initialTarget.CastSpell(GetHitUnit(), SpellIds.HolyPrismAreaBeamVisual, true);
|
||||
}
|
||||
@@ -900,18 +1127,15 @@ namespace Scripts.Spells.Paladin
|
||||
[Script] // 25912 - Holy Shock
|
||||
class spell_pal_holy_shock_damage_visual : SpellScript
|
||||
{
|
||||
const uint PaladinVisualSpellHolyShockDamage = 83731;
|
||||
const uint PaladinVisualSpellHolyShockDamageCrit = 83881;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return CliDB.SpellVisualStorage.HasRecord(PaladinVisualSpellHolyShockDamage)
|
||||
&& CliDB.SpellVisualStorage.HasRecord(PaladinVisualSpellHolyShockDamageCrit);
|
||||
return CliDB.SpellVisualStorage.HasRecord(SpellIds.VisualSpellHolyShockDamage)
|
||||
&& CliDB.SpellVisualStorage.HasRecord(SpellIds.VisualSpellHolyShockDamageCrit);
|
||||
}
|
||||
|
||||
void PlayVisual()
|
||||
{
|
||||
GetCaster().SendPlaySpellVisual(GetHitUnit(), IsHitCrit() ? PaladinVisualSpellHolyShockDamageCrit : PaladinVisualSpellHolyShockDamage, 0, 0, 0.0f, false);
|
||||
GetCaster().SendPlaySpellVisual(GetHitUnit(), IsHitCrit() ? SpellIds.VisualSpellHolyShockDamageCrit : SpellIds.VisualSpellHolyShockDamage, 0, 0, 0.0f, false);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -923,18 +1147,15 @@ namespace Scripts.Spells.Paladin
|
||||
[Script] // 25914 - Holy Shock
|
||||
class spell_pal_holy_shock_heal_visual : SpellScript
|
||||
{
|
||||
const uint PaladinVisualSpellHolyShockHeal = 83732;
|
||||
const uint PaladinVisualSpellHolyShockHealCrit = 83880;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return CliDB.SpellVisualStorage.HasRecord(PaladinVisualSpellHolyShockHeal)
|
||||
&& CliDB.SpellVisualStorage.HasRecord(PaladinVisualSpellHolyShockHealCrit);
|
||||
return CliDB.SpellVisualStorage.HasRecord(SpellIds.VisualSpellHolyShockHeal)
|
||||
&& CliDB.SpellVisualStorage.HasRecord(SpellIds.VisualSpellHolyShockHealCrit);
|
||||
}
|
||||
|
||||
void PlayVisual()
|
||||
{
|
||||
GetCaster().SendPlaySpellVisual(GetHitUnit(), IsHitCrit() ? PaladinVisualSpellHolyShockHealCrit : PaladinVisualSpellHolyShockHeal, 0, 0, 0.0f, false);
|
||||
GetCaster().SendPlaySpellVisual(GetHitUnit(), IsHitCrit() ? SpellIds.VisualSpellHolyShockHealCrit : SpellIds.VisualSpellHolyShockHeal, 0, 0, 0.0f, false);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -1006,36 +1227,27 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 633 - Lay on Hands
|
||||
// 633 - Lay on Hands
|
||||
[Script] // 471195 - Lay on Hands (from 387791 - Empyreal Ward)
|
||||
class spell_pal_lay_on_hands : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.Forbearance, SpellIds.ImmuneShieldMarker) && spellInfo.ExcludeTargetAuraSpell == SpellIds.ImmuneShieldMarker;
|
||||
}
|
||||
|
||||
SpellCastResult CheckForbearance()
|
||||
{
|
||||
Unit target = GetExplTargetUnit();
|
||||
if (target == null || target.HasAura(SpellIds.Forbearance))
|
||||
return SpellCastResult.TargetAurastate;
|
||||
|
||||
return SpellCastResult.SpellCastOk;
|
||||
return ValidateSpellInfo(SpellIds.Forbearance)
|
||||
&& spellInfo.ExcludeTargetAuraSpell == SpellIds.ImmuneShieldMarker;
|
||||
}
|
||||
|
||||
void TriggerForbearance()
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
if (target != null)
|
||||
GetCaster().CastSpell(GetHitUnit(), SpellIds.Forbearance, new CastSpellExtraArgs()
|
||||
{
|
||||
GetCaster().CastSpell(target, SpellIds.Forbearance, true);
|
||||
GetCaster().CastSpell(target, SpellIds.ImmuneShieldMarker, true);
|
||||
}
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new(CheckForbearance));
|
||||
AfterHit.Add(new(TriggerForbearance));
|
||||
}
|
||||
}
|
||||
@@ -1077,7 +1289,7 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
CastSpellExtraArgs args = new(aurEff);
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0, (int)heal);
|
||||
eventInfo.GetActor().CastSpell(applications.FirstOrDefault().GetTarget(), SpellIds.BeaconOfLightHeal, args);
|
||||
eventInfo.GetActor().CastSpell(applications.First().GetTarget(), SpellIds.BeaconOfLightHeal, args);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1103,7 +1315,7 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
foreach (var summonedObject in GetSpell().GetExecuteLogEffect(SpellEffectName.Summon).GenericVictimTargets)
|
||||
{
|
||||
Unit hammer = ObjAccessor.GetUnit(GetCaster(), summonedObject.Victim);
|
||||
Unit hammer = Global.ObjAccessor.GetUnit(GetCaster(), summonedObject.Victim);
|
||||
if (hammer != null)
|
||||
{
|
||||
hammer.CastSpell(hammer, SpellIds.LightHammerCosmetic,
|
||||
@@ -1170,8 +1382,8 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
int value = aurEff.GetAmount() * 100 * _baseHolyPowerCost.Amount;
|
||||
|
||||
GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.AvengingWrath, TimeSpan.FromMilliseconds(-value));
|
||||
GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.GuardianOfAncientKings, TimeSpan.FromMilliseconds(-value));
|
||||
GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.AvengingWrath, TimeSpan.FromSeconds(-value));
|
||||
GetTarget().GetSpellHistory().ModifyCooldown(SpellIds.GuardianOfAncientKings, TimeSpan.FromSeconds(-value));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -1223,12 +1435,12 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.ShieldOfTheRightrousArmor);
|
||||
return ValidateSpellInfo(SpellIds.ShieldOfTheRighteousArmor);
|
||||
}
|
||||
|
||||
void HandleArmor()
|
||||
{
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.ShieldOfTheRightrousArmor, true);
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.ShieldOfTheRighteousArmor, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
@@ -1240,7 +1452,7 @@ namespace Scripts.Spells.Paladin
|
||||
[Script] // 184662 - Shield of Vengeance
|
||||
class spell_pal_shield_of_vengeance : AuraScript
|
||||
{
|
||||
int _initialAmount;
|
||||
int _initialAmount = 0;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -1270,6 +1482,31 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 469304 - Steed of Liberty
|
||||
class spell_pal_steed_of_liberty : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.BlessingOfFreedom);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
target.CastSpell(target, SpellIds.BlessingOfFreedom, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringAura = aurEff,
|
||||
SpellValueOverrides = { new(SpellValueMod.Duration, aurEff.GetAmount()) }
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 85256 - Templar's Verdict
|
||||
class spell_pal_templar_s_verdict : SpellScript
|
||||
{
|
||||
@@ -1294,7 +1531,7 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.HolyPowerArmor, SpellIds.HolyPowerAttackPower, SpellIds.HolyPowerSpellPower, SpellIds.HolyPowerMp5);
|
||||
return ValidateSpellInfo(SpellIds.HolyPowerArmor, SpellIds.HolyPowerAttackPower, SpellIds.HolyPowerSpellPower, SpellIds.HolyPowerMP5);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
@@ -1311,7 +1548,7 @@ namespace Scripts.Spells.Paladin
|
||||
case Class.Priest:
|
||||
case Class.Shaman:
|
||||
case Class.Druid:
|
||||
spellId = SpellIds.HolyPowerMp5;
|
||||
spellId = SpellIds.HolyPowerMP5;
|
||||
break;
|
||||
case Class.Mage:
|
||||
case Class.Warlock:
|
||||
@@ -1356,7 +1593,7 @@ namespace Scripts.Spells.Paladin
|
||||
Unit caster = eventInfo.GetActor();
|
||||
Unit target = eventInfo.GetProcTarget();
|
||||
|
||||
SpellInfo spellInfo = SpellMgr.GetSpellInfo(SpellIds.HolyMending, GetCastDifficulty());
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyMending, GetCastDifficulty());
|
||||
int amount = MathFunctions.CalculatePct((int)(healInfo.GetHeal()), aurEff.GetAmount());
|
||||
|
||||
Cypher.Assert(spellInfo.GetMaxTicks() > 0);
|
||||
@@ -1378,7 +1615,7 @@ namespace Scripts.Spells.Paladin
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.T302PHeartfireDamage);
|
||||
return ValidateSpellInfo(SpellIds.T30_2PHeartfireDamage);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
@@ -1386,10 +1623,10 @@ namespace Scripts.Spells.Paladin
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit caster = procInfo.GetActor();
|
||||
uint ticks = SpellMgr.GetSpellInfo(SpellIds.T302PHeartfireDamage, Difficulty.None).GetMaxTicks();
|
||||
uint ticks = Global.SpellMgr.GetSpellInfo(SpellIds.T30_2PHeartfireDamage, Difficulty.None).GetMaxTicks();
|
||||
uint damage = MathFunctions.CalculatePct(procInfo.GetDamageInfo().GetOriginalDamage(), aurEff.GetAmount()) / ticks;
|
||||
|
||||
caster.CastSpell(procInfo.GetActionTarget(), SpellIds.T302PHeartfireDamage, new CastSpellExtraArgs(aurEff)
|
||||
caster.CastSpell(procInfo.GetActionTarget(), SpellIds.T30_2PHeartfireDamage, new CastSpellExtraArgs(aurEff)
|
||||
.SetTriggeringSpell(procInfo.GetProcSpell())
|
||||
.AddSpellMod(SpellValueMod.BasePoint0, (int)damage));
|
||||
}
|
||||
@@ -1403,21 +1640,19 @@ namespace Scripts.Spells.Paladin
|
||||
[Script] // 408461 - Heartfire
|
||||
class spell_pal_t30_2p_protection_bonus_heal : AuraScript
|
||||
{
|
||||
const uint SpellLabelPaladinT302PHeartfire = 2598;
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.T302PHeartfireHeal);
|
||||
return ValidateSpellInfo(SpellIds.T30_2PHeartfireHeal);
|
||||
}
|
||||
|
||||
bool CheckProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
return procInfo.GetDamageInfo() != null && procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().HasLabel(SpellLabelPaladinT302PHeartfire);
|
||||
return procInfo.GetDamageInfo() != null && procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().HasLabel(SpellIds.LabelPaladinT30_2PHeartfire);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
|
||||
{
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.T302PHeartfireHeal, new CastSpellExtraArgs(aurEff)
|
||||
GetTarget().CastSpell(GetTarget(), SpellIds.T30_2PHeartfireHeal, new CastSpellExtraArgs(aurEff)
|
||||
.SetTriggeringSpell(procInfo.GetProcSpell())
|
||||
.AddSpellMod(SpellValueMod.BasePoint0, (int)procInfo.GetDamageInfo().GetOriginalDamage()));
|
||||
}
|
||||
@@ -1429,6 +1664,34 @@ namespace Scripts.Spells.Paladin
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 255937 - Wake of Ashes
|
||||
class spell_pal_wake_of_ashes : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellEntry)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.WakeOfAshesStun);
|
||||
}
|
||||
|
||||
void HandleHitTarget(uint effIndex)
|
||||
{
|
||||
Unit target = GetHitUnit();
|
||||
|
||||
if (target.GetCreatureType() == CreatureType.Demon || target.GetCreatureType() == CreatureType.Undead)
|
||||
{
|
||||
GetCaster().CastSpell(target, SpellIds.WakeOfAshesStun, new CastSpellExtraArgs()
|
||||
{
|
||||
TriggerFlags = TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError,
|
||||
TriggeringSpell = GetSpell()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new(HandleHitTarget, 0, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 269569 - Zeal
|
||||
class spell_pal_zeal : AuraScript
|
||||
{
|
||||
@@ -1450,4 +1713,4 @@ namespace Scripts.Spells.Paladin
|
||||
OnEffectProc.Add(new(HandleEffectProc, 0, AuraType.ProcTriggerSpell));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+53
-1322
File diff suppressed because it is too large
Load Diff
+328
-230
File diff suppressed because it is too large
Load Diff
+518
-482
File diff suppressed because it is too large
Load Diff
+606
-167
File diff suppressed because it is too large
Load Diff
+1855
-280
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user