diff options
Diffstat (limited to 'src')
13 files changed, 335 insertions, 264 deletions
diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp index 5b66eedc4ad..51ab38c5d5c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp @@ -192,7 +192,7 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI { DoScriptText(SAY_DEATH, m_creature); if (Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight)) - pMidnight->DealDamage(pMidnight, pMidnight->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pMidnight->Kill(pMidnight); } void UpdateAI(const uint32 diff) @@ -210,7 +210,7 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI } Midnight = 0; m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->Kill(m_creature); } } else ResetTimer -= diff; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp index d152b3b5c78..0f52240d52c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp @@ -260,7 +260,7 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI { Unit *axe = Unit::GetUnit(*m_creature, axes[i]); if (axe && axe->isAlive()) - axe->DealDamage(axe, axe->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + axe->Kill(axe); axes[i] = 0; } } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp index 9f0e24f19d5..b4f2567be73 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp @@ -611,7 +611,7 @@ struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI void UpdateAI(const uint32 diff) { if (DespawnTimer < diff) - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->Kill(m_creature); else DespawnTimer -= diff; //Return since we have no target @@ -627,7 +627,7 @@ struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI AttackStart(target); } - ChangeTargetTimer = 5000 + rand()%10000; + ChangeTargetTimer = urand(5000,15000); }else ChangeTargetTimer -= diff; } }; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_selin_fireheart.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_selin_fireheart.cpp index 7b0dd626ecf..080e2ad6f68 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_selin_fireheart.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/magisters_terrace/boss_selin_fireheart.cpp @@ -174,9 +174,9 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI for(std::list<uint64>::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { //Creature* pCrystal = (Unit::GetCreature(*m_creature, FelCrystals[i])); - Creature* pCrystal = (Unit::GetCreature(*m_creature, *itr)); + Creature* pCrystal = Unit::GetCreature(*m_creature, *itr); if (pCrystal && pCrystal->isAlive()) - pCrystal->DealDamage(pCrystal, pCrystal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pCrystal->Kill(pCrystal); } } @@ -243,7 +243,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DRAIN_LIFE); DrainLifeTimer = 10000; - }else DrainLifeTimer -= diff; + } else DrainLifeTimer -= diff; // Heroic only if (Heroic) @@ -252,7 +252,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI { DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_DRAIN_MANA); DrainManaTimer = 10000; - }else DrainManaTimer -= diff; + } else DrainManaTimer -= diff; } } @@ -263,7 +263,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI DoCast(m_creature, SPELL_FEL_EXPLOSION); FelExplosionTimer = 2000; } - }else FelExplosionTimer -= diff; + } else FelExplosionTimer -= diff; // If below 10% mana, start recharging maxPowerMana = m_creature->GetMaxPower(POWER_MANA); @@ -274,7 +274,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI SelectNearestCrystal(); if (Heroic) DrainCrystalTimer = 10000 + rand()%5000; else DrainCrystalTimer = 20000 + rand()%5000; - }else DrainCrystalTimer -= diff; + } else DrainCrystalTimer -= diff; } }else @@ -291,13 +291,13 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID); if (CrystalChosen && CrystalChosen->isAlive()) // Use Deal Damage to kill it, not setDeathState. - CrystalChosen->DealDamage(CrystalChosen, CrystalChosen->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + CrystalChosen->Kill(CrystalChosen); CrystalGUID = 0; m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); - }else EmpowerTimer -= diff; + } else EmpowerTimer -= diff; } } @@ -340,7 +340,7 @@ struct TRINITY_DLL_DECL mob_fel_crystalAI : public ScriptedAI } } } - }else error_log(ERROR_INST_DATA); + } else error_log(ERROR_INST_DATA); } }; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp index 2aed67def40..7c79a0a1a7c 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter5.cpp @@ -1191,7 +1191,7 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here { DoScriptText(EMOTE_LIGHT_OF_DAWN17, pTemp); - pTemp->DealDamage(pTemp, pTemp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pTemp->Kill(pTemp); } JumpToNextStep(10000); break; @@ -1590,7 +1590,7 @@ struct TRINITY_DLL_DECL npc_highlord_darion_mograineAI : public npc_escortAI if (pTemp->isAlive()) { pTemp->SetVisibility(VISIBILITY_OFF); - pTemp->DealDamage(pTemp, pTemp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pTemp->Kill(pTemp); } } }; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp index 02c10b348f8..46e73d489e6 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/stratholme/stratholme.cpp @@ -125,7 +125,7 @@ struct TRINITY_DLL_DECL mob_restless_soulAI : public ScriptedAI Tagged = false; } - void EnterCombat(Unit* who) { } + void EnterCombat(Unit* who) {} void SpellHit(Unit *caster, const SpellEntry *spell) { @@ -156,9 +156,9 @@ struct TRINITY_DLL_DECL mob_restless_soulAI : public ScriptedAI { if (Die_Timer < diff) { - if (Unit* temp = Unit::GetUnit(*m_creature,Tagger)) - temp->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - }else Die_Timer -= diff; + if (Unit* pTemp = Unit::GetUnit(*m_creature,Tagger)) + pTemp->Kill(pTemp); + } else Die_Timer -= diff; } } }; @@ -191,7 +191,7 @@ struct TRINITY_DLL_DECL mobs_spectral_ghostly_citizenAI : public ScriptedAI Tagged = false; } - void EnterCombat(Unit* who) { } + void EnterCombat(Unit* who) {} void SpellHit(Unit *caster, const SpellEntry *spell) { @@ -206,8 +206,7 @@ struct TRINITY_DLL_DECL mobs_spectral_ghostly_citizenAI : public ScriptedAI for(uint32 i = 1; i <= 4; ++i) { //100%, 50%, 33%, 25% chance to spawn - uint32 j = urand(1,i); - if (j==1) + if (urand(1,i) == 1) DoSummon(ENTRY_RESTLESS, me, 20.0f, 600000); } } @@ -218,9 +217,8 @@ struct TRINITY_DLL_DECL mobs_spectral_ghostly_citizenAI : public ScriptedAI if (Tagged) { if (Die_Timer < diff) - { - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - }else Die_Timer -= diff; + m_creature->Kill(m_creature); + else Die_Timer -= diff; } if (!UpdateVictim()) diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp index 3662531d08e..99353b19b21 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_eredar_twins.cpp @@ -697,7 +697,7 @@ struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI { target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); target->CastSpell(target, SPELL_DARK_FLAME, true); - }else target->CastSpell(target,SPELL_DARK_TOUCHED,true); + } else target->CastSpell(target,SPELL_DARK_TOUCHED,true); } break; } @@ -710,9 +710,9 @@ struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI if (KillTimer < diff) { - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->Kill(m_creature); KillTimer = 9999999; - }else KillTimer -=diff; + } else KillTimer -= diff; if (!UpdateVictim()) return; @@ -721,7 +721,7 @@ struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI { DoCast(m_creature, SPELL_SHADOW_FURY); ShadowfuryTimer = 10000; - }else ShadowfuryTimer -=diff; + } else ShadowfuryTimer -=diff; if (DarkstrikeTimer < diff) { @@ -732,8 +732,7 @@ struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_DARK_STRIKE); } DarkstrikeTimer = 3000; - } - else DarkstrikeTimer -= diff; + } else DarkstrikeTimer -= diff; } }; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp index d1e5d1b583c..c91e36e31bb 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp @@ -224,8 +224,7 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI { float x, y, z; caster->GetPosition(x, y, z); - Unit* summon = m_creature->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if (summon) + if (Unit* summon = m_creature->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) { summon->SetMaxHealth(caster->GetMaxHealth()); summon->SetHealth(caster->GetMaxHealth()); diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp index 394bb059369..3bb91d52110 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp @@ -352,7 +352,8 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI } } - void ResetOrbs(){ + void ResetOrbs() + { m_creature->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); for(uint8 i = 0; i < 4; ++i) if (Orb[i]) Orb[i]->SetUInt32Value(GAMEOBJECT_FACTION, 0); @@ -362,10 +363,12 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI { if (!Orb[OrbsEmpowered]) return; - uint8 random = rand()%3; - if (all){ + uint8 random = urand(0,3); + if (all) + { m_creature->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - for(uint8 i = 0; i < 4; ++i){ + for(uint8 i = 0; i < 4; ++i) + { if (!Orb[i]) return; Orb[i]->CastSpell(m_creature, SPELL_RING_OF_BLUE_FLAMES); Orb[i]->SetUInt32Value(GAMEOBJECT_FACTION, 35); @@ -400,7 +403,8 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI } ++EmpowerCount; - switch(EmpowerCount){ + switch(EmpowerCount) + { case 1: DoScriptText(SAY_KALEC_ORB_READY1, m_creature); break; case 2: DoScriptText(SAY_KALEC_ORB_READY2, m_creature); break; case 3: DoScriptText(SAY_KALEC_ORB_READY3, m_creature); break; @@ -408,13 +412,16 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI } } - void UpdateAI(const uint32 diff){ - if (!Searched){ + void UpdateAI(const uint32 diff) + { + if (!Searched) + { FindOrbs(); Searched = true; - } + } - if (OrbsEmpowered == 4) OrbsEmpowered = 0; + if (OrbsEmpowered == 4) + OrbsEmpowered = 0; } }; @@ -484,19 +491,24 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI ChangeTimers(false, 0); } - void ChangeTimers(bool status, uint32 WTimer){ + void ChangeTimers(bool status, uint32 WTimer) + { for(uint8 i = 0; i < 10; ++i) TimerIsDeactiveted[i] = status; TimerIsDeactiveted[TIMER_KALEC_JOIN] = IsKalecJoined; - if (WTimer > 0){ + if (WTimer > 0) + { IsWaiting = true; WaitTimer = WTimer; } - if (OrbActivated) TimerIsDeactiveted[TIMER_ORBS_EMPOWER] = true; - if (Timer[TIMER_SHADOW_SPIKE] == 0) TimerIsDeactiveted[TIMER_SHADOW_SPIKE] = true; - if (Phase == PHASE_SACRIFICE) TimerIsDeactiveted[TIMER_SUMMON_SHILEDORB] = true; + if (OrbActivated) + TimerIsDeactiveted[TIMER_ORBS_EMPOWER] = true; + if (Timer[TIMER_SHADOW_SPIKE] == 0) + TimerIsDeactiveted[TIMER_SHADOW_SPIKE] = true; + if (Phase == PHASE_SACRIFICE) + TimerIsDeactiveted[TIMER_SUMMON_SHILEDORB] = true; } void JustSummoned(Creature* summoned) @@ -522,11 +534,7 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI void KilledUnit(Unit* victim) { - switch(rand()%2) - { - case 0: DoScriptText(SAY_KJ_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_KJ_SLAY2, m_creature); break; - } + DoScriptText(RAND(SAY_KJ_SLAY1,SAY_KJ_SLAY2), m_creature); } void EnterEvadeMode() @@ -535,31 +543,29 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI Summons.DespawnAll(); // Reset the controller - if (pInstance){ - Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))); - if (Control) + if (pInstance) + if(Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER)))) CAST_AI(Scripted_NoMovementAI, Control->AI())->Reset(); - } } - void EnterCombat(Unit* who){ + void EnterCombat(Unit* who) + { DoZoneInCombat(); DoScriptText(SAY_KJ_EMERGE, m_creature); } void CastSinisterReflection() { - switch(rand()%2){ - case 0: DoScriptText(SAY_KJ_REFLECTION1, m_creature); break; - case 1: DoScriptText(SAY_KJ_REFLECTION2, m_creature); break; - } + DoScriptText(RAND(SAY_KJ_REFLECTION1,SAY_KJ_REFLECTION2), m_creature); DoCast(m_creature, SPELL_SINISTER_REFLECTION, true); - for(uint8 i = 0; i < 4; ++i){ + for(uint8 i = 0; i < 4; ++i) + { float x,y,z; Unit* target; - for(uint8 z = 0; z < 6; ++z){ + for(uint8 z = 0; z < 6; ++z) + { target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) break; + if (!target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0))break; } target->GetPosition(x,y,z); Creature* SinisterReflection = m_creature->SummonCreature(CREATURE_SINISTER_REFLECTION, x,y,z,0, TEMPSUMMON_CORPSE_DESPAWN, 0); @@ -573,46 +579,57 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI if (!UpdateVictim() || Phase < PHASE_NORMAL) return; - if (IsWaiting){ - if (WaitTimer < diff){ + if (IsWaiting) + { + if (WaitTimer < diff) + { IsWaiting = false; ChangeTimers(false, 0); - } - else WaitTimer -= diff; + } else WaitTimer -= diff; } - for(uint8 t = 0; t < ActiveTimers; ++t){ - if (Timer[t] < diff && !TimerIsDeactiveted[t]){ - switch(t){ + for(uint8 t = 0; t < ActiveTimers; ++t) + { + if (Timer[t] < diff && !TimerIsDeactiveted[t]) + { + switch(t) + { case TIMER_KALEC_JOIN: - if (Kalec){ + if (Kalec) + { DoScriptText(SAY_KALECGOS_JOIN, Kalec); IsKalecJoined = true; TimerIsDeactiveted[TIMER_KALEC_JOIN] = true; } break; case TIMER_SOUL_FLAY: - if (!m_creature->IsNonMeleeSpellCasted(false)){ - m_creature->CastSpell(m_creature->getVictim(), SPELL_SOUL_FLAY, false); - m_creature->getVictim()->CastSpell(m_creature->getVictim(), SPELL_SOUL_FLAY_SLOW, true); - Timer[TIMER_SOUL_FLAY] = 3500; + if (!m_creature->IsNonMeleeSpellCasted(false)) + { + m_creature->CastSpell(m_creature->getVictim(), SPELL_SOUL_FLAY, false); + m_creature->getVictim()->CastSpell(m_creature->getVictim(), SPELL_SOUL_FLAY_SLOW, true); + Timer[TIMER_SOUL_FLAY] = 3500; } break; case TIMER_LEGION_LIGHTNING: - if (!m_creature->IsNonMeleeSpellCasted(false)){ + if (!m_creature->IsNonMeleeSpellCasted(false)) + { m_creature->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); - for(uint8 z = 0; z < 6; ++z){ + for(uint8 z = 0; z < 6; ++z) + { randomPlayer = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (!randomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) break; } - if (randomPlayer)DoCast(randomPlayer, SPELL_LEGION_LIGHTNING, false); - else error_log("try to cast SPELL_LEGION_LIGHTNING on invalid target"); + if (randomPlayer) + DoCast(randomPlayer, SPELL_LEGION_LIGHTNING, false); + else + error_log("try to cast SPELL_LEGION_LIGHTNING on invalid target"); Timer[TIMER_LEGION_LIGHTNING] = (Phase == PHASE_SACRIFICE) ? 18000 : 30000; // 18 seconds in PHASE_SACRIFICE Timer[TIMER_SOUL_FLAY] = 2500; } break; case TIMER_FIRE_BLOOM: - if (!m_creature->IsNonMeleeSpellCasted(false)){ + if (!m_creature->IsNonMeleeSpellCasted(false)) + { m_creature->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); DoCastAOE(SPELL_FIRE_BLOOM, false); Timer[TIMER_FIRE_BLOOM] = (Phase == PHASE_SACRIFICE) ? 25000 : 40000; // 25 seconds in PHASE_SACRIFICE @@ -620,21 +637,23 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI } break; case TIMER_SUMMON_SHILEDORB: - for(uint8 i = 1; i < Phase; ++i){ + for(uint8 i = 1; i < Phase; ++i) + { float sx, sy; sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]); sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]); m_creature->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); } - Timer[TIMER_SUMMON_SHILEDORB] = 30000+rand()%30*1000; // 30-60seconds cooldown + Timer[TIMER_SUMMON_SHILEDORB] = urand(30000,60000); // 30-60seconds cooldown Timer[TIMER_SOUL_FLAY] = 2000; break; case TIMER_SHADOW_SPIKE: //Phase 3 - if (!m_creature->IsNonMeleeSpellCasted(false)){ - DoCastAOE(SPELL_SHADOW_SPIKE, false); - Timer[TIMER_SHADOW_SPIKE] = 0; - TimerIsDeactiveted[TIMER_SHADOW_SPIKE] = true; - ChangeTimers(true, 30000); + if (!m_creature->IsNonMeleeSpellCasted(false)) + { + DoCastAOE(SPELL_SHADOW_SPIKE, false); + Timer[TIMER_SHADOW_SPIKE] = 0; + TimerIsDeactiveted[TIMER_SHADOW_SPIKE] = true; + ChangeTimers(true, 30000); } break; case TIMER_FLAME_DART: //Phase 3 @@ -642,44 +661,56 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI Timer[TIMER_FLAME_DART] = 3000; //TODO Timer break; case TIMER_DARKNESS: //Phase 3 - if (!m_creature->IsNonMeleeSpellCasted(false)){ - // Begins to channel for 8 seconds, then deals 50'000 damage to all raid members. - if (!IsInDarkness){ - DoScriptText(EMOTE_KJ_DARKNESS, m_creature); - DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); - ChangeTimers(true, 9000); - Timer[TIMER_DARKNESS] = 8750; - TimerIsDeactiveted[TIMER_DARKNESS] = false; - if (Phase == PHASE_SACRIFICE) TimerIsDeactiveted[TIMER_ARMAGEDDON] = false; - IsInDarkness = true; - }else{ - Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 20000 + rand()%15000 : 40000 + rand()%30000; - IsInDarkness = false; - DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE); - switch(rand()%3){ - case 0: DoScriptText(SAY_KJ_DARKNESS1, m_creature); break; - case 1: DoScriptText(SAY_KJ_DARKNESS2, m_creature); break; - case 2: DoScriptText(SAY_KJ_DARKNESS3, m_creature); break; + if (!m_creature->IsNonMeleeSpellCasted(false)) + { + // Begins to channel for 8 seconds, then deals 50'000 damage to all raid members. + if (!IsInDarkness) + { + DoScriptText(EMOTE_KJ_DARKNESS, m_creature); + DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); + ChangeTimers(true, 9000); + Timer[TIMER_DARKNESS] = 8750; + TimerIsDeactiveted[TIMER_DARKNESS] = false; + if (Phase == PHASE_SACRIFICE) + TimerIsDeactiveted[TIMER_ARMAGEDDON] = false; + IsInDarkness = true; } - } - Timer[TIMER_SOUL_FLAY] = 9000; + else + { + Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? urand(20000,35000) : urand(40000,70000); + IsInDarkness = false; + DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE); + DoScriptText(RAND(SAY_KJ_DARKNESS1,SAY_KJ_DARKNESS2,SAY_KJ_DARKNESS3), m_creature); + } + Timer[TIMER_SOUL_FLAY] = 9000; } break; case TIMER_ORBS_EMPOWER: //Phase 3 - if (Phase == PHASE_SACRIFICE){ - if (Kalec)CAST_AI(boss_kalecgos_kjAI, Kalec->AI())->EmpowerOrb(true); - }else if (Kalec)CAST_AI(boss_kalecgos_kjAI, Kalec->AI())->EmpowerOrb(false); - Timer[TIMER_ORBS_EMPOWER]= (Phase == PHASE_SACRIFICE) ? 45000 : 35000; + if (Kalec) + { + switch (Phase) + { + case PHASE_SACRIFICE: + CAST_AI(boss_kalecgos_kjAI, Kalec->AI())->EmpowerOrb(true); + break; + default: + CAST_AI(boss_kalecgos_kjAI, Kalec->AI())->EmpowerOrb(false); + break; + } + } + Timer[TIMER_ORBS_EMPOWER] = (Phase == PHASE_SACRIFICE) ? 45000 : 35000; OrbActivated = true; TimerIsDeactiveted[TIMER_ORBS_EMPOWER] = true; break; case TIMER_ARMAGEDDON: //Phase 4 Unit* target; - for(uint8 z = 0; z < 6; ++z){ + for(uint8 z = 0; z < 6; ++z) + { target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (!target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) break; } - if (target){ + if (target) + { float x, y, z; target->GetPosition(x, y, z); m_creature->SummonCreature(CREATURE_ARMAGEDDON_TARGET, x,y,z,0, TEMPSUMMON_TIMED_DESPAWN,15000); @@ -692,14 +723,17 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI } //Time runs over! for(uint8 i = 0; i < ActiveTimers; ++i) - if (!TimerIsDeactiveted[i]){ + if (!TimerIsDeactiveted[i]) + { Timer[i] -= diff; if (((int32)Timer[i]) < 0) Timer[i] = 0; } //Phase 3 - if (Phase <= PHASE_NORMAL){ - if (Phase == PHASE_NORMAL && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 85)){ + if (Phase <= PHASE_NORMAL) + { + if (Phase == PHASE_NORMAL && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 85)) + { CastSinisterReflection(); DoScriptText(SAY_KJ_PHASE3, m_creature); Phase = PHASE_DARKNESS; @@ -710,8 +744,10 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI } //Phase 4 - if (Phase <= PHASE_DARKNESS){ - if (Phase == PHASE_DARKNESS && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 55)){ + if (Phase <= PHASE_DARKNESS) + { + if (Phase == PHASE_DARKNESS && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 55)) + { DoScriptText(SAY_KJ_PHASE4, m_creature); Phase = PHASE_ARMAGEDDON; OrbActivated = false; @@ -721,13 +757,16 @@ struct TRINITY_DLL_DECL boss_kiljaedenAI : public Scripted_NoMovementAI } //Phase 5 specific spells all we can - if (Phase <= PHASE_ARMAGEDDON){ - if (Phase == PHASE_ARMAGEDDON && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 25)){ + if (Phase <= PHASE_ARMAGEDDON) + { + if (Phase == PHASE_ARMAGEDDON && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 25)) + { Phase = PHASE_SACRIFICE; - Creature* Anveena = (Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_ANVEENA) : 0)); - if (Anveena)Anveena->CastSpell(m_creature, SPELL_SACRIFICE_OF_ANVEENA, false); + if (pInstance) + if(Creature* Anveena = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_ANVEENA))) + Anveena->CastSpell(m_creature, SPELL_SACRIFICE_OF_ANVEENA, false); OrbActivated = false; - ChangeTimers(true, 10000);// He shouldn't cast spells for ~10 seconds after Anveena's sacrifice. This will be done within Anveena's script + ChangeTimers(true, 10000); // He shouldn't cast spells for ~10 seconds after Anveena's sacrifice. This will be done within Anveena's script } else return; } @@ -770,9 +809,11 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA ScriptedAI::InitializeAI(); } - void Reset(){ + void Reset() + { Phase = PHASE_DECEIVERS; - if (KalecKJ)CAST_AI(boss_kalecgos_kjAI, KalecKJ->AI())->ResetOrbs(); + if (KalecKJ) + CAST_AI(boss_kalecgos_kjAI, KalecKJ->AI())->ResetOrbs(); DeceiverDeathCount = 0; SummonedDeceivers = false; KiljaedenDeath = false; @@ -780,8 +821,10 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA Summons.DespawnAll(); } - void JustSummoned(Creature* summoned){ - switch(summoned->GetEntry()){ + void JustSummoned(Creature* summoned) + { + switch(summoned->GetEntry()) + { case CREATURE_HAND_OF_THE_DECEIVER: summoned->CastSpell(summoned, SPELL_SHADOW_CHANNELING, false); break; @@ -801,19 +844,15 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA void UpdateAI(const uint32 diff) { - if (RandomSayTimer < diff && pInstance && pInstance->GetData(DATA_MURU_EVENT) != DONE && pInstance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED){ - switch(rand()%5){ - case 0: DoScriptText(SAY_KJ_OFFCOMBAT1, m_creature); break; - case 1: DoScriptText(SAY_KJ_OFFCOMBAT2, m_creature); break; - case 2: DoScriptText(SAY_KJ_OFFCOMBAT3, m_creature); break; - case 3: DoScriptText(SAY_KJ_OFFCOMBAT4, m_creature); break; - case 4: DoScriptText(SAY_KJ_OFFCOMBAT5, m_creature); break; - } + if (RandomSayTimer < diff && pInstance && pInstance->GetData(DATA_MURU_EVENT) != DONE && pInstance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) + { + DoScriptText(RAND(SAY_KJ_OFFCOMBAT1,SAY_KJ_OFFCOMBAT2,SAY_KJ_OFFCOMBAT3,SAY_KJ_OFFCOMBAT4,SAY_KJ_OFFCOMBAT5), m_creature); RandomSayTimer = 30000; - }else RandomSayTimer -= diff; + } else RandomSayTimer -= diff; - if (!SummonedDeceivers){ - for(uint8 i = 0; i < 3; ++i) + if (!SummonedDeceivers) + { + for (uint8 i = 0; i < 3; ++i) m_creature->SummonCreature(CREATURE_HAND_OF_THE_DECEIVER, DeceiverLocations[i][0], DeceiverLocations[i][1], FLOOR_Z, DeceiverLocations[i][2], TEMPSUMMON_DEAD_DESPAWN, 0); DoSpawnCreature(CREATURE_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); @@ -821,8 +860,9 @@ struct TRINITY_DLL_DECL mob_kiljaeden_controllerAI : public Scripted_NoMovementA SummonedDeceivers = true; } - if (DeceiverDeathCount > 2 && Phase == PHASE_DECEIVERS){ - m_creature->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN) ; + if (DeceiverDeathCount > 2 && Phase == PHASE_DECEIVERS) + { + m_creature->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); Phase = PHASE_NORMAL; DoSpawnCreature(CREATURE_KILJAEDEN, 0, 0,0, 0, TEMPSUMMON_MANUAL_DESPAWN, 0); } @@ -846,25 +886,27 @@ struct TRINITY_DLL_DECL mob_hand_of_the_deceiverAI : public ScriptedAI uint32 ShadowBoltVolleyTimer; uint32 FelfirePortalTimer; - void Reset(){ + void Reset() + { // TODO: Timers! - ShadowBoltVolleyTimer = 8000 + rand()%6000; // So they don't all cast it in the same moment. + ShadowBoltVolleyTimer = urand(8000,14000); // So they don't all cast it in the same moment. FelfirePortalTimer = 20000; if (pInstance) pInstance->SetData(DATA_KILJAEDEN_EVENT, NOT_STARTED); } - void JustSummoned(Creature* summoned){ + void JustSummoned(Creature* summoned) + { summoned->setFaction(m_creature->getFaction()); summoned->SetLevel(m_creature->getLevel()); } - void EnterCombat(Unit* who){ + void EnterCombat(Unit* who) + { if (pInstance) { pInstance->SetData(DATA_KILJAEDEN_EVENT, IN_PROGRESS); - Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))); - if (Control) + if (Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER)))) Control->AddThreat(who, 1.0f); } m_creature->InterruptNonMeleeSpells(true); @@ -875,12 +917,12 @@ struct TRINITY_DLL_DECL mob_hand_of_the_deceiverAI : public ScriptedAI if (!pInstance) return; - Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))); - if (Control) - CAST_AI(mob_kiljaeden_controllerAI, Control->AI())->DeceiverDeathCount++; + if (Creature* Control = CAST_CRE(Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER)))) + ++(CAST_AI(mob_kiljaeden_controllerAI, Control->AI())->DeceiverDeathCount); } - void UpdateAI(const uint32 diff){ + void UpdateAI(const uint32 diff) + { if (!me->isInCombat()) DoCast(m_creature, SPELL_SHADOW_CHANNELING); @@ -929,7 +971,8 @@ struct TRINITY_DLL_DECL mob_felfire_portalAI : public Scripted_NoMovementAI uint32 SpawnFiendTimer; - void InitializeAI(){ + void InitializeAI() + { SpawnFiendTimer = 5000; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -938,9 +981,7 @@ struct TRINITY_DLL_DECL mob_felfire_portalAI : public Scripted_NoMovementAI } // TODO: Timers - void Reset() { - - } + void Reset() {} void JustSummoned(Creature* summoned) { @@ -958,7 +999,7 @@ struct TRINITY_DLL_DECL mob_felfire_portalAI : public Scripted_NoMovementAI Creature* Fiend = DoSpawnCreature(CREATURE_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000); if (Fiend) Fiend->AddThreat(SelectUnit(SELECT_TARGET_RANDOM,0), 100000.0f); - SpawnFiendTimer = 4000 + rand()%4000; + SpawnFiendTimer = urand(4000,8000); }else SpawnFiendTimer -= diff; } }; @@ -994,12 +1035,14 @@ struct TRINITY_DLL_DECL mob_volatile_felfire_fiendAI : public ScriptedAI if (!UpdateVictim()) return; - if (!LockedTarget){ + if (!LockedTarget) + { m_creature->AddThreat(m_creature->getVictim(), 10000000.0f); LockedTarget = true; } - if (ExplodeTimer){ + if (ExplodeTimer) + { if (ExplodeTimer < diff) ExplodeTimer = 0; else ExplodeTimer -= diff; @@ -1007,7 +1050,7 @@ struct TRINITY_DLL_DECL mob_volatile_felfire_fiendAI : public ScriptedAI else if (m_creature->IsWithinDistInMap(m_creature->getVictim(), 3)) // Explode if it's close enough to it's target { DoCast(m_creature->getVictim(), SPELL_FELFIRE_FISSION); - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->Kill(m_creature); } } }; @@ -1025,15 +1068,18 @@ struct TRINITY_DLL_DECL mob_armageddonAI : public Scripted_NoMovementAI uint8 Spell; uint32 Timer; - void Reset(){ + void Reset() + { Spell = 0; Timer = 0; } void UpdateAI(const uint32 diff) { - if (Timer < diff){ - switch(Spell){ + if (Timer < diff) + { + switch(Spell) + { case 0: DoCast(m_creature, SPELL_ARMAGEDDON_VISUAL, true); ++Spell; @@ -1049,11 +1095,11 @@ struct TRINITY_DLL_DECL mob_armageddonAI : public Scripted_NoMovementAI Timer = 5000; break; case 3: - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->Kill(m_creature); m_creature->RemoveCorpse(); break; } - }else Timer -=diff; + } else Timer -=diff; } }; @@ -1077,53 +1123,63 @@ struct TRINITY_DLL_DECL mob_shield_orbAI : public ScriptedAI ScriptedInstance* pInstance; float x, y, r, c, mx, my; - void InitializeAI(){ + void InitializeAI() + { m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); PointReached = true; - Timer = 500+ rand()%500; + Timer = urand(500,1000); CheckTimer = 1000; r = 17; c = 0; mx = ShieldOrbLocations[0][0]; my = ShieldOrbLocations[0][1]; - if (rand()%2 == 0)Clockwise = true; - else Clockwise = false; + Clockwise = urand(0,1); ScriptedAI::InitializeAI(); } void Reset(){} - void UpdateAI(const uint32 diff){ - if (PointReached){ - if (Clockwise){ + void UpdateAI(const uint32 diff) + { + if (PointReached) + { + if (Clockwise) + { y = my - r * sin(c); x = mx - r * cos(c); - }else{ + } + else + { y = my + r * sin(c); x = mx + r * cos(c); } PointReached = false; CheckTimer = 1000; m_creature->GetMotionMaster()->MovePoint(1,x, y, SHIELD_ORB_Z); - c += 3.1415926535/32; - if (c > 2*3.1415926535) c = 0; - }else{ - if (CheckTimer < diff){ + c += M_PI/32; + if (c > 2*M_PI) c = 0; + } + else + { + if (CheckTimer < diff) + { DoTeleportTo(x,y,SHIELD_ORB_Z); PointReached = true; - }else CheckTimer -= diff; + } else CheckTimer -= diff; } - if (Timer < diff){ - Unit* random = (Unit::GetUnit(*m_creature, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0)); - if (random)DoCast(random, SPELL_SHADOW_BOLT, false); - Timer = 500+ rand()%500; - }else Timer -= diff; + if (Timer < diff) + { + if (Unit* random = Unit::GetUnit(*m_creature, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0)) + DoCast(random, SPELL_SHADOW_BOLT, false); + Timer = urand(500,1000); + } else Timer -= diff; } - void MovementInform(uint32 type, uint32 id){ + void MovementInform(uint32 type, uint32 id) + { if (type != POINT_MOTION_TYPE) return; @@ -1144,18 +1200,22 @@ struct TRINITY_DLL_DECL mob_sinster_reflectionAI : public ScriptedAI uint8 Class; uint32 Timer[3]; - void Reset(){ + void Reset() + { Timer[0] = 0; Timer[1] = 0; Timer[2] = 0; Class = 0; } - void UpdateAI(const uint32 diff){ + void UpdateAI(const uint32 diff) + { - if (Class == 0){ + if (Class == 0) + { Class = m_creature->getVictim()->getClass(); - switch(Class){ + switch (Class) + { case CLASS_DRUID: break; case CLASS_HUNTER: @@ -1182,23 +1242,28 @@ struct TRINITY_DLL_DECL mob_sinster_reflectionAI : public ScriptedAI switch(Class){ case CLASS_DRUID: - if (Timer[1] < diff){ + if (Timer[1] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_MOONFIRE, false); Timer[1] = 3000; } DoMeleeAttackIfReady(); break; case CLASS_HUNTER: - if (Timer[1] < diff){ + if (Timer[1] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_MULTI_SHOT, false); Timer[1] = 9000; } - if (Timer[2] < diff){ + if (Timer[2] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_SHOOT, false); Timer[2] = 5000; } - if (m_creature->IsWithinMeleeRange(m_creature->getVictim(), 6)){ - if (Timer[3] < diff){ + if (m_creature->IsWithinMeleeRange(m_creature->getVictim(), 6)) + { + if (Timer[3] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_MULTI_SHOT, false); Timer[3] = 7000; } @@ -1206,61 +1271,71 @@ struct TRINITY_DLL_DECL mob_sinster_reflectionAI : public ScriptedAI } break; case CLASS_MAGE: - if (Timer[1] < diff){ + if (Timer[1] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_FIREBALL, false); Timer[1] = 3000; } DoMeleeAttackIfReady(); break; case CLASS_WARLOCK: - if (Timer[1] < diff){ + if (Timer[1] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_SHADOW_BOLT, false); Timer[1] = 4000; } - if (Timer[2] < diff){ + if (Timer[2] < diff) + { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_SR_CURSE_OF_AGONY, true); Timer[2] = 3000; } DoMeleeAttackIfReady(); break; case CLASS_WARRIOR: - if (Timer[1] < diff){ + if (Timer[1] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_WHIRLWIND, false); Timer[1] = 10000; } DoMeleeAttackIfReady(); break; case CLASS_PALADIN: - if (Timer[1] < diff){ + if (Timer[1] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_HAMMER_OF_JUSTICE, false); Timer[1] = 7000; } - if (Timer[2] < diff){ + if (Timer[2] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_HOLY_SHOCK, false); Timer[2] = 3000; } DoMeleeAttackIfReady(); break; case CLASS_PRIEST: - if (Timer[1] < diff){ + if (Timer[1] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_HOLY_SMITE, false); Timer[1] = 5000; } - if (Timer[2] < diff){ + if (Timer[2] < diff) + { DoCast(m_creature, SPELL_SR_RENEW, false); Timer[2] = 7000; } DoMeleeAttackIfReady(); break; case CLASS_SHAMAN: - if (Timer[1] < diff){ + if (Timer[1] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_EARTH_SHOCK, false); Timer[1] = 5000; } DoMeleeAttackIfReady(); break; case CLASS_ROGUE: - if (Timer[1] < diff){ + if (Timer[1] < diff) + { DoCast(m_creature->getVictim(), SPELL_SR_HEMORRHAGE, true); Timer[1] = 5000; } diff --git a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp index 2d2247d185e..11b7784e1dc 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/halls_of_stone/boss_sjonnir.cpp @@ -245,9 +245,9 @@ struct TRINITY_DLL_DECL mob_malformed_oozeAI : public ScriptedAI if (Creature* pTemp = m_creature->FindNearestCreature(CREATURE_MALFORMED_OOZE, 1.0f, true)) { DoSpawnCreature(CREATURE_IRON_SLUDGE, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); - pTemp->DealDamage(pTemp, pTemp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pTemp->Kill(pTemp, false); pTemp->RemoveCorpse(); - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->Kill(m_creature, false); m_creature->RemoveCorpse(); } else bIsMerging = false; } else uiMergeTimer -= diff; @@ -283,8 +283,9 @@ struct TRINITY_DLL_DECL mob_iron_sludgeAI : public ScriptedAI void JustDied(Unit* pKiller) { - if (pInstance ? Creature* pSjonnir = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SJONNIR)) : false) - CAST_AI(boss_sjonnirAI, pSjonnir->AI())->KilledIronSludge(); + if (pInstance) + if(Creature* pSjonnir = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SJONNIR))) + CAST_AI(boss_sjonnirAI, pSjonnir->AI())->KilledIronSludge(); } }; diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 348703fc793..21f3c995dce 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -4227,7 +4227,7 @@ bool ChatHandler::HandleDieCommand(const char* /*args*/) m_session->GetPlayer()->Kill(target); else m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); -} + } return true; } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 373dfb912b1..872e0cbce0a 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2385,7 +2385,7 @@ void AuraEffect::TriggerSpell() case 31347: { m_target->CastSpell(m_target,31350,true, NULL, this); - m_target->DealDamage(m_target, m_target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_target->Kill(m_target); return; } // Spellcloth diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 27c65113f39..faec94e1690 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -263,21 +263,21 @@ void Spell::EffectResurrectNew(uint32 i) void Spell::EffectInstaKill(uint32 /*i*/) { - if( !unitTarget || !unitTarget->isAlive() ) + if (!unitTarget || !unitTarget->isAlive()) return; // Demonic Sacrifice - if(m_spellInfo->Id==18788 && unitTarget->GetTypeId()==TYPEID_UNIT) + if (m_spellInfo->Id == 18788 && unitTarget->GetTypeId() == TYPEID_UNIT) { uint32 entry = unitTarget->GetEntry(); uint32 spellID; - switch(entry) + switch (entry) { - case 416: spellID=18789; break; //imp - case 417: spellID=18792; break; //fellhunter - case 1860: spellID=18790; break; //void - case 1863: spellID=18791; break; //succubus - case 17252: spellID=35701; break; //fellguard + case 416: spellID = 18789; break; //imp + case 417: spellID = 18792; break; //fellhunter + case 1860: spellID = 18790; break; //void + case 1863: spellID = 18791; break; //succubus + case 17252: spellID = 35701; break; //fellguard default: sLog.outError("EffectInstaKill: Unhandled creature entry (%u) case.", entry); return; @@ -315,20 +315,20 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) void Spell::SpellDamageSchoolDmg(uint32 effect_idx) { - bool apply_direct_bonus=true; + bool apply_direct_bonus = true; - if( unitTarget && unitTarget->isAlive()) + if (unitTarget && unitTarget->isAlive()) { - switch(m_spellInfo->SpellFamilyName) + switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { // Meteor like spells (divided damage to targets) - if(m_customAttr & SPELL_ATTR_CU_SHARE_DAMAGE) + if (m_customAttr & SPELL_ATTR_CU_SHARE_DAMAGE) { uint32 count = 0; - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) - if(ihit->effectMask & (1<<effect_idx)) + for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + if (ihit->effectMask & (1<<effect_idx)) ++count; damage /= count; // divide to all targets @@ -341,9 +341,9 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) case 28085: case 39090: case 39093: - if(!m_triggeredByAuraSpell) + if (!m_triggeredByAuraSpell) break; - if(unitTarget == m_caster) + if (unitTarget == m_caster) { uint8 count = 0; for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) @@ -351,10 +351,10 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) if(Player *target = ObjectAccessor::FindPlayer(ihit->targetGUID)) if(target->HasAura(m_triggeredByAuraSpell->Id)) ++count; - if(count) + if (count) { uint32 spellId; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 28062: spellId = 29659; break; case 28085: spellId = 29660; break; @@ -362,17 +362,17 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) case 39093: spellId = 39092; break; } Aura *aur = m_caster->GetAura(spellId); - if(!aur) + if (!aur) { m_caster->CastSpell(m_caster, spellId, true); aur = m_caster->GetAura(spellId); } - if(aur) + if (aur) aur->SetStackAmount(count); } } - if(unitTarget->HasAura(m_triggeredByAuraSpell->Id)) + if (unitTarget->HasAura(m_triggeredByAuraSpell->Id)) damage = 0; break; // Consumption @@ -403,9 +403,9 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) return; float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[0])); - if(!radius) return; + if (!radius) return; float distance = m_caster->GetDistance2d(unitTarget); - damage = (distance > radius ) ? 0 : (int32)(m_spellInfo->EffectBasePoints[0]*((radius - distance)/radius)); + damage = (distance > radius) ? 0 : int32(m_spellInfo->EffectBasePoints[0]*((radius - distance)/radius)); break; } // Cataclysmic Bolt @@ -430,7 +430,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) if(m_spellInfo->SpellFamilyFlags[1] & 0x400) damage = uint32(damage * (m_caster->GetTotalAttackPowerValue(BASE_ATTACK)) / 100); // Shield Slam - else if(m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category==1209) + else if(m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category == 1209) damage += int32(m_caster->GetShieldBlockValue()); // Victory Rush else if(m_spellInfo->SpellFamilyFlags[1] & 0x100) @@ -471,7 +471,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) { // for caster applied auras only if ((*i)->GetSpellProto()->SpellFamilyName != SPELLFAMILY_WARLOCK || - (*i)->GetCasterGUID()!=m_caster->GetGUID()) + (*i)->GetCasterGUID() != m_caster->GetGUID()) continue; // Immolate @@ -521,7 +521,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) case SPELLFAMILY_DRUID: { // Ferocious Bite - if(m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[0] & 0x000800000) && m_spellInfo->SpellVisual[0]==6587) + if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[0] & 0x000800000) && m_spellInfo->SpellVisual[0]==6587) { // converts each extra point of energy into ($f1+$AP/410) additional damage float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); @@ -543,10 +543,10 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) case SPELLFAMILY_ROGUE: { // Envenom - if(m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[1] & 0x8)) + if (m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[1] & 0x8)) { // consume from stack dozes not more that have combo-points - if(uint32 combo = ((Player*)m_caster)->GetComboPoints()) + if (uint32 combo = ((Player*)m_caster)->GetComboPoints()) { // Lookup for Deadly poison (only attacker applied) if (AuraEffect const * aurEff = unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0, 0, m_caster->GetGUID())) @@ -563,20 +563,20 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.03f * doses); } // Eviscerate and Envenom Bonus Damage (item set effect) - if(m_caster->HasAura(37169)) + if (m_caster->HasAura(37169)) damage += ((Player*)m_caster)->GetComboPoints()*40; } } // Eviscerate - else if((m_spellInfo->SpellFamilyFlags[0] & 0x00020000) && m_caster->GetTypeId()==TYPEID_PLAYER) + else if ((m_spellInfo->SpellFamilyFlags[0] & 0x00020000) && m_caster->GetTypeId()==TYPEID_PLAYER) { - if(uint32 combo = ((Player*)m_caster)->GetComboPoints()) + if (uint32 combo = ((Player*)m_caster)->GetComboPoints()) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); damage += irand(int32(ap * combo * 0.03f), int32(ap * combo * 0.07f)); // Eviscerate and Envenom Bonus Damage (item set effect) - if(m_caster->HasAura(37169)) + if (m_caster->HasAura(37169)) damage += combo*40; } } @@ -591,14 +591,14 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage *= 2; } // Steady Shot - else if(m_spellInfo->SpellFamilyFlags[1] & 0x1) + else if (m_spellInfo->SpellFamilyFlags[1] & 0x1) { bool found = false; // check dazed affect Unit::AuraEffectList const& decSpeedList = unitTarget->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); - for(Unit::AuraEffectList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter) + for (Unit::AuraEffectList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter) { - if((*iter)->GetSpellProto()->SpellIconID==15 && (*iter)->GetSpellProto()->Dispel==0) + if ((*iter)->GetSpellProto()->SpellIconID == 15 && (*iter)->GetSpellProto()->Dispel == 0) { found = true; break; @@ -613,11 +613,11 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) { // Add Ammo and Weapon damage plus RAP * 0.1 Item *item = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK); - if(item) + if (item) { float dmg_min = item->GetProto()->Damage->DamageMin; float dmg_max = item->GetProto()->Damage->DamageMax; - if(dmg_max == 0.0f && dmg_min > dmg_max) + if (dmg_max == 0.0f && dmg_min > dmg_max) damage += uint32(dmg_min); else damage += urand(uint32(dmg_min), uint32(dmg_max)); @@ -631,7 +631,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) case SPELLFAMILY_PALADIN: { // Hammer of the Righteous - if(m_spellInfo->SpellFamilyFlags[1]&0x00040000) + if (m_spellInfo->SpellFamilyFlags[1]&0x00040000) { // Add main hand dps * effect[2] amount float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2; @@ -639,7 +639,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage += count * int32(average * IN_MILISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); } // Shield of Righteousness - else if(m_spellInfo->SpellFamilyFlags[1]&0x00100000) + else if (m_spellInfo->SpellFamilyFlags[1]&0x00100000) { damage += int32(m_caster->GetShieldBlockValue() * 1.3f); } @@ -666,7 +666,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) void Spell::EffectDummy(uint32 i) { - if(!unitTarget && !gameObjTarget && !itemTarget) + if (!unitTarget && !gameObjTarget && !itemTarget) return; uint32 spell_id = 0; @@ -675,11 +675,11 @@ void Spell::EffectDummy(uint32 i) SpellCastTargets targets; // selection by spell family - switch(m_spellInfo->SpellFamilyName) + switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(m_spellInfo->Id ) + switch (m_spellInfo->Id) { // Wrath of the Astromancer case 42784: @@ -697,11 +697,10 @@ void Spell::EffectDummy(uint32 i) // now deal the damage for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) if(ihit->effectMask & (1<<i)) - { - Unit* casttarget = Unit::GetUnit((*unitTarget), ihit->targetGUID); - if(casttarget) - m_caster->DealDamage(casttarget, damage, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, spellInfo, false); - } + { + if (Unit* casttarget = Unit::GetUnit((*unitTarget), ihit->targetGUID)) + m_caster->DealDamage(casttarget, damage, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, spellInfo, false); + } } case 8063: // Deviate Fish { @@ -739,7 +738,7 @@ void Spell::EffectDummy(uint32 i) case 8593: // Symbol of life (restore creature to life) case 31225: // Shimmering Vessel (restore creature to life) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; ((Creature*)unitTarget)->setDeathState(JUST_ALIVED); return; @@ -748,7 +747,7 @@ void Spell::EffectDummy(uint32 i) case 12850: // (now good common check for this spells) case 12868: { - if(!unitTarget) + if (!unitTarget) return; float damage; @@ -771,7 +770,7 @@ void Spell::EffectDummy(uint32 i) // get remaining damage of old Deep Wound aura AuraEffect* deepWound = unitTarget->GetAuraEffect(12721, 0); - if(deepWound) + if (deepWound) { int32 remainingTicks = deepWound->GetParentAura()->GetAuraDuration() / deepWound->GetAuraAmplitude(); damage += remainingTicks * deepWound->GetAmount(); @@ -784,7 +783,7 @@ void Spell::EffectDummy(uint32 i) } case 13120: // net-o-matic { - if(!unitTarget) + if (!unitTarget) return; uint32 spell_id = 0; @@ -804,10 +803,10 @@ void Spell::EffectDummy(uint32 i) case 13567: // Dummy Trigger { // can be used for different aura triggering, so select by aura - if(!m_triggeredByAuraSpell || !unitTarget) + if (!m_triggeredByAuraSpell || !unitTarget) return; - switch(m_triggeredByAuraSpell->Id) + switch (m_triggeredByAuraSpell->Id) { case 26467: // Persistent Shield m_caster->CastCustomSpell(unitTarget, 26470, &damage, NULL, NULL, true); @@ -821,7 +820,7 @@ void Spell::EffectDummy(uint32 i) case 15998: // Capture Worg Pup case 29435: // Capture Female Kaliri Hatchling { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; ((Creature*)unitTarget)->ForcedDespawn(); @@ -833,7 +832,7 @@ void Spell::EffectDummy(uint32 i) return; uint32 spell_id = 0; - switch(urand(1, 3)) + switch (urand(1, 3)) { case 1: spell_id = 16595; break; case 2: spell_id = 16593; break; |