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
+25 -2
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,7 +336,7 @@ namespace Game.Entities
m_damage -= amount;
m_hitMask |= ProcFlagsHit.Absorb;
}
public void ResistDamage(uint amount)
public void ResistDamage(ref uint amount)
{
amount = Math.Min(amount, GetDamage());
m_resist += amount;
@@ -335,7 +347,18 @@ namespace Game.Entities
m_hitMask &= ~(ProcFlagsHit.Normal | ProcFlagsHit.Critical);
}
}
void BlockDamage(uint amount)
public void ResistDamage(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 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)
{