Added missing null checks for DamageInfo struct
Misc spell fixes
This commit is contained in:
@@ -1657,7 +1657,7 @@ namespace Framework.Constants
|
|||||||
ScalesWithItemLevel = 0x04, // 2
|
ScalesWithItemLevel = 0x04, // 2
|
||||||
Unk3 = 0x08, // 3
|
Unk3 = 0x08, // 3
|
||||||
Unk4 = 0x10, // 4
|
Unk4 = 0x10, // 4
|
||||||
AbsorbFallDamage = 0x20, // 5
|
AbsorbEnvironmentalDamage = 0x20, // 5
|
||||||
Unk6 = 0x40, // 6
|
Unk6 = 0x40, // 6
|
||||||
RankIgnoresCasterLevel = 0x80, // 7 Spell_C_GetSpellRank returns SpellLevels->MaxLevel * 5 instead of std::min(SpellLevels->MaxLevel, caster->Level) * 5
|
RankIgnoresCasterLevel = 0x80, // 7 Spell_C_GetSpellRank returns SpellLevels->MaxLevel * 5 instead of std::min(SpellLevels->MaxLevel, caster->Level) * 5
|
||||||
Unk8 = 0x100, // 8
|
Unk8 = 0x100, // 8
|
||||||
|
|||||||
@@ -2801,7 +2801,7 @@ namespace Game.Spells
|
|||||||
else if (caster)
|
else if (caster)
|
||||||
level = caster.getLevel();
|
level = caster.getLevel();
|
||||||
|
|
||||||
if (!_spellInfo.HasAttribute(SpellAttr11.ScalesWithItemLevel) && _spellInfo.HasAttribute(SpellAttr10.UseSpellBaseLevelForScaling))
|
if (_spellInfo.BaseLevel != 0 && !_spellInfo.HasAttribute(SpellAttr11.ScalesWithItemLevel) && _spellInfo.HasAttribute(SpellAttr10.UseSpellBaseLevelForScaling))
|
||||||
level = _spellInfo.BaseLevel;
|
level = _spellInfo.BaseLevel;
|
||||||
|
|
||||||
if (_spellInfo.Scaling.MinScalingLevel != 0 && _spellInfo.Scaling.MinScalingLevel > level)
|
if (_spellInfo.Scaling.MinScalingLevel != 0 && _spellInfo.Scaling.MinScalingLevel > level)
|
||||||
|
|||||||
@@ -393,7 +393,6 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.KrikthirTheGatewatcher
|
|||||||
{
|
{
|
||||||
public npc_watcher_gashra(Creature creature) : base(creature, true)
|
public npc_watcher_gashra(Creature creature) : base(creature, true)
|
||||||
{
|
{
|
||||||
_instance = creature.GetInstanceScript();
|
|
||||||
me.SetReactState(ReactStates.Passive);
|
me.SetReactState(ReactStates.Passive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,10 +450,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.KrikthirTheGatewatcher
|
|||||||
[Script]
|
[Script]
|
||||||
class npc_watcher_narjil : npc_gatewatcher_petAI
|
class npc_watcher_narjil : npc_gatewatcher_petAI
|
||||||
{
|
{
|
||||||
public npc_watcher_narjil(Creature creature) : base(creature, true)
|
public npc_watcher_narjil(Creature creature) : base(creature, true) { }
|
||||||
{
|
|
||||||
_instance = creature.GetInstanceScript();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
@@ -510,10 +506,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.KrikthirTheGatewatcher
|
|||||||
[Script]
|
[Script]
|
||||||
class npc_watcher_silthik : npc_gatewatcher_petAI
|
class npc_watcher_silthik : npc_gatewatcher_petAI
|
||||||
{
|
{
|
||||||
public npc_watcher_silthik(Creature creature) : base(creature, true)
|
public npc_watcher_silthik(Creature creature) : base(creature, true) { }
|
||||||
{
|
|
||||||
_instance = creature.GetInstanceScript();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ namespace Scripts.Spells.Generic
|
|||||||
|
|
||||||
bool CheckProc(ProcEventInfo eventInfo)
|
bool CheckProc(ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
if (eventInfo.GetDamageInfo().GetSpellInfo() != null) // eventInfo.GetSpellInfo()
|
if (eventInfo.GetSpellInfo() == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// find Mage Armor
|
// find Mage Armor
|
||||||
@@ -1705,7 +1705,7 @@ namespace Scripts.Spells.Generic
|
|||||||
|
|
||||||
bool CheckProc(ProcEventInfo eventInfo)
|
bool CheckProc(ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
if (eventInfo.GetDamageInfo().GetSpellInfo() != null) // eventInfo.GetSpellInfo()
|
if (eventInfo.GetSpellInfo() == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (SharedConst.GetFirstSchoolInMask(eventInfo.GetSchoolMask()) == SpellSchools.Normal)
|
if (SharedConst.GetFirstSchoolInMask(eventInfo.GetSchoolMask()) == SpellSchools.Normal)
|
||||||
|
|||||||
@@ -483,9 +483,16 @@ namespace Scripts.Spells.Hunter
|
|||||||
return ValidateSpellInfo(SpellIds.RoarOfSacrificeTriggered);
|
return ValidateSpellInfo(SpellIds.RoarOfSacrificeTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckProc(ProcEventInfo eventInfo)
|
bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
return GetCaster() && ((uint)eventInfo.GetDamageInfo().GetSchoolMask() & GetEffect(1).GetMiscValue()) != 0;
|
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||||
|
if (damageInfo == null || !Convert.ToBoolean((int)damageInfo.GetSchoolMask() & aurEff.GetMiscValue()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!GetCaster())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||||
@@ -498,7 +505,7 @@ namespace Scripts.Spells.Hunter
|
|||||||
|
|
||||||
public override void Register()
|
public override void Register()
|
||||||
{
|
{
|
||||||
DoCheckProc.Add(new CheckProcHandler(CheckProc));
|
DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckProc, 1, AuraType.Dummy));
|
||||||
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy));
|
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1360,7 +1360,11 @@ namespace Scripts.Spells.Items
|
|||||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
PreventDefaultAction();
|
PreventDefaultAction();
|
||||||
int bp = (int)MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount());
|
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||||
|
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int bp = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount());
|
||||||
GetTarget().CastCustomSpell(SpellIds.ItemNecroticTouchProc, SpellValueMod.BasePoint0, bp, eventInfo.GetProcTarget(), true, null, aurEff);
|
GetTarget().CastCustomSpell(SpellIds.ItemNecroticTouchProc, SpellValueMod.BasePoint0, bp, eventInfo.GetProcTarget(), true, null, aurEff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -258,7 +258,11 @@ namespace Scripts.Spells.Paladin
|
|||||||
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
void HandleEffectProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
PreventDefaultAction();
|
PreventDefaultAction();
|
||||||
int damage = (int)MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount());
|
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||||
|
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int damage = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount());
|
||||||
GetTarget().CastCustomSpell(SpellIds.EyeForAnEyeDamage, SpellValueMod.BasePoint0, damage, eventInfo.GetProcTarget(), true, null, aurEff);
|
GetTarget().CastCustomSpell(SpellIds.EyeForAnEyeDamage, SpellValueMod.BasePoint0, damage, eventInfo.GetProcTarget(), true, null, aurEff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,32 @@ namespace Scripts.Spells.Warlock
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Script] // 77220 - Mastery: Chaotic Energies
|
||||||
|
class spell_warl_chaotic_energies : AuraScript
|
||||||
|
{
|
||||||
|
void HandleAbsorb(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
|
||||||
|
{
|
||||||
|
AuraEffect effect1 = GetEffect(1);
|
||||||
|
if (effect1 == null || !GetTargetApplication().HasEffect(1))
|
||||||
|
{
|
||||||
|
PreventDefaultAction();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// You take ${$s2/3}% reduced damage
|
||||||
|
float damageReductionPct = effect1.GetAmount() / 3;
|
||||||
|
// plus a random amount of up to ${$s2/3}% additional reduced damage
|
||||||
|
damageReductionPct += RandomHelper.FRand(0.0f, damageReductionPct);
|
||||||
|
|
||||||
|
absorbAmount = MathFunctions.CalculatePct(dmgInfo.GetDamage(), damageReductionPct);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Register()
|
||||||
|
{
|
||||||
|
OnEffectAbsorb.Add(new EffectAbsorbHandler(HandleAbsorb, 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Script] // 6201 - Create Healthstone
|
[Script] // 6201 - Create Healthstone
|
||||||
class spell_warl_create_healthstone : SpellScript
|
class spell_warl_create_healthstone : SpellScript
|
||||||
{
|
{
|
||||||
@@ -409,7 +435,11 @@ namespace Scripts.Spells.Warlock
|
|||||||
|
|
||||||
bool CheckProc(ProcEventInfo eventInfo)
|
bool CheckProc(ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
return GetTarget().GetGuardianPet() && eventInfo.GetDamageInfo().GetDamage() != 0;
|
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||||
|
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return GetTarget().GetGuardianPet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
void onProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||||
@@ -656,7 +686,7 @@ namespace Scripts.Spells.Warlock
|
|||||||
{
|
{
|
||||||
PreventDefaultAction();
|
PreventDefaultAction();
|
||||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||||
if (damageInfo == null)
|
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int amount = (int)(aurEff.GetAmount() - damageInfo.GetDamage());
|
int amount = (int)(aurEff.GetAmount() - damageInfo.GetDamage());
|
||||||
@@ -700,7 +730,7 @@ namespace Scripts.Spells.Warlock
|
|||||||
{
|
{
|
||||||
PreventDefaultAction();
|
PreventDefaultAction();
|
||||||
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||||
if (damageInfo == null)
|
if (damageInfo == null || damageInfo.GetDamage() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int amount = aurEff.GetAmount() - (int)damageInfo.GetDamage();
|
int amount = aurEff.GetAmount() - (int)damageInfo.GetDamage();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Scripts.Spells.Warrior
|
|||||||
{
|
{
|
||||||
struct SpellIds
|
struct SpellIds
|
||||||
{
|
{
|
||||||
|
public const uint BladestormPeriodicWhirlwind = 50622;
|
||||||
public const uint BloodthirstHeal = 117313;
|
public const uint BloodthirstHeal = 117313;
|
||||||
public const uint Charge = 34846;
|
public const uint Charge = 34846;
|
||||||
public const uint ChargeEffect = 218104;
|
public const uint ChargeEffect = 218104;
|
||||||
@@ -61,7 +62,8 @@ namespace Scripts.Spells.Warrior
|
|||||||
public const uint Slam = 50782;
|
public const uint Slam = 50782;
|
||||||
public const uint Stoicism = 70845;
|
public const uint Stoicism = 70845;
|
||||||
public const uint StormBoltStun = 132169;
|
public const uint StormBoltStun = 132169;
|
||||||
public const uint SweepingStrikesExtraAttack = 26654;
|
public const uint SweepingStrikesExtraAttack1 = 12723;
|
||||||
|
public const uint SweepingStrikesExtraAttack2 = 26654;
|
||||||
public const uint Taunt = 355;
|
public const uint Taunt = 355;
|
||||||
public const uint TraumaEffect = 215537;
|
public const uint TraumaEffect = 215537;
|
||||||
public const uint UnrelentingAssaultRank1 = 46859;
|
public const uint UnrelentingAssaultRank1 = 46859;
|
||||||
@@ -703,13 +705,7 @@ namespace Scripts.Spells.Warrior
|
|||||||
{
|
{
|
||||||
public override bool Validate(SpellInfo spellInfo)
|
public override bool Validate(SpellInfo spellInfo)
|
||||||
{
|
{
|
||||||
return ValidateSpellInfo(SpellIds.SweepingStrikesExtraAttack);
|
return ValidateSpellInfo(SpellIds.SweepingStrikesExtraAttack1, SpellIds.SweepingStrikesExtraAttack2);
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Load()
|
|
||||||
{
|
|
||||||
_procTarget = null;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckProc(ProcEventInfo eventInfo)
|
bool CheckProc(ProcEventInfo eventInfo)
|
||||||
@@ -721,7 +717,21 @@ namespace Scripts.Spells.Warrior
|
|||||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
PreventDefaultAction();
|
PreventDefaultAction();
|
||||||
GetTarget().CastSpell(_procTarget, SpellIds.SweepingStrikesExtraAttack, true, null, aurEff);
|
DamageInfo damageInfo = eventInfo.GetDamageInfo();
|
||||||
|
if (damageInfo != null)
|
||||||
|
{
|
||||||
|
SpellInfo spellInfo = damageInfo.GetSpellInfo();
|
||||||
|
if (spellInfo != null && (spellInfo.Id == SpellIds.BladestormPeriodicWhirlwind || (spellInfo.Id == SpellIds.Execute && !_procTarget.HasAuraState(AuraStateType.HealthLess20Percent))))
|
||||||
|
{
|
||||||
|
// If triggered by Execute (while target is not under 20% hp) or Bladestorm deals normalized weapon damage
|
||||||
|
GetTarget().CastSpell(_procTarget, SpellIds.SweepingStrikesExtraAttack2, true, null, aurEff);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int damage = (int)damageInfo.GetDamage();
|
||||||
|
GetTarget().CastCustomSpell(SpellIds.SweepingStrikesExtraAttack1, SpellValueMod.BasePoint0, damage, _procTarget, true, null, aurEff);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Register()
|
public override void Register()
|
||||||
|
|||||||
Reference in New Issue
Block a user