void Reset() { AxesCleanup(); ClearWeapons(); InfernalCleanup(); positions.clear(); for (uint8 i = 0; i < 5; ++i) enfeeble_targets[i] = 0; for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); EnfeebleTimer = 30000; EnfeebleResetTimer = 38000; ShadowNovaTimer = 35500; SWPainTimer = 20000; AmplifyDamageTimer = 5000; Cleave_Timer = 8000; InfernalTimer = 45000; InfernalCleanupTimer = 47000; AxesTargetSwitchTimer = urand(7500, 20000); SunderArmorTimer = urand(5000, 10000); phase = 1; if (pInstance) pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); }
void Reset() { AxesCleanup(); ClearWeapons(); InfernalCleanup(); m_positions.clear(); for (uint8 i = 0; i < 5; ++i) { m_aEnfeebleTargetGuid[i].Clear(); m_auiEnfeebleHealth[i] = 0; } for(int i = 0; i < TOTAL_INFERNAL_POINTS; ++i) m_positions.push_back(&InfernalPoints[i]); m_uiEnfeebleTimer = 30000; m_uiEnfeebleResetTimer = 38000; m_uiShadowNovaTimer = 35500; m_uiSWPainTimer = 20000; m_uiAmplifyDamageTimer = 5000; m_uiCleave_Timer = 8000; InfernalTimer = 45000; m_uiInfernalCleanupTimer = 47000; m_uiAxesTargetSwitchTimer = urand(7500, 20000); SunderArmorTimer = urand(5000, 10000); m_uiPhase = 1; }
void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); AxesCleanup(); ClearWeapons(); InfernalCleanup(); positions.clear(); for(int i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); }
void JustDied(Unit* /*killer*/) override { Talk(SAY_DEATH); AxesCleanup(); ClearWeapons(); InfernalCleanup(); positions.clear(); for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), true); }
void Reset() override { AxesCleanup(); ClearWeapons(); InfernalCleanup(); positions.clear(); Initialize(); for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), true); }
// Bot Weapons CBotWeapons::CBotWeapons(CBot *pBot) { m_pBot = pBot; ClearWeapons(); /*for ( int i = 0; i < MAX_WEAPONS; i ++ ) { // find weapon info from weapon id m_theWeapons[i].setWeapon(CWeapons::getWeapon(i)); }*/ m_fUpdateWeaponsTime = 0; m_iWeaponsSignature = 0x0; }
void JustDied(Unit* /*victim*/) { DoScriptText(SAY_DEATH, me); AxesCleanup(); ClearWeapons(); InfernalCleanup(); positions.clear(); for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) positions.push_back(&InfernalPoints[i]); if (pInstance) pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); }
//----------------------------------------------------------------------------- // Kills the player. //----------------------------------------------------------------------------- void PlayerObject::Kill() { // Indicate that the player is dying. m_dying = true; // Clear the player's movment. SetDrive( 0.0f ); SetStrafe( 0.0f ); SetFire( false ); Stop(); // Clear the player's weapons. ClearWeapons(); // Stop the player from changing weapons. m_changingWeapon = 0.0f; m_weaponChanging = false; // Play the death animation. PlayAnimation( ANIM_DEATH, 0.0f, false ); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that { EnfeebleResetHealth(); EnfeebleResetTimer = 0; } else EnfeebleResetTimer -= diff; if (me->HasUnitState(UNIT_STAT_STUNNED)) // While shifting to phase 2 malchezaar stuns himself return; if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID()) me->SetUInt64Value(UNIT_FIELD_TARGET, me->getVictim()->GetGUID()); if (phase == 1) { if (HealthBelowPct(60)) { me->InterruptNonMeleeSpells(false); phase = 2; //animation DoCast(me, SPELL_EQUIP_AXES); //text DoScriptText(SAY_AXE_TOSS1, me); //passive thrash aura DoCast(me, SPELL_THRASH_AURA, true); //models SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); //damage const CreatureTemplate *cinfo = me->GetCreatureInfo(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); me->UpdateDamagePhysical(BASE_ATTACK); me->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg); me->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg); //Sigh, updating only works on main attack, do it manually .... me->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); me->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100); } } else if (phase == 2) { if (HealthBelowPct(30)) { InfernalTimer = 15000; phase = 3; ClearWeapons(); //remove thrash me->RemoveAurasDueToSpell(SPELL_THRASH_AURA); DoScriptText(SAY_AXE_TOSS2, me); Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); for (uint8 i = 0; i < 2; ++i) { Creature* axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (axe) { axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); axe->setFaction(me->getFaction()); axes[i] = axe->GetGUID(); if (pTarget) { axe->AI()->AttackStart(pTarget); //axe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly // So we'll use a hack to add a lot of threat to our target axe->AddThreat(pTarget, 10000000.0f); } } } if (ShadowNovaTimer > 35000) ShadowNovaTimer = EnfeebleTimer + 5000; return; } if (SunderArmorTimer <= diff) { DoCast(me->getVictim(), SPELL_SUNDER_ARMOR); SunderArmorTimer = urand(10000, 18000); } else SunderArmorTimer -= diff; if (Cleave_Timer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); Cleave_Timer = urand(6000, 12000); } else Cleave_Timer -= diff; } else { if (AxesTargetSwitchTimer <= diff) { AxesTargetSwitchTimer = urand(7500, 20000); if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { for (uint8 i = 0; i < 2; ++i) { if (Unit* axe = Unit::GetUnit(*me, axes[i])) { if (axe->getVictim()) DoModifyThreatPercent(axe->getVictim(), -100); if (pTarget) axe->AddThreat(pTarget, 1000000.0f); //axe->getThreatManager().tauntFadeOut(axe->getVictim()); //axe->getThreatManager().tauntApply(pTarget); } } } } else AxesTargetSwitchTimer -= diff; if (AmplifyDamageTimer <= diff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, SPELL_AMPLIFY_DAMAGE); AmplifyDamageTimer = urand(20000, 30000); } else AmplifyDamageTimer -= diff; } //Time for global and double timers if (InfernalTimer <= diff) { SummonInfernal(diff); InfernalTimer = phase == 3 ? 14500 : 44500; // 15 secs in phase 3, 45 otherwise } else InfernalTimer -= diff; if (ShadowNovaTimer <= diff) { DoCast(me->getVictim(), SPELL_SHADOWNOVA); ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1); } else ShadowNovaTimer -= diff; if (phase != 2) { if (SWPainTimer <= diff) { Unit* pTarget = NULL; if (phase == 1) pTarget = me->getVictim(); // the tank else // anyone but the tank pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); if (pTarget) DoCast(pTarget, SPELL_SW_PAIN); SWPainTimer = 20000; } else SWPainTimer -= diff; } if (phase != 3) { if (EnfeebleTimer <= diff) { EnfeebleHealthEffect(); EnfeebleTimer = 30000; ShadowNovaTimer = 5000; EnfeebleResetTimer = 9000; } else EnfeebleTimer -= diff; } if (phase == 2) DoMeleeAttacksIfReady(); else DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiEnfeebleResetTimer) { if (m_uiEnfeebleResetTimer <= uiDiff) //Let's not forget to reset that { EnfeebleResetHealth(); m_uiEnfeebleResetTimer=0; } else m_uiEnfeebleResetTimer -= uiDiff; } if (m_creature->hasUnitState(UNIT_STAT_STUNNED)) //While shifting to m_uiPhase 2 m_malchezaarGuid stuns himself return; if (m_creature->GetTargetGuid() != m_creature->getVictim()->GetObjectGuid()) m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid()); if (m_uiPhase == 1) { if (m_creature->GetHealthPercent() < 60.0f) { m_creature->InterruptNonMeleeSpells(false); m_uiPhase = 2; //animation DoCastSpellIfCan(m_creature, SPELL_EQUIP_AXES); //text DoScriptText(SAY_AXE_TOSS1, m_creature); //passive thrash aura m_creature->CastSpell(m_creature, SPELL_THRASH_AURA, true); //models SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); //damage const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); m_creature->UpdateDamagePhysical(BASE_ATTACK); m_creature->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg); m_creature->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg); //Sigh, updating only works on main attack , do it manually .... m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); m_creature->SetAttackTime(OFF_ATTACK, (m_creature->GetAttackTime(BASE_ATTACK)*150)/100); } } else if (m_uiPhase == 2) { if (m_creature->GetHealthPercent() < 30.0f) { InfernalTimer = 15000; m_uiPhase = 3; ClearWeapons(); //remove thrash m_creature->RemoveAurasDueToSpell(SPELL_THRASH_AURA); DoScriptText(SAY_AXE_TOSS2, m_creature); Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); for (uint32 i = 0; i < 2; ++i) { Creature* pAxe = m_creature->SummonCreature(MALCHEZARS_AXE, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); if (pAxe) { pAxe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pAxe->setFaction(m_creature->getFaction()); m_aAxeGuid[i] = pAxe->GetObjectGuid(); if (pTarget) { pAxe->AI()->AttackStart(pTarget); // pAxe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly // So we'll use a hack to add a lot of threat to our pTarget pAxe->AddThreat(pTarget, 10000000.0f); } } } if (m_uiShadowNovaTimer > 35000) m_uiShadowNovaTimer = m_uiEnfeebleTimer + 5000; return; } if (SunderArmorTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUNDER_ARMOR); SunderArmorTimer = urand(10000, 18000); } else SunderArmorTimer -= uiDiff; if (m_uiCleave_Timer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); m_uiCleave_Timer = urand(6000, 12000); } else m_uiCleave_Timer -= uiDiff; } else { if (m_uiAxesTargetSwitchTimer < uiDiff) { m_uiAxesTargetSwitchTimer = urand(7500, 20000); Unit *target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) { for(int i = 0; i < 2; ++i) { Creature *axe = m_creature->GetMap()->GetCreature(m_aAxeGuid[i]); if (axe) { float threat = 1000000.0f; if (axe->getVictim() && m_creature->getThreatManager().getThreat(axe->getVictim())) { threat = axe->getThreatManager().getThreat(axe->getVictim()); axe->getThreatManager().modifyThreatPercent(axe->getVictim(), -100); } if (target) axe->AddThreat(target, threat); //axe->getThreatManager().tauntFadeOut(axe->getVictim()); //axe->getThreatManager().tauntApply(target); } } } } else m_uiAxesTargetSwitchTimer -= uiDiff; if (m_uiAmplifyDamageTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) DoCastSpellIfCan(pTarget, SPELL_AMPLIFY_DAMAGE); m_uiAmplifyDamageTimer = urand(20000, 30000); } else m_uiAmplifyDamageTimer -= uiDiff; } //Time for global and double timers if (InfernalTimer < uiDiff) { SummonInfernal(); InfernalTimer = m_uiPhase == 3 ? 14500 : 44500; //15 secs in m_uiPhase 3, 45 otherwise } else InfernalTimer -= uiDiff; if (m_uiShadowNovaTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWNOVA); m_uiShadowNovaTimer = m_uiPhase == 3 ? 31000 : -1; } else m_uiShadowNovaTimer -= uiDiff; if (m_uiPhase != 2) { if (m_uiSWPainTimer < uiDiff) { Unit* target = NULL; if (m_uiPhase == 1) target = m_creature->getVictim(); // the tank else //anyone but the tank target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); if (target) DoCastSpellIfCan(target, SPELL_SW_PAIN); m_uiSWPainTimer = 20000; } else m_uiSWPainTimer -= uiDiff; } if (m_uiPhase != 3) { if (m_uiEnfeebleTimer < uiDiff) { EnfeebleHealthEffect(); m_uiEnfeebleTimer = 30000; m_uiShadowNovaTimer = 5000; m_uiEnfeebleResetTimer = 9000; } else m_uiEnfeebleTimer -= uiDiff; } if (m_uiPhase==2) DoMeleeAttacksIfReady(); else DoMeleeAttackIfReady(); }