diff options
| author | Vincent_Michael <Vincent_Michael@gmx.de> | 2014-01-24 19:32:13 +0100 |
|---|---|---|
| committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2014-01-24 19:36:32 +0100 |
| commit | a5ade26fa0b1771d7adaf8c3ca8631421e8f670b (patch) | |
| tree | 7f8b4e3add4b7f323ae8aa869ccd2c5ca3af069e /src/server/scripts/Spells | |
| parent | b61bf8f01f6ec9298df6b94eb31cadbde72c4b57 (diff) | |
| parent | 9531073b7787ae65140b436395411194b43fd4ed (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Handlers/ChatHandler.cpp
src/server/game/Spells/Auras/SpellAuraEffects.cpp
src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
src/server/scripts/Spells/spell_rogue.cpp
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_quest.cpp | 46 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 105 |
2 files changed, 125 insertions, 26 deletions
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 4dd06b762a1..cdf32bd94d5 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1606,6 +1606,7 @@ class spell_q12527_zuldrak_rat : public SpellScriptLoader } }; +// 55368 - Summon Stefan class spell_q12661_q12669_q12676_q12677_q12713_summon_stefan : public SpellScriptLoader { public: @@ -1615,19 +1616,16 @@ class spell_q12661_q12669_q12676_q12677_q12713_summon_stefan : public SpellScrip { PrepareSpellScript(spell_q12661_q12669_q12676_q12677_q12713_summon_stefan_SpellScript); - void ChangeSummonPos(SpellEffIndex /*effIndex*/) + void SetDest(SpellDestination& dest) { // Adjust effect summon position - WorldLocation summonPos = *GetExplTargetDest(); - Position offset = { 0.0f, 0.0f, 20.0f, 0.0f }; - summonPos.RelocateOffset(offset); - SetExplTargetDest(summonPos); - GetHitDest()->RelocateOffset(offset); + Position const offset = { 0.0f, 0.0f, 20.0f, 0.0f }; + dest.RelocateOffset(offset); } void Register() OVERRIDE { - OnEffectHit += SpellEffectFn(spell_q12661_q12669_q12676_q12677_q12713_summon_stefan_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q12661_q12669_q12676_q12677_q12713_summon_stefan_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_BACK); } }; @@ -1723,6 +1721,7 @@ class spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy : public } }; +// 59303 - Summon Frost Wyrm class spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon : public SpellScriptLoader { public: @@ -1732,19 +1731,16 @@ class spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon : public S { PrepareSpellScript(spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon_SpellScript); - void ChangeSummonPos(SpellEffIndex /*effIndex*/) + void SetDest(SpellDestination& dest) { // Adjust effect summon position - WorldLocation summonPos = *GetExplTargetDest(); - Position offset = { 0.0f, 0.0f, 20.0f, 0.0f }; - summonPos.RelocateOffset(offset); - SetExplTargetDest(summonPos); - GetHitDest()->RelocateOffset(offset); + Position const offset = { 0.0f, 0.0f, 20.0f, 0.0f }; + dest.RelocateOffset(offset); } void Register() OVERRIDE { - OnEffectHit += SpellEffectFn(spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_BACK); } }; @@ -1754,6 +1750,7 @@ class spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon : public S } }; +// 12601 - Second Chances: Summon Landgren's Soul Moveto Target Bunny class spell_q12847_summon_soul_moveto_bunny : public SpellScriptLoader { public: @@ -1763,19 +1760,16 @@ class spell_q12847_summon_soul_moveto_bunny : public SpellScriptLoader { PrepareSpellScript(spell_q12847_summon_soul_moveto_bunny_SpellScript); - void ChangeSummonPos(SpellEffIndex /*effIndex*/) + void SetDest(SpellDestination& dest) { // Adjust effect summon position - WorldLocation summonPos = *GetExplTargetDest(); - Position offset = { 0.0f, 0.0f, 2.5f, 0.0f }; - summonPos.RelocateOffset(offset); - SetExplTargetDest(summonPos); - GetHitDest()->RelocateOffset(offset); + Position const offset = { 0.0f, 0.0f, 2.5f, 0.0f }; + dest.RelocateOffset(offset); } void Register() OVERRIDE { - OnEffectHit += SpellEffectFn(spell_q12847_summon_soul_moveto_bunny_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q12847_summon_soul_moveto_bunny_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER); } }; @@ -2012,19 +2006,19 @@ class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScriptLoa { PrepareSpellScript(spell_q12308_escape_from_silverbrook_summon_worgen_SpellScript); - void ModDest(SpellEffIndex effIndex) + void ModDest(SpellDestination& dest) { - float dist = GetSpellInfo()->Effects[effIndex].CalcRadius(GetCaster()); - float angle = (urand(0, 1) ? -1 : 1) * (frand(0.75f, 1.0f) * M_PI); + float dist = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + float angle = frand(0.75f, 1.25f) * M_PI; Position pos; GetCaster()->GetNearPosition(pos, dist, angle); - GetHitDest()->Relocate(&pos); + dest.Relocate(pos); } void Register() OVERRIDE { - OnEffectHit += SpellEffectFn(spell_q12308_escape_from_silverbrook_summon_worgen_SpellScript::ModDest, EFFECT_0, SPELL_EFFECT_SUMMON); + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q12308_escape_from_silverbrook_summon_worgen_SpellScript::ModDest, EFFECT_0, TARGET_DEST_CASTER_SUMMON); } }; diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index f6386616b24..6c870bb55c4 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -25,6 +25,7 @@ #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" +#include "Containers.h" enum RogueSpells { @@ -33,6 +34,10 @@ enum RogueSpells SPELL_ROGUE_CHEAT_DEATH_COOLDOWN = 31231, SPELL_ROGUE_CRIPPLING_POISON = 3409, SPELL_ROGUE_GLYPH_OF_PREPARATION = 56819, + SPELL_ROGUE_KILLING_SPREE = 51690, + SPELL_ROGUE_KILLING_SPREE_TELEPORT = 57840, + SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG = 57841, + SPELL_ROGUE_KILLING_SPREE_DMG_BUFF = 61851, SPELL_ROGUE_MASTER_OF_SUBTLETY_DAMAGE_PERCENT = 31665, SPELL_ROGUE_MASTER_OF_SUBTLETY_PASSIVE = 31223, SPELL_ROGUE_MASTER_OF_SUBTLETY_PERIODIC = 31666, @@ -333,6 +338,105 @@ class spell_rog_deadly_poison : public SpellScriptLoader } }; +// 51690 - Killing Spree +class spell_rog_killing_spree : public SpellScriptLoader +{ + public: + spell_rog_killing_spree() : SpellScriptLoader("spell_rog_killing_spree") { } + + class spell_rog_killing_spree_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rog_killing_spree_SpellScript); + + void FilterTargets(std::list<WorldObject*>& targets) + { + if (targets.empty() || GetCaster()->GetVehicleBase()) + FinishCast(SPELL_FAILED_OUT_OF_RANGE); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Aura* aura = GetCaster()->GetAura(SPELL_ROGUE_KILLING_SPREE)) + { + if (spell_rog_killing_spree_AuraScript* script = dynamic_cast<spell_rog_killing_spree_AuraScript*>(aura->GetScriptByName("spell_rog_killing_spree"))) + script->AddTarget(GetHitUnit()); + } + } + + void Register() OVERRIDE + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rog_killing_spree_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_rog_killing_spree_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_rog_killing_spree_SpellScript(); + } + + class spell_rog_killing_spree_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rog_killing_spree_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_TELEPORT) + || !sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG) + || !sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_DMG_BUFF)) + return false; + return true; + } + + void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->CastSpell(GetTarget(), SPELL_ROGUE_KILLING_SPREE_DMG_BUFF, true); + } + + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) + { + while (!_targets.empty()) + { + uint64 guid = Trinity::Containers::SelectRandomContainerElement(_targets); + if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid)) + { + GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_TELEPORT, true); + GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG, true); + break; + } + else + _targets.remove(guid); + } + } + + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(SPELL_ROGUE_KILLING_SPREE_DMG_BUFF); + } + + void Register() OVERRIDE + { + AfterEffectApply += AuraEffectApplyFn(spell_rog_killing_spree_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_killing_spree_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + AfterEffectRemove += AuraEffectRemoveFn(spell_rog_killing_spree_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + + public: + void AddTarget(Unit* target) + { + _targets.push_back(target->GetGUID()); + } + + private: + std::list<uint64> _targets; + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_rog_killing_spree_AuraScript(); + } +}; + // 31666 - Master of Subtlety class spell_rog_master_of_subtlety : public SpellScriptLoader { @@ -863,6 +967,7 @@ void AddSC_rogue_spell_scripts() new spell_rog_crippling_poison(); new spell_rog_cut_to_the_chase(); new spell_rog_deadly_poison(); + new spell_rog_killing_spree(); new spell_rog_master_of_subtlety(); new spell_rog_nerves_of_steel(); new spell_rog_overkill(); |
