diff options
Diffstat (limited to 'src')
3 files changed, 64 insertions, 36 deletions
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 0d0752eefa5..25c804f2eed 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -684,20 +684,6 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader } }; -class PactOfTheDarkfallenCheck -{ - public: - PactOfTheDarkfallenCheck(bool hasPact) : _hasPact(hasPact) { } - - bool operator() (Unit* unit) - { - return unit->HasAura(SPELL_PACT_OF_THE_DARKFALLEN) == _hasPact; - } - - private: - bool _hasPact; -}; - class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader { public: @@ -709,7 +695,7 @@ class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader void FilterTargets(std::list<Unit*>& unitList) { - unitList.remove_if(PactOfTheDarkfallenCheck(false)); + unitList.remove_if(Trinity::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN)); bool remove = true; std::list<Unit*>::const_iterator itrEnd = unitList.end(), itr, itr2; @@ -795,7 +781,7 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg_target : public SpellScriptLo void FilterTargets(std::list<Unit*>& unitList) { - unitList.remove_if(PactOfTheDarkfallenCheck(true)); + unitList.remove_if(Trinity::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN)); unitList.push_back(GetCaster()); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 5227f515cca..ff8d8f0945b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -192,18 +192,9 @@ class boss_rotface : public CreatureScript } break; case EVENT_MUTATED_INFECTION: - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -MUTATED_INFECTION); - if (!target) - target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -MUTATED_INFECTION); - if (target) - { - me->CastCustomSpell(SPELL_MUTATED_INFECTION, SPELLVALUE_MAX_TARGETS, 1, target, false); - Talk(EMOTE_MUTATED_INFECTION, target->GetGUID()); - } + me->CastCustomSpell(SPELL_MUTATED_INFECTION, SPELLVALUE_MAX_TARGETS, 1, NULL, false); events.ScheduleEvent(EVENT_MUTATED_INFECTION, infectionCooldown); break; - } default: break; } @@ -479,6 +470,65 @@ class spell_rotface_ooze_flood : public SpellScriptLoader } }; +class spell_rotface_mutated_infection : public SpellScriptLoader +{ + public: + spell_rotface_mutated_infection() : SpellScriptLoader("spell_rotface_mutated_infection") { } + + class spell_rotface_mutated_infection_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rotface_mutated_infection_SpellScript); + + bool Load() + { + _target = NULL; + return true; + } + + void FilterTargets(std::list<Unit*>& targets) + { + // remove targets with this aura already + // tank is not on this list + targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); + std::list<Unit*>::iterator itr = targets.begin(); + std::advance(itr, urand(0, targets.size() - 1)); + Unit* target = *itr; + targets.clear(); + targets.push_back(target); + _target = target; + } + + void ReplaceTargets(std::list<Unit*>& targets) + { + targets.clear(); + if (_target) + targets.push_back(_target); + } + + void NotifyTargets() + { + if (Creature* caster = GetCaster()->ToCreature()) + if (Unit* target = GetHitUnit()) + caster->AI()->Talk(EMOTE_MUTATED_INFECTION, target->GetGUID()); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); + AfterHit += SpellHitFn(spell_rotface_mutated_infection_SpellScript::NotifyTargets); + } + + Unit* _target; + }; + + SpellScript* GetSpellScript() const + { + return new spell_rotface_mutated_infection_SpellScript(); + } +}; + class spell_rotface_little_ooze_combine : public SpellScriptLoader { public: @@ -725,6 +775,7 @@ void AddSC_boss_rotface() new npc_big_ooze(); new npc_precious_icc(); new spell_rotface_ooze_flood(); + new spell_rotface_mutated_infection(); new spell_rotface_little_ooze_combine(); new spell_rotface_large_ooze_combine(); new spell_rotface_large_ooze_buff_combine(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index b5d3eb947c0..4022983544d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -212,15 +212,6 @@ class AuraRemoveEvent : public BasicEvent uint32 _spellId; }; -class SummonTargetSelector -{ - public: - bool operator()(Unit* unit) const - { - return unit->HasAura(SPELL_RECENTLY_SPAWNED); - } -}; - class ValithriaDespawner : public BasicEvent { public: @@ -1227,7 +1218,7 @@ class spell_dreamwalker_summon_suppresser : public SpellScriptLoader std::list<Creature*> summoners; GetCreatureListWithEntryInGrid(summoners, caster, 22515, 100.0f); - summoners.remove_if(SummonTargetSelector()); + summoners.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); Trinity::RandomResizeList(summoners, 2); if (summoners.empty()) return; |