1616
1717/* ScriptData
1818SDName: boss_deathbringer_saurfang
19- SD%Complete: 60 %
20- SDComment: Blood Power and all the related spells require core support; Intro and Outro event NYI.
19+ SD%Complete: 80 %
20+ SDComment: Intro and Outro event NYI.
2121SDCategory: Icecrown Citadel
2222EndScriptData */
2323
7373 SAY_OUTRO_HORDE_4 = -1631069 ,
7474
7575 // intro event related
76- // SPELL_GRIP_OF_AGONY = 70572,
77- // SPELL_VEHICLE_HARDCODED = 46598,
76+ SPELL_GRIP_OF_AGONY = 70572 ,
77+ SPELL_VEHICLE_HARDCODED = 46598 ,
7878
79- // combat spells
80- SPELL_BLOOD_POWER = 72371 ,
81- // SPELL_BLOOD_POWER_SCALE = 72370 , // included in creature_template_addon
82- // SPELL_ZERO_POWER = 72242 , // included in creature_template_addon
79+ // aggro spells
80+ SPELL_BLOOD_LINK = 72178 ,
81+ SPELL_MARK_FALLEN_DAMAGE = 72256 , // procs 72255 on Saurfang melee attack
82+ SPELL_RUNE_OF_BLOOD_PROC = 72408 , // procs 72409 on Saurfang melee attack
8383
84- // SPELL_MARK_FALLEN_DAMAGE = 72256, // procs on Saurfang melee attack - 72255 - included in creature_template_addon
85- SPELL_MARK_FALLEN_CHAMPION = 72293 , // procs on target death - 72260
86- SPELL_REMOVE_MARKS = 72257 ,
84+ // combat spells
85+ SPELL_BLOOD_POWER = 72371 , // triggered by 72195
86+ // SPELL_BLOOD_POWER_SCALE = 72370, // purpose unk
87+ // SPELL_ZERO_POWER = 72242, // included in creature_template_addon
8788
88- // SPELL_RUNE_OF_BLOOD_PROC = 72408 , // procs on Saurfang mele attack - 72409 - included in creature_template_addon
89+ SPELL_MARK_FALLEN_CHAMPION = 72254 , // triggers 72293 which procs 72260 on target death
8990 SPELL_RUNE_OF_BLOOD = 72410 ,
90-
9191 SPELL_BLOOD_NOVA = 72378 ,
9292 SPELL_BOILING_BLOOD = 72385 ,
9393
@@ -101,14 +101,17 @@ enum
101101 SPELL_BERSERK = 26662 ,
102102 SPELL_FRENZY = 72737 ,
103103
104+ // evade / death spells
105+ SPELL_REMOVE_MARKS = 72257 ,
106+ SPELL_ACHIEVEMENT = 72928 ,
107+
104108 // Summoned spells
105109 SPELL_RESISTANT_SKIN = 72723 ,
106110 SPELL_BLOOD_LINK_BEAST = 72176 ,
107111
108112 FACTION_ID_UNDEAD = 974 ,
109113
110114 POINT_ID_INTRO = 1 ,
111- POINT_ID_EVADE = 2 ,
112115};
113116
114117static const float fIntroPosition [4 ] = { -491 .30f , 2211 .35f , 541 .11f , 3 .16f };
@@ -118,7 +121,6 @@ struct boss_deathbringer_saurfangAI : public ScriptedAI
118121 boss_deathbringer_saurfangAI (Creature* pCreature) : ScriptedAI(pCreature)
119122 {
120123 m_pInstance = (instance_icecrown_citadel*)pCreature->GetInstanceData ();
121- m_powerBloodPower = m_creature->GetPowerType ();
122124 m_bIsIntroDone = false ;
123125 Reset ();
124126 }
@@ -135,8 +137,6 @@ struct boss_deathbringer_saurfangAI : public ScriptedAI
135137 bool m_bIsFrenzied;
136138 bool m_bIsIntroDone;
137139
138- Powers m_powerBloodPower;
139-
140140 void Reset () override
141141 {
142142 m_uiRuneOfBloodTimer = 25000 ;
@@ -150,14 +150,15 @@ struct boss_deathbringer_saurfangAI : public ScriptedAI
150150 m_uiBerserkTimer = 6 * MINUTE * IN_MILLISECONDS ;
151151
152152 m_bIsFrenzied = false ;
153-
154- m_creature->SetPower (m_powerBloodPower, 0 );
155153 }
156154
157155 void Aggro (Unit* /* pWho*/ ) override
158156 {
159157 DoScriptText (SAY_AGGRO , m_creature);
160- DoCastSpellIfCan (m_creature, SPELL_BLOOD_POWER , CAST_TRIGGERED );
158+
159+ DoCastSpellIfCan (m_creature, SPELL_BLOOD_LINK , CAST_TRIGGERED );
160+ DoCastSpellIfCan (m_creature, SPELL_MARK_FALLEN_DAMAGE , CAST_TRIGGERED );
161+ DoCastSpellIfCan (m_creature, SPELL_RUNE_OF_BLOOD_PROC , CAST_TRIGGERED );
161162
162163 if (m_pInstance)
163164 m_pInstance->SetData (TYPE_DEATHBRINGER_SAURFANG , IN_PROGRESS );
@@ -189,6 +190,7 @@ struct boss_deathbringer_saurfangAI : public ScriptedAI
189190 {
190191 DoScriptText (SAY_DEATH , m_creature);
191192 DoCastSpellIfCan (m_creature, SPELL_REMOVE_MARKS , CAST_TRIGGERED );
193+ DoCastSpellIfCan (m_creature, SPELL_ACHIEVEMENT , CAST_TRIGGERED );
192194
193195 if (m_pInstance)
194196 m_pInstance->SetData (TYPE_DEATHBRINGER_SAURFANG , DONE );
@@ -198,46 +200,27 @@ struct boss_deathbringer_saurfangAI : public ScriptedAI
198200 {
199201 if (m_pInstance)
200202 m_pInstance->SetData (TYPE_DEATHBRINGER_SAURFANG , FAIL );
201- }
202-
203- void EnterEvadeMode () override
204- {
205- m_creature->RemoveAllAurasOnEvade ();
206- m_creature->DeleteThreatList ();
207- m_creature->CombatStop (true );
208-
209- // Boss needs to evade to the point in front of the door
210- if (m_creature->isAlive ())
211- m_creature->GetMotionMaster ()->MovePoint (POINT_ID_EVADE , fIntroPosition [0 ], fIntroPosition [1 ], fIntroPosition [2 ]);
212203
213- m_creature->SetLootRecipient (NULL );
214-
215- Reset ();
204+ DoCastSpellIfCan (m_creature, SPELL_REMOVE_MARKS , CAST_TRIGGERED );
205+ m_creature->RemoveFlag (UNIT_FIELD_FLAGS , UNIT_FLAG_OOC_NOT_ATTACKABLE );
216206 }
217207
218208 void MovementInform (uint32 uiMoveType, uint32 uiPointId) override
219209 {
220210 if (uiMoveType != POINT_MOTION_TYPE )
221211 return ;
222212
223- if (uiPointId == POINT_ID_EVADE )
224- {
225- m_creature->SetFacingTo (fIntroPosition [3 ]);
226-
227- if (m_pInstance)
228- m_pInstance->SetData (TYPE_DEATHBRINGER_SAURFANG , FAIL );
229- }
230- else if (uiPointId == POINT_ID_INTRO )
213+ if (uiPointId == POINT_ID_INTRO )
231214 {
232215 if (m_pInstance)
233216 m_pInstance->DoUseDoorOrButton (GO_SAURFANG_DOOR );
234217
235218 // Note: this should be done only after the intro event is finished
236219 // ToDo: move this to the proper place after the intro will be implemented
237220 // Also the faction needs to be checked if it should be handled in database
238- m_creature->setFaction (FACTION_ID_UNDEAD );
239- m_creature->RemoveFlag (UNIT_FIELD_FLAGS , UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PASSIVE );
240- m_creature->SetInCombatWithZone ( );
221+ m_creature->SetFactionTemporary (FACTION_ID_UNDEAD , TEMPFACTION_NONE );
222+ m_creature->RemoveFlag (UNIT_FIELD_FLAGS , UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PASSIVE | UNIT_FLAG_OOC_NOT_ATTACKABLE );
223+ m_creature->SetRespawnCoord (m_creature-> GetPositionX (), m_creature-> GetPositionY (), m_creature-> GetPositionZ (), m_creature-> GetOrientation () );
241224 }
242225 }
243226
@@ -251,46 +234,21 @@ struct boss_deathbringer_saurfangAI : public ScriptedAI
251234 pSummoned->AI ()->AttackStart (pTarget);
252235 }
253236
254- // Wrapper to help get a random player for the Mark of the Fallen Champion
255- Unit* SelectRandomPlayerForMark ()
256- {
257- // Search only for players which are not within 18 yards of the boss
258- std::vector<Unit*> suitableTargets;
259- ThreatList const & threatList = m_creature->getThreatManager ().getThreatList ();
260-
261- for (ThreatList::const_iterator itr = threatList.begin (); itr != threatList.end (); ++itr)
262- {
263- if (Unit* pTarget = m_creature->GetMap ()->GetUnit ((*itr)->getUnitGuid ()))
264- {
265- if (pTarget->GetTypeId () == TYPEID_PLAYER && pTarget != m_creature->getVictim () && !pTarget->HasAura (SPELL_MARK_FALLEN_CHAMPION ))
266- suitableTargets.push_back (pTarget);
267- }
268- }
269-
270- if (suitableTargets.empty ())
271- return m_creature->getVictim ();
272- else
273- return suitableTargets[urand (0 , suitableTargets.size () - 1 )];
274- }
275-
276237 void UpdateAI (const uint32 uiDiff) override
277238 {
278239 if (!m_creature->SelectHostileTarget () || !m_creature->getVictim ())
279240 return ;
280241
281242 // Mark of the Fallen Champion
282- // ToDo: enable this when blood power is fully supported by the core
283- /* if (m_creature->GetPower(m_powerBloodPower) >= 100)
243+ if (m_creature->GetPower (m_creature->GetPowerType ()) == 100 )
284244 {
285- if (Unit* pTarget = SelectRandomPlayerForMark() )
245+ if (DoCastSpellIfCan (m_creature, SPELL_MARK_FALLEN_CHAMPION ) == CAST_OK )
286246 {
287- if (DoCastSpellIfCan(pTarget, SPELL_MARK_FALLEN_CHAMPION) == CAST_OK)
288- {
289- DoScriptText(SAY_FALLENCHAMPION, m_creature);
290- m_creature->SetPower(m_powerBloodPower, 0);
291- }
247+ DoScriptText (SAY_FALLENCHAMPION , m_creature);
248+ m_creature->RemoveAurasDueToSpell (SPELL_BLOOD_POWER );
249+ m_creature->SetPower (m_creature->GetPowerType (), 0 );
292250 }
293- }*/
251+ }
294252
295253 // Frenzy (soft enrage)
296254 if (!m_bIsFrenzied)
@@ -308,7 +266,7 @@ struct boss_deathbringer_saurfangAI : public ScriptedAI
308266 // Berserk (hard enrage)
309267 if (m_uiBerserkTimer)
310268 {
311- if (m_uiBerserkTimer < uiDiff)
269+ if (m_uiBerserkTimer <= uiDiff)
312270 {
313271 if (DoCastSpellIfCan (m_creature, SPELL_BERSERK ) == CAST_OK )
314272 {
0 commit comments