diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 37 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 1 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 76 |
3 files changed, 114 insertions, 0 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 79e31d3e76e..834fdd84bd3 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5676,6 +5676,31 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger } break; } + // Item - Shadowmourne Legendary + case 71903: + { + if (!pVictim || !pVictim->isAlive() || HasAura(73422)) // cant collect shards while under effect of Chaos Bane buff + return false; + + CastSpell(this, 71905, true, NULL, triggeredByAura); + + // this can't be handled in AuraScript because we need to know pVictim + Aura const* dummy = GetAura(71905); + if (!dummy || dummy->GetStackAmount() < 10) + return false; + + RemoveAurasDueToSpell(71905); + triggered_spell_id = 71904; + target = pVictim; + break; + } + // Shadow's Fate (Shadowmourne questline) + case 71169: + { + triggered_spell_id = 71203; + target = triggeredByAura->GetCaster(); + break; + } } break; } @@ -8754,6 +8779,18 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig case 72202: target = FindNearestCreature(37813, 75.0f); // NPC_DEATHBRINGER_SAURFANG = 37813 break; + // Shadow's Fate (Shadowmourne questline) + case 71169: + if (GetTypeId() != TYPEID_PLAYER) + return false; + if (ToPlayer()->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) // A Feast of Souls + return false; + if (pVictim->GetTypeId() != TYPEID_UNIT) + return false; + // critters are not allowed + if (pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER) + return false; + break; } if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(trigger_spell_id)) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 6c415278ee8..926f9ff952b 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3606,6 +3606,7 @@ void SpellMgr::LoadSpellCustomAttr() case 45150: // Meteor Slash case 64422: case 64688: // Sonic Screech case 72373: // Shared Suffering + case 71904: // Chaos Bane // ONLY SPELLS WITH SPELLFAMILY_GENERIC and EFFECT_SCHOOL_DAMAGE mSpellCustomAttr[i] |= SPELL_ATTR_CU_SHARE_DAMAGE; count++; diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 81b314db9be..1a50126ed64 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -632,6 +632,81 @@ public: } }; +enum eShadowmourneVisuals +{ + SPELL_SHADOWMOURNE_VISUAL_LOW = 72521, + SPELL_SHADOWMOURNE_VISUAL_HIGH = 72523, + SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF = 73422, +}; + +class spell_item_shadowmourne : public SpellScriptLoader +{ +public: + spell_item_shadowmourne() : SpellScriptLoader("spell_item_shadowmourne") { } + + class spell_item_shadowmourne_AuraScript : public AuraScript + { + public: + spell_item_shadowmourne_AuraScript() : AuraScript(), prevStackCount(0) { } + + bool Validate(SpellEntry const* /*spellEntry*/) + { + if (!sSpellStore.LookupEntry(SPELL_SHADOWMOURNE_VISUAL_LOW)) + return false; + if (!sSpellStore.LookupEntry(SPELL_SHADOWMOURNE_VISUAL_HIGH)) + return false; + if (!sSpellStore.LookupEntry(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) + return false; + return true; + } + + void OnStackChange(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + { + Unit* target = aurApp->GetTarget(); + if (!target) + return; + switch (GetStackAmount()) + { + case 1: + target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_LOW, true); + break; + case 6: + target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW); + target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_HIGH, true); + break; + case 10: + target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH); + target->CastSpell(target, SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF, true); + break; + } + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + { + Unit* target = aurApp->GetTarget(); + if (!target) + return; + if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_STACK) + return; + target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW); + target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH); + } + + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_item_shadowmourne_AuraScript::OnStackChange, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_item_shadowmourne_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_REAL); + } + + uint8 prevStackCount; + }; + + AuraScript* GetAuraScript() const + { + return new spell_item_shadowmourne_AuraScript(); + } +}; + enum eGenericData { SPELL_ARCANITE_DRAGONLING = 19804, @@ -661,4 +736,5 @@ void AddSC_item_spell_scripts() new spell_item_savory_deviate_delight(); new spell_item_six_demon_bag(); new spell_item_underbelly_elixir(); + new spell_item_shadowmourne(); } |