Core/Spells: Moved applying exclusive aura spells to scripts
This commit is contained in:
@@ -2287,15 +2287,6 @@ namespace Game.Spells
|
|||||||
|
|
||||||
void DoTriggersOnSpellHit(Unit unit, uint effMask)
|
void DoTriggersOnSpellHit(Unit unit, uint effMask)
|
||||||
{
|
{
|
||||||
// Apply additional spell effects to target
|
|
||||||
/// @todo move this code to scripts
|
|
||||||
if (m_preCastSpell != 0)
|
|
||||||
{
|
|
||||||
if (Global.SpellMgr.GetSpellInfo(m_preCastSpell) != null)
|
|
||||||
// Blizz seems to just apply aura without bothering to cast
|
|
||||||
m_caster.AddAura(m_preCastSpell, unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras
|
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras
|
||||||
// this is executed after spell proc spells on target hit
|
// this is executed after spell proc spells on target hit
|
||||||
// spells are triggered for each hit spell target
|
// spells are triggered for each hit spell target
|
||||||
@@ -2307,7 +2298,7 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
if (CanExecuteTriggersOnHit(effMask, hit.triggeredByAura) && RandomHelper.randChance(hit.chance))
|
if (CanExecuteTriggersOnHit(effMask, hit.triggeredByAura) && RandomHelper.randChance(hit.chance))
|
||||||
{
|
{
|
||||||
m_caster.CastSpell(unit, hit.triggeredSpell, true);
|
m_caster.CastSpell(unit, hit.triggeredSpell, TriggerCastFlags.FullMask);
|
||||||
Log.outDebug(LogFilter.Spells, "Spell {0} triggered spell {1} by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo.Id, hit.triggeredSpell.Id);
|
Log.outDebug(LogFilter.Spells, "Spell {0} triggered spell {1} by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo.Id, hit.triggeredSpell.Id);
|
||||||
|
|
||||||
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
|
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
|
||||||
@@ -6938,62 +6929,32 @@ namespace Game.Spells
|
|||||||
|
|
||||||
void PrepareTriggersExecutedOnHit()
|
void PrepareTriggersExecutedOnHit()
|
||||||
{
|
{
|
||||||
// @todo move this to scripts
|
|
||||||
if (m_spellInfo.SpellFamilyName != 0)
|
|
||||||
{
|
|
||||||
SpellInfo excludeCasterSpellInfo = Global.SpellMgr.GetSpellInfo(m_spellInfo.ExcludeCasterAuraSpell);
|
|
||||||
if (excludeCasterSpellInfo != null && !excludeCasterSpellInfo.IsPositive())
|
|
||||||
m_preCastSpell = m_spellInfo.ExcludeCasterAuraSpell;
|
|
||||||
SpellInfo excludeTargetSpellInfo = Global.SpellMgr.GetSpellInfo(m_spellInfo.ExcludeTargetAuraSpell);
|
|
||||||
if (excludeTargetSpellInfo != null && !excludeTargetSpellInfo.IsPositive())
|
|
||||||
m_preCastSpell = m_spellInfo.ExcludeTargetAuraSpell;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @todo move this to scripts
|
|
||||||
switch (m_spellInfo.SpellFamilyName)
|
|
||||||
{
|
|
||||||
case SpellFamilyNames.Mage:
|
|
||||||
{
|
|
||||||
// Permafrost
|
|
||||||
if (m_spellInfo.SpellFamilyFlags[1].HasAnyFlag(0x00001000u) || m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00100220u))
|
|
||||||
m_preCastSpell = 68391;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras:
|
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras:
|
||||||
// save auras which were present on spell caster on cast, to prevent triggered auras from affecting caster
|
// save auras which were present on spell caster on cast, to prevent triggered auras from affecting caster
|
||||||
// and to correctly calculate proc chance when combopoints are present
|
// and to correctly calculate proc chance when combopoints are present
|
||||||
var targetTriggers = m_caster.GetAuraEffectsByType(AuraType.AddTargetTrigger);
|
var targetTriggers = m_caster.GetAuraEffectsByType(AuraType.AddTargetTrigger);
|
||||||
foreach (var eff in targetTriggers)
|
foreach (var aurEff in targetTriggers)
|
||||||
{
|
{
|
||||||
if (!eff.IsAffectingSpell(m_spellInfo))
|
if (!aurEff.IsAffectingSpell(m_spellInfo))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SpellInfo auraSpellInfo = eff.GetSpellInfo();
|
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(aurEff.GetSpellEffectInfo().TriggerSpell);
|
||||||
byte auraSpellIdx = eff.GetEffIndex();
|
|
||||||
SpellEffectInfo auraEffect = auraSpellInfo.GetEffect(m_caster.GetMap().GetDifficultyID(), auraSpellIdx);
|
|
||||||
if (auraEffect != null)
|
|
||||||
{
|
|
||||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(auraEffect.TriggerSpell);
|
|
||||||
if (spellInfo != null)
|
if (spellInfo != null)
|
||||||
{
|
{
|
||||||
// calculate the chance using spell base amount, because aura amount is not updated on combo-points change
|
// calculate the chance using spell base amount, because aura amount is not updated on combo-points change
|
||||||
// this possibly needs fixing
|
// this possibly needs fixing
|
||||||
int auraBaseAmount = eff.GetBaseAmount();
|
int auraBaseAmount = aurEff.GetBaseAmount();
|
||||||
// proc chance is stored in effect amount
|
// proc chance is stored in effect amount
|
||||||
int chance = m_caster.CalculateSpellDamage(null, auraSpellInfo, auraSpellIdx, auraBaseAmount);
|
int chance = m_caster.CalculateSpellDamage(null, aurEff.GetSpellInfo(), aurEff.GetEffIndex(), auraBaseAmount);
|
||||||
// build trigger and add to the list
|
// build trigger and add to the list
|
||||||
HitTriggerSpell spellTriggerInfo = new HitTriggerSpell();
|
HitTriggerSpell spellTriggerInfo;
|
||||||
spellTriggerInfo.triggeredSpell = spellInfo;
|
spellTriggerInfo.triggeredSpell = spellInfo;
|
||||||
spellTriggerInfo.triggeredByAura = auraSpellInfo;
|
spellTriggerInfo.triggeredByAura = aurEff.GetSpellInfo();
|
||||||
spellTriggerInfo.chance = chance * eff.GetBase().GetStackAmount();
|
spellTriggerInfo.chance = chance * aurEff.GetBase().GetStackAmount();
|
||||||
|
|
||||||
m_hitTriggerSpells.Add(spellTriggerInfo);
|
m_hitTriggerSpells.Add(spellTriggerInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool HasGlobalCooldown()
|
bool HasGlobalCooldown()
|
||||||
{
|
{
|
||||||
@@ -7220,7 +7181,6 @@ namespace Game.Spells
|
|||||||
public SpellCastFlagsEx m_castFlagsEx;
|
public SpellCastFlagsEx m_castFlagsEx;
|
||||||
public SpellMisc m_misc;
|
public SpellMisc m_misc;
|
||||||
public uint m_SpellVisual;
|
public uint m_SpellVisual;
|
||||||
public uint m_preCastSpell;
|
|
||||||
public SpellCastTargets m_targets;
|
public SpellCastTargets m_targets;
|
||||||
public sbyte m_comboPointGain;
|
public sbyte m_comboPointGain;
|
||||||
public SpellCustomErrors m_customError;
|
public SpellCustomErrors m_customError;
|
||||||
|
|||||||
@@ -2542,6 +2542,48 @@ namespace Scripts.Spells.Generic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Script]
|
||||||
|
class spell_gen_trigger_exclude_caster_aura_spell_SpellScript : SpellScript
|
||||||
|
{
|
||||||
|
public override bool Validate(SpellInfo spellInfo)
|
||||||
|
{
|
||||||
|
return ValidateSpellInfo(spellInfo.ExcludeCasterAuraSpell);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleTrigger()
|
||||||
|
{
|
||||||
|
// Blizz seems to just apply aura without bothering to cast
|
||||||
|
GetCaster().AddAura(GetSpellInfo().ExcludeCasterAuraSpell, GetCaster());
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Register()
|
||||||
|
{
|
||||||
|
AfterCast.Add(new CastHandler(HandleTrigger));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Script]
|
||||||
|
class spell_gen_trigger_exclude_target_aura_spell_SpellScript : SpellScript
|
||||||
|
{
|
||||||
|
public override bool Validate(SpellInfo spellInfo)
|
||||||
|
{
|
||||||
|
return ValidateSpellInfo(spellInfo.ExcludeTargetAuraSpell);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleTrigger()
|
||||||
|
{
|
||||||
|
Unit target = GetHitUnit();
|
||||||
|
if (target)
|
||||||
|
// Blizz seems to just apply aura without bothering to cast
|
||||||
|
GetCaster().AddAura(GetSpellInfo().ExcludeTargetAuraSpell, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Register()
|
||||||
|
{
|
||||||
|
AfterHit.Add(new HitHandler(HandleTrigger));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Script("spell_pvp_trinket_shared_cd", SpellIds.WillOfTheForsakenCooldownTrigger)]
|
[Script("spell_pvp_trinket_shared_cd", SpellIds.WillOfTheForsakenCooldownTrigger)]
|
||||||
[Script("spell_wotf_shared_cd", SpellIds.WillOfTheForsakenCooldownTriggerWotf)]
|
[Script("spell_wotf_shared_cd", SpellIds.WillOfTheForsakenCooldownTriggerWotf)]
|
||||||
class spell_pvp_trinket_wotf_shared_cd : SpellScript
|
class spell_pvp_trinket_wotf_shared_cd : SpellScript
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
DELETE FROM `spell_script_names` WHERE `ScriptName` IN (
|
||||||
|
'spell_gen_trigger_exclude_caster_aura_spell',
|
||||||
|
'spell_gen_trigger_exclude_target_aura_spell');
|
||||||
|
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||||
|
(45438, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
--
|
||||||
|
(100, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(172, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(1454, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(2823, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(3411, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(31790, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(36554, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(49376, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(77606, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(79830, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(82828, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(100780, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(100784, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(100950, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(102416, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(102417, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(119996, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(121471, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(122506, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(131632, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(143395, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(145158, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(146739, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(159607, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(178338, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(193549, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(194834, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(195457, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(198304, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(198337, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(198758, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(200153, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(205523, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(212284, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(213398, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(213831, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
(219779, 'spell_gen_trigger_exclude_caster_aura_spell'),
|
||||||
|
--
|
||||||
|
(20484, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(20707, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(61999, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(126393, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(159931, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(159956, 'spell_gen_trigger_exclude_target_aura_spell'),
|
||||||
|
(226277, 'spell_gen_trigger_exclude_target_aura_spell');
|
||||||
Reference in New Issue
Block a user