void RemoveGravityLapse() { std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) { pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); WorldPacket data(12); data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); data.append(pUnit->GetPackGUID()); data << uint32(0); pUnit->SendMessageToSet(&data, true); } } }
void RemoveGravityLapse() { ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12); data.append(unit->GetPackGUID()); data << uint32(0); unit->SendMessageToSet(&data, true); } } }
void Totem::UnSummon() { SendObjectDeSpawnAnim(GetGUID()); CombatStop(); RemoveAurasDueToSpell(GetSpell()); Unit *owner = this->GetOwner(); if (owner) { // clear owenr's totem slot for(int i = 0; i < MAX_TOTEM; ++i) { if(owner->m_TotemSlot[i]==GetGUID()) { owner->m_TotemSlot[i] = 0; break; } } owner->RemoveAurasDueToSpell(GetSpell()); //remove aura all party members too Group *pGroup = NULL; if (owner->GetTypeId() == TYPEID_PLAYER) { // Not only the player can summon the totem (scripted AI) pGroup = ((Player*)owner)->GetGroup(); if (pGroup) { for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); if(Target && pGroup->SameSubGroup((Player*)owner, Target)) Target->RemoveAurasDueToSpell(GetSpell()); } } } } CleanupsBeforeDelete(); AddObjectToRemoveList(); }
void UpdateAI(const uint32 uiDiff) override { if (!m_pInstance) m_creature->ForcedDespawn(); if (m_pInstance->GetData(TYPE_VALKIRIES) != IN_PROGRESS) { Map* pMap = m_creature->GetMap(); Map::PlayerList const &lPlayers = pMap->GetPlayers(); for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) { Unit* pPlayer = itr->getSource(); if (!pPlayer) continue; if (pPlayer) pPlayer->RemoveAurasDueToSpell(SPELL_LIGHT_ESSENCE); } m_creature->ForcedDespawn(); } return; }
void OnRemoveVehicle(constAuraEffectPtr /*aurEff*/, AuraEffectHandleModes mode) { PreventDefaultAction(); Unit* caster = GetCaster(); if (!caster) return; Position exitPosition; exitPosition.m_positionX = 1750.0f; exitPosition.m_positionY = -7.5f + frand(-3.0f, 3.0f); exitPosition.m_positionZ = 457.9322f; caster->_ExitVehicle(&exitPosition); caster->RemoveAurasDueToSpell(GetId()); Position oldPos; caster->GetPosition(&oldPos); caster->Relocate(exitPosition); caster->GetMotionMaster()->MoveFall(); caster->Relocate(oldPos); }
void SetPhaseOne() { Talk(SAY_HEART_CLOSED); if (me->HasAura(SPELL_SUBMERGE)) me->RemoveAurasDueToSpell(SPELL_SUBMERGE); DoCast(me, SPELL_STAND); // Just for the case this isn't done by the spell above. phase = PHASE_ONE; events.SetPhase(PHASE_ONE); events.RescheduleEvent(EVENT_SEARING_LIGHT, TIMER_SEARING_LIGHT / 2, 0, PHASE_ONE); events.RescheduleEvent(EVENT_GRAVITY_BOMB, TIMER_GRAVITY_BOMB, 0, PHASE_ONE); events.RescheduleEvent(EVENT_TYMPANIC_TANTRUM, urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX), 0, PHASE_ONE); Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL; if (!heart) return; heart->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); heart->RemoveAurasDueToSpell(SPELL_EXPOSED_HEART); if (!hardMode) { if (me->GetHealth() <= _transferHealth) _transferHealth = me->GetHealth() - 10000; me->ModifyHealth(-((int32)_transferHealth)); me->LowerPlayerDamageReq(_transferHealth); } float healthPct = me->GetHealthPct(); if (healthPct <= 25) heartExposed = 3; else if (healthPct <= 50) heartExposed = 2; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); }
bool BSWScriptedAI::_doRemoveFromAll(uint32 SpellID) { Map* pMap = m_creature->GetMap(); Map::PlayerList const& pPlayers = pMap->GetPlayers(); if (!pPlayers.isEmpty()) { debug_log("BSW: Removing effects of spell %u from all players",SpellID); for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr) { Unit* pTarget = itr->getSource(); if (pTarget && pTarget->IsInWorld()) pTarget->RemoveAurasDueToSpell(SpellID); } return true; } else { debug_log("BSW: Removing effects of spell %u from all players FAILED - no players in map",SpellID); return false; } };
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (uiGripOfSladRanTimer <= diff) { Unit* target = me->getVictim(); uiGripOfSladRanTimer = urand(3, 6)*IN_MILLISECONDS; if (!target) return; if (!target->HasAura(SPELL_GRIP_OF_SLAD_RAN)) { me->AddAura(SPELL_GRIP_OF_SLAD_RAN, target); return; } if (Aura* grip = target->GetAura(SPELL_GRIP_OF_SLAD_RAN)) { if (grip->GetStackAmount() < 5) { grip->SetStackAmount(grip->GetStackAmount() + 1); } else { target->RemoveAurasDueToSpell(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID()); target->CastSpell(target, SPELL_SNAKE_WRAP, true); if (TempSummon* _me = me->ToTempSummon()) if (Creature* sladran = _me->GetSummoner()->ToCreature()) sladran->AI()->SetGUID(target->GetGUID() ,DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES); me->DespawnOrUnsummon(); } } } else uiGripOfSladRanTimer -= diff; }
void SetPhaseOne() { DoScriptText(SAY_HEART_CLOSED, me); if (me->HasAura(SPELL_SUBMERGE)) me->RemoveAurasDueToSpell(SPELL_SUBMERGE); DoCast(me, SPELL_STAND); // Just for the case this isn't done by the spell above. me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); phase = PHASE_ONE; events.SetPhase(PHASE_ONE); events.RescheduleEvent(EVENT_SEARING_LIGHT, TIMER_SEARING_LIGHT / 2, 0, PHASE_ONE); events.RescheduleEvent(EVENT_GRAVITY_BOMB, TIMER_GRAVITY_BOMB, 0, PHASE_ONE); events.RescheduleEvent(EVENT_TYMPANIC_TANTRUM, urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX)*2, 0, PHASE_ONE); Unit* heart = FindHeart(); if (!heart) return; heart->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); heart->RemoveAurasDueToSpell(SPELL_EXPOSED_HEART); if (!hardMode) { if (!transferHealth) // Not settled == heart did not die if ( uint32 healthDiff = (heart->GetMaxHealth() - heart->GetHealth()) ) { me->DealDamage(me, healthDiff); me->LowerPlayerDamageReq(healthDiff); } // Note: if the heart did not go down enough or the players sucked too much (heal through bots), we may have jumped back in heart-phase // Otherwise, damage to the heart got mirrored to the XT002, thus one or more of the heart-phases can be excluded. RecalcHeartPhase(); } }
void RemoveGravityLapse() { std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); ObjectGuid guid = unit->GetGUID(); WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12); data.WriteBitSeq<2, 1, 5, 0, 3, 4, 6, 7>(guid); data.WriteByteSeq<1, 5, 6>(guid); data << uint32(0); //! movement counter data.WriteByteSeq<7, 4, 2, 3, 0>(guid); unit->SendMessageToSet(&data, true); } } }
void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { PreventDefaultAction(); Unit* caster = GetCaster(); if (!caster) return; Position exitPosition; exitPosition.m_positionX = 1750.0f; exitPosition.m_positionY = -7.5f + frand(-3.0f, 3.0f); exitPosition.m_positionZ = 457.9322f; // Remove pending passengers before exiting vehicle - might cause an Uninstall GetTarget()->GetVehicleKit()->RemovePendingEventsForPassenger(caster); caster->_ExitVehicle(&exitPosition); caster->RemoveAurasDueToSpell(GetId()); // Temporarily relocate player to vehicle exit dest serverside to send proper fall movement // beats me why blizzard sends these 2 spline packets one after another instantly Position oldPos = caster->GetPosition(); caster->Relocate(exitPosition); caster->GetMotionMaster()->MoveFall(); caster->Relocate(oldPos); }
void SetPhaseOne() { Talk(SAY_HEART_CLOSED); Talk(EMOTE_HEART_CLOSED); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); DoCastSelf(SPELL_STAND); _phase = 1; events.RescheduleEvent(EVENT_SEARING_LIGHT, TIMER_SEARING_LIGHT / 2); events.RescheduleEvent(EVENT_GRAVITY_BOMB, TIMER_GRAVITY_BOMB); events.RescheduleEvent(EVENT_TYMPANIC_TANTRUM, urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX)); Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT_EXPOSED) : nullptr; if (!heart) return; heart->CastSpell(me, SPELL_HEART_RIDE_VEHICLE, true); heart->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); heart->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); heart->RemoveAurasDueToSpell(SPELL_EXPOSED_HEART); if (!_hardMode) { if (!_transferHealth) _transferHealth = (heart->GetMaxHealth() - heart->GetHealth()); if (_transferHealth >= me->GetHealth()) _transferHealth = me->GetHealth() - 1; me->ModifyHealth(-((int32)_transferHealth)); me->LowerPlayerDamageReq(_transferHealth); } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; //Shimmer_Timer Timer if (Shimmer_Timer <= diff) { //Remove old vulnerabilty spell if (CurrentVurln_Spell) me->RemoveAurasDueToSpell(CurrentVurln_Spell); //Cast new random vulnerabilty on self uint32 spell; do { spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY, SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY); }while (spell == CurrentVurln_Spell); // Endlosschleife Wahrscheinlichkeit -> 0 DoCast(me, spell); CurrentVurln_Spell = spell; DoScriptText(EMOTE_SHIMMER, me); Shimmer_Timer = 45000; } else Shimmer_Timer -= diff; //Breath1_Timer if (Breath1_Timer <= diff) { DoCast(me->getVictim(), Breath1_Spell); Breath1_Timer = 60000; } else Breath1_Timer -= diff; //Breath2_Timer if (Breath2_Timer <= diff) { DoCast(me->getVictim(), Breath2_Spell); Breath2_Timer = 60000; } else Breath2_Timer -= diff; //Affliction_Timer if (Affliction_Timer <= diff) { std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) { Unit* pUnit; if ((*i) && (*i)->getSource()) { pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); if (pUnit) { //Cast affliction DoCast(pUnit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true); //Chromatic mutation if target is effected by all afflictions if (pUnit->HasAura(SPELL_BROODAF_BLUE) && pUnit->HasAura(SPELL_BROODAF_BLACK) && pUnit->HasAura(SPELL_BROODAF_RED) && pUnit->HasAura(SPELL_BROODAF_BRONZE) && pUnit->HasAura(SPELL_BROODAF_GREEN)) { if (pUnit->GetTypeId() == TYPEID_PLAYER) { pUnit->RemoveAurasDueToSpell(SPELL_BROODAF_BLUE); pUnit->RemoveAurasDueToSpell(SPELL_BROODAF_BLACK); pUnit->RemoveAurasDueToSpell(SPELL_BROODAF_RED); pUnit->RemoveAurasDueToSpell(SPELL_BROODAF_BRONZE); pUnit->RemoveAurasDueToSpell(SPELL_BROODAF_GREEN); DoCast(pUnit, SPELL_CHROMATIC_MUT_1, true); } //Chromatic mutation is causing issues //Assuming it is caused by a lack of core support for Charm //So instead we instant kill our target //WORKAROUND //if (pUnit->GetTypeId() == TYPEID_PLAYER) // pUnit->CastSpell(pUnit, 5, false); } } } } Affliction_Timer = 10000; } else Affliction_Timer -= diff; //Frenzy_Timer if (Frenzy_Timer <= diff) { DoCast(me, SPELL_FRENZY); DoScriptText(EMOTE_FRENZY, me); Frenzy_Timer = urand(10000, 15000); } else Frenzy_Timer -= diff; //Enrage if not already enraged and below 20% if (!Enraged && HealthBelowPct(20)) { DoCast(me, SPELL_ENRAGE); Enraged = true; } DoMeleeAttackIfReady(); }
void JustDied(Unit* /*victim*/) { Unit* pUnit = Unit::GetUnit((*me), victimGUID); if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER)) pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { if (Phase == PHASE_INTRO) { if (m_uiEventTimer <= uiDiff) { switch(subevent) { case 0: if (lInitiates.size() < SUMMONS_NUMBER) SpawnAdds(lInitiates, MOB_INITIATE); else ++subevent; m_uiEventTimer = 1500; break; case 1: case 2: case 3: case 4: case 5: DoScriptText(SayPreaching[subevent], m_creature); m_uiEventTimer = 10000; ++subevent; break; case 6: if (!lInitiates.empty()) for (std::list<uint64>::iterator itr = lInitiates.begin(); itr != lInitiates.end(); ++itr) { if (Unit* pUnit = Unit::GetUnit(*m_creature, *itr)) pUnit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); } subevent = 0; Phase = PHASE_AFTER_INTRO; m_uiEventTimer = 1500; break; default: break; } } else m_uiEventTimer -= uiDiff; } return; } if (Phase == PHASE_SACRIFICE_SEQUENCE) { if (m_uiEventTimer <= uiDiff) { if (!m_pInstance) { // this should not happen! Phase = PHASE_READY_TO_ATTACK; return; } Unit* pController = Unit::GetUnit(*m_creature, m_pInstance->GetData64(NPC_JEDOGA_CONTROLLER)); if (!pController) { // this should not happen! Phase = PHASE_READY_TO_ATTACK; return; } switch(subevent) { case 0: MoveToPosition(true); ++subevent; break; case 1: if (lVolunteers.size() < SUMMONS_NUMBER) SpawnAdds(lVolunteers, MOB_VOLUNTEER); else { DoScriptText(urand(0, 1) > 0 ? SAY_CALL_SACRIFICE_1 : SAY_CALL_SACRIFICE_2, m_creature); ++subevent; } break; case 2: pController->CastSpell(pController, SPELL_SACRIFICE_VISUAL, false); DoCastSpellIfCan(m_creature, SPELL_SACRIFICE_BEAM); ++subevent; break; case 3: { std::list<uint64>::iterator itr = lVolunteers.begin(); advance(itr, (rand()% (lVolunteers.size()))); if (Unit* pVolunteer = Unit::GetUnit(*m_creature, *itr)) { pVolunteer->RemoveAurasDueToSpell(SPELL_VOLUNTEER_SPHERE); float x, y, z; pController->GetPosition(x, y, z); pVolunteer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); pVolunteer->GetMotionMaster()->MovePoint(7, x, y, z); DoScriptText(SAY_VOLUNTEER_1, pVolunteer); } ++subevent; } break; case 4: if (m_creature->HasAura(SPELL_GIFT_OF_HERALD)) bSacrificeEnding = true; if (bSacrificeEnding) { pController->RemoveAurasDueToSpell(SPELL_SACRIFICE_VISUAL); MoveToPosition(false); Phase = PHASE_READY_TO_ATTACK; subevent = 0; return; } break; default: break; } m_uiEventTimer = 1500; }else m_uiEventTimer -= uiDiff; return; } if(!bSacrificeEnding) { if (m_uiSacrificeTimer < uiDiff) Phase = PHASE_SACRIFICE_SEQUENCE; else m_uiSacrificeTimer -= uiDiff; } if(m_uiCycloneTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_CYCLONE_STRIKE : SPELL_CYCLONE_STRIKE_H); m_uiCycloneTimer = urand(10000, 20000); } else m_uiCycloneTimer -= uiDiff; if(m_uiLightningboltTimer < uiDiff) { if(Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_LIGHTING_BOLT : SPELL_LIGHTING_BOLT_H); m_uiLightningboltTimer = urand(3000, 8000); } else m_uiLightningboltTimer -= uiDiff; if(m_uiThunderTimer < uiDiff) { if(Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_THUNDER_SHOCK : SPELL_THUNDER_SHOCK_H); m_uiThunderTimer = urand(8000, 16000); } else m_uiThunderTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) { //No target so we'll use this section to do our random wispers instance wide //WisperTimer if (WisperTimer <= diff) { Map *map = me->GetMap(); if (!map->IsDungeon()) return; Map::PlayerList const &PlayerList = map->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (Player* i_pl = i->getSource()) { //Play random sound to the zone i_pl->SendPlaySound(RANDOM_SOUND_WHISPER, true); } } //One random wisper every 90 - 300 seconds WisperTimer = 90000 + (rand()% 210000); } else WisperTimer -= diff; return; } me->SetUInt64Value(UNIT_FIELD_TARGET, 0); //No instance if (!pInst) return; switch (pInst->GetData(DATA_CTHUN_PHASE)) { //Transition phase case 2: { //PhaseTimer if (PhaseTimer <= diff) { //Switch pInst->SetData(DATA_CTHUN_PHASE, 3); //Switch to c'thun model me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_TRANSFORM, false); me->SetHealth(me->GetMaxHealth()); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); //Emerging phase //AttackStart(Unit::GetUnit(*me, HoldPlayer)); DoZoneInCombat(); //Place all units in threat list on outside of stomach Stomach_Map.clear(); std::list<HostileReference*>::iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) { //Outside stomach Stomach_Map[(*i)->getUnitGuid()] = false; } //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; Creature* Spawned; //Spawn flesh tentacle Spawned = (Creature*)me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0); if (!Spawned) FleshTentaclesKilled++; else ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(me->GetGUID()); //Spawn flesh tentacle Spawned = (Creature*)me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0); if (!Spawned) FleshTentaclesKilled++; else ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(me->GetGUID()); PhaseTimer = 0; } else PhaseTimer -= diff; }break; //Body Phase case 3: { //Remove Target field me->SetUInt64Value(UNIT_FIELD_TARGET, 0); //Weaken if (FleshTentaclesKilled > 1) { pInst->SetData(DATA_CTHUN_PHASE, 4); DoScriptText(EMOTE_WEAKENED, me); PhaseTimer = 45000; DoCast(me, SPELL_RED_COLORATION, true); UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); //Kick all players out of stomach while (i != Stomach_Map.end()) { //Check for valid player Unit* pUnit = Unit::GetUnit(*me, i->first); //Only move units in stomach if (pUnit && i->second == true) { //Teleport each player out DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); //Cast knockback on them DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } ++i; } return; } //Stomach acid if (StomachAcidTimer <= diff) { //Apply aura to all players in stomach UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); while (i != Stomach_Map.end()) { //Check for valid player Unit* pUnit = Unit::GetUnit(*me, i->first); //Only apply to units in stomach if (pUnit && i->second == true) { //Cast digestive acid on them DoCast(pUnit, SPELL_DIGESTIVE_ACID, true); //Check if player should be kicked from stomach if (pUnit->GetDistance(KICK_X, KICK_Y, KICK_Z) < 15) { //Teleport each player out DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); //Cast knockback on them DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } } ++i; } StomachAcidTimer = 4000; } else StomachAcidTimer -= diff; //Stomach Enter Timer if (StomachEnterTimer <= diff) { Unit* pTarget = NULL; pTarget = SelectRandomNotStomach(); if (pTarget) { //Set target in stomach Stomach_Map[pTarget->GetGUID()] = true; pTarget->InterruptNonMeleeSpells(false); pTarget->CastSpell(pTarget, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID()); StomachEnterTarget = pTarget->GetGUID(); StomachEnterVisTimer = 3800; } StomachEnterTimer = 13800; } else StomachEnterTimer -= diff; if (StomachEnterVisTimer && StomachEnterTarget) { if (StomachEnterVisTimer <= diff) { //Check for valid player Unit* pUnit = Unit::GetUnit(*me, StomachEnterTarget); if (pUnit) { DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); } StomachEnterTarget = 0; StomachEnterVisTimer = 0; } else StomachEnterVisTimer -= diff; } //GientClawTentacleTimer if (GiantClawTentacleTimer <= diff) { Unit* pTarget = NULL; pTarget = SelectRandomNotStomach(); if (pTarget) { Creature* Spawned = NULL; //Spawn claw tentacle on the random target Spawned = (Creature*)me->SummonCreature(MOB_GIANT_CLAW_TENTACLE,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500); if (Spawned) Spawned->AI()->AttackStart(pTarget); } //One giant claw tentacle every minute GiantClawTentacleTimer = 60000; } else GiantClawTentacleTimer -= diff; //GiantEyeTentacleTimer if (GiantEyeTentacleTimer <= diff) { Unit* pTarget = NULL; pTarget = SelectRandomNotStomach(); if (pTarget) { Creature* Spawned = NULL; //Spawn claw tentacle on the random target Spawned = (Creature*)me->SummonCreature(MOB_GIANT_EYE_TENTACLE,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500); if (Spawned) Spawned->AI()->AttackStart(pTarget); } //One giant eye tentacle every minute GiantEyeTentacleTimer = 60000; } else GiantEyeTentacleTimer -= diff; //EyeTentacleTimer if (EyeTentacleTimer <= diff) { //Spawn the 8 Eye Tentacles in the corret spots SpawnEyeTentacle(0, 25); //south SpawnEyeTentacle(12, 12); //south west SpawnEyeTentacle(25, 0); //west SpawnEyeTentacle(12, -12); //north west SpawnEyeTentacle(0, -25); //north SpawnEyeTentacle(-12, -12); //north east SpawnEyeTentacle(-25, 0); // east SpawnEyeTentacle(-12, 12); // south east //These spawn at every 30 seconds EyeTentacleTimer = 30000; } else EyeTentacleTimer -= diff; }break; //Weakened state case 4: { //PhaseTimer if (PhaseTimer <= diff) { //Switch pInst->SetData(DATA_CTHUN_PHASE, 3); //Remove red coloration me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; Creature* Spawned; //Spawn flesh tentacle Spawned = (Creature*)me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0); if (!Spawned) FleshTentaclesKilled++; else ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(me->GetGUID()); //Spawn flesh tentacle Spawned = (Creature*)me->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0); if (!Spawned) FleshTentaclesKilled++; else ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(me->GetGUID()); PhaseTimer = 0; } else PhaseTimer -= diff; } } }
void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); target->RemoveAurasDueToSpell(SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1); target->RemoveAurasDueToSpell(SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2); }
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) { uint32 spellId; uint8 cast_count, unk_flags; recvPacket >> cast_count; recvPacket >> spellId; recvPacket >> unk_flags; // flags (if 0x02 - some additional data are received) // ignore for remote control state (for player case) Unit* mover = _player->m_mover; if(mover != _player && mover->GetTypeId()==TYPEID_PLAYER) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } // vehicle spells are handled by CMSG_PET_CAST_SPELL, // but player is still able to cast own spells if(_player->GetCharmGUID() && _player->GetCharmGUID() == _player->GetVehicleGUID()) mover = _player; sLog.outDebug("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i", spellId, cast_count, unk_flags, (uint32)recvPacket.size()); SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); if(!spellInfo) { sLog.outError("WORLD: unknown spell id %u", spellId); recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } //remove invisibility on casted hack if(spellId != 32612) if(mover->HasAura(32612)) mover->RemoveAurasDueToSpell(32612); if(mover->GetTypeId()==TYPEID_PLAYER) { // not have spell in spellbook or spell passive and not casted by client if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) ) { //cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } } else { // not have spell in spellbook or spell passive and not casted by client if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellId) ) { //cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } } // client provided targets SpellCastTargets targets; if(!targets.read(&recvPacket,mover)) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } // some spell cast packet including more data (for projectiles?) if (unk_flags & 0x02) { recvPacket.read_skip<float>(); // unk1, coords? recvPacket.read_skip<float>(); // unk1, coords? uint8 unk1; recvPacket >> unk1; // >> 1 or 0 if(unk1) { recvPacket.read_skip<uint32>(); // >> MSG_MOVE_STOP uint64 guid; // guid - unused if(!recvPacket.readPackGUID(guid)) return; MovementInfo movementInfo; ReadMovementInfo(recvPacket, &movementInfo); } }
void UpdateAI(const uint32 uiDiff) { // Return since we have no target if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; // Supreme mode - Causes Kazzak to cast his Shadowbolt every second. if (m_uiSupremeTimer < uiDiff && !m_bSupremeMode) m_bSupremeMode = true; else if (!m_bSupremeMode) m_uiSupremeTimer -= uiDiff; // Shadowbolt Volley if (m_uiShadowVolleyTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOW_VOLLEY); if (m_bSupremeMode) m_uiShadowVolleyTimer = 1000; else m_uiShadowVolleyTimer = urand(4000,20000); } else m_uiShadowVolleyTimer -= uiDiff; // Cleave if (m_uiCleaveTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(),SPELL_CLEAVE); m_uiCleaveTimer = urand(8000,12000); } else m_uiCleaveTimer -= uiDiff; // Thunder Clap if (m_uiThunderClapTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_THUNDERCLAP); m_uiThunderClapTimer = urand(10000,14000); } else m_uiThunderClapTimer -= uiDiff; // Void Bolt if (m_uiVoidBoltTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_VOIDBOLT); m_uiVoidBoltTimer = urand(15000,28000); } else m_uiVoidBoltTimer -= uiDiff; // Mark of Kazzak if (m_uiMarkOfKazzakTimer < uiDiff) { Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (pTarget && pTarget->getPowerType() == POWER_MANA && pTarget->GetPower(POWER_MANA) > 1000) { DoCastSpellIfCan(pTarget, SPELL_MARK_OF_KAZZAK); m_uiMarkOfKazzakTimer = 20000; } } else m_uiMarkOfKazzakTimer -= uiDiff; // Mark of Kazzak - Explode the target when does not have more mana ThreatList const& tMarkList = m_creature->getThreatManager().getThreatList(); for (ThreatList::const_iterator iter = tMarkList.begin(); iter != tMarkList.end(); ++iter) { Unit* pMarked = m_creature->GetMap()->GetUnit((*iter)->getUnitGuid()); if (pMarked && pMarked->HasAura(SPELL_MARK_OF_KAZZAK, EFFECT_INDEX_0) && pMarked->GetPower(POWER_MANA) < 250) { pMarked->RemoveAurasDueToSpell(SPELL_MARK_OF_KAZZAK); pMarked->CastSpell(pMarked, SPELL_MARK_OF_KAZZAK_EXP, false); break; } } // Twisted Reflection if (m_uiTwistedReflectionTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) DoCastSpellIfCan(pTarget, SPELL_TWISTEDREFLECTION); m_uiTwistedReflectionTimer = 15000; } else m_uiTwistedReflectionTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; // Growth // Gruul can cast this spell up to 30 times if (Growth_Timer <= diff) { DoCast(me,SPELL_GROWTH); DoScriptText(EMOTE_GROW, me); Growth_Timer = 30000; } else Growth_Timer -= diff; if (PerformingGroundSlam) { if (GroundSlamTimer <= diff) { switch(GroundSlamStage) { case 0: { //Begin the whole ordeal std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); std::vector<Unit*> knockback_targets; //First limit the list to only players for (std::list<HostileReference*>::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) { Unit* pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) knockback_targets.push_back(pTarget); } //Now to totally disoriend those players for (std::vector<Unit*>::iterator itr = knockback_targets.begin(); itr != knockback_targets.end(); ++itr) { Unit* target = *itr; Unit* target2 = *(knockback_targets.begin() + rand()%knockback_targets.size()); if (target && target2) { switch(rand()%2) { case 0: target2->CastSpell(target, SPELL_MAGNETIC_PULL, true, NULL, NULL, me->GetGUID()); break; case 1: target2->CastSpell(target, SPELL_KNOCK_BACK, true, NULL, NULL, me->GetGUID()); break; } } } GroundSlamTimer = 7000; break; } case 1: { //Players are going to get stoned std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) { Unit* pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (pTarget) { pTarget->RemoveAurasDueToSpell(SPELL_GRONN_LORDS_GRASP); pTarget->CastSpell(pTarget, SPELL_STONED, true, NULL, NULL, me->GetGUID()); } } GroundSlamTimer = 5000; break; } case 2: { DoCast(me, SPELL_SHATTER); GroundSlamTimer = 1000; break; } case 3: { //Shatter takes effect // Not Needet Anymore Handled in Spell SPELL_SHATTER //std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); //for (std::list<HostileReference*>::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) //{ // Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); // if (target) // { // target->RemoveAurasDueToSpell(SPELL_STONED); // if (target->GetTypeId() == TYPEID_PLAYER) // target->CastSpell(target, SPELL_SHATTER_EFFECT, false, NULL, NULL, me->GetGUID()); // } //} me->GetMotionMaster()->Clear(); Unit* victim = me->getVictim(); if (victim) { me->GetMotionMaster()->MoveChase(victim); me->SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); } PerformingGroundSlam = false; GroundSlamTimer =120000; HurtfulStrike_Timer= 8000; if (Reverberation_Timer < 10000) //Give a little time to the players to undo the damage from shatter Reverberation_Timer += 10000; break; } } GroundSlamStage++; } else GroundSlamTimer-=diff; } else { // Hurtful Strike if (HurtfulStrike_Timer <= diff) { Unit* pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1); if (pTarget && me->IsWithinMeleeRange(me->getVictim())) DoCast(pTarget,SPELL_HURTFUL_STRIKE); else DoCast(me->getVictim(),SPELL_HURTFUL_STRIKE); HurtfulStrike_Timer= 8000; } else HurtfulStrike_Timer -= diff; // Reverberation if (Reverberation_Timer <= diff) { DoCast(me->getVictim(), SPELL_REVERBERATION, true); Reverberation_Timer = 30000; } else Reverberation_Timer -= diff; // Cave In if (CaveIn_Timer <= diff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(pTarget,SPELL_CAVE_IN); CaveIn_Timer = 20000; } else CaveIn_Timer -= diff; // Ground Slam, Gronn Lord's Grasp, Stoned, Shatter if (GroundSlamTimer <= diff) { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->SetUInt64Value(UNIT_FIELD_TARGET, 0); PerformingGroundSlam= true; GroundSlamTimer = 0; GroundSlamStage = 0; DoCast(me->getVictim(), SPELL_GROUND_SLAM); } else GroundSlamTimer -=diff; DoMeleeAttackIfReady(); } }
void JustDied(Unit* /*killer*/) override { Unit* unit = ObjectAccessor::GetUnit(*me, victimGUID); if (unit && unit->HasAura(SPELL_INSIDIOUS_WHISPER)) unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); }
void JustDied(Unit* victim) { pPlayer->RemoveAurasDueToSpell(RAID_MODE(RAID_10_SPELL_IRON_ROOTS, RAID_25_SPELL_IRON_ROOTS)); }
void HandleHeal() { Unit* caster = GetCaster(); caster->CastSpell(caster, SPELL_WARRIOR_VICTORY_RUSH_HEAL, true); caster->RemoveAurasDueToSpell(SPELL_WARRIOR_VICTORIOUS); }
void UpdateAI(uint32 diff) { events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CRYSTAL_TRAP_TRIGGER: //Riplimb has a higher Priority than Players... if(GetRiplimb() && GetRiplimb()->GetDistance(me) <= 2.0f && (!GetRiplimb()->HasAura(RAID_MODE(SPELL_WARY_10N, SPELL_WARY_25N, SPELL_WARY_10H, SPELL_WARY_25H))) && GetRiplimb()->IsAlive() && GetShannox()->AI()->GetData(DATA_PHASE) == PHASE_SHANNOX_HAS_SPEER) tempTarget = GetRiplimb(); else if(GetRageface() && GetRageface()->GetDistance(me) <= 3.0f && !GetRageface()->HasAura(RAID_MODE(SPELL_WARY_10N, SPELL_WARY_25N, SPELL_WARY_10H, SPELL_WARY_25H)) && GetRageface()->IsAlive()) tempTarget = GetRageface(); else tempTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 2.0f, true); if (!tempTarget || tempTarget->HasAura(CRYSTAL_PRISON_EFFECT)) // If no Target exists try to get a new Target in 0,5s events.ScheduleEvent(EVENT_CRYSTAL_TRAP_TRIGGER, 500); else { // Intialize Prison if tempTarget was set DoCast(tempTarget,CRYSTAL_PRISON_EFFECT); myPrison = me->SummonCreature(NPC_CRYSTAL_PRISON,tempTarget->GetPositionX(), tempTarget->GetPositionY(), tempTarget->GetPositionZ(),0, TEMPSUMMON_MANUAL_DESPAWN); if (myPrison) { me->SetReactState(REACT_AGGRESSIVE); myPrison->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); } events.ScheduleEvent(EVENT_CRYSTAL_PRISON_DESPAWN, 20000); } break; case EVENT_CRYSTAL_PRISON_DESPAWN: if (tempTarget) { myPrison->DisappearAndDie(); tempTarget->RemoveAurasDueToSpell(CRYSTAL_PRISON_EFFECT); // Cast Spell Wary on Dogs if(tempTarget->GetEntry() == NPC_RIPLIMB || tempTarget->GetEntry() == NPC_RAGEFACE) tempTarget->AddAura(RAID_MODE(SPELL_WARY_10N, SPELL_WARY_25N, SPELL_WARY_10H, SPELL_WARY_25H),tempTarget); me->DisappearAndDie(); } break; default: break; } } if(myPrison && myPrison->IsDead()) { myPrison->DisappearAndDie(); tempTarget->RemoveAurasDueToSpell(CRYSTAL_PRISON_EFFECT); // Cast Spell Wary on Dogs if(tempTarget->GetEntry() == NPC_RIPLIMB || tempTarget->GetEntry() == NPC_RAGEFACE) tempTarget->AddAura(RAID_MODE(SPELL_WARY_10N, SPELL_WARY_25N, SPELL_WARY_10H, SPELL_WARY_25H),tempTarget); me->DisappearAndDie(); } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (TargetTimer <= diff && Enslaved == false) { EnslaveTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); TargetTimer = 1000; } else TargetTimer -= diff; if (EnslaveEndTimer <= diff && Enslaved == true) { me->SetReactState(REACT_AGGRESSIVE); EnslaveTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); EnslaveTarget->RemoveAurasDueToSpell(SPELL_ENSLAVE); EnslaveTarget->RemoveAurasDueToSpell(SPELL_ENSLAVE_BUFF); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Enslaved = false; EnslaveTimer = 30000; AbsorbMagicTimer = 20000; MindFogTimer = urand(6000,12000); UnrelentingAgonyTimer = 10000; EnslaveEndTimer = 90000; } else EnslaveEndTimer -= diff; if (EnslaveTimer <= diff && Enslaved == false) { if (EnslaveTarget) { DoZoneInCombat(); me->SetReactState(REACT_PASSIVE); DoCast(EnslaveTarget, SPELL_ENSLAVE); DoCast(EnslaveTarget, SPELL_ENSLAVE_BUFF); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); DoScriptText(RAND(SAY_MIND_CONTROL_1,SAY_MIND_CONTROL_2,SAY_MIND_CONTROL_3), me); Enslaved = true; EnslaveTimer = 180000; AbsorbMagicTimer = 180000; MindFogTimer = 180000; UnrelentingAgonyTimer = 180000; EnslaveEndTimer = DUNGEON_MODE(60000,30000); CastTimer = 2000; } EnslaveTimer = 1000; } else EnslaveTimer -= diff; if (EnslaveTarget && Enslaved == true) if (EnslaveTarget->HealthBelowPct(50)) { me->SetReactState(REACT_AGGRESSIVE); EnslaveTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); EnslaveTarget->RemoveAurasDueToSpell(SPELL_ENSLAVE); EnslaveTarget->RemoveAurasDueToSpell(SPELL_ENSLAVE_BUFF); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Enslaved = false; EnslaveTimer = 30000; AbsorbMagicTimer = 20000; MindFogTimer = urand(6000,12000); UnrelentingAgonyTimer = 10000; } if (CastTimer <= diff && Enslaved == true) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, NotCharmedTargetSelector())) { switch(EnslaveTarget->getClass()) { case CLASS_DRUID: if (urand(0,1)) EnslaveTarget->CastSpell(pTarget, 8921, false); else EnslaveTarget->CastSpell(me, 774, false); break; case CLASS_HUNTER: EnslaveTarget->CastSpell(pTarget, RAND(2643, 1978), false); break; case CLASS_MAGE: EnslaveTarget->CastSpell(pTarget, RAND(44614, 30455), false); break; case CLASS_WARLOCK: EnslaveTarget->CastSpell(pTarget, RAND(980, 686), true); break; case CLASS_WARRIOR: EnslaveTarget->CastSpell(pTarget, RAND(46924, 845), false); break; case CLASS_PALADIN: if (urand(0,1)) EnslaveTarget->CastSpell(pTarget, 853, false); else EnslaveTarget->CastSpell(me, 20473, false); break; case CLASS_PRIEST: if (urand(0,1)) EnslaveTarget->CastSpell(pTarget, 34914, false); else EnslaveTarget->CastSpell(me, 139, false); break; case CLASS_SHAMAN: if (urand(0,1)) EnslaveTarget->CastSpell(pTarget, 421, false); else EnslaveTarget->CastSpell(me, 61295, false); break; case CLASS_ROGUE: EnslaveTarget->CastSpell(pTarget, RAND(16511, 1329), false); break; case CLASS_DEATH_KNIGHT: if (urand(0,1)) EnslaveTarget->CastSpell(pTarget, 45462, true); else EnslaveTarget->CastSpell(pTarget, 49184, true); break; } } CastTimer = 3000; } else CastTimer -= diff; if (AbsorbMagicTimer <= diff && Enslaved == false) { DoCast(me, SPELL_ABSORB_MAGIC); AbsorbMagicTimer = urand(15000,20000); } else AbsorbMagicTimer -= diff; if (MindFogTimer <= diff && Enslaved == false) { DoCast(me, SPELL_MIND_FOG_SUMMON); DoScriptText(SAY_MIND_FOG, me); MindFogTimer = 18000; } else MindFogTimer -= diff; if (UnrelentingAgonyTimer <= diff && Enslaved == false) { DoCastAOE(SPELL_UNRELENTING_AGONY); UnrelentingAgonyTimer = 20000; } else UnrelentingAgonyTimer -= diff; DoMeleeAttackIfReady(); }
void JustDied(Unit* /*killer*/) { Unit* unit = Unit::GetUnit(*me, victimGUID); if (unit && unit->HasAura(SPELL_INSIDIOUS_WHISPER)) unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); }
void JustDied(Unit* pVictim) { Unit* pUnit = m_creature->GetMap()->GetUnit(m_uiVictimGUID); if (pUnit) pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); }
void UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) { //No target so we'll use this section to do our random wispers instance wide //WisperTimer if (WisperTimer <= diff) { Map* map = me->GetMap(); if (!map->IsDungeon()) return; //Play random sound to the zone Map::PlayerList const &PlayerList = map->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { if (Player* pPlr = itr->getSource()) pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER, pPlr); } } //One random wisper every 90 - 300 seconds WisperTimer = urand(90000, 300000); } else WisperTimer -= diff; return; } me->SetTarget(0); //No instance if (!pInst) return; uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE); if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK) { // EyeTentacleTimer if (EyeTentacleTimer <= diff) { //Spawn the 8 Eye Tentacles in the corret spots SpawnEyeTentacle(0, 20); //south SpawnEyeTentacle(10, 10); //south west SpawnEyeTentacle(20, 0); //west SpawnEyeTentacle(10, -10); //north west SpawnEyeTentacle(0, -20); //north SpawnEyeTentacle(-10, -10); //north east SpawnEyeTentacle(-20, 0); // east SpawnEyeTentacle(-10, 10); // south east EyeTentacleTimer = 30000; // every 30sec in phase 2 } else EyeTentacleTimer -= diff; } switch (currentPhase) { //Transition phase case PHASE_CTHUN_TRANSITION: //PhaseTimer if (PhaseTimer <= diff) { //Switch pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); //Switch to c'thun model me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_TRANSFORM, false); me->SetFullHealth(); me->SetVisible(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); //Emerging phase //AttackStart(Unit::GetUnit(*me, HoldpPlayer)); DoZoneInCombat(); //Place all units in threat list on outside of stomach Stomach_Map.clear(); std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) { //Outside stomach Stomach_Map[(*i)->getUnitGuid()] = false; } //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; //Spawn flesh tentacle for (uint8 i = 0; i < 2; i++) { Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); if (!spawned) ++FleshTentaclesKilled; } PhaseTimer = 0; } else PhaseTimer -= diff; break; //Body Phase case PHASE_CTHUN_STOMACH: //Remove Target field me->SetTarget(0); //Weaken if (FleshTentaclesKilled > 1) { pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_WEAK); DoScriptText(EMOTE_WEAKENED, me); PhaseTimer = 45000; DoCast(me, SPELL_PURPLE_COLORATION, true); UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); //Kick all players out of stomach while (i != Stomach_Map.end()) { //Check for valid player Unit* pUnit = Unit::GetUnit(*me, i->first); //Only move units in stomach if (pUnit && i->second == true) { //Teleport each player out DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); //Cast knockback on them DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } ++i; } return; } //Stomach acid if (StomachAcidTimer <= diff) { //Apply aura to all players in stomach UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); while (i != Stomach_Map.end()) { //Check for valid player Unit* pUnit = Unit::GetUnit(*me, i->first); //Only apply to units in stomach if (pUnit && i->second == true) { //Cast digestive acid on them DoCast(pUnit, SPELL_DIGESTIVE_ACID, true); //Check if player should be kicked from stomach if (pUnit->IsWithinDist3d(&KickPos, 15.0f)) { //Teleport each player out DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); //Cast knockback on them DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } } ++i; } StomachAcidTimer = 4000; } else StomachAcidTimer -= diff; //Stomach Enter Timer if (StomachEnterTimer <= diff) { if (Unit* target = SelectRandomNotStomach()) { //Set target in stomach Stomach_Map[target->GetGUID()] = true; target->InterruptNonMeleeSpells(false); target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID()); StomachEnterTarget = target->GetGUID(); StomachEnterVisTimer = 3800; } StomachEnterTimer = 13800; } else StomachEnterTimer -= diff; if (StomachEnterVisTimer && StomachEnterTarget) { if (StomachEnterVisTimer <= diff) { //Check for valid player Unit* pUnit = Unit::GetUnit(*me, StomachEnterTarget); if (pUnit) { DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); } StomachEnterTarget = 0; StomachEnterVisTimer = 0; } else StomachEnterVisTimer -= diff; } //GientClawTentacleTimer if (GiantClawTentacleTimer <= diff) { if (Unit* target = SelectRandomNotStomach()) { //Spawn claw tentacle on the random target if (Creature* spawned = me->SummonCreature(MOB_GIANT_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500)) if (spawned->AI()) spawned->AI()->AttackStart(target); } //One giant claw tentacle every minute GiantClawTentacleTimer = 60000; } else GiantClawTentacleTimer -= diff; //GiantEyeTentacleTimer if (GiantEyeTentacleTimer <= diff) { if (Unit* target = SelectRandomNotStomach()) { //Spawn claw tentacle on the random target if (Creature* spawned = me->SummonCreature(MOB_GIANT_EYE_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500)) if (spawned->AI()) spawned->AI()->AttackStart(target); } //One giant eye tentacle every minute GiantEyeTentacleTimer = 60000; } else GiantEyeTentacleTimer -= diff; break; //Weakened state case PHASE_CTHUN_WEAK: //PhaseTimer if (PhaseTimer <= diff) { //Switch pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); //Remove purple coloration me->RemoveAurasDueToSpell(SPELL_PURPLE_COLORATION); //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; //Spawn flesh tentacle for (uint8 i = 0; i < 2; i++) { Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); if (!spawned) ++FleshTentaclesKilled; } PhaseTimer = 0; } else PhaseTimer -= diff; break; } }
void UpdateAI(const uint32 uiDiff) { if (!m_instance || !UpdateVictim()) return; if (m_instance->GetData(DATA_HEALTH_TWIN_SHARED) != 0) me->SetHealth(m_instance->GetData(DATA_HEALTH_TWIN_SHARED)); else if (me->getVictim()) { me->LowerPlayerDamageReq(me->GetMaxHealth()); me->getVictim()->Kill(me); return; } else me->SetHealth(1); if (m_uiSpecialAbilityTimer <= uiDiff) { me->InterruptNonMeleeSpells(false); if (urand(0, 1)) { DoScriptText(m_uiVortexEmote, me); DoScriptText(m_uiVortexSay, me); DoCastAOE(m_uiVortexSpellId); std::list<Unit*> targetList; SelectTargetList(targetList, 100, SELECT_TARGET_NEAREST, 150.0f, true, m_uiMyEssenceSpellId); if (!targetList.empty()) { for (std::list<Unit* >::const_iterator itr = targetList.begin(); itr != targetList.end(); ++itr) { Unit* pUnit = (*itr); if (pUnit && pUnit->isAlive()) { if (!pUnit->HasAura(SPELL_POWER_UP)) pUnit->AddAura(SPELL_POWER_UP, pUnit); if (Aura* aur = pUnit->GetAura(SPELL_POWER_UP)) { if (aur->GetStackAmount() + 30 > 100) { pUnit->RemoveAurasDueToSpell(SPELL_POWER_UP); pUnit->CastSpell(pUnit, me->GetEntry() == NPC_LIGHTBANE ? SPELL_EMPOWERED_LIGHT : SPELL_EMPOWERED_DARK, true); } else { if (urand(0, 100) <= 15) pUnit->CastSpell(pUnit, SPELL_SPEED, true); aur->SetStackAmount(aur->GetStackAmount() + 30); } } } } } } else { DoScriptText(EMOTE_SHIELD, me); DoScriptText(SAY_SHIELD, me); if (Creature* Sister = GetSister()) Sister->CastSpell(Sister, SPELL_TWIN_POWER, true); DoCast(me, m_uiShieldSpellId); me->CastCustomSpell(me, m_uiTwinPactSpellId, 0, 0, 0, false); } m_uiSpecialAbilityTimer = 80000; } else m_uiSpecialAbilityTimer -= uiDiff; if (m_uiSpikeTimer <= uiDiff) { DoCastVictim(m_uiSpikeSpellId); m_uiSpikeTimer = 20*1000; } else m_uiSpikeTimer -= uiDiff; if (IsHeroic()) { if (m_uiTouchTimer <= uiDiff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true, m_uiOtherEssenceSpellId)) { if (!target->HasAura(m_uiTouchSpellId)) { target->AddAura(m_uiTouchSpellId, target); } } m_uiTouchTimer = urand(10, 15)*1000; } else m_uiTouchTimer -= uiDiff; } if (m_uiColorballsTimer <= uiDiff) { if (m_uiWaveCount >= 2) { SummonColorballs(15); m_uiWaveCount = 0; } else { SummonColorballs(2); m_uiWaveCount++; } m_uiColorballsTimer = 15*1000; } else m_uiColorballsTimer -= uiDiff; if (m_uiBerserkTimer <= uiDiff) { if (!m_bIsBerserk) { DoCast(me, SPELL_BERSERK); DoScriptText(SAY_BERSERK, me); m_bIsBerserk = true; } } else m_uiBerserkTimer -= uiDiff; DoMeleeAttackIfReady(); }