Updated all spell scripts

This commit is contained in:
Hondacrx
2025-10-13 13:23:31 -04:00
parent 3c4602e4a1
commit 3e028633ba
46 changed files with 33364 additions and 26554 deletions
+2 -2
View File
@@ -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>
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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; }
+13 -1
View File
@@ -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;
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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);
+4 -4
View File
@@ -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);
+4 -4
View File
@@ -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)
+1 -1
View File
@@ -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];
+2 -2
View File
@@ -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:
+1 -1
View File
@@ -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;
}
+24 -1
View File
@@ -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;
+5 -2
View File
@@ -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)
+5
View File
@@ -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)
+5 -4
View File
@@ -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)
{
+2 -2
View File
@@ -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))
+1 -1
View File
@@ -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) + ' ';
}
+1 -1
View File
@@ -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());
+21
View File
@@ -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)
+10 -11
View File
@@ -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);
}
}
+3 -3
View File
@@ -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)
+6 -6
View File
@@ -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 _);
}
+9 -2
View File
@@ -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;
+141 -151
View File
@@ -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,13 +8,32 @@ 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
{
[Script]
class spell_azerite_gen_aura_calc_from_2nd_effect_triggered_spell : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellEffect((spellInfo.Id, 1)) && ValidateSpellInfo(spellInfo.GetEffect(1).TriggerSpell);
@@ -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();
}
@@ -37,11 +56,11 @@ namespace Scripts.Spells.Azerite
{
DoEffectCalcAmount.Add(new(CalculateAmount, 0, AuraType.ModRating));
}
}
}
[Script] // 270658 - Azerite Fortification
class spell_item_azerite_fortification : AuraScript
{
[Script] // 270658 - Azerite Fortification
class spell_item_azerite_fortification : AuraScript
{
bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
{
Spell procSpell = eventInfo.GetProcSpell();
@@ -58,27 +77,24 @@ namespace Scripts.Spells.Azerite
{
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpell));
}
}
[Script] // 271548 - Strength in Numbers
class spell_item_strength_in_numbers : SpellScript
{
const uint SpellStrengthInNumbersTrait = 271546;
const uint SpellStrengthInNumbersBuff = 271550;
}
[Script] // 271548 - Strength in Numbers
class spell_item_strength_in_numbers : SpellScript
{
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));
}
@@ -88,17 +104,14 @@ namespace Scripts.Spells.Azerite
{
AfterHit.Add(new(TriggerHealthBuff));
}
}
[Script] // 271843 - Blessed Portents
class spell_item_blessed_portents : AuraScript
{
const uint SpellBlessedPortentsTrait = 267889;
const uint SpellBlessedPortentsHeal = 280052;
}
[Script] // 271843 - Blessed Portents
class spell_item_blessed_portents : AuraScript
{
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()));
}
}
@@ -122,16 +135,14 @@ namespace Scripts.Spells.Azerite
{
OnEffectAbsorb.Add(new(CheckProc, 0));
}
}
[Script] // 272260 - Concentrated Mending
class spell_item_concentrated_mending : AuraScript
{
const uint SpellConcentratedMendingTrait = 267882;
}
[Script] // 272260 - Concentrated Mending
class spell_item_concentrated_mending : AuraScript
{
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()));
}
@@ -149,18 +160,14 @@ namespace Scripts.Spells.Azerite
{
OnEffectUpdatePeriodic.Add(new(RecalculateHealAmount, 0, AuraType.PeriodicHeal));
}
}
[Script] // 272276 - Bracing Chill
class spell_item_bracing_chill_proc : AuraScript
{
const uint SpellBracingChillTrait = 267884;
const uint SpellBracingChillHeal = 272428;
const uint SpellBracingChillSearchJumpTarget = 272436;
}
[Script] // 272276 - Bracing Chill
class spell_item_bracing_chill_proc : AuraScript
{
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();
@@ -191,20 +198,18 @@ namespace Scripts.Spells.Azerite
DoCheckEffectProc.Add(new(CheckHealCaster, 0, AuraType.Dummy));
AfterEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
}
}
[Script] // 272436 - Bracing Chill
class spell_item_bracing_chill_search_jump_target : SpellScript
{
const uint SpellBracingChill = 272276;
}
[Script] // 272436 - Bracing Chill
class spell_item_bracing_chill_search_jump_target : SpellScript
{
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));
}
@@ -229,11 +234,11 @@ namespace Scripts.Spells.Azerite
OnObjectAreaTargetSelect.Add(new(FilterTarget, 0, Targets.UnitDestAreaAlly));
OnEffectHitTarget.Add(new(MoveAura, 0, SpellEffectName.Dummy));
}
}
}
[Script] // 272837 - Trample the Weak
class spell_item_trample_the_weak : AuraScript
{
[Script] // 272837 - Trample the Weak
class spell_item_trample_the_weak : AuraScript
{
bool CheckHealthPct(AuraEffect aurEff, ProcEventInfo eventInfo)
{
return eventInfo.GetActor().GetHealthPct() > eventInfo.GetActionTarget().GetHealthPct();
@@ -243,18 +248,14 @@ namespace Scripts.Spells.Azerite
{
DoCheckEffectProc.Add(new(CheckHealthPct, 0, AuraType.ProcTriggerSpell));
}
}
[Script] // 272892 - Wracking Brilliance
class spell_item_wracking_brilliance : AuraScript
{
const uint SpellAgonySoulShardGain = 210067;
bool _canTrigger = true;
}
[Script] // 272892 - Wracking Brilliance
class spell_item_wracking_brilliance : AuraScript
{
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,53 +275,51 @@ namespace Scripts.Spells.Azerite
{
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpell));
}
}
[Script] // 275514 - Orbital Precision
class spell_item_orbital_precision : AuraScript
{
const uint SpellMageFrozenOrb = 84714;
bool _canTrigger = true;
}
[Script] // 275514 - Orbital Precision
class spell_item_orbital_precision : AuraScript
{
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()
{
DoCheckEffectProc.Add(new(CheckFrozenOrbActive, 0, AuraType.ProcTriggerSpell));
}
}
[Script] // 277966 - Blur of Talons
class spell_item_blur_of_talons : AuraScript
{
const uint SpellHunterCoordinatedAssault = 266779;
}
[Script] // 277966 - Blur of Talons
class spell_item_blur_of_talons : AuraScript
{
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()
{
DoCheckEffectProc.Add(new(CheckCoordinatedAssaultActive, 0, AuraType.ProcTriggerSpell));
}
}
}
[Script] // 278519 - Divine Right
class spell_item_divine_right : AuraScript
{
[Script] // 278519 - Divine Right
class spell_item_divine_right : AuraScript
{
bool CheckHealthPct(AuraEffect aurEff, ProcEventInfo eventInfo)
{
return eventInfo.GetProcTarget().HasAuraState(AuraStateType.Wounded20Percent, eventInfo.GetSpellInfo(), eventInfo.GetActor());
@@ -330,11 +329,11 @@ namespace Scripts.Spells.Azerite
{
DoCheckEffectProc.Add(new(CheckHealthPct, 0, AuraType.ProcTriggerSpell));
}
}
}
[Script] // 280409 - Blood Rite
class spell_item_blood_rite : AuraScript
{
[Script] // 280409 - Blood Rite
class spell_item_blood_rite : AuraScript
{
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
{
RefreshDuration();
@@ -344,23 +343,21 @@ namespace Scripts.Spells.Azerite
{
AfterEffectProc.Add(new(HandleProc, 1, AuraType.Dummy));
}
}
[Script] // 281843 - Tradewinds
class spell_item_tradewinds : AuraScript
{
const uint SpellTradewindsAllyBuff = 281844;
}
[Script] // 281843 - Tradewinds
class spell_item_tradewinds : AuraScript
{
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()));
}
@@ -368,32 +365,30 @@ namespace Scripts.Spells.Azerite
{
AfterEffectRemove.Add(new(HandleRemove, 0, AuraType.ModRating, AuraEffectHandleModes.Real));
}
}
[Script] // 287379 - Bastion of Might
class spell_item_bastion_of_might : SpellScript
{
const uint SpellWarriorIgnorePain = 190456;
}
[Script] // 287379 - Bastion of Might
class spell_item_bastion_of_might : SpellScript
{
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()
{
AfterHit.Add(new(TriggerIgnorePain));
}
}
}
[Script] // 287650 - Echoing Blades
class spell_item_echoing_blades : AuraScript
{
[Script] // 287650 - Echoing Blades
class spell_item_echoing_blades : AuraScript
{
ObjectGuid _lastFanOfKnives;
void PrepareProc(ProcEventInfo eventInfo)
@@ -423,21 +418,19 @@ namespace Scripts.Spells.Azerite
DoCheckEffectProc.Add(new(CheckFanOfKnivesCounter, 0, AuraType.ProcTriggerSpell));
AfterEffectProc.Add(new(ReduceCounter, 0, AuraType.ProcTriggerSpell));
}
}
[Script] // 287653 - Echoing Blades
class spell_item_echoing_blades_damage : SpellScript
{
const uint SpellEchoingBladesTrait = 287649;
}
[Script] // 287653 - Echoing Blades
class spell_item_echoing_blades_damage : SpellScript
{
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;
}
@@ -452,16 +445,14 @@ namespace Scripts.Spells.Azerite
CalcDamage.Add(new(CalculateDamage));
OnCalcCritChance.Add(new(ForceCritical));
}
}
[Script] // 288882 - Hour of Reaping
class spell_item_hour_of_reaping : AuraScript
{
const uint SpellDhSoulBarrier = 263648;
}
[Script] // 288882 - Hour of Reaping
class spell_item_hour_of_reaping : AuraScript
{
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()
@@ -479,11 +470,11 @@ namespace Scripts.Spells.Azerite
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.Dummy));
AfterEffectProc.Add(new(TriggerSoulBarrier, 0, AuraType.Dummy));
}
}
}
[Script] // 304086 - Azerite Fortification
class spell_item_conflict_wearer_on_stun_proc : AuraScript
{
[Script] // 304086 - Azerite Fortification
class spell_item_conflict_wearer_on_stun_proc : AuraScript
{
bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
{
Spell procSpell = eventInfo.GetProcSpell();
@@ -498,14 +489,14 @@ namespace Scripts.Spells.Azerite
{
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpell));
}
}
}
[Script] // 305723 - Strife (Azerite Essence)
class spell_item_conflict_rank3 : AuraScript
{
[Script] // 305723 - Strife (Azerite Essence)
class spell_item_conflict_rank3 : AuraScript
{
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();
@@ -531,11 +522,11 @@ namespace Scripts.Spells.Azerite
{
DoCheckProc.Add(new(CheckProc));
}
}
}
[Script] // 277253 - Heart of Azeroth
class spell_item_heart_of_azeroth : AuraScript
{
[Script] // 277253 - Heart of Azeroth
class spell_item_heart_of_azeroth : AuraScript
{
void SetEquippedFlag(AuraEffect effect, AuraEffectHandleModes mode)
{
SetState(true);
@@ -564,11 +555,11 @@ namespace Scripts.Spells.Azerite
OnEffectApply.Add(new(SetEquippedFlag, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
OnEffectRemove.Add(new(ClearEquippedFlag, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
}
[Script] // 315176 - Grasping Tendrils
class spell_item_corruption_grasping_tendrils : AuraScript
{
[Script] // 315176 - Grasping Tendrils
class spell_item_corruption_grasping_tendrils : AuraScript
{
public override bool Load()
{
return GetUnitOwner().IsPlayer();
@@ -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;
}
@@ -585,5 +576,4 @@ namespace Scripts.Spells.Azerite
{
DoEffectCalcAmount.Add(new(CalcAmount, 0, AuraType.ModDecreaseSpeed));
}
}
}
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
+521 -120
View File
@@ -1,51 +1,74 @@
// 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
namespace Scripts.Spells.Evoker;
struct SpellIds
{
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,
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;
LabelEvokerBlue = 1465
}
public const uint LabelEvokerBlue = 1465;
[Script] // 362969 - Azure Strike (blue)
class spell_evo_azure_strike : SpellScript
{
public const uint VisualKitEvokerVerdantEmbraceJump = 152557;
public static uint[] CausalityAffectedEmpowerSpells = [EternitySurge, FireBreath];
}
[Script] // 362969 - Azure Strike (blue)
class spell_evo_azure_strike : SpellScript
{
void FilterTargets(List<WorldObject> targets)
{
targets.Remove(GetExplTargetUnit());
@@ -57,23 +80,23 @@ namespace Scripts.Spells.Evoker
{
OnObjectAreaTargetSelect.Add(new(FilterTargets, 1, Targets.UnitDestAreaEnemy));
}
}
}
// 381732 - Blessing of the Bronze (Bronze)
// 381741 - Blessing of the Bronze (Bronze)
// 381746 - Blessing of the Bronze (Bronze)
// 381748 - Blessing of the Bronze (Bronze)
// 381749 - Blessing of the Bronze (Bronze)
// 381750 - Blessing of the Bronze (Bronze)
// 381751 - Blessing of the Bronze (Bronze)
// 381752 - Blessing of the Bronze (Bronze)
// 381753 - Blessing of the Bronze (Bronze)
// 381754 - Blessing of the Bronze (Bronze)
// 381756 - Blessing of the Bronze (Bronze)
// 381757 - Blessing of the Bronze (Bronze)
[Script] // 381758 - Blessing of the Bronze (Bronze)
class spell_evo_blessing_of_the_bronze : SpellScript
{
// 381732 - Blessing of the Bronze (Bronze)
// 381741 - Blessing of the Bronze (Bronze)
// 381746 - Blessing of the Bronze (Bronze)
// 381748 - Blessing of the Bronze (Bronze)
// 381749 - Blessing of the Bronze (Bronze)
// 381750 - Blessing of the Bronze (Bronze)
// 381751 - Blessing of the Bronze (Bronze)
// 381752 - Blessing of the Bronze (Bronze)
// 381753 - Blessing of the Bronze (Bronze)
// 381754 - Blessing of the Bronze (Bronze)
// 381756 - Blessing of the Bronze (Bronze)
// 381757 - Blessing of the Bronze (Bronze)
[Script] // 381758 - Blessing of the Bronze (Bronze)
class spell_evo_blessing_of_the_bronze : SpellScript
{
void RemoveInvalidTargets(List<WorldObject> targets)
{
targets.RemoveAll(target =>
@@ -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;
});
}
@@ -106,40 +131,217 @@ namespace Scripts.Spells.Evoker
{
OnObjectAreaTargetSelect.Add(new(RemoveInvalidTargets, SpellConst.EffectAll, Targets.UnitCasterAreaRaid));
}
}
[Script] // 375801 - Burnout
class spell_evo_burnout : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.Burnout);
}
[Script] // 370455 - Charged Blast
class spell_evo_charged_blast : AuraScript
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()
{
DoCheckProc.Add(new(CheckProc));
}
}
}
// 357208 Fire Breath (Red)
[Script] // 382266 Fire Breath (Red)
class spell_evo_fire_breath : SpellScript
// 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 ValidateSpellInfo((uint)SpellIds.FireBreathDamage, (uint)SpellIds.BlastFurnace);
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(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)
@@ -150,11 +352,11 @@ namespace Scripts.Spells.Evoker
{
OnEmpowerCompleted.Add(new(OnComplete));
}
}
}
[Script] // 357209 Fire Breath (Red)
class spell_evo_fire_breath_damage : SpellScript
{
[Script] // 357209 Fire Breath (Red)
class spell_evo_fire_breath_damage : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellEffect((spellInfo.Id, 2))
@@ -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)
@@ -183,14 +385,61 @@ namespace Scripts.Spells.Evoker
CalcDamage.Add(new(AddBonusUpfrontDamage));
OnObjectAreaTargetSelect.Add(new(RemoveUnusedEffect, 2, Targets.UnitConeCasterToDestEnemy));
}
}
[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;
}
[Script] // 358733 - Glide (Racial)
class spell_evo_glide : SpellScript
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()
@@ -220,33 +469,33 @@ namespace Scripts.Spells.Evoker
OnCheckCast.Add(new(CheckCast));
OnCast.Add(new(HandleCast));
}
}
}
[Script] // 361469 - Living Flame (Red)
class spell_evo_living_flame : SpellScript
{
[Script] // 361469 - Living Flame (Red)
class spell_evo_living_flame : SpellScript
{
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,19 +504,48 @@ namespace Scripts.Spells.Evoker
}
}
public override void Register()
{
OnEffectHitTarget.Add(new(HandleHitTarget, 0, SpellEffectName.Dummy));
OnEffectLaunchTarget.Add(new(HandleLaunchTarget, 0, SpellEffectName.Dummy));
}
}
}
[Script] // 381773 - Permeating Chill
class spell_evo_permeating_chill : AuraScript
{
[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((uint)SpellIds.PermeatingChillTalent);
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(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;
@@ -290,38 +568,68 @@ namespace Scripts.Spells.Evoker
{
DoCheckProc.Add(new(CheckProc));
}
}
}
[Script] // 393568 - Pyre
class spell_evo_pyre : SpellScript
{
[Script] // 393568 - Pyre
class spell_evo_pyre : SpellScript
{
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));
}
}
}
[Script] // 357209 Fire Breath (Red)
class spell_evo_scouring_flame : SpellScript
{
// 361500 Living Flame (Red)
[Script] // 361509 Living Flame (Red)
class spell_evo_ruby_embers : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo((uint)SpellIds.ScouringFlame);
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(SpellIds.ScouringFlame);
}
void HandleScouringFlame(List<WorldObject> targets)
{
if (!GetCaster().HasAura((uint)SpellIds.ScouringFlame))
if (!GetCaster().HasAura(SpellIds.ScouringFlame))
targets.Clear();
}
@@ -337,5 +645,98 @@ namespace Scripts.Spells.Evoker
OnObjectAreaTargetSelect.Add(new(HandleScouringFlame, 3, Targets.UnitConeCasterToDestEnemy));
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));
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1645 -1473
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+333 -84
View File
@@ -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
{
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,32 +44,83 @@ 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;
return null;
}
}
[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));
}
[Script] // 117952 - Crackling Jade Lightning
class spell_monk_crackling_jade_lightning : AuraScript
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
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.StanceOfTheSpiritedCrane, SpellIds.CracklingJadeLightningChiProc);
@@ -74,16 +138,14 @@ namespace Scripts.Spells.Monk
{
OnEffectPeriodic.Add(new(OnTick, 0, AuraType.PeriodicDamage));
}
}
}
[Script] // 117959 - Crackling Jade Lightning
class spell_monk_crackling_jade_lightning_knockback_proc : AuraScript
{
[Script] // 117959 - Crackling Jade Lightning
class spell_monk_crackling_jade_lightning_knockback_proc_aura : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.CracklingJadeLightningKnockback,
SpellIds.CracklingJadeLightningKnockbackCd
);
return ValidateSpellInfo(SpellIds.CracklingJadeLightningKnockback, SpellIds.CracklingJadeLightningKnockbackCd);
}
bool CheckProc(ProcEventInfo eventInfo)
@@ -112,11 +174,40 @@ namespace Scripts.Spells.Monk
DoCheckProc.Add(new(CheckProc));
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
}
}
[Script] // 450553 - Jade Walk
class spell_monk_jade_walk : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.JadeWalk);
}
[Script] // 116849 - Life Cocoon
class spell_monk_life_cocoon : SpellScript
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
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.CalmingCoalescence);
@@ -136,18 +227,50 @@ namespace Scripts.Spells.Monk
calmingCoalescence.GetBase().Remove();
}
GetSpell().SetSpellValue(new((int)SpellValueMod.BasePoint0, absorb));
GetSpell().SetSpellValue(new(SpellValueMod.BasePoint0, absorb));
}
public override void Register()
{
OnEffectLaunch.Add(new(CalculateAbsorb, 2, SpellEffectName.Dummy));
}
}
[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);
}
[Script] // 392972 - Open Palm Strikes
class spell_monk_open_palm_strikes : AuraScript
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
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellEffect((SpellIds.OpenPalmStrikesTalent, 1));
@@ -163,11 +286,11 @@ namespace Scripts.Spells.Monk
{
DoCheckEffectProc.Add(new(CheckProc, 0, AuraType.ProcTriggerSpell));
}
}
}
[Script] // 121817 - Power Strike
class spell_monk_power_strike_periodic : AuraScript
{
[Script] // 121817 - Power Strike
class spell_monk_power_strike_periodic : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.PowerStrikeProc);
@@ -182,11 +305,11 @@ namespace Scripts.Spells.Monk
{
OnEffectPeriodic.Add(new(HandlePeriodic, 0, AuraType.PeriodicDummy));
}
}
}
[Script] // 129914 - Power Strike Proc
class spell_monk_power_strike_proc : AuraScript
{
[Script] // 129914 - Power Strike Proc
class spell_monk_power_strike_proc : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.PowerStrikeEnergize);
@@ -201,27 +324,51 @@ namespace Scripts.Spells.Monk
{
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
}
}
[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);
}
[Script] // 115546 - Provoke
class spell_monk_provoke : SpellScript
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
{
const uint BlackOxStatusEntry = 61146;
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;
@@ -246,11 +393,39 @@ namespace Scripts.Spells.Monk
OnCheckCast.Add(new(CheckExplicitTarget));
OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy));
}
}
[Script] // 107428 - Rising Sun Kick
class spell_monk_rising_sun_kick : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.CombatConditioning, SpellIds.MortalWounds);
}
[Script] // 109132 - Roll
class spell_monk_roll : SpellScript
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
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.RollBackward, SpellIds.RollForward, SpellIds.NoFeatherFall);
@@ -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);
}
@@ -275,12 +449,12 @@ namespace Scripts.Spells.Monk
OnCheckCast.Add(new(CheckCast));
OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy));
}
}
}
// 107427 - Roll
[Script] // 109131 - Roll (backward)
class spell_monk_roll_AuraScript : AuraScript
{
// 107427 - Roll
[Script] // 109131 - Roll (backward)
class spell_monk_roll_aura : AuraScript
{
void CalcMovementAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
{
amount += 100;
@@ -313,11 +487,71 @@ namespace Scripts.Spells.Monk
AfterEffectApply.Add(new(ChangeRunBackSpeed, 4, AuraType.UseNormalMovementSpeed, AuraEffectHandleModes.Real));
AfterEffectRemove.Add(new(RestoreRunBackSpeed, 4, AuraType.UseNormalMovementSpeed, AuraEffectHandleModes.Real));
}
}
[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));
}
[Script] // 115069 - Stagger
class spell_monk_stagger : AuraScript
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
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.StaggerLight, SpellIds.StaggerModerate, SpellIds.StaggerHeavy);
@@ -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)
@@ -420,11 +656,11 @@ namespace Scripts.Spells.Monk
// We only set the total stagger amount. The amount per tick will be set by the stagger spell script
unit.CastSpell(unit, staggerSpellId, new CastSpellExtraArgs(SpellValueMod.BasePoint1, (int)staggerAmount).SetTriggerFlags(TriggerCastFlags.FullMask));
}
}
}
[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)
{
return ValidateSpellInfo(SpellIds.StaggerLight, SpellIds.StaggerModerate, SpellIds.StaggerHeavy);
@@ -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));
}
}
@@ -450,13 +686,11 @@ namespace Scripts.Spells.Monk
{
OnEffectPeriodic.Add(new(OnPeriodicDamage, 0, AuraType.PeriodicDamage));
}
}
[Script] // 124273, 124274, 124275 - Light/Moderate/Heavy Stagger - SpellIds.StaggerLight / SpellIds.StaggerModerate / SpellIds.StaggerHeavy
class spell_monk_stagger_debuff : AuraScript
{
float _period;
}
[Script] // 124273, 124274, 124275 - Light/Moderate/Heavy Stagger - StaggerLight / StaggerModerate / StaggerHeavy
class spell_monk_stagger_debuff_aura : AuraScript
{
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();
@@ -515,5 +751,18 @@ namespace Scripts.Spells.Monk
eff.ChangeAmount((int)tickDamage);
}
}
}
[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));
}
}
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
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
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff