diff options
Diffstat (limited to 'src/server/scripts')
| -rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 10 | ||||
| -rwxr-xr-x | src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp | 184 |
2 files changed, 104 insertions, 90 deletions
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 1778dc9be67..aaa4d1c3f68 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -953,8 +953,8 @@ public: if (!player_str) return false; - char* location_str = strtok(NULL, ""); - if (!location_str) + std::string location_str = strtok(NULL, ""); + if (location_str.empty()) location_str = "inn"; Player* player = NULL; @@ -969,19 +969,19 @@ public: return false; } - if (!stricmp(location_str, "inn")) + if (location_str == "inn") { player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation()); return true; } - if (!stricmp(location_str, "graveyard")) + if (location_str == "graveyard") { player->RepopAtGraveyard(); return true; } - if (!stricmp(location_str, "startzone")) + if (location_str == "startzone") { player->TeleportTo(player->GetStartPosition()); return true; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index a9ba0baa86f..489616332c8 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -23,6 +23,7 @@ #include "Spell.h" #include "icecrown_citadel.h" #include "Vehicle.h" +#include "GridNotifiers.h" enum ScriptTexts { @@ -185,12 +186,15 @@ class AbominationDespawner if (Vehicle* veh = summon->GetVehicleKit()) veh->RemoveAllPassengers(); // also despawns the vehicle + // Found unit is Mutated Abomination, remove it return true; } + // Found unit is not Mutated Abomintaion, leave it return false; } + // No unit found, remove from SummonList return true; } @@ -198,6 +202,19 @@ class AbominationDespawner Unit* _owner; }; +struct RotfaceHeightCheck +{ + RotfaceHeightCheck(Creature* rotface) : _rotface(rotface) { } + + bool operator()(Creature* stalker) const + { + return stalker->GetPositionZ() < _rotface->GetPositionZ() + 5.0f; + } + +private: + Creature* _rotface; +}; + class boss_professor_putricide : public CreatureScript { public: @@ -246,7 +263,7 @@ class boss_professor_putricide : public CreatureScript events.Reset(); events.ScheduleEvent(EVENT_BERSERK, 600000); events.ScheduleEvent(EVENT_SLIME_PUDDLE, 10000); - events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(25000, 30000)); + events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(30000, 35000)); if (IsHeroic()) events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 20000); @@ -295,18 +312,16 @@ class boss_professor_putricide : public CreatureScript // no possible aura seen in sniff adding the aurastate summon->ModifyAuraState(AURA_STATE_UNKNOWN22, true); summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true); - summon->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, summon, false); summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); summon->SetReactState(REACT_PASSIVE); - return; + break; case NPC_VOLATILE_OOZE: // no possible aura seen in sniff adding the aurastate summon->ModifyAuraState(AURA_STATE_UNKNOWN19, true); summon->CastSpell(summon, SPELL_OOZE_ERUPTION_SEARCH_PERIODIC, true); - summon->CastSpell(summon, SPELL_VOLATILE_OOZE_ADHESIVE, false); summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); summon->SetReactState(REACT_PASSIVE); - return; + break; case NPC_CHOKING_GAS_BOMB: summon->CastSpell(summon, SPELL_CHOKING_GAS_BOMB_PERIODIC, true); summon->CastSpell(summon, SPELL_CHOKING_GAS_EXPLOSION_TRIGGER, true); @@ -428,7 +443,8 @@ class boss_professor_putricide : public CreatureScript if (Creature* rotface = Unit::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) { std::list<Creature*> list; - GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 36.0f); + GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 50.0f); + list.remove_if(RotfaceHeightCheck(rotface)); if (list.size() > 4) { list.sort(Trinity::ObjectDistanceOrderPred(rotface)); @@ -510,7 +526,6 @@ class boss_professor_putricide : public CreatureScript SetPhase(PHASE_COMBAT_3); events.ScheduleEvent(EVENT_MUTATED_PLAGUE, 25000); events.CancelEvent(EVENT_UNSTABLE_EXPERIMENT); - summons.remove_if(AbominationDespawner(me)); break; default: break; @@ -643,7 +658,7 @@ class boss_professor_putricide : public CreatureScript case EVENT_UNBOUND_PLAGUE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) { - me->CastCustomSpell(SPELL_UNBOUND_PLAGUE, SPELLVALUE_BASE_POINT0, 775, target); + DoCast(target, SPELL_UNBOUND_PLAGUE); DoCast(target, SPELL_UNBOUND_PLAGUE_SEARCHER); } events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 90000); @@ -668,6 +683,7 @@ class boss_professor_putricide : public CreatureScript me->SetFacingToObject(face); me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); Talk(SAY_TRANSFORM_2); + summons.remove_if(AbominationDespawner(me)); events.ScheduleEvent(EVENT_RESUME_ATTACK, 8500, 0, PHASE_COMBAT_3); break; default: @@ -702,57 +718,78 @@ class boss_professor_putricide : public CreatureScript } }; -class npc_volatile_ooze : public CreatureScript +class npc_putricide_oozeAI : public ScriptedAI { public: - npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { } + npc_putricide_oozeAI(Creature* creature, uint32 hitTargetSpellId) : ScriptedAI(creature), + _newTargetSelectTimer(0), _hitTargetSpellId(hitTargetSpellId) + { + } - struct npc_putricide_oozeAI : public ScriptedAI + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) { - npc_putricide_oozeAI(Creature* creature) : ScriptedAI(creature) - { - _newTargetSelectTimer = 0; - } + if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(_hitTargetSpellId, me)) + _newTargetSelectTimer = 1000; + } - void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) - { - if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_OOZE_ERUPTION, me)) - _newTargetSelectTimer = 1000; - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_TEAR_GAS_CREATURE) + _newTargetSelectTimer = 1000; + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim() && !_newTargetSelectTimer) + return; + + if (!_newTargetSelectTimer && !me->IsNonMeleeSpellCasted(false, false, true, false, true)) + _newTargetSelectTimer = 1000; + + DoMeleeAttackIfReady(); - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + if (!_newTargetSelectTimer) + return; + + if (me->HasAura(SPELL_TEAR_GAS_CREATURE)) + return; + + if (_newTargetSelectTimer <= diff) { - if (spell->Id == SPELL_TEAR_GAS_CREATURE) - _newTargetSelectTimer = 1000; + _newTargetSelectTimer = 0; + CastMainSpell(); } + else + _newTargetSelectTimer -= diff; + } - void UpdateAI(uint32 const diff) - { - if (!UpdateVictim() && !_newTargetSelectTimer) - return; + virtual void CastMainSpell() = 0; - if (!_newTargetSelectTimer) - return; + private: + uint32 _hitTargetSpellId; + uint32 _newTargetSelectTimer; +}; - if (me->HasAura(SPELL_TEAR_GAS_CREATURE)) - return; +class npc_volatile_ooze : public CreatureScript +{ + public: + npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { } - if (_newTargetSelectTimer <= diff) - { - _newTargetSelectTimer = 0; - me->CastSpell(me, SPELL_VOLATILE_OOZE_ADHESIVE, false); - } - else - _newTargetSelectTimer -= diff; + struct npc_volatile_oozeAI : public npc_putricide_oozeAI + { + npc_volatile_oozeAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_OOZE_ERUPTION) + { } - private: - uint32 _newTargetSelectTimer; + void CastMainSpell() + { + me->CastSpell(me, SPELL_VOLATILE_OOZE_ADHESIVE, false); + } }; CreatureAI* GetAI(Creature* creature) const { - return GetIcecrownCitadelAI<npc_putricide_oozeAI>(creature); + return GetIcecrownCitadelAI<npc_volatile_oozeAI>(creature); } }; @@ -761,45 +798,16 @@ class npc_gas_cloud : public CreatureScript public: npc_gas_cloud() : CreatureScript("npc_gas_cloud") { } - struct npc_gas_cloudAI : public ScriptedAI + struct npc_gas_cloudAI : public npc_putricide_oozeAI { - npc_gas_cloudAI(Creature* creature) : ScriptedAI(creature) + npc_gas_cloudAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_EXPUNGED_GAS) { _newTargetSelectTimer = 0; } - void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) - { - if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_EXPUNGED_GAS, me)) - _newTargetSelectTimer = 1000; - } - - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + void CastMainSpell() { - if (spell->Id == SPELL_TEAR_GAS_CREATURE) - _newTargetSelectTimer = 1000; - } - - void UpdateAI(uint32 const diff) - { - if (!UpdateVictim() && !_newTargetSelectTimer) - return; - - DoMeleeAttackIfReady(); - - if (!_newTargetSelectTimer) - return; - - if (me->HasAura(SPELL_TEAR_GAS_CREATURE)) - return; - - if (_newTargetSelectTimer <= diff) - { - _newTargetSelectTimer = 0; - me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false); - } - else - _newTargetSelectTimer -= diff; + me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false); } private: @@ -900,23 +908,12 @@ class spell_putricide_ooze_channel : public SpellScriptLoader GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff } - // temporary, until SelectTarget are not called on empty lists - void CheckTarget() - { - if (_target) - return; - - FinishCast(SPELL_FAILED_NO_VALID_TARGETS); - GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update - } - void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack); - OnCast += SpellCastFn(spell_putricide_ooze_channel_SpellScript::CheckTarget); } WorldObject* _target; @@ -1125,6 +1122,21 @@ class spell_putricide_unbound_plague : public SpellScriptLoader return true; } + SpellCastResult CheckCast() + { + if (AuraEffect const* eff = GetCaster()->GetAuraEffect(SPELL_UNBOUND_PLAGUE_SEARCHER, EFFECT_0)) + if (eff->GetTickNumber() < 2) + return SPELL_FAILED_DONT_REPORT; + + return SPELL_CAST_OK; + } + + void FilterTargets(std::list<WorldObject*>& targets) + { + targets.remove_if(Trinity::UnitAuraCheck(true, sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster()))); + Trinity::Containers::RandomResizeList(targets, 1); + } + void HandleScript(SpellEffIndex /*effIndex*/) { if (!GetHitUnit()) @@ -1159,6 +1171,8 @@ class spell_putricide_unbound_plague : public SpellScriptLoader void Register() { + OnCheckCast += SpellCheckCastFn(spell_putricide_unbound_plague_SpellScript::CheckCast); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_unbound_plague_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); OnEffectHitTarget += SpellEffectFn(spell_putricide_unbound_plague_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; |
