Creature* RespawnNearbyBugsAndGetOne(uint32 bugEntry) { std::list<Creature*> lUnitList; GetCreatureListWithEntryInGrid(lUnitList, m_creature, bugEntry, 150.0f); if (lUnitList.empty()) return NULL; float dist = 9999999999999.f; Creature* pClosest = nullptr; for(std::list<Creature*>::iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter) { Creature *c = (Creature *)(*iter); if (c->HasAura(SPELL_EXPLODEBUG) || c->HasAura(SPELL_MUTATE_BUG)) continue; if (c->isDead()) { c->Respawn(); c->SetFactionTemporary(14); c->RemoveAllAuras(); } if (c->GetDistance(m_creature) < dist) { pClosest = c; dist = c->GetDistance(m_creature); } } return pClosest; }
void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; if (uiChaoticEnergyBurstTimer <= diff) { Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANOMALUS)); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) DoCast(target, SPELL_CHARGED_CHAOTIC_ENERGY_BURST); else DoCast(target, SPELL_CHAOTIC_ENERGY_BURST); } uiChaoticEnergyBurstTimer = 1000; } else uiChaoticEnergyBurstTimer -= diff; if (uiSummonCrazedManaWraithTimer <= diff) { if (Creature* Wraith = me->SummonCreature(MOB_CRAZED_MANA_WRAITH, me->GetPositionX() + 1, me->GetPositionY() + 1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) Wraith->AI()->AttackStart(target); Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANOMALUS)); if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) uiSummonCrazedManaWraithTimer = 5000; else uiSummonCrazedManaWraithTimer = 10000; } else uiSummonCrazedManaWraithTimer -= diff; }
bool EffectDummy(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override { if (pCaster->GetTypeId() != TYPEID_PLAYER) return true; Creature* pCreatureTarget = pTarget->ToCreature(); if (pCaster->HasAura(SPELL_DRAKE_HATCHLING_SUBDUED) || pCreatureTarget->HasAura(SPELL_SUBDUED)) return true; Player* pPlayer = (Player*)pCaster; if (!pPlayer) return true; // check the quest if (pPlayer->GetQuestStatus(QUEST_DRAKE_HUNT) != QUEST_STATUS_INCOMPLETE && pPlayer->GetQuestStatus(QUEST_DRAKE_HUNT_DAILY) != QUEST_STATUS_INCOMPLETE) return true; // evade and set friendly and start following @TODO move to creature script pCreatureTarget->SetFactionTemporary(FACTION_FRIENDLY, TEMPFACTION_RESTORE_REACH_HOME | TEMPFACTION_RESTORE_RESPAWN); pCreatureTarget->DeleteThreatList(); pCreatureTarget->CombatStop(true); pCreatureTarget->AI()->SendAIEvent(AI_EVENT_START_EVENT, pCaster, pCreatureTarget); // cast visual spells pCreatureTarget->CastSpell(pCreatureTarget, SPELL_DRAKE_VOMIT_PERIODIC, true); pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUBDUED, true); pCreatureTarget->CastSpell(pCaster, SPELL_DRAKE_HATCHLING_SUBDUED, true); return true; }
bool AwakenPeon(uint32 i, Spell* pSpell) { if ( pSpell == NULL || pSpell->p_caster == NULL ) return true; Player *pPlayer = pSpell->p_caster; Unit *pUnit = pSpell->GetUnitTarget(); if ( pUnit == NULL || !pUnit->IsCreature() ) return true; Creature *pTarget = static_cast< Creature* >( pUnit ); if ( !pTarget->HasAura( 17743 ) ) return true; if ( pTarget->GetEntry() == 10556 ) { WorldPacket data(SMSG_PLAY_OBJECT_SOUND, 12); data << uint32( 6197 ) << pTarget->GetGUID(); pPlayer->SendMessageToSet(&data, true); pTarget->RemoveAllAuras(); string Text; Text = "Ow! Ok, I'll get back to work, "; Text += pPlayer->GetName(); Text += "!"; pTarget->SendChatMessage( CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, Text.c_str() ); pTarget->Emote( EMOTE_STATE_WORK_NOSHEATHE_CHOPWOOD ); sQuestMgr.OnPlayerKill( pPlayer, pTarget ); } return true; }
bool EffectDummy(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override { // always check spellid and effectindex if (uiSpellId == SPELL_AWAKEN_PEON && uiEffIndex == EFFECT_INDEX_0) { Creature* pCreatureTarget = pTarget->ToCreature(); if (!pCreatureTarget) { return true; } if (!pCreatureTarget->HasAura(SPELL_PEON_SLEEP) || pCaster->GetTypeId() != TYPEID_PLAYER || pCreatureTarget->GetEntry() != NPC_SLEEPING_PEON) { return true; } if (CreatureAI* pPeonAI = pCreatureTarget->AI()) { pPeonAI->SendAIEvent(AI_EVENT_CUSTOM_A, pCaster, pCreatureTarget); //>StartLumbering(pCaster); } // always return true when we are handling this spell and effect return true; } return false; }
bool Carcass(uint32 i, Spell* pSpell) // Becoming a Shadoweave Tailor { if(!pSpell->u_caster->IsPlayer()) return true; Player *pPlayer = static_cast< Player* >(pSpell->u_caster); QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 10804 ); Creature *NetherDrake = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 21648); GameObject *FlayerCarcass = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 185155); if ( FlayerCarcass == NULL ) { FlayerCarcass = sEAS.SpawnGameobject(pPlayer, 185155, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0, 1); FlayerCarcass->Despawn(60000); } if ( NetherDrake == NULL ) return true; if ( NetherDrake->HasAura(38502) ) return true; if( pQuest!=NULL && pQuest->GetMobCount( 0 ) < pQuest->GetQuest()->required_mobcount[0] ) { NetherDrake->CastSpell(NetherDrake, dbcSpell.LookupEntry( 38502 ), true); NetherDrake->GetAIInterface()->m_moveFly = true; NetherDrake->GetAIInterface()->MoveTo(pPlayer->GetPositionX(), pPlayer->GetPositionY()+2, pPlayer->GetPositionZ(), 0); pQuest->SetMobCount( 0, pQuest->GetMobCount( 0 )+1); pQuest->SendUpdateAddKill( 0 ); pQuest->UpdatePlayerFields(); } return true; }
bool EffectAuraDummy_npc_nexus_drake_hatchling(const Aura* pAura, bool bApply) { if (pAura->GetId() == SPELL_DRAKE_HARPOON) { if (pAura->GetEffIndex() != EFFECT_INDEX_0 || !bApply) return false; Creature* pCreature = (Creature*)pAura->GetTarget(); Unit* pCaster = pAura->GetCaster(); if (!pCreature || !pCaster || pCaster->GetTypeId() != TYPEID_PLAYER || pCreature->GetEntry() != NPC_NEXUS_DRAKE_HATCHLING) return false; // check if drake is already doing the quest if (pCreature->HasAura(SPELL_RED_DRAGONBLOOD) || pCreature->HasAura(SPELL_SUBDUED)) return false; pCaster->CastSpell(pCreature, SPELL_RED_DRAGONBLOOD, true); return true; } else if (pAura->GetId() == SPELL_RED_DRAGONBLOOD && pAura->GetEffIndex() == EFFECT_INDEX_0) { Creature* pCreature = (Creature*)pAura->GetTarget(); Unit* pCaster = pAura->GetCaster(); if (!pCreature || !pCaster || pCaster->GetTypeId() != TYPEID_PLAYER || pCreature->GetEntry() != NPC_NEXUS_DRAKE_HATCHLING) return false; // start attacking on apply and capture on aura expire if (bApply) pCreature->AI()->AttackStart(pCaster); else pCaster->CastSpell(pCreature, SPELL_CAPTURE_TRIGGER, true); return true; } else if (pAura->GetId() == SPELL_SUBDUED && pAura->GetEffIndex() == EFFECT_INDEX_0 && !bApply) { Creature* pCreature = (Creature*)pAura->GetTarget(); if (!pCreature || pCreature->GetEntry() != NPC_NEXUS_DRAKE_HATCHLING) return false; // aura expired - evade pCreature->AI()->SendAIEvent(AI_EVENT_CUSTOM_A, pCreature, pCreature); return true; } return false; }
bool OnDummyApply(const Aura* pAura, bool bApply) override { if (pAura->GetEffIndex() != EFFECT_INDEX_0 || !bApply) return false; Creature* pCreature = (Creature*)pAura->GetTarget(); Unit* pCaster = pAura->GetCaster(); if (!pCreature || !pCaster || pCaster->GetTypeId() != TYPEID_PLAYER || pCreature->GetEntry() != NPC_NEXUS_DRAKE_HATCHLING) return false; // check if drake is already doing the quest if (pCreature->HasAura(SPELL_RED_DRAGONBLOOD) || pCreature->HasAura(SPELL_SUBDUED)) return false; pCaster->CastSpell(pCreature, SPELL_RED_DRAGONBLOOD, true); return true; }
void UpdateAI(const uint32 uiDiff) { // OOC if (m_uiCheckoutTimer <= uiDiff) { for (int i = 0; i < MAX_WEAVERS; ++i) { if (WeaverGUID[i] == 0) continue; Creature* pWeaver = m_creature->GetMap()->GetCreature(WeaverGUID[i]); // return weavers to orginal spawn point if (pWeaver && pWeaver->isAlive()) { if (!pWeaver->SelectHostileTarget() || !pWeaver->getVictim()) { if ((m_creature->GetDistance(pWeaver) > (SPAWN_DISTANCE + 1.5)) || (m_creature->GetDistance(pWeaver) < (SPAWN_DISTANCE - 1.5))) { pWeaver->GetMotionMaster()->Clear(); pWeaver->GetMotionMaster()->MovePoint(0, WeaverPOSITION[i][0], WeaverPOSITION[i][1], WeaverPOSITION[i][2]); } else if (!pWeaver->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) pWeaver->CastSpell(m_creature, SPELL_WEAVING_OOC, false); } else if (pWeaver->HasAura(SPELL_WEAVING_OOC)) pWeaver->InterruptSpell(CURRENT_CHANNELED_SPELL); } } m_uiCheckoutTimer = 1000; } m_uiCheckoutTimer -= uiDiff; // in combat if(!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiEventTimer <= uiDiff) { if (Unit* pVictim = m_creature->getVictim()) { switch(m_creature->GetEntry()) { case NPC_DURVAL: DoCastSpellIfCan(pVictim, SPELL_RUNE_OF_DESTRUCTION); break; case NPC_LOCHLI: DoCastSpellIfCan(pVictim, SPELL_THUNDERSTORM); break; case NPC_KORGAN: if (m_creature->GetHealthPercent() < 80.0f) DoCastSpellIfCan(m_creature, SPELL_SPELL_REVITALIZING_RUNE); else DoCastSpellIfCan(pVictim, SPELL_CALL_LIGHTNING); break; default: break; } } m_uiEventTimer = 30000; } else m_uiEventTimer -= uiDiff; DoMeleeAttackIfReady(); }
void JustDied(Unit* pKiller) { // remove twilight torment on Vesperon if (m_pInstance) { Creature* pVesperon = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_VESPERON)); if (pVesperon && pVesperon->isAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); } }
void UpdateAI(const uint32 uiDiff) { if (Heat) { if (HeatTimer <= uiDiff) { Creature* Construct = me->GetCreature(*me, ConstructGUID); if (Construct && !Construct->HasAura(SPELL_MOLTEN)) { me->AddAura(SPELL_HEAT, Construct); HeatTimer = 1000; } } else HeatTimer -= uiDiff; } }
// Wrapper to refresh frost spheres - it's not very clear how ofter should this happen void DoRefreshSpheres() { for (uint8 i = 0; i < MAX_FROSTSPHERES; ++i) { // If the sphere is alive and hasn't transfomed to permafrost yet summon a new one Creature* pTemp = m_creature->GetMap()->GetCreature(m_vSpheresGuidVector[i]); if (pTemp && !pTemp->HasAura(SPELL_PERMAFROST_TRANSFORM)) continue; // Summon a new frost sphere instead of the killed one if (Creature* pTemp = m_creature->SummonCreature(NPC_FROSTSPHERE, aFrostSphereSpawnPositions[i][0], aFrostSphereSpawnPositions[i][1], aFrostSphereSpawnPositions[i][2], 0, TEMPSUMMON_DEAD_DESPAWN, 0)) m_vSpheresGuidVector[i] = pTemp->GetObjectGuid(); } }
void EnterCombat(Unit* who) { if (!slatedrake->HasAura(SPELL_UNRESPONSIVE_DRAKE)) slatedrake->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (!stormrider->HasAura(SPELL_UNRESPONSIVE_DRAKE)) stormrider->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (!netherscion->HasAura(SPELL_UNRESPONSIVE_DRAKE)) netherscion->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (!timewarden->HasAura(SPELL_UNRESPONSIVE_DRAKE)) timewarden->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP); if (bWhelps) if (GameObject* pGo = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_WHELP_CAGE))) pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND); if (me->HasAura(SPELL_SHADOW_WARPED)) events.ScheduleEvent(EVENT_SHADOW_NOVA, 7000); events.ScheduleEvent(EVENT_BERSERK, 6 * MINUTE * IN_MILLISECONDS); proto->AddThreat(who, 10.0f); proto->SetInCombatWith(who); Talk(SAY_AGGRO); DoZoneInCombat(); instance->SetBossState(DATA_HALFUS,IN_PROGRESS); }
void JustDied(Unit* killer) { if (m_pInstance) { Creature* pDebuffTarget = NULL; if (m_pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) { //not solo fight, so main boss has deduff pDebuffTarget = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_SARTHARION)); if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR)) pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR); } else { //event not in progress, then solo fight and must remove debuff mini-boss pDebuffTarget = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_SHADRON)); if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); } } }
void SetData(uint32 id, uint32 value) { switch (id) { case 1: // cleanup at the start of the fight if (pInstance) { uint32 h_entry = GetHarpoonGunIdForThisHFS(); if( GameObject* wh = me->FindNearestGameObject(h_entry, 5.0f) ) { wh->SetRespawnTime(0); wh->Delete(); } if( GameObject* bh = me->FindNearestGameObject(GO_BROKEN_HARPOON, 5.0f) ) if (bh->GetPhaseMask() != 1) bh->SetPhaseMask(1, true); } Reset(); break; case 2: // repairing if (repairPoints < REPAIR_POINTS) { if (++repairPoints >= REPAIR_POINTS) { if( GameObject* bh = me->FindNearestGameObject(GO_BROKEN_HARPOON, 4.0f) ) bh->SetPhaseMask(2, true); if( GameObject* wh = me->SummonGameObject(GetHarpoonGunIdForThisHFS(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 3*M_PI/2, 0.0f, 0.0f, 0.0f, 0.0f, 0) ) { me->RemoveGameObject(wh, false); me->MonsterTextEmote(TEXT_TURRET_READY, 0, true); } } } break; case 3: // shoot if (pInstance) { Creature* razorscale = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_RAZORSCALE)); if (!razorscale) return; if (!razorscale->HasAura(value)) me->CastSpell(razorscale, SPELL_LAUNCH_CHAIN, true); } break; } }
bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_MISSING_DIPLOMAT11) { Creature* pSlim = GetClosestCreatureWithEntry(pCreature, NPC_TAPOKE_SLIM_JAHN, 25.0f); if (!pSlim) return false; if (!pSlim->HasAura(SPELL_STEALTH)) pSlim->CastSpell(pSlim, SPELL_STEALTH, true); pCreature->AI()->SendAIEvent(AI_EVENT_START_ESCORT, pPlayer, pSlim, pQuest->GetQuestId()); return true; } return false; }
void UpdateAI(const uint32 uiDiff) { if (heat) { if (heatTimer <= uiDiff) { Creature* construct = me->GetCreature(*me, constructGUID); if (construct && !construct->HasAura(SPELL_MOLTEN)) { me->AddAura(SPELL_HEAT, construct); heatTimer = 1*IN_MILLISECONDS; } } else heatTimer -= uiDiff; } }
void UpdateAI(const uint32 uiDiff) { if (_heat) { if (_heatTimer <= uiDiff) { Creature* construct = me->GetCreature(*me , _constructGUID); if (construct && !construct->HasAura(SPELL_MOLTEN)) { me->AddAura(SPELL_HEAT, construct); _heatTimer = 1000; } } else _heatTimer -= uiDiff; } }
void MovementInform(uint32 uiMotionType, uint32 uiPointId) override { if (uiMotionType != POINT_MOTION_TYPE || !m_pInstance) return; switch (uiPointId) { case POINT_ID_MOUNT: { // mount the closest vehicle and start attacking uint32 uiMountEntry = m_pInstance->GetMountEntryForChampion(); // search for the vehicle again, just in case the previous one was taken Creature* pMount = m_creature->GetMap()->GetCreature(m_newMountGuid); if (pMount->HasAura(SPELL_RIDE_ARGENT_VEHICLE)) pMount = GetClosestCreatureWithEntry(m_creature, uiMountEntry, 60.0f); // if we don't have any mount send an error if (!pMount) { script_error_log("Instance Trial of the Champion: ERROR Failed to get a mount replacement for champion %u.", m_creature->GetEntry()); return; } DoCastSpellIfCan(pMount, SPELL_RIDE_ARGENT_VEHICLE, CAST_TRIGGERED); if (m_creature->getVictim()) pMount->AI()->AttackStart(m_creature->getVictim()); m_bDefeated = false; break; } case POINT_ID_EXIT: // mark the first part as complete if required if (m_pInstance->GetData(TYPE_GRAND_CHAMPIONS) != DONE) m_pInstance->SetData(TYPE_ARENA_CHALLENGE, DONE); m_creature->ForcedDespawn(); break; } }
bool AwakenPeon(uint32 i, Spell * pSpell) { if ( pSpell == NULL || pSpell->p_caster == NULL ) return true; Player * pPlayer = pSpell->p_caster; Unit * pUnit = pSpell->GetUnitTarget(); if ( pUnit == NULL || !pUnit->IsCreature() ) return true; Creature * pTarget = TO_CREATURE( pUnit ); if ( !pTarget->HasAura( 17743 ) ) return true; if ( pTarget->GetEntry() == 10556 ) { QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 5441 ); if ( pQuest == NULL || pQuest->GetMobCount(0) < pQuest->GetQuest()->required_mobcount[0] ) return true; WorldPacket data(SMSG_PLAY_OBJECT_SOUND, 12); data << uint32( 6197 ) << pTarget->GetGUID(); pPlayer->SendMessageToSet(&data, true); pTarget->RemoveAllAuras(); string Text; Text = "Ow! Ok, I'll get back to work, "; Text += pPlayer->GetName(); Text += "!"; pTarget->SendChatMessage( CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, Text.c_str() ); pTarget->Emote( EMOTE_STATE_WORK_CHOPWOOD ); pQuest->SetMobCount( 0, pQuest->GetMobCount(0)+1 ); pQuest->SendUpdateAddKill( 0 ); pQuest->UpdatePlayerFields(); } return true; }
void Update(uint32 diff) { if (!instance->HavePlayers()) return; // portals should spawn if other portal is dead and doors are closed if (bActive && uiMainEventPhase == IN_PROGRESS) { if (uiActivationTimer < diff) { AddWave(); bActive = false; uiActivationTimer = 5000; } else uiActivationTimer -= diff; } // if main event is in progress and players have wiped then reset instance if ( uiMainEventPhase == IN_PROGRESS && CheckWipe()) { SetData(DATA_REMOVE_NPC, 1); StartBossEncounter(uiFirstBoss, false); StartBossEncounter(uiSecondBoss, false); SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); SetData(DATA_WAVE_COUNT, 0); uiMainEventPhase = NOT_STARTED; if (Creature* pSinclari = instance->GetCreature(uiSinclari)) { pSinclari->SetVisibility(VISIBILITY_ON); std::list<Creature*> GuardList; pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); if (!GuardList.empty()) { for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { if (Creature* pGuard = *itr) { pGuard->SetVisibility(VISIBILITY_ON); pGuard->SetReactState(REACT_AGGRESSIVE); pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition()); } } } pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition()); pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE); } } // Cyanigosa is spawned but not tranformed, prefight event Creature *pCyanigosa = instance->GetCreature(uiCyanigosa); if (pCyanigosa && !pCyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM)) { if (uiCyanigosaEventTimer <= diff) { switch(uiCyanigosaEventPhase) { case 1: pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa); uiCyanigosaEventTimer = 7*IN_MILISECONDS; ++uiCyanigosaEventPhase; break; case 2: pCyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); uiCyanigosaEventTimer = 7*IN_MILISECONDS; ++uiCyanigosaEventPhase; break; case 3: pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); pCyanigosa->SetReactState(REACT_AGGRESSIVE); uiCyanigosaEventTimer = 2*IN_MILISECONDS; ++uiCyanigosaEventPhase; break; case 4: uiCyanigosaEventPhase = 0; break; } } else uiCyanigosaEventTimer -= diff; } // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS) { // if door integrity is > 0 then decrase it's integrity state if(GetData(DATA_DOOR_INTEGRITY)) { if(uiDoorSpellTimer < diff) { SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1); uiDoorSpellTimer =2000; } else uiDoorSpellTimer -= diff; } // else set door state to active (means door will open and group have failed to sustain mob invasion on the door) else { SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); uiMainEventPhase = FAIL; } } }
bool EffectDummy(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override { if (uiSpellId == SPELL_THROW_WOLF_BAIT) { Creature* pCreatureTarget = pTarget->ToCreature(); if (uiEffIndex == EFFECT_INDEX_0 && pCreatureTarget->getFaction() != FACTION_MONSTER && !pCreatureTarget->HasAura(SPELL_HAS_EATEN)) { pCreatureTarget->SetFactionTemporary(FACTION_MONSTER); pCreatureTarget->SetWalk(false); pCreatureTarget->GetMotionMaster()->MoveIdle(); float fX, fY, fZ; pCaster->GetContactPoint(pCreatureTarget, fX, fY, fZ, CONTACT_DISTANCE); pCreatureTarget->GetMotionMaster()->MovePoint(POINT_DEST, fX, fY, fZ); return true; } } return false; }
void Update(uint32 diff) override { if (!instance->HavePlayers()) return; // portals should spawn if other portal is dead and doors are closed if (bActive && uiMainEventPhase == IN_PROGRESS) { if (uiActivationTimer < diff) { AddWave(); bActive = false; // 1 minute waiting time after each boss fight uiActivationTimer = (uiWaveCount == 6 || uiWaveCount == 12) ? 60000 : 5000; } else uiActivationTimer -= diff; } // if main event is in progress and players have wiped then reset instance if (uiMainEventPhase == IN_PROGRESS && CheckWipe()) { SetData(DATA_REMOVE_NPC, 1); StartBossEncounter(uiFirstBoss, false); StartBossEncounter(uiSecondBoss, false); SetData(DATA_MAIN_DOOR, GO_STATE_ACTIVE); SetData(DATA_WAVE_COUNT, 0); uiMainEventPhase = NOT_STARTED; for (int i = 0; i < 4; ++i) if (GameObject* crystal = instance->GetGameObject(uiActivationCrystal[i])) crystal->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); if (Creature* sinclari = GetCreature(DATA_SINCLARI)) { sinclari->SetVisible(true); std::list<Creature*> GuardList; sinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); if (!GuardList.empty()) { for (Creature* guard : GuardList) { guard->SetVisible(true); guard->SetReactState(REACT_AGGRESSIVE); guard->GetMotionMaster()->MovePoint(1, guard->GetHomePosition()); } } sinclari->GetMotionMaster()->MovePoint(1, sinclari->GetHomePosition()); sinclari->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } // Cyanigosa is spawned but not tranformed, prefight event Creature* cyanigosa = GetCreature(DATA_CYANIGOSA); if (cyanigosa && !cyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM)) { if (uiCyanigosaEventTimer <= diff) { switch (uiCyanigosaEventPhase) { case 1: cyanigosa->CastSpell(cyanigosa, CYANIGOSA_BLUE_AURA, false); cyanigosa->AI()->Talk(CYANIGOSA_SAY_SPAWN); uiCyanigosaEventTimer = 7*IN_MILLISECONDS; ++uiCyanigosaEventPhase; break; case 2: cyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); cyanigosa->CastSpell(cyanigosa, CYANIGOSA_BLUE_AURA, false); uiCyanigosaEventTimer = 7*IN_MILLISECONDS; ++uiCyanigosaEventPhase; break; case 3: cyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); cyanigosa->CastSpell(cyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); cyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); cyanigosa->SetReactState(REACT_AGGRESSIVE); uiCyanigosaEventTimer = 2*IN_MILLISECONDS; ++uiCyanigosaEventPhase; break; case 4: uiCyanigosaEventPhase = 0; break; } } else uiCyanigosaEventTimer -= diff; } // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS) { // if door integrity is > 0 then decrase it's integrity state if (GetData(DATA_DOOR_INTEGRITY)) { if (uiDoorSpellTimer < diff) { SetData(DATA_DOOR_INTEGRITY, GetData(DATA_DOOR_INTEGRITY)-1); uiDoorSpellTimer =2000; } else uiDoorSpellTimer -= diff; } // else set door state to active (means door will open and group have failed to sustain mob invasion on the door) else { SetData(DATA_MAIN_DOOR, GO_STATE_ACTIVE); uiMainEventPhase = FAIL; } } }
void UpdateAI(const uint32 diff) { if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); if (!UpdateVictim()) return; if (CheckTimer <= diff) { Creature* Kalec = Unit::GetCreature(*me, KalecGUID); if (!Kalec || (Kalec && !Kalec->isAlive())) { if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->EnterEvadeMode(); return; } if (HealthBelowPct(10) && !isEnraged) { if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->DoAction(DO_ENRAGE); DoAction(DO_ENRAGE); } Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID); if (Kalecgos) { if (!Kalecgos->isInCombat()) { me->AI()->EnterEvadeMode(); return; } } if (!isBanished && HealthBelowPct(1)) { if (Kalecgos) { if (Kalecgos->HasAura(SPELL_BANISH)) { me->DealDamage(me, me->GetHealth()); return; } else DoAction(DO_BANISH); } else { me->MonsterTextEmote(EMOTE_UNABLE_TO_FIND, 0); EnterEvadeMode(); return; } } CheckTimer = 1000; } else CheckTimer -= diff; if (ResetThreat <= diff) { for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) { if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { if (unit->GetPositionZ() > me->GetPositionZ()+5) { me->getThreatManager().modifyThreatPercent(unit, -100); } } } ResetThreat = 1000; } else ResetThreat -= diff; if (ShadowBoltTimer <= diff) { if (!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me); DoCast(me, SPELL_SHADOW_BOLT); ShadowBoltTimer = 7000+(rand()%3000); } else ShadowBoltTimer -= diff; if (AgonyCurseTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (!target) target = me->getVictim(); DoCast(target, SPELL_AGONY_CURSE); AgonyCurseTimer = 20000; } else AgonyCurseTimer -= diff; if (CorruptionStrikeTimer <= diff) { if (!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me); DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE); CorruptionStrikeTimer = 13000; } else CorruptionStrikeTimer -= diff; DoMeleeAttackIfReady(); }
void FocusMagic(uint32 diff) { if (!FOCUSMAGIC || fmCheckTimer > diff || GC_Timer > diff || me->getLevel() < 20 || Rand() < 50 || IsCasting()) return; if (Unit* target = FindAffectedTarget(FOCUSMAGIC, me->GetGUID(), 70, 2)) { fmCheckTimer = 15000; return; } else { Group* pGroup = master->GetGroup(); if (!pGroup) { if (master->getPowerType() == POWER_MANA && me->GetExactDist(master) < 30 && !master->HasAura(FOCUSMAGIC)) target = master; } else { for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pPlayer = itr->GetSource(); if (!pPlayer || pPlayer->IsInWorld() || pPlayer->IsDead()) continue; if (me->GetMapId() != pPlayer->GetMapId()) continue; if (pPlayer->getPowerType() == POWER_MANA && me->GetExactDist(pPlayer) < 30 && !pPlayer->HasAura(FOCUSMAGIC)) { target = pPlayer; break; } } if (!target) { for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pPlayer = itr->GetSource(); if (!pPlayer || !pPlayer->IsInWorld() || !pPlayer->HaveBot()) continue; if (me->GetMapId() != pPlayer->GetMapId()) continue; for (uint8 i = 0; i != pPlayer->GetMaxNpcBots(); ++i) { Creature* cre = pPlayer->GetBotMap(i)->_Cre(); if (!cre || !cre->IsInWorld() || cre == me || cre->IsDead()) continue; if (cre->getPowerType() == POWER_MANA && me->GetExactDist(cre) < 30 && !cre->HasAura(FOCUSMAGIC)) { target = cre; break; } } } } } if (target && doCast(target, FOCUSMAGIC)) { GC_Timer = 500; fmCheckTimer = 30000; return; } } fmCheckTimer = 5000; }
void UpdateAI(uint32 diff) override { if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); if (!UpdateVictim()) return; if (CheckTimer <= diff) { Creature* Kalec = ObjectAccessor::GetCreature(*me, KalecGUID); if (!Kalec || !Kalec->IsAlive()) { if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->EnterEvadeMode(); return; } if (HealthBelowPct(10) && !isEnraged) { if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->DoAction(DO_ENRAGE); DoAction(DO_ENRAGE); } Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID); if (Kalecgos && !Kalecgos->IsInCombat()) { EnterEvadeMode(); return; } if (!isBanished && HealthBelowPct(1)) { if (Kalecgos) { if (Kalecgos->HasAura(SPELL_BANISH)) { me->DealDamage(me, me->GetHealth()); return; } DoAction(DO_BANISH); } else { me->MonsterTextEmote(EMOTE_UNABLE_TO_FIND, NULL); EnterEvadeMode(); return; } } CheckTimer = 1000; } else CheckTimer -= diff; if (ResetThreat <= diff) { ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (unit->GetPositionZ() > me->GetPositionZ() + 5) me->getThreatManager().modifyThreatPercent(unit, -100); } ResetThreat = 1000; } else ResetThreat -= diff; if (ShadowBoltTimer <= diff) { if (!(rand32() % 5)) Talk(SAY_SATH_SPELL1); DoCast(me, SPELL_SHADOW_BOLT); ShadowBoltTimer = 7000 + (rand32() % 3000); } else ShadowBoltTimer -= diff; if (AgonyCurseTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->GetVictim(); DoCast(target, SPELL_AGONY_CURSE); AgonyCurseTimer = 20000; } else AgonyCurseTimer -= diff; if (CorruptionStrikeTimer <= diff) { if (!(rand32() % 5))Talk(SAY_SATH_SPELL2); DoCastVictim(SPELL_CORRUPTION_STRIKE); CorruptionStrikeTimer = 13000; } else CorruptionStrikeTimer -= diff; DoMeleeAttackIfReady(); }
void WaypointReached(uint32 i) { Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; switch (i) { case 9: Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 100.0f); break; case 10: if (Mrfloppy) { DoScriptText(SAY_WORGHAGGRO1, m_creature); m_creature->SummonCreature(NPC_HUNGRY_WORG,m_creature->GetPositionX()+5,m_creature->GetPositionY()+2,m_creature->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); } break; case 11: Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); break; case 17: Mrfloppy->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()); DoScriptText(SAY_WORGRAGGRO3, m_creature); RWORG = m_creature->SummonCreature(NPC_RAVENOUS_WORG,m_creature->GetPositionX()+10,m_creature->GetPositionY()+8,m_creature->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); RWORG->setFaction(35); break; case 18: if (Mrfloppy) { RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); DoCast(Mrfloppy,SPELL_MRFLOPPY); } break; case 19: if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0)) Mrfloppy->EnterVehicle(RWORG); break; case 20: if (Mrfloppy) RWORG->HandleEmoteCommand(34); break; case 21: if (Mrfloppy) { RWORG->Kill(Mrfloppy); Mrfloppy->ExitVehicle(); RWORG->setFaction(14); RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ()); DoScriptText(SAY_VICTORY2, m_creature); } break; case 22: if (Mrfloppy && Mrfloppy->isDead()) { RWORG->DisappearAndDie(); m_creature->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); Mrfloppy->setDeathState(ALIVE); Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); DoScriptText(SAY_VICTORY3, m_creature); } break; case 24: if (pPlayer) { Completed = true; pPlayer->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, m_creature); DoScriptText(SAY_QUEST_COMPLETE, m_creature, pPlayer); } m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; case 25: DoScriptText(SAY_VICTORY4, m_creature); break; case 27: m_creature->DisappearAndDie(); if (Mrfloppy) Mrfloppy->DisappearAndDie(); break; } }
Creature* instance_draktharon_keep::GetNextCrystalTarget(Creature* pCrystalHandler, uint8& uiIndex) { Creature* pTarget = NULL; uiIndex = 0; for (uint8 i = 0; i < MAX_CRYSTALS; ++i) { Creature* pDummy = instance->GetCreature(m_aNovosCrystalInfo[i].m_channelGuid); // Return the nearest 'unused' crystal dummy // unused means, that the crystal was not already used, and the dummy-npc doesn't have the aura that will trigger the use on remove if (pDummy && !m_aNovosCrystalInfo[i].m_bWasUsed && (!pTarget || pCrystalHandler->GetDistanceOrder(pDummy, pTarget)) && !pDummy->HasAura(aCrystalHandlerDeathSpells[i])) { pTarget = pDummy; uiIndex = i; } } return pTarget; }
void UpdateAI(const uint32 uiDiff) { // start the encounter if(m_pInstance && m_pInstance->GetData(TYPE_GORTOK) == SPECIAL) { ++m_uiAnimalCounter; m_pInstance->SetData(TYPE_GORTOK, IN_PROGRESS); if(GameObject* pGenerator = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(DATA_STATIS_GENERATOR))) pGenerator->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); } if (m_uiAnimalCounter) { if(m_uiAnimalCheck_Timer < uiDiff) { Creature* pTemp = NULL; if (m_uiAnimalCounter == 1) pTemp = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(NPC_WORGEN)); if (m_uiAnimalCounter == 2) pTemp = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(NPC_FURBOLG)); if (m_uiAnimalCounter == 3) pTemp = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(NPC_JORMUNGAR)); if (m_uiAnimalCounter == 4) pTemp = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(NPC_RHINO)); if (pTemp) { if (!pTemp->isAlive()) ++m_uiAnimalCounter; if (pTemp->isAlive() && !pTemp->getVictim()) { if (pTemp->HasAura(SPELL_FREEZE_ANIM, EFFECT_INDEX_0)) pTemp->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); ((Unit*)pTemp)->SetStandState(UNIT_STAND_STATE_STAND); pTemp->AI()->AttackStart(pPlayer); } } if (m_uiAnimalCounter == 5) { if (m_creature->HasAura(SPELL_FREEZE_ANIM, EFFECT_INDEX_0)) m_creature->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); ((Unit*)m_creature)->SetStandState(UNIT_STAND_STATE_STAND); m_uiAnimalCheck_Timer = 10000000; AttackStart(pPlayer); } else { m_uiAnimalCheck_Timer = 1000; return; } }else m_uiAnimalCheck_Timer -= uiDiff; } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if(m_uiRoarTimer < uiDiff) { if(m_creature->getVictim()) m_creature->CastSpell(m_creature->getVictim(), m_bIsRegularMode ? SPELL_WITHERING_ROAR : SPELL_WITHERING_ROAR_H, false); m_uiRoarTimer = urand(22000,28000); }else m_uiRoarTimer -= uiDiff; if(m_uiImpaleTimer < uiDiff) { if(Unit* pPlayer = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) m_creature->CastSpell(pPlayer, m_bIsRegularMode ? SPELL_IMPALE : SPELL_IMPALE_H, false); m_uiImpaleTimer = urand(15000,25000); }else m_uiImpaleTimer -= uiDiff; if(m_uiArcingSmashTimer < uiDiff) { if(m_creature->getVictim()) m_creature->CastSpell(m_creature->getVictim(), SPELL_ARCING_SMASH, false); m_uiArcingSmashTimer = urand(10000,30000); }else m_uiArcingSmashTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) override { if (m_uiEpilogueTimer) { if (m_uiEpilogueTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_TELEPORT, CAST_TRIGGERED) == CAST_OK) { m_creature->ForcedDespawn(2000); m_uiEpilogueTimer = 0; } } else m_uiEpilogueTimer -= uiDiff; } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiBerserkTimer) { if (m_uiBerserkTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK) { DoScriptText(SAY_BERSERK, m_creature); m_uiBerserkTimer = 0; } } else m_uiBerserkTimer -= uiDiff; } // Drain elders after hard mode aggro if (m_uiDrainEldersTimer) { if (m_uiDrainEldersTimer <= uiDiff) { DoDrainElders(); m_uiDrainEldersTimer = 0; } else m_uiDrainEldersTimer -= uiDiff; } if (m_uiThreeAlliesTimer) { if (m_uiThreeAlliesTimer <= uiDiff) { Creature* pSpirit = m_creature->GetMap()->GetCreature(m_waterSpiritGuid); Creature* pStormLasher = m_creature->GetMap()->GetCreature(m_stormLasherGuid); Creature* pSnapLasher = m_creature->GetMap()->GetCreature(m_snaplasherGuid); if (!pSpirit || !pStormLasher || !pSnapLasher) return; if (pSpirit->HasAura(SPELL_FEIGN_DEATH) && pStormLasher->HasAura(SPELL_FEIGN_DEATH) && pSnapLasher->HasAura(SPELL_FEIGN_DEATH)) { m_creature->DealDamage(pSpirit, pSpirit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false); m_creature->DealDamage(pStormLasher, pStormLasher->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false); m_creature->DealDamage(pSnapLasher, pSnapLasher->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false); } else { pSpirit->CastSpell(pSpirit, SPELL_FULL_HEAL, true); pStormLasher->CastSpell(pStormLasher, SPELL_FULL_HEAL, true); pSnapLasher->CastSpell(pSnapLasher, SPELL_FULL_HEAL, true); } m_uiThreeAlliesTimer = 0; } else m_uiThreeAlliesTimer -= uiDiff; } if (m_uiAlliesWaveCount < MAX_ALLIES_WAVES) { if (m_uiAlliesNatureTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_SUMMON_ALLIES_OF_NATURE : SPELL_SUMMON_ALLIES_OF_NATURE_H) == CAST_OK) { DoScriptText(EMOTE_ALLIES_NATURE, m_creature); m_uiAlliesNatureTimer = 60000; } } else m_uiAlliesNatureTimer -= uiDiff; } else { if (m_uiNatureBombTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_NATURE_BOMB_SUMMON) == CAST_OK) m_uiNatureBombTimer = 15000; } else m_uiNatureBombTimer -= uiDiff; } if (m_uiSunbeamTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_SUNBEAM : SPELL_SUNBEAM_H) == CAST_OK) m_uiSunbeamTimer = 15000; } } else m_uiSunbeamTimer -= uiDiff; if (m_uiLifebindersGiftTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_LIFEBINDERS_GIFT_SUMMON) == CAST_OK) m_uiLifebindersGiftTimer = 40000; } else m_uiLifebindersGiftTimer -= uiDiff; // Brightleaf ability if (m_uiUnstableEnergyTimer) { if (m_uiUnstableEnergyTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_UNSTABLE_SUN_BEAM : SPELL_UNSTABLE_SUN_BEAM_H) == CAST_OK) m_uiUnstableEnergyTimer = 25000; } else m_uiUnstableEnergyTimer -= uiDiff; } // Ironbranch ability if (m_uiIronRootsTimer) { if (m_uiIronRootsTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_IRON_ROOTS : SPELL_IRON_ROOTS_H) == CAST_OK) m_uiIronRootsTimer = 60000; } else m_uiIronRootsTimer -= uiDiff; } // Stonebark ability if (m_uiGroundTremorTimer) { if (m_uiGroundTremorTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_GROUND_TREMOR : SPELL_GROUND_TREMOR_H) == CAST_OK) m_uiGroundTremorTimer = 30000; } else m_uiGroundTremorTimer -= uiDiff; } DoMeleeAttackIfReady(); }