Core/Spell: restore old proc system behaviour on auras self proc.

- Use Spell::m_triggeredByAuraSpell and compare against trigger aura, it requires scripts to set triggeredByAura parameter.
- Fixed existing scripts lacking it

DB/Spell: Anger Capacitor (Tiny Abomination in a Jar) proc

Closes #18269

(cherry picked from commit 5b56c94e6d)

# Conflicts:
#	src/server/game/Entities/Unit/Unit.cpp
#	src/server/game/Spells/Auras/SpellAuras.cpp
#	src/server/game/Spells/Spell.cpp
#	src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
#	src/server/scripts/Pet/pet_hunter.cpp
#	src/server/scripts/Spells/spell_dk.cpp
#	src/server/scripts/Spells/spell_druid.cpp
#	src/server/scripts/Spells/spell_hunter.cpp
#	src/server/scripts/Spells/spell_item.cpp
#	src/server/scripts/Spells/spell_mage.cpp
#	src/server/scripts/Spells/spell_paladin.cpp
#	src/server/scripts/Spells/spell_priest.cpp
#	src/server/scripts/Spells/spell_rogue.cpp
#	src/server/scripts/Spells/spell_shaman.cpp
#	src/server/scripts/Spells/spell_warlock.cpp
#	src/server/scripts/Spells/spell_warrior.cpp
This commit is contained in:
ariel-
2016-11-19 03:05:44 -03:00
committed by joschiwald
parent 843a190052
commit 8cb118009e
19 changed files with 118 additions and 100 deletions

View File

@@ -217,7 +217,7 @@ class spell_item_anger_capacitor : public SpellScriptLoader
});
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
@@ -234,7 +234,7 @@ class spell_item_anger_capacitor : public SpellScriptLoader
if (player->GetWeaponForAttack(OFF_ATTACK, true) && urand(0, 1))
spellId = SPELL_MANIFEST_ANGER_OFF_HAND;
caster->CastSpell(target, spellId, true);
caster->CastSpell(target, spellId, true, nullptr, aurEff);
}
void Register() override
@@ -323,7 +323,7 @@ class spell_item_aura_of_madness : public SpellScriptLoader
});
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
static std::vector<uint32> const triggeredSpells[MAX_CLASSES] =
{
@@ -356,7 +356,7 @@ class spell_item_aura_of_madness : public SpellScriptLoader
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
uint32 spellId = Trinity::Containers::SelectRandomContainerElement(triggeredSpells[caster->getClass()]);
caster->CastSpell(caster, spellId, true);
caster->CastSpell(caster, spellId, true, nullptr, aurEff);
if (roll_chance_i(10))
caster->Unit::Say(SAY_MADNESS);
@@ -389,10 +389,10 @@ class spell_item_dementia : public SpellScriptLoader
return ValidateSpellInfo({ SPELL_DEMENTIA_POS, SPELL_DEMENTIA_NEG });
}
void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
void HandlePeriodicDummy(AuraEffect const* aurEff)
{
PreventDefaultAction();
GetTarget()->CastSpell(GetTarget(), RAND(SPELL_DEMENTIA_POS, SPELL_DEMENTIA_NEG), true);
GetTarget()->CastSpell(GetTarget(), RAND(SPELL_DEMENTIA_POS, SPELL_DEMENTIA_NEG), true, nullptr, aurEff);
}
void Register() override
@@ -450,7 +450,7 @@ class spell_item_blessing_of_ancient_kings : public SpellScriptLoader
protEff->GetBase()->RefreshDuration();
}
else
GetTarget()->CastCustomSpell(SPELL_PROTECTION_OF_ANCIENT_KINGS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, NULL, aurEff);
GetTarget()->CastCustomSpell(SPELL_PROTECTION_OF_ANCIENT_KINGS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, nullptr, aurEff);
}
void Register() override
@@ -575,7 +575,7 @@ class spell_item_deathbringers_will : public SpellScriptLoader
});
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
static std::vector<uint32> const triggeredSpells[MAX_CLASSES] =
{
@@ -607,12 +607,12 @@ class spell_item_deathbringers_will : public SpellScriptLoader
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
auto const& randomSpells = triggeredSpells[caster->getClass()];
std::vector<uint32> const& randomSpells = triggeredSpells[caster->getClass()];
if (randomSpells.empty())
return;
uint32 spellId = Trinity::Containers::SelectRandomContainerElement(randomSpells);
caster->CastSpell(caster, spellId, true);
caster->CastSpell(caster, spellId, true, nullptr, aurEff);
}
void Register() override
@@ -1038,7 +1038,7 @@ class spell_item_frozen_shadoweave : public SpellScriptLoader
int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
Unit* caster = eventInfo.GetActor();
caster->CastCustomSpell(SPELL_SHADOWMEND, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true);
caster->CastCustomSpell(SPELL_SHADOWMEND, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true, nullptr, aurEff);
}
void Register() override
@@ -1081,9 +1081,9 @@ class spell_item_gnomish_death_ray : public SpellScriptLoader
if (Unit* target = GetHitUnit())
{
if (urand(0, 99) < 15)
caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true, NULL); // failure
caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true); // failure
else
caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true, NULL);
caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true);
}
}
@@ -1139,7 +1139,7 @@ class spell_item_heartpierce : public SpellScriptLoader
});
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
@@ -1156,6 +1156,7 @@ class spell_item_heartpierce : public SpellScriptLoader
case POWER_RAGE:
spellId = Rage;
break;
// Death Knights can't use daggers, but oh well
case POWER_RUNIC_POWER:
spellId = RunicPower;
break;
@@ -1163,7 +1164,7 @@ class spell_item_heartpierce : public SpellScriptLoader
return;
}
caster->CastSpell((Unit*)nullptr, spellId, true);
caster->CastSpell((Unit*)nullptr, spellId, true, nullptr, aurEff);
}
void Register() override
@@ -1301,14 +1302,14 @@ class spell_item_mark_of_conquest : public SpellScriptLoader
return ValidateSpellInfo({ SPELL_MARK_OF_CONQUEST_ENERGIZE });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
if (eventInfo.GetTypeMask() & (PROC_FLAG_DONE_RANGED_AUTO_ATTACK | PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS))
{
// in that case, do not cast heal spell
PreventDefaultAction();
// but mana instead
eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_MARK_OF_CONQUEST_ENERGIZE, true);
eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_MARK_OF_CONQUEST_ENERGIZE, true, nullptr, aurEff);
}
}
@@ -1468,7 +1469,7 @@ class spell_item_net_o_matic : public SpellScriptLoader
else if (roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown)
spellId = SPELL_NET_O_MATIC_TRIGGERED2;
GetCaster()->CastSpell(target, spellId, true, NULL);
GetCaster()->CastSpell(target, spellId, true, nullptr);
}
}
@@ -1527,7 +1528,7 @@ class spell_item_noggenfogger_elixir : public SpellScriptLoader
case 2: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2; break;
}
caster->CastSpell(caster, spellId, true, NULL);
caster->CastSpell(caster, spellId, true, nullptr);
}
void Register() override
@@ -1660,7 +1661,7 @@ class spell_item_pet_healing : public SpellScriptLoader
int32 bp = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
Unit* caster = eventInfo.GetActor();
caster->CastCustomSpell(SPELL_HEALTH_LINK, SPELLVALUE_BASE_POINT0, bp, (Unit*)nullptr, true);
caster->CastCustomSpell(SPELL_HEALTH_LINK, SPELLVALUE_BASE_POINT0, bp, (Unit*)nullptr, true, nullptr, aurEff);
}
void Register() override
@@ -2135,7 +2136,7 @@ class spell_item_swift_hand_justice_dummy : public SpellScriptLoader
Unit* caster = eventInfo.GetActor();
int32 amount = caster->CountPctFromMaxHealth(aurEff->GetAmount());
caster->CastCustomSpell(SPELL_SWIFT_HAND_OF_JUSTICE_HEAL, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true);
caster->CastCustomSpell(SPELL_SWIFT_HAND_OF_JUSTICE_HEAL, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true, nullptr, aurEff);
}
void Register() override
@@ -3617,17 +3618,17 @@ class spell_item_shard_of_the_scale : public SpellScriptLoader
return ValidateSpellInfo({ HealProc, DamageProc });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
Unit* target = eventInfo.GetProcTarget();
if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS)
caster->CastSpell(target, HealProc, true);
caster->CastSpell(target, HealProc, true, nullptr, aurEff);
if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG)
caster->CastSpell(target, DamageProc, true);
caster->CastSpell(target, DamageProc, true, nullptr, aurEff);
}
void Register() override
@@ -3766,7 +3767,7 @@ class spell_item_sunwell_neck : public SpellScriptLoader
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Player* player = eventInfo.GetActor()->ToPlayer();
@@ -3774,10 +3775,10 @@ class spell_item_sunwell_neck : public SpellScriptLoader
// Aggression checks are in the spell system... just cast and forget
if (player->GetReputationRank(FACTION_ALDOR) == REP_EXALTED)
player->CastSpell(target, Aldors, true);
player->CastSpell(target, Aldors, true, nullptr, aurEff);
if (player->GetReputationRank(FACTION_SCRYERS) == REP_EXALTED)
player->CastSpell(target, Scryers, true);
player->CastSpell(target, Scryers, true, nullptr, aurEff);
}
void Register() override