Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptMgr.h"
- #include "InstanceScript.h"
- #include "naxxramas.h"
- #include "ScriptedCreature.h"
- enum Spells
- {
- SPELL_HATEFUL_STRIKE = 28308,
- SPELL_FRENZY = 28131,
- SPELL_BERSERK = 26662,
- SPELL_SLIME_BOLT = 32309,
- //Vincent
- SPELL_ICE_BARRIER = 69787,
- SPELL_DEATHANDDECAY = 37788
- };
- enum Yells
- {
- SAY_AGGRO = 0,
- SAY_SLAY = 1,
- SAY_DEATH = 2,
- EMOTE_BERSERK = 3,
- EMOTE_FRENZY = 4
- };
- enum Events
- {
- EVENT_NONE,
- EVENT_BERSERK,
- EVENT_HATEFUL,
- EVENT_SLIME,
- /////
- EVENT_VINCENT
- };
- enum Misc
- {
- ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT = 10286
- };
- enum HatefulThreatAmounts
- {
- HATEFUL_THREAT_AMT = 1000,
- };
- class boss_patchwerk : public CreatureScript
- {
- public:
- boss_patchwerk() : CreatureScript("boss_patchwerk") { }
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetNaxxramasAI<boss_patchwerkAI>(creature);
- }
- struct boss_patchwerkAI : public BossAI
- {
- boss_patchwerkAI(Creature* creature) : BossAI(creature, BOSS_PATCHWERK)
- {
- Enraged = false;
- }
- bool Enraged;
- void Reset() override
- {
- _Reset();
- instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT);
- }
- void KilledUnit(Unit* /*Victim*/) override
- {
- if (!(rand32() % 5))
- Talk(SAY_SLAY);
- }
- void JustDied(Unit* /*killer*/) override
- {
- _JustDied();
- Talk(SAY_DEATH);
- }
- void JustEngagedWith(Unit* /*who*/) override
- {
- _JustEngagedWith();
- Enraged = false;
- Talk(SAY_AGGRO);
- ////
- //DoCast(me, SPELL_ICE_BARRIER, true);
- //DoCastAOE(SPELL_DEATHANDDECAY);
- //DoCast(me, SPELL_DEATHANDDECAY, true);
- events.ScheduleEvent(EVENT_VINCENT, Seconds(1));
- //////
- //events.ScheduleEvent(EVENT_HATEFUL, Seconds(1));
- events.ScheduleEvent(EVENT_BERSERK, Minutes(6));
- instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT);
- }
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
- events.Update(diff);
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_HATEFUL:
- {
- // Hateful Strike targets the highest non-MT threat in melee range on 10man
- // and the higher HP target out of the two highest non-MT threats in melee range on 25man
- ThreatReference* secondThreat = nullptr;
- ThreatReference* thirdThreat = nullptr;
- ThreatManager const& mgr = me->GetThreatManager();
- Unit* currentVictim = mgr.GetCurrentVictim();
- auto list = mgr.GetModifiableThreatList();
- auto it = list.begin(), end = list.end();
- if (it == end)
- {
- EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
- return;
- }
- if ((*it)->GetVictim() != currentVictim)
- secondThreat = *it;
- if ((!secondThreat || Is25ManRaid()) && (++it != end && (*it)->IsAvailable()))
- {
- if ((*it)->GetVictim() != currentVictim)
- (secondThreat ? thirdThreat : secondThreat) = *it;
- if (!thirdThreat && Is25ManRaid() && (++it != end && (*it)->IsAvailable()))
- thirdThreat = *it;
- }
- Unit* pHatefulTarget = nullptr;
- if (!secondThreat)
- pHatefulTarget = currentVictim;
- else if (!thirdThreat)
- pHatefulTarget = secondThreat->GetVictim();
- else
- pHatefulTarget = (secondThreat->GetVictim()->GetHealth() < thirdThreat->GetVictim()->GetHealth()) ? thirdThreat->GetVictim() : secondThreat->GetVictim();
- // add threat to highest threat targets
- AddThreat(currentVictim, HATEFUL_THREAT_AMT);
- if (secondThreat)
- secondThreat->AddThreat(HATEFUL_THREAT_AMT);
- if (thirdThreat)
- thirdThreat->AddThreat(HATEFUL_THREAT_AMT);
- DoCast(pHatefulTarget, SPELL_HATEFUL_STRIKE, true);
- events.Repeat(Seconds(1));
- break;
- }
- case EVENT_BERSERK:
- DoCast(me, SPELL_BERSERK, true);
- Talk(EMOTE_BERSERK);
- events.ScheduleEvent(EVENT_SLIME, Seconds(2));
- break;
- case EVENT_SLIME:
- DoCastAOE(SPELL_SLIME_BOLT, true);
- events.Repeat(Seconds(2));
- break;
- //////
- case EVENT_VINCENT:
- ThreatManager const& mgr = me->GetThreatManager();
- Unit* currentVictim = mgr.GetCurrentVictim();
- DoCast(currentVictim, SPELL_DEATHANDDECAY, true);
- ////////
- }
- }
- if (!Enraged && HealthBelowPct(5))
- {
- DoCast(me, SPELL_FRENZY, true);
- Talk(EMOTE_FRENZY);
- Enraged = true;
- }
- DoMeleeAttackIfReady();
- }
- };
- };
- void AddSC_boss_patchwerk()
- {
- new boss_patchwerk();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement