void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) { TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL"); uint64 guid; uint8 castCount; uint32 spellId; uint8 castFlags; recvPacket >> guid >> castCount >> spellId >> castFlags; TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags); // This opcode is also sent from charmed and possessed units (players and creatures) if (!_player->GetGuardianPet() && !_player->GetCharm()) return; Unit* caster = ObjectAccessor::GetUnit(*_player, guid); if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm())) { TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); return; } SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %i", spellId); return; } if (spellInfo->StartRecoveryCategory > 0) // Check if spell is affected by GCD if (caster->GetTypeId() == TYPEID_UNIT && caster->GetCharmInfo() && caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo)) { caster->SendPetCastFail(spellId, SPELL_FAILED_NOT_READY); return; } // check spell focus object if (spellInfo->RequiresSpellFocus && caster->IsVehicle()) { CellCoord p(Trinity::ComputeCellCoord(caster->GetPositionX(), caster->GetPositionY())); Cell cell(p); GameObject* ok = NULL; Trinity::GameObjectFocusCheck goCheck(caster, spellInfo->RequiresSpellFocus); Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck> checker(caster, ok, goCheck); TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck>, GridTypeMapContainer > objectChecker(checker); Map& map = *caster->GetMap(); cell.Visit(p, objectChecker, map, *caster, caster->GetVisibilityRange()); if (!ok) { caster->SendPetCastFail(spellId, SPELL_FAILED_REQUIRES_SPELL_FOCUS); return; } } // do not cast not learned spells if (!caster->HasSpell(spellId) || spellInfo->IsPassive()) return; SpellCastTargets targets; targets.Read(recvPacket, caster); HandleClientCastFlags(recvPacket, castFlags, targets); caster->ClearUnitState(UNIT_STATE_FOLLOW); Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE); spell->m_cast_count = castCount; // probably pending spell cast spell->m_targets = targets; /// @todo need to check victim? SpellCastResult result; if (caster->m_movedPlayer) result = spell->CheckPetCast(caster->m_movedPlayer->GetSelectedUnit()); else result = spell->CheckPetCast(NULL); if (result == SPELL_CAST_OK) { if (caster->GetTypeId() == TYPEID_UNIT) { Creature* pet = caster->ToCreature(); pet->AddCreatureSpellCooldown(spellId); if (pet->IsPet()) { Pet* p = (Pet*)pet; // 10% chance to play special pet attack talk, else growl // actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell if (p->getPetType() == SUMMON_PET && (urand(0, 100) < 10)) pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL); else pet->SendPetAIReaction(guid); } } spell->prepare(&(spell->m_targets)); } else { caster->SendPetCastFail(spellId, result); if (caster->GetTypeId() == TYPEID_PLAYER) { if (!caster->ToPlayer()->HasSpellCooldown(spellId)) GetPlayer()->SendClearCooldown(spellId, caster); } else { if (!caster->ToCreature()->HasSpellCooldown(spellId)) GetPlayer()->SendClearCooldown(spellId, caster); } spell->finish(false); delete spell; } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (bEventInProgress) { if (uiSpawnResTimer) { if (uiSpawnResTimer <= diff) { DoCast(me, SPELL_SUMMON_BANSHEE); // Summons directly on caster position // DoCast(me, SPELL_SCOURG_RESURRECTION, true); // Not needed ? uiSpawnResTimer = 0; } else uiSpawnResTimer -= diff; } return; } if (uiCleaveTimer <= diff) { if (!me->HasUnitState(UNIT_STAT_CASTING)) { if (bIsUndead) DoCast(me->getVictim(), SPELL_WOE_STRIKE); else DoCast(me->getVictim(), SPELL_CLEAVE); uiCleaveTimer = rand()%5000 + 2000; } } else uiCleaveTimer -= diff; if (uiSmashTimer <= diff) { if (!me->HasUnitState(UNIT_STAT_CASTING)) { if (bIsUndead) DoCast(me->getVictim(), SPELL_DARK_SMASH); else DoCast(me->getVictim(), SPELL_SMASH); uiSmashTimer = 10000; } } else uiSmashTimer -= diff; if (!bIsUndead) { if (uiEnrageTimer <= diff) { DoCast(me, SPELL_ENRAGE); uiEnrageTimer = 10000; } else uiEnrageTimer -= diff; } else // In Undead form used to summon weapon { if (uiEnrageTimer <= diff) { if (!me->HasUnitState(UNIT_STAT_CASTING)) { // Spawn target for Axe Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO, 1); if (pTarget) { me->SummonCreature(ENTRY_THROW_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2000); DoCast(me, SPELL_SHADOW_AXE_SUMMON); } uiEnrageTimer = 30000; } } else uiEnrageTimer -= diff; } if (uiRoarTimer <= diff) { if (!me->HasUnitState(UNIT_STAT_CASTING)) { if (bIsUndead) DoCast(me, SPELL_DREADFUL_ROAR); else DoCast(me, SPELL_STAGGERING_ROAR); uiRoarTimer = 10000; } } else uiRoarTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI (const uint32 diff) { //Random movement if (movement_timer <= diff) { uint32 rndpos = rand()%8; me->GetMotionMaster()->MovePoint(1, SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]); movement_timer = 6000; } else movement_timer -= diff; //toxic spores if (bolt_timer <= diff) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) { Creature* trig = me->SummonCreature(TOXIC_SPORES_TRIGGER, pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 30000); if (trig) { trig->setFaction(14); trig->CastSpell(trig, SPELL_TOXIC_SPORES, true); } } bolt_timer = 10000+rand()%5000; } else bolt_timer -= diff; //Check_Timer if (Check_Timer <= diff) { if (pInstance) { //check if vashj is death Unit *Vashj = NULL; Vashj = Unit::GetUnit((*me), pInstance->GetData64(DATA_LADYVASHJ)); if (!Vashj || (Vashj && !Vashj->isAlive()) || (Vashj && CAST_AI(boss_lady_vashjAI, CAST_CRE(Vashj)->AI())->Phase != 3)) { //remove me->setDeathState(DEAD); me->RemoveCorpse(); me->setFaction(35); } } Check_Timer = 1000; } else Check_Timer -= diff; }
void HandleFlightSequence() { switch (uiFlightCount) { case 0: //me->AttackStop(); me->GetMotionMaster()->Clear(false); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->StopMoving(); DoScriptText(YELL_TAKEOFF, me); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); break; case 1: me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); break; case 2: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); if (!target) { EnterEvadeMode(); return; } Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); if (Vapor) { Vapor->AI()->AttackStart(target); me->InterruptNonMeleeSpells(false); DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); } events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); break; } case 3: { DespawnSummons(MOB_VAPOR_TRAIL); //DoCast(me, SPELL_VAPOR_SELECT); need core support Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); if (!target) { EnterEvadeMode(); return; } //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support Creature* pVapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); if (pVapor) { if (pVapor->AI()) pVapor->AI()->AttackStart(target); me->InterruptNonMeleeSpells(false); DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); } events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); break; } case 4: DespawnSummons(MOB_VAPOR_TRAIL); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); break; case 5: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); if (!target) { EnterEvadeMode(); return; } breathX = target->GetPositionX(); breathY = target->GetPositionY(); float x, y, z; target->GetContactPoint(me, x, y, z, 70); me->GetMotionMaster()->MovePoint(0, x, y, z+10); break; } case 6: me->SetOrientation(me->GetAngle(breathX, breathY)); me->StopMoving(); //DoTextEmote("takes a deep breath.", NULL); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); break; case 7: { DoCast(me, SPELL_FOG_BREATH, true); float x, y, z; me->GetPosition(x, y, z); x = 2 * breathX - x; y = 2 * breathY - y; me->GetMotionMaster()->MovePoint(0, x, y, z); events.ScheduleEvent(EVENT_SUMMON_FOG, 1); break; } case 8: me->CastStop(SPELL_FOG_BREATH); me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); ++uiBreathCount; events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); if (uiBreathCount < 3) uiFlightCount = 4; break; case 9: if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO)) DoStartMovement(target); else { EnterEvadeMode(); return; } break; case 10: me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); EnterPhase(PHASE_GROUND); AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); break; } ++uiFlightCount; }
void UpdateAI(const uint32 diff) { if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); if (me->HasUnitState(UNIT_STAT_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BONE_SPIKE_GRAVEYARD: if (IsHeroic() || !me->HasAura(SPELL_BONE_STORM)) DoCast(me, SPELL_BONE_SPIKE_GRAVEYARD); events.ScheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL); break; case EVENT_COLDFLAME: coldflameLastPos.Relocate(me); if (!me->HasAura(SPELL_BONE_STORM)) me->CastCustomSpell(SPELL_COLDFLAME_NORMAL, SPELLVALUE_MAX_TARGETS, 1, me); else DoCast(me, SPELL_COLDFLAME_BONE_STORM); events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL); break; case EVENT_WARN_BONE_STORM: boneSlice = false; Talk(EMOTE_BONE_STORM); me->FinishSpell(CURRENT_MELEE_SPELL, false); DoCast(me, SPELL_BONE_STORM); events.DelayEvents(3000, EVENT_GROUP_SPECIAL); events.ScheduleEvent(EVENT_BONE_STORM_BEGIN, 3050); events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(90000, 95000)); break; case EVENT_BONE_STORM_BEGIN: if (Aura* pStorm = me->GetAura(SPELL_BONE_STORM)) pStorm->SetDuration(int32(boneStormDuration)); me->SetSpeed(MOVE_RUN, baseSpeed*3.0f, true); Talk(SAY_BONE_STORM); events.ScheduleEvent(EVENT_BONE_STORM_END, boneStormDuration+1); // no break here case EVENT_BONE_STORM_MOVE: { events.ScheduleEvent(EVENT_BONE_STORM_MOVE, boneStormDuration/3); Unit* unit = SelectUnit(SELECT_TARGET_RANDOM, 1); if (!unit) unit = SelectUnit(SELECT_TARGET_RANDOM, 0); if (unit) me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()); break; } case EVENT_BONE_STORM_END: if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); DoStartMovement(me->getVictim()); me->SetSpeed(MOVE_RUN, baseSpeed, true); events.CancelEvent(EVENT_BONE_STORM_MOVE); events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000); if (!IsHeroic()) events.RescheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL); break; case EVENT_ENABLE_BONE_SLICE: boneSlice = true; break; case EVENT_ENRAGE: DoCast(me, SPELL_BERSERK, true); Talk(SAY_BERSERK); break; } } // We should not melee attack when storming if (me->HasAura(SPELL_BONE_STORM)) return; // After 10 seconds since encounter start Bone Slice replaces melee attacks if (boneSlice && !me->GetCurrentSpell(CURRENT_MELEE_SPELL)) DoCastVictim(SPELL_BONE_SLICE); DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (TidalShieldTimer <= diff) { if (TryDoCast(me, SPELL_TIDAL_SHIELD, true)) { ResetTimer(45000); TidalShieldTimer = 60000; } } else TidalShieldTimer -= diff; if (!me->HasAura(SPELL_BERSERK,0)) { if (EnrageTimer <= diff) { DoScriptText(SAY_ENRAGE2, me); DoCast(me, SPELL_BERSERK, true); } else EnrageTimer -= diff; } if (SpecialYellTimer <= diff) { switch(rand()%2) { case 0: DoScriptText(SAY_SPECIAL1, me); break; case 1: DoScriptText(SAY_SPECIAL2, me); break; } SpecialYellTimer = 25000 + (rand()%76)*1000; } else SpecialYellTimer -= diff; if (ImpalingSpineTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 80,true); if (!pTarget) pTarget = me->getVictim(); if (pTarget) { DoCast(pTarget, SPELL_IMPALING_SPINE); SpineTargetGUID = pTarget->GetGUID(); //must let target summon, otherwise you cannot click the spine pTarget->SummonGameObject(GOBJECT_SPINE, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 0); switch(rand()%2) { case 0: DoScriptText(SAY_NEEDLE1, me); break; case 1: DoScriptText(SAY_NEEDLE2, me); break; } ImpalingSpineTimer = 21000; } } } else ImpalingSpineTimer -= diff; if (NeedleSpineTimer <= diff) { if (TryDoCast(me, SPELL_NEEDLE_SPINE, true)) { //std::list<Unit*> target; //SelectUnitList(target, 3, SELECT_TARGET_RANDOM, 100, true); //for (std::list<Unit*>::iterator i = target.begin(); i != target.end(); ++i) // me->CastSpell(*i, 39835, true); NeedleSpineTimer = 3000; } } else NeedleSpineTimer -= diff; DoMeleeAttackIfReady(); }
void Spell::AddChainTargets(uint32 i, uint32 TargetType, float r, uint32 maxtargets) { if(!m_caster->IsInWorld()) return; Object* targ = m_caster->GetMapMgr()->_GetObject(m_targets.m_unitTarget); if(targ == NULL) return; TargetsList* list = &m_targetUnits[i]; //if selected target is party member, then jumps on party Unit* firstTarget = NULL; if(targ->IsUnit()) firstTarget = TO_UNIT(targ); else firstTarget = u_caster; bool RaidOnly = false; float range = GetMaxRange(dbcSpellRange.LookupEntry(m_spellInfo->rangeIndex));//this is probably wrong, //this is cast distance, not searching distance range *= range; //is this party only? Player* casterFrom = TO< Player* >(u_caster->GetPlayerOwner()); Player* pfirstTargetFrom = TO< Player* >(firstTarget->GetPlayerOwner()); if(casterFrom != NULL && pfirstTargetFrom != NULL && casterFrom->GetGroup() == pfirstTargetFrom->GetGroup()) RaidOnly = true; uint32 jumps = m_spellInfo->EffectChainTarget[i]; //range range /= jumps; //hacky, needs better implementation! if(m_spellInfo->SpellGroupType && u_caster != NULL) SM_FIValue(u_caster->SM_FAdditionalTargets, (int32*)&jumps, m_spellInfo->SpellGroupType); AddTarget(i, TargetType, firstTarget); if(jumps <= 1 || list->size() == 0) //1 because we've added the first target, 0 size if spell is resisted return; ObjectSet::iterator itr; for(itr = firstTarget->GetInRangeSetBegin(); itr != firstTarget->GetInRangeSetEnd(); itr++) { if(!(*itr)->IsUnit() || !TO_UNIT((*itr))->isAlive()) continue; if(RaidOnly && !pfirstTargetFrom->InRaid(TO_UNIT(*itr))) continue; //healing spell, full health target = NONO if(IsHealingSpell(m_spellInfo) && TO_UNIT(*itr)->GetHealthPct() == 100) continue; size_t oldsize; if(IsInrange(firstTarget->GetPositionX(), firstTarget->GetPositionY(), firstTarget->GetPositionZ(), (*itr), range)) { oldsize = list->size(); AddTarget(i, TargetType, (*itr)); if(list->size() == oldsize || list->size() >= jumps) //either out of jumps or a resist return; } } }
void UpdateAI(const uint32 diff) { //Inhibitmagic_Timer if (Inhibitmagic_Timer <= diff) { float dist; Map *map = me->GetMap(); Map::PlayerList const &PlayerList = map->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* i_pl = i->getSource()) if (i_pl->isAlive() && (dist = i_pl->GetDistance(me)) < 45) { i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC); me->AddAura(SPELL_INHIBITMAGIC, i_pl); if (dist < 35) me->AddAura(SPELL_INHIBITMAGIC, i_pl); if (dist < 25) me->AddAura(SPELL_INHIBITMAGIC, i_pl); if (dist < 15) me->AddAura(SPELL_INHIBITMAGIC, i_pl); } Inhibitmagic_Timer = 3000+(rand()%1000); } else Inhibitmagic_Timer -= diff; //Return since we have no target if (!UpdateVictim()) return; //Attractmagic_Timer if (Attractmagic_Timer <= diff) { DoCast(me, SPELL_ATTRACTMAGIC); Attractmagic_Timer = 30000; Carnivorousbite_Timer = 1500; } else Attractmagic_Timer -= diff; //Carnivorousbite_Timer if (Carnivorousbite_Timer <= diff) { DoCast(me, SPELL_CARNIVOROUSBITE); Carnivorousbite_Timer = 10000; } else Carnivorousbite_Timer -= diff; //FocusFire_Timer if (FocusFire_Timer <= diff) { // Summon Focus Fire & Emote Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive()) { focusedTarget = pTarget; me->SummonCreature(ENTRY_FOCUS_FIRE, pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 5500); // Emote std::string *emote = new std::string(EMOTE_FOCUSES_ON); emote->append(pTarget->GetName()); emote->append("!"); const char* text = emote->c_str(); me->MonsterTextEmote(text, 0, true); delete emote; } FocusFire_Timer = 15000+(rand()%5000); } else FocusFire_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_SHIELD: DoCast(me, SPELL_TIDAL_SHIELD, true); ResetTimer(45000); break; case EVENT_BERSERK: DoScriptText(SAY_ENRAGE2, me); DoCast(me, SPELL_BERSERK, true); events.DelayEvents(15000, GCD_YELL); break; case EVENT_SPINE: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->getVictim(); if (target) { DoCast(target, SPELL_IMPALING_SPINE, true); SpineTargetGUID = target->GetGUID(); //must let target summon, otherwise you cannot click the spine target->SummonGameObject(GOBJECT_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30); DoScriptText(rand()%2 ? SAY_NEEDLE1 : SAY_NEEDLE2, me); events.DelayEvents(1500, GCD_CAST); events.DelayEvents(15000, GCD_YELL); } events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST); return; } case EVENT_NEEDLE: { //DoCast(me, SPELL_NEEDLE_SPINE, true); std::list<Unit*> pTargets; SelectTargetList(pTargets, 3, SELECT_TARGET_RANDOM, 80, true); for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) DoCast(*i, 39835, true); events.ScheduleEvent(EVENT_NEEDLE, urand(15000, 25000), GCD_CAST); events.DelayEvents(1500, GCD_CAST); return; } case EVENT_YELL: DoScriptText(RAND(SAY_SPECIAL1, SAY_SPECIAL2), me); events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL); events.DelayEvents(15000, GCD_YELL); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (me->getVictim() && me->isAlive()) { if (PoisonVolley_Timer <= diff) { DoCast(me->getVictim(), SPELL_POISONVOLLEY); PoisonVolley_Timer = urand(10000, 20000); } else PoisonVolley_Timer -= diff; if (!PhaseTwo && Aspect_Timer <= diff) { DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI); Aspect_Timer = urand(13000, 18000); } else Aspect_Timer -= diff; if (!Spawned && SpawnStartSpiders_Timer <= diff) { Talk(SAY_SPIDER_SPAWN); Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (!target) return; Creature* Spider = NULL; Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); Spawned = true; } else SpawnStartSpiders_Timer -= diff; if (SpawnSpider_Timer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (!target) return; Creature* Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Spider) Spider->AI()->AttackStart(target); SpawnSpider_Timer = urand(12000, 17000); } else SpawnSpider_Timer -= diff; if (!PhaseTwo && Transform_Timer <= diff) { Talk(SAY_TRANSFORM); DoCast(me, SPELL_SPIDER_FORM); const CreatureTemplate* cinfo = me->GetCreatureTemplate(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); me->UpdateDamagePhysical(BASE_ATTACK); DoCast(me->getVictim(), SPELL_ENVOLWINGWEB); if (DoGetThreat(me->getVictim())) DoModifyThreatPercent(me->getVictim(), -100); PhaseTwo = true; Transform_Timer = urand(35000, 60000); } else Transform_Timer -= diff; if (PhaseTwo) { if (Charge_Timer <= diff) { Unit* target = NULL; int i = 0; while (i < 3) // max 3 tries to get a random target with power_mana { ++i; target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); // not aggro leader if (target && target->getPowerType() == POWER_MANA) i = 3; } if (target) { DoCast(target, SPELL_CHARGE); //me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); //me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1); AttackStart(target); } Charge_Timer = 8000; } else Charge_Timer -= diff; if (TransformBack_Timer <= diff) { me->SetDisplayId(15220); const CreatureTemplate* cinfo = me->GetCreatureTemplate(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); me->UpdateDamagePhysical(BASE_ATTACK); PhaseTwo = false; TransformBack_Timer = urand(25000, 40000); } else TransformBack_Timer -= diff; } DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; //MortalWound_Timer if (MortalWound_Timer < diff) { DoCastSpellIfCan(m_creature->getVictim(),SPELL_MORTAL_WOUND); MortalWound_Timer = urand(10000, 20000); }else MortalWound_Timer -= diff; //Summon 1-3 Spawns of Fankriss at random time. if (SpawnSpawns_Timer < diff) { switch(urand(0, 2)) { case 0: SummonSpawn(m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)); break; case 1: SummonSpawn(m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)); SummonSpawn(m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)); break; case 2: SummonSpawn(m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)); SummonSpawn(m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)); SummonSpawn(m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)); break; } SpawnSpawns_Timer = urand(30000, 60000); }else SpawnSpawns_Timer -= diff; // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer. //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot. if (m_creature->GetHealthPercent() > 3.0f) { if (SpawnHatchlings_Timer< diff) { Unit* target = NULL; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0); if (target && target->GetTypeId() == TYPEID_PLAYER) { DoCastSpellIfCan(target, SPELL_ROOT); if (m_creature->getThreatManager().getThreat(target)) m_creature->getThreatManager().modifyThreatPercent(target, -100); switch(urand(0, 2)) { case 0: DoTeleportPlayer(target, -8106.0142f, 1289.2900f, -74.419533f, 5.112f); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()-3, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()+3, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()-5, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()+5, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); break; case 1: DoTeleportPlayer(target, -7990.135354f, 1155.1907f, -78.849319f, 2.608f); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()-3, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()+3, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()-5, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()+5, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); break; case 2: DoTeleportPlayer(target, -8159.7753f, 1127.9064f, -76.868660f, 0.675f); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()-3, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-3, target->GetPositionY()+3, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()-5, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); Hatchling = m_creature->SummonCreature(15962, target->GetPositionX()-5, target->GetPositionY()+5, target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) ((CreatureAI*)Hatchling->AI())->AttackStart(target); break; } } SpawnHatchlings_Timer = urand(45000, 60000); }else SpawnHatchlings_Timer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!pInstance || !UpdateVictim()) return; if (IsHeroic() && me->HealthBelowPct(30) && !bShadowBreath) { bShadowBreath = true; if (Creature* pNefarius = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS_HEROIC, 200.0f)) pNefarius->AI()->DoAction(ACTION_SHADOW_BREATH); } events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { /*case EVENT_HEAD_START: SetGrounded(true, 0); if (Creature* pMagmawhead = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MAGMAW_HEAD))) pMagmawhead->AI()->DoAction(ACTION_HEAD_START); events.ScheduleEvent(EVENT_HEAD_END, 20000); break; case EVENT_HEAD_END: if (Creature* pMagmawhead = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MAGMAW_HEAD))) pMagmawhead->AI()->DoAction(ACTION_HEAD_END); SetGrounded(false, 0); events.ScheduleEvent(EVENT_MELEE_CHECK, 6000); events.ScheduleEvent(EVENT_LAVA_SPEW, urand(3000, 7000)); events.ScheduleEvent(EVENT_PILLAR_OF_FLAME, urand(10000, 15000)); events.ScheduleEvent(EVENT_MAGMA_SPLIT, urand(15000, 20000)); break;*/ case EVENT_BERSERK: DoCast(me, SPELL_BERSERK); break; case EVENT_MELEE_CHECK: if (!me->IsWithinMeleeRange(me->GetVictim())) DoCast(me, SPELL_MAGMA_SPLIT_2); events.ScheduleEvent(EVENT_MELEE_CHECK, 1000); break; case EVENT_MAGMA_SPLIT: me->CastCustomSpell(SPELL_MAGMA_SPLIT_1, SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 8, 3, 8), 0, false); events.ScheduleEvent(EVENT_MAGMA_SPLIT, urand(15000, 20000)); break; case EVENT_LAVA_SPEW: DoCast (me, SPELL_LAVA_SPEW); events.ScheduleEvent(EVENT_LAVA_SPEW, 22000); break; case EVENT_PILLAR_OF_FLAME: Unit* target; target = SelectTarget(SELECT_TARGET_RANDOM, 1, -20.0f, true); if (!target) target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); if (!target) break; me->SummonCreature(NPC_PILLAR_OF_FLAME, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 8000); events.ScheduleEvent(EVENT_PILLAR_OF_FLAME, urand(35000, 45000)); break; case EVENT_MANGLE: DoCast(me->GetVictim(), SPELL_MANGLE); //events.CancelEvent(EVENT_MELEE_CHECK); //events.CancelEvent(EVENT_LAVA_SPEW); //events.CancelEvent(EVENT_PILLAR_OF_FLAME); //events.CancelEvent(EVENT_MAGMA_SPLIT); events.ScheduleEvent(EVENT_MANGLE, 95000); //events.ScheduleEvent(EVENT_HEAD_START, 12000); break; } } if (me->GetVictim()) if (!me->GetVictim()->HasAura(SPELL_MANGLE) && !bGrounded) DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if(!UpdateVictim()) return; //ManaBurn_Timer if(ManaBurn_Timer <= diff) { DoCast(me->getVictim(), SPELL_MANABURN); ManaBurn_Timer = 8000 + rand()%8000; } else ManaBurn_Timer -= diff; //Sleep_Timer if(Sleep_Timer <= diff) { DoCast(me->getVictim(), SPELL_SLEEP); Sleep_Timer = 12000 + rand()%8000; } else Sleep_Timer -= diff; //Illusions_Timer if(Illusions_Timer <= diff) { //We will summon 3 illusions that will spawn on a random gamer and attack this gamer //We will just use one model for the beginning Unit* target = NULL; for(uint8 i = 0; i < 3; ++i) { target = SelectTarget(SELECT_TARGET_RANDOM, 0); if(!target) return; Creature* Illusion = me->SummonCreature(15163, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); if(Illusion) Illusion->AI()->AttackStart(target); } Illusions_Timer = 15000 + rand()%10000; } else Illusions_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING)) return; if(ShouldSummonAdds) { // Despawns the Stalker DespawnCreatures(NPC_SHADOW_GALE_STALKER); RemoveShadowGaleDebuffFromPlayers(); me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); if ((rand()%2)) me->MonsterYell(SAY_SUMMON, LANG_UNIVERSAL, NULL); //Adds a visual portal effect to the Stalker FacelessPortalStalker->GetAI()->DoCast(FacelessPortalStalker,SPELL_TWILIGHT_PORTAL_VISUAL,true); events.ScheduleEvent(EVENT_REMOVE_TWILIGHT_PORTAL, 7000); //Summons Faceless over the Spell FacelessPortalStalker->GetAI()->DoCast(FacelessPortalStalker,SPELL_SPAWN_FACELESS,true); ShouldSummonAdds = false; // DBM says that the Spell has 40s CD events.ScheduleEvent(EVENT_SHADOW_GALE, urand(40000,44000)); } events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_ENFEEBLING_BLOW: DoCastVictim(SPELL_ENFEEBLING_BLOW); events.ScheduleEvent(EVENT_ENFEEBLING_BLOW, urand(19000,24000)); break; case EVENT_SHADOW_GALE: ShadowGaleTrigger = me->SummonCreature(NPC_SHADOW_GALE_STALKER,-739.665f/*+(urand(0,20)-10)*/,-827.024f/*+(urand(0,20)-10)*/,232.412f,3.1f,TEMPSUMMON_CORPSE_DESPAWN); me->SetReactState(REACT_PASSIVE); me->GetMotionMaster()->MovePoint(POINT_ERUDAX_IS_AT_STALKER,ShadowGaleTrigger->GetPositionX(),ShadowGaleTrigger->GetPositionY(),ShadowGaleTrigger->GetPositionZ()); DoScriptText(SAY_GALE, me); break; case EVENT_REMOVE_TWILIGHT_PORTAL: //Removes Portal effect from Stalker FacelessPortalStalker->RemoveAllAuras(); break; case EVENT_BINDING_SHADOWS: if (Unit* tempTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 500.0f, true)) DoCast(tempTarget,SPELL_BINDING_SHADOWS); events.ScheduleEvent(EVENT_BINDING_SHADOWS, urand(12000,17000)); break; default: break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (m_bSummonKilrek) { if (m_uiSummonKilrekTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_SUMMON_IMP) == CAST_OK) { m_uiSummonKilrekTimer = 45000; m_bSummonKilrek = false; } } else m_uiSummonKilrekTimer -= uiDiff; } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiSacrifice_Timer < uiDiff) { Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) { DoCastSpellIfCan(pTarget, SPELL_SACRIFICE, CAST_TRIGGERED); if (Creature* pChains = m_creature->SummonCreature(NPC_DEMONCHAINS, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 21000)) { if (mob_demon_chainAI* pDemonAI = dynamic_cast<mob_demon_chainAI*>(pChains->AI())) pDemonAI->m_uiSacrificeGUID = pTarget->GetGUID(); pChains->CastSpell(pChains, SPELL_DEMON_CHAINS, true); DoScriptText(urand(0, 1) ? SAY_SACRIFICE1 : SAY_SACRIFICE2, m_creature); m_uiSacrifice_Timer = 30000; } } } else m_uiSacrifice_Timer -= uiDiff; if (m_uiShadowbolt_Timer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOW_BOLT); m_uiShadowbolt_Timer = 10000; } else m_uiShadowbolt_Timer -= uiDiff; if (!m_bSummonedPortals) { if (m_uiSummon_Timer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_FIENDISH_PORTAL, CAST_INTERRUPT_PREVIOUS) == CAST_OK) { DoScriptText(urand(0, 1) ? SAY_SUMMON1 : SAY_SUMMON2, m_creature); m_bSummonedPortals = true; } } else m_uiSummon_Timer -= uiDiff; } if (!m_bBerserk) { if (m_uiBerserk_Timer < uiDiff) { DoCastSpellIfCan(m_creature, SPELL_BERSERK, CAST_INTERRUPT_PREVIOUS); m_bBerserk = true; } else m_uiBerserk_Timer -= uiDiff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if( m_creature->getVictim() && m_creature->isAlive()) { if (PoisonVolley_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_POISONVOLLEY); PoisonVolley_Timer = 10000 + rand()%10000; }else PoisonVolley_Timer -= diff; if (!PhaseTwo && Aspect_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_ASPECT_OF_MARLI); Aspect_Timer = 13000 + rand()%5000; }else Aspect_Timer -= diff; if (!Spawned && SpawnStartSpiders_Timer < diff) { DoScriptText(SAY_SPIDER_SPAWN, m_creature); Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); if(!target) return; Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if(Spider) Spider->AI()->AttackStart(target); Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if(Spider) Spider->AI()->AttackStart(target); Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if(Spider) Spider->AI()->AttackStart(target); Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if(Spider) Spider->AI()->AttackStart(target); Spawned = true; }else SpawnStartSpiders_Timer -= diff; if (SpawnSpider_Timer < diff) { Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); if(!target) return; Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if(Spider) Spider->AI()->AttackStart(target); SpawnSpider_Timer = 12000 + rand()%5000; }else SpawnSpider_Timer -= diff; if(!PhaseTwo && Transform_Timer < diff) { DoScriptText(SAY_TRANSFORM, m_creature); DoCast(m_creature,SPELL_SPIDER_FORM); const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); m_creature->UpdateDamagePhysical(BASE_ATTACK); DoCast(m_creature->getVictim(),SPELL_ENVOLWINGWEB); if(DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-100); PhaseTwo = true; Transform_Timer = 35000 + rand()%25000; }else Transform_Timer -= diff; if (PhaseTwo) { if (Charge_Timer < diff) { Unit* target = NULL; int i = 0 ; while (i < 3) // max 3 tries to get a random target with power_mana { ++i; //not aggro leader target = SelectUnit(SELECT_TARGET_RANDOM,1); if (target) if (target->getPowerType() == POWER_MANA) i=3; } if (target) { DoCast(target, SPELL_CHARGE); //m_creature->Relocate(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); //m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); AttackStart(target); } Charge_Timer = 8000; }else Charge_Timer -= diff; if (TransformBack_Timer < diff) { m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,15220); const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); m_creature->UpdateDamagePhysical(BASE_ATTACK); PhaseTwo = false; TransformBack_Timer = 25000 + rand()%15000; }else TransformBack_Timer -= diff; } DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { if(!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) return; if(event_inProgress) { if(SpawnResTimer) if(SpawnResTimer< diff) { DoCast(m_creature,SPELL_SUMMON_BANSHEE); // Summons direktly on caster position //DoCast(m_creature,SPELL_SCOURG_RESURRECTION_EFFEKTSPAWN); // Dont needet ? SpawnResTimer = 0; }else SpawnResTimer -= diff; return; } // This is used for a spell queue ... the spells should not castet if one spell is already casting if(wait_Timer) if(wait_Timer < diff) { wait_Timer = 0; }else wait_Timer -= diff; if(Cleave_Timer < diff) { if(!wait_Timer) { if(undead) DoCast(m_creature->getVictim(),HeroicMode ? H_SPELL_WOE_STRIKE : SPELL_WOE_STRIKE); else DoCast(m_creature->getVictim(),SPELL_CLEAVE); Cleave_Timer = rand()%5000 + 2000; wait_Timer = 1000; } }else Cleave_Timer -= diff; if(Smash_Timer < diff) { if(!wait_Timer) { if(undead) DoCast(m_creature->getVictim(), SPELL_DARK_SMASH); else DoCast(m_creature->getVictim(),HeroicMode ? H_SPELL_SMASH : SPELL_SMASH); Smash_Timer = 10000; wait_Timer = 5000; } }else Smash_Timer -= diff; if(!undead) { if(Enrage_Timer < diff) { DoCast(m_creature,HeroicMode ? H_SPELL_ENRAGE : SPELL_ENRAGE); Enrage_Timer = 10000; }else Enrage_Timer -= diff; }else // In Undead form used to summon weapon { if(Enrage_Timer < diff) { if(!wait_Timer) { // Spawn target for Axe Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO, 1); if(target) { Creature* temp = m_creature->SummonCreature(ENTRY_THROW_TARGET,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,2000); DoCast(m_creature,SPELL_SHADOW_AXE_SUMMON); } Enrage_Timer = 30000; } }else Enrage_Timer -= diff; } if(Roar_Timer < diff) { if(!wait_Timer) { if(undead) DoCast(m_creature,HeroicMode ? H_SPELL_DREADFUL_ROAR : SPELL_DREADFUL_ROAR); else DoCast(m_creature,HeroicMode ? H_SPELL_STAGGERING_ROAR : SPELL_STAGGERING_ROAR); Roar_Timer = 10000; wait_Timer = 5000; } }else Roar_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (me->getVictim() && me->isAlive()) { if (!CombatStart) { //At combat Start Mandokir is mounted so we must unmount it first me->Unmount(); //And summon his raptor me->SummonCreature(14988, me->getVictim()->GetPositionX(), me->getVictim()->GetPositionY(), me->getVictim()->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 35000); CombatStart = true; } if (Watch_Timer <= diff) //Every 20 Sec Mandokir will check this { if (WatchTarget) //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him { Unit* pUnit = Unit::GetUnit(*me, WatchTarget); if (pUnit && ( targetX != pUnit->GetPositionX() || targetY != pUnit->GetPositionY() || targetZ != pUnit->GetPositionZ() || pUnit->isInCombat())) { if (me->IsWithinMeleeRange(pUnit)) { DoCast(pUnit, 24316); } else { DoCast(pUnit, SPELL_CHARGE); //me->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true, 1); AttackStart(pUnit); } } } someWatched = false; Watch_Timer = 20000; } else Watch_Timer -= diff; if ((Watch_Timer < 8000) && !someWatched) //8 sec(cast time + expire time) before the check for the watch effect mandokir will cast watch debuff on a random target { if (Unit* p = SelectUnit(SELECT_TARGET_RANDOM, 0)) { DoScriptText(SAY_WATCH, me, p); DoCast(p, SPELL_WATCH); WatchTarget = p->GetGUID(); someWatched = true; endWatch = true; } } if ((Watch_Timer < 1000) && endWatch) //1 sec before the debuf expire, store the target position { Unit* pUnit = Unit::GetUnit(*me, WatchTarget); if (pUnit) { targetX = pUnit->GetPositionX(); targetY = pUnit->GetPositionY(); targetZ = pUnit->GetPositionZ(); } endWatch = false; } if (!someWatched) { //Cleave if (Cleave_Timer <= diff) { DoCast(me->getVictim(), SPELL_CLEAVE); Cleave_Timer = 7000; } else Cleave_Timer -= diff; //Whirlwind if (Whirlwind_Timer <= diff) { DoCast(me, SPELL_WHIRLWIND); Whirlwind_Timer = 18000; } else Whirlwind_Timer -= diff; //If more then 3 targets in melee range mandokir will cast fear if (Fear_Timer <= diff) { TargetInRange = 0; std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit(*me, (*i)->getUnitGuid()); if (pUnit && me->IsWithinMeleeRange(pUnit)) ++TargetInRange; } if (TargetInRange > 3) DoCast(me->getVictim(), SPELL_FEAR); Fear_Timer = 4000; } else Fear_Timer -=diff; //Mortal Strike if target below 50% hp if (me->getVictim() && me->getVictim()->HealthBelowPct(50)) { if (MortalStrike_Timer <= diff) { DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); MortalStrike_Timer = 15000; } else MortalStrike_Timer -= diff; } } //Checking if Ohgan is dead. If yes Mandokir will enrage. if (Check_Timer <= diff) { if (m_pInstance) { if (m_pInstance->GetData(TYPE_OHGAN) == DONE) { if (!RaptorDead) { DoCast(me, SPELL_ENRAGE); RaptorDead = true; } } } Check_Timer = 1000; } else Check_Timer -= diff; DoMeleeAttackIfReady(); } }
void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; //MortalWound_Timer if (MortalWound_Timer <= diff) { DoCast(me->getVictim(), SPELL_MORTAL_WOUND); MortalWound_Timer = 10000 + rand() % 10000; } else MortalWound_Timer -= diff; //Summon 1-3 Spawns of Fankriss at random time. if (SpawnSpawns_Timer <= diff) { switch (urand(0, 2)) { case 0: SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); break; case 1: SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); break; case 2: SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); break; } SpawnSpawns_Timer = 30000 + rand() % 30000; } else SpawnSpawns_Timer -= diff; // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer. //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot. if (HealthAbovePct(3)) { if (SpawnHatchlings_Timer <= diff) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) { DoCast(pTarget, SPELL_ROOT); if (DoGetThreat(pTarget)) DoModifyThreatPercent(pTarget, -100); switch (urand(0, 2)) { case 0: DoTeleportPlayer(pTarget, -8106.0142f, 1289.2900f, -74.419533f, 5.112f); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 3, pTarget->GetPositionY() - 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 3, pTarget->GetPositionY() + 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 5, pTarget->GetPositionY() - 5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 5, pTarget->GetPositionY() + 5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); break; case 1: DoTeleportPlayer(pTarget, -7990.135354f, 1155.1907f, -78.849319f, 2.608f); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 3, pTarget->GetPositionY() - 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 3, pTarget->GetPositionY() + 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 5, pTarget->GetPositionY() - 5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 5, pTarget->GetPositionY() + 5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); break; case 2: DoTeleportPlayer(pTarget, -8159.7753f, 1127.9064f, -76.868660f, 0.675f); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 3, pTarget->GetPositionY() - 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 3, pTarget->GetPositionY() + 3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 5, pTarget->GetPositionY() - 5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX() - 5, pTarget->GetPositionY() + 5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); break; } } SpawnHatchlings_Timer = 45000 + rand() % 15000; } else SpawnHatchlings_Timer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if(phase == 2 && boss_phase == 1) { events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 27000); events.RescheduleEvent(EVENT_RUNE_OF_POWER, 60000); events.RescheduleEvent(EVENT_RUNE_OF_DEATH, 30000); boss_phase++; } if(phase == 3 && boss_phase == 2) { events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 27000); events.RescheduleEvent(EVENT_RUNE_OF_POWER, 60000); events.RescheduleEvent(EVENT_RUNE_OF_DEATH, 30000); events.RescheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); } events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_ENRAGE: DoScriptText(SAY_MOLGEIM_BERSERK, me); DoCast(SPELL_BERSERK); break; case EVENT_RUNE_OF_POWER: // Improve target selection; random alive friendly { Unit *pTarget = DoSelectLowestHpFriendly(60); if (!pTarget || (pTarget && !pTarget->isAlive())) pTarget = me; me->SummonCreature(33705, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ() , 0 , TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); // Fais pop la rune events.ScheduleEvent(EVENT_RUNE_OF_POWER, 60000); break; } case EVENT_SHIELD_OF_RUNES: DoCast(me, RAID_MODE(SPELL_SHIELD_OF_RUNES, SPELL_SHIELD_OF_RUNES_H)); events.ScheduleEvent(EVENT_SHIELD_OF_RUNES, urand(27000,34000)); break; case EVENT_RUNE_OF_DEATH: DoScriptText(SAY_MOLGEIM_RUNE_DEATH, me); if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) DoCast(pTarget, SPELL_RUNE_OF_DEATH); events.ScheduleEvent(EVENT_RUNE_OF_DEATH, urand(30000,40000)); break; case EVENT_RUNE_OF_SUMMONING: DoScriptText(SAY_MOLGEIM_SUMMON, me); if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) // DoCast(pTarget, SPELL_RUNE_OF_SUMMONING); events.ScheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; //Invisible_Timer if (Invisible_Timer <= diff) { me->InterruptSpell(CURRENT_GENERIC_SPELL); SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); me->SetDisplayId(11686); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Invisible = true; Invisible_Timer = urand(15000, 30000); } else Invisible_Timer -= diff; if (Invisible) { if (Ambush_Timer <= diff) { Unit* target = NULL; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) { DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); DoCast(target, SPELL_AMBUSH); } Ambushed = true; Ambush_Timer = 3000; } else Ambush_Timer -= diff; } if (Ambushed) { if (Visible_Timer <= diff) { me->InterruptSpell(CURRENT_GENERIC_SPELL); me->SetDisplayId(15268); SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Invisible = false; Visible_Timer = 4000; } else Visible_Timer -= diff; } //Resetting some aggro so he attacks other gamers if (!Invisible) { if (Aggro_Timer <= diff) { Unit* target = NULL; target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (DoGetThreat(me->getVictim())) DoModifyThreatPercent(me->getVictim(), -50); if (target) AttackStart(target); Aggro_Timer = urand(7000, 20000); } else Aggro_Timer -= diff; if (ThousandBlades_Timer <= diff) { DoCast(me->getVictim(), SPELL_THOUSANDBLADES); ThousandBlades_Timer = urand(7000, 12000); } else ThousandBlades_Timer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BERSERK: DoCast(me, SPELL_BERSERK, true); break; case EVENT_FLAME: DoCast(me, SPELL_MOLTEN_PUNCH); events.DelayEvents(1500, GCD_CAST); events.ScheduleEvent(EVENT_FLAME, 20000, GCD_CAST); break; case EVENT_HATEFUL_STRIKE: if (Unit* target = CalculateHatefulStrikeTarget()) DoCast(target, SPELL_HATEFUL_STRIKE); events.DelayEvents(1000, GCD_CAST); events.ScheduleEvent(EVENT_HATEFUL_STRIKE, 5000, GCD_CAST, PHASE_STRIKE); break; case EVENT_SWITCH_TARGET: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) { DoResetThreat(); me->AddThreat(target, 5000000.0f); DoScriptText(EMOTE_NEW_TARGET, me); } events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, 0, PHASE_CHASE); break; case EVENT_VOLCANO: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 999, true); if (!target) target = me->GetVictim(); if (target) { //DoCast(target, SPELL_VOLCANIC_SUMMON);//movement bugged me->SummonCreature(CREATURE_VOLCANO, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000); DoScriptText(EMOTE_GROUND_CRACK, me); events.DelayEvents(1500, GCD_CAST); } events.ScheduleEvent(EVENT_VOLCANO, 10000, GCD_CAST, PHASE_CHASE); return; } case EVENT_SWITCH_PHASE: ChangePhase(); break; } } DoMeleeAttackIfReady(); }
void OnApply(constAuraEffectPtr /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); if (!target) return; std::list<Creature*> shuList; GetCreatureListWithEntryInGrid(shuList, target, 55213, 20.0f); for (auto shu: shuList) if (shu->ToTempSummon()) if (shu->ToTempSummon()->GetOwnerGUID() == target->GetGUID()) return; // A partir d'ici on sait que le joueur n'a pas encore de Huo if (TempSummon* tempShu = target->SummonCreature(55213, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0, target->GetGUID())) { tempShu->SetOwnerGUID(target->GetGUID()); tempShu->GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } }
void UpdateAI(const uint32 diff) { if(!m_creature->SelectHostileTarget() || !m_creature->getVictim() ) return; if (MovementInform_id >= 0) { Moving = false; m_creature->SetLevitate(false); switch (MovementInform_id) { case 0: case 1: case 2: case 3: Platforms_Move_Timer = 30000+rand()%5000; break; case 4: DoCast(m_creature, SPELL_FLAME_QUILLS); FlameQuillsDuration_Timer = 10000; FlameQuills = true; break; case 5: m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetVisibility(VISIBILITY_ON); DoCast(m_creature, SPELL_REBIRTH); Phase2_begin = true; FakeDeath = false; break; case 6: m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, false); m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, DefaultSize/4.0f); DoCast(m_creature->getVictim(), SPELL_DIVE_BOMB_VISUAL); DiveBombCastDelay_Timer = 4000; break; case 7: m_creature->SetSpeedRate(MOVE_RUN, DefaultMoveSpeedRate); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, DefaultModel); m_creature->SetVisibility(VISIBILITY_OFF); // I know, that this sequence of commands looks stupid, but without it visual effect of Rebirth m_creature->SetVisibility(VISIBILITY_ON); // after Dive Bomb looks not perfect (Al'ar appears, and than again disappears and cast Rebirth). DoCast(m_creature, SPELL_REBIRTH_2); DiveBombCastDelay_Timer = 9999999; FlameBuffetAfterDiveBomb = true; DiveBomb_Timer = 40000+rand()%5000; FlameBuffet_Timer = 5000; m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); break; } m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); MovementInform_id = -1; } if (Charge) { if (ChargeDelay_Timer < diff) { if (Charge_target) { m_creature->getThreatManager().modifyThreatPercent(Charge_target, -100); m_creature->getThreatManager().addThreat(Charge_target, Charge_target_threat); } Charge = false; m_creature->SetSpeedRate(MOVE_RUN, DefaultMoveSpeedRate); ChargeDelay_Timer = 2000; } else ChargeDelay_Timer -= diff; return; } if (!Phase1) if (Enrage_Timer < diff) { DoCast(m_creature, SPELL_ENRAGE); Enrage_Timer = 600000; }else Enrage_Timer -= diff; if (Moving) return; if (CorpseDisappear_Timer < diff) { m_creature->SetVisibility(VISIBILITY_OFF); m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); m_creature->SetHealth(m_creature->GetMaxHealth()); CreaturePointMove(5, waypoint[5][0], waypoint[5][1], waypoint[5][2]); CorpseDisappear_Timer = 9999999; }else CorpseDisappear_Timer -= diff; if (FakeDeath) return; if (Phase2_begin) { m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); MeltArmor_Timer = 60000; Charge_Timer = 7000; DiveBomb_Timer = 40000+rand()%5000; DiveBombCastDelay_Timer = 9999999; FlameBuffet_Timer = 9999999; FlamePatch_Timer = 30000; Phase2_begin = false; Phase1 = false; if(pInstance) pInstance->SetData(TYPE_ALAR, SPECIAL); } if (Phase1) { if (FlameQuills) { if (FlameQuillsDuration_Timer < diff) { switch(rand()%2) { case 0: cur_wp = 0; break; case 1: cur_wp = 3; break; } CreaturePointMove(cur_wp, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]); FlameQuills = false; }else FlameQuillsDuration_Timer -= diff; return; } if (Platforms_Move_Timer < diff) { Creature* Summoned = NULL; Summoned = m_creature->SummonCreature(CREATURE_EMBER_OF_ALAR, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); if (Summoned) { Unit* target = NULL; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) Summoned->AI()->AttackStart(target); } if (rand()%100 <= 20) { cur_wp = 4; FlameQuills = true; } else { cur_wp++; if (cur_wp == 4) cur_wp = 0; } CreaturePointMove(cur_wp, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]); }else Platforms_Move_Timer -= diff; if (FlameBuffet_Timer < diff) { bool InMeleeRange = false; ThreatList const& tList = m_creature->getThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) { Unit* pUnit = NULL; pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()); if (pUnit) if (m_creature->IsWithinDistInMap(pUnit, 5)) { InMeleeRange = true; m_creature->getThreatManager().addThreat(pUnit, 2.0f); break; }else m_creature->getThreatManager().modifyThreatPercent(pUnit, -100); } if (!InMeleeRange) DoCast(m_creature, SPELL_FLAME_BUFFET); FlameBuffet_Timer = 1500; }else FlameBuffet_Timer -= diff; } else { if (FlameBuffetAfterDiveBomb) { if (FlameBuffet_Timer < diff) { if (m_creature->IsWithinDistInMap(m_creature->getVictim(), 5)) { m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); FlameBuffetAfterDiveBomb = false; FlameBuffet_Timer = 9999999; } else { DoCast(m_creature, SPELL_FLAME_BUFFET); FlameBuffet_Timer = 1500; } } else FlameBuffet_Timer -= diff; } else { if (MeltArmor_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_MELT_ARMOR); MeltArmor_Timer = 60000; }else MeltArmor_Timer -= diff; if (Charge_Timer < diff) { Charge_target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); if (Charge_target) { m_creature->SetInFront(Charge_target); Charge_target_threat = m_creature->getThreatManager().getThreat(Charge_target); m_creature->getThreatManager().addThreat(Charge_target, 100000000.0f); m_creature->SetSpeedRate(MOVE_RUN, DefaultMoveSpeedRate*5.0f); DoCast(Charge_target, SPELL_CHARGE); ChargeDelay_Timer = 2000; Charge = true; } Charge_Timer = 30000; }else Charge_Timer -= diff; } if (DiveBomb_Timer < diff) { m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); CreaturePointMove(6, waypoint[4][0], waypoint[4][1], waypoint[4][2]); DiveBomb_Timer = 40000+rand()%5000; }else DiveBomb_Timer -= diff; if (DiveBombCastDelay_Timer < diff) { m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); Unit* target = NULL; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); DoCast(target, SPELL_DIVE_BOMB); m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, DefaultSize); m_creature->RemoveAurasDueToSpell(SPELL_DIVE_BOMB_VISUAL); m_creature->SetSpeedRate(MOVE_RUN, DefaultMoveSpeedRate*2.0f); if (target) CreaturePointMove(7, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); Creature* Summoned = NULL; for (int8 i=1; i<=2; i++) if (target) { Summoned = m_creature->SummonCreature(CREATURE_EMBER_OF_ALAR, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); if (Summoned) { Unit* target1 = NULL; target1 = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target1) Summoned->AI()->AttackStart(target1); } } DiveBombCastDelay_Timer = 9999999; }else DiveBombCastDelay_Timer -= diff; if (FlamePatch_Timer < diff) { Unit* target = NULL; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) { Creature* Summoned = NULL; Summoned = m_creature->SummonCreature(CREATURE_FLAME_PATCH_ALAR, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 120000); if (Summoned) { Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Summoned->SetFloatValue(OBJECT_FIELD_SCALE_X, Summoned->GetFloatValue(OBJECT_FIELD_SCALE_X)*2.9f); Summoned->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686); Summoned->setFaction(m_creature->getFaction()); Summoned->SetLevel(m_creature->getLevel()); Summoned->CastSpell(Summoned, SPELL_FLAME_PATCH, false); } } FlamePatch_Timer = 30000; }else FlamePatch_Timer -= diff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; //BrainWashTotemTimer if (BrainWashTotemTimer <= diff) { DoCast(me, SPELL_BRAINWASHTOTEM); BrainWashTotemTimer = urand(18000, 26000); } else BrainWashTotemTimer -= diff; //HealingWardTimer if (HealingWardTimer <= diff) { //DoCast(me, SPELL_POWERFULLHEALINGWARD); me->SummonCreature(14987, me->GetPositionX()+3, me->GetPositionY()-2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); HealingWardTimer = urand(14000, 20000); } else HealingWardTimer -= diff; //HexTimer if (HexTimer <= diff) { DoCastVictim(SPELL_HEX); if (DoGetThreat(me->GetVictim())) DoModifyThreatPercent(me->GetVictim(), -80); HexTimer = urand(12000, 20000); } else HexTimer -= diff; //Casting the delusion curse with a shade. So shade will attack the same target with the curse. if (DelusionsTimer <= diff) { if (Unit* target = SelectTarget(TARGET_RANDOM, 0)) { DoCast(target, SPELL_DELUSIONSOFJINDO); Creature* Shade = me->SummonCreature(14986, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Shade) Shade->AI()->AttackStart(target); } DelusionsTimer = urand(4000, 12000); } else DelusionsTimer -= diff; //Teleporting a random gamer and spawning 9 skeletons that will attack this gamer if (TeleportTimer <= diff) { Unit* target = NULL; target = SelectTarget(TARGET_RANDOM, 0); if (target && target->GetTypeId() == TYPE_ID_PLAYER) { DoTeleportPlayer(target, -11583.7783f, -1249.4278f, 77.5471f, 4.745f); if (DoGetThreat(me->GetVictim())) DoModifyThreatPercent(target, -100); Creature* Skeletons; Skeletons = me->SummonCreature(14826, target->GetPositionX()+2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) Skeletons->AI()->AttackStart(target); Skeletons = me->SummonCreature(14826, target->GetPositionX()-2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) Skeletons->AI()->AttackStart(target); Skeletons = me->SummonCreature(14826, target->GetPositionX()+4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) Skeletons->AI()->AttackStart(target); Skeletons = me->SummonCreature(14826, target->GetPositionX()-4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) Skeletons->AI()->AttackStart(target); Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()+2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) Skeletons->AI()->AttackStart(target); Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()-2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) Skeletons->AI()->AttackStart(target); Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()+4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) Skeletons->AI()->AttackStart(target); Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()-4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) Skeletons->AI()->AttackStart(target); Skeletons = me->SummonCreature(14826, target->GetPositionX()+3, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Skeletons) Skeletons->AI()->AttackStart(target); } TeleportTimer = urand(15000, 23000); } else TeleportTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; // Pounding if (Pounding_Timer <= diff) { DoCast(m_creature->getVictim(), SPELL_POUNDING); DoScriptText(RAND(SAY_POUNDING1,SAY_POUNDING2), m_creature); Pounding_Timer = 15000; //cast time(3000) + cooldown time(12000) } else Pounding_Timer -= diff; // Arcane Orb if (ArcaneOrb_Timer <= diff) { Unit *pTarget = NULL; std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList(); std::vector<Unit *> target_list; for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (!pTarget) continue; // exclude pets & totems if (pTarget->GetTypeId() != TYPEID_PLAYER) continue; //18 yard radius minimum if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive() && !pTarget->IsWithinDist(m_creature, 18, false)) target_list.push_back(pTarget); pTarget = NULL; } if (target_list.size()) pTarget = *(target_list.begin()+rand()%target_list.size()); else pTarget = m_creature->getVictim(); if (pTarget) m_creature->CastSpell(pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(), SPELL_ARCANE_ORB, false, NULL, NULL, NULL, pTarget); ArcaneOrb_Timer = 3000; } else ArcaneOrb_Timer -= diff; // Single Target knock back, reduces aggro if (KnockAway_Timer <= diff) { DoCast(m_creature->getVictim(), SPELL_KNOCK_AWAY); //Drop 25% aggro if (DoGetThreat(m_creature->getVictim())) DoModifyThreatPercent(m_creature->getVictim(),-25); KnockAway_Timer = 30000; } else KnockAway_Timer -= diff; //Berserk if (Berserk_Timer < diff && !Enraged) { DoCast(m_creature, SPELL_BERSERK); Enraged = true; } else Berserk_Timer -= diff; DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(diff); }
void SpellCast(float val) { if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget()) { float comulativeperc = 0; Unit * target = NULLUNIT; for(int i=0;i<nrspells;i++) { spells[i].casttime--; if (m_spellcheck[i]) { if (!spells[i].instant) _unit->GetAIInterface()->StopMovement(1); spells[i].casttime = spells[i].cooldown; target = _unit->GetAIInterface()->GetNextTarget(); switch(spells[i].targettype) { case TARGET_SELF: case TARGET_VARIOUS: _unit->CastSpell(_unit, spells[i].info, spells[i].instant); break; case TARGET_ATTACKING: _unit->CastSpell(target, spells[i].info, spells[i].instant); break; case TARGET_DESTINATION: _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break; case TARGET_RANDOM_SINGLE:{ std::vector<Unit * > target_list; for (UNORDERED_SET<Player *>::iterator itr = _unit->GetInRangePlayerSetBegin(); itr != _unit->GetInRangePlayerSetEnd(); ++itr) { target = TO_UNIT(*itr); if(target) target_list.push_back(target); target = NULLUNIT; } if(target_list.size()) target = *(target_list.begin()+rand()%target_list.size()); if(target) _unit->CastSpell(target, spells[i].info, spells[i].instant); target = NULLUNIT; }break; } if (spells[i].speech != "") { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, spells[i].speech.c_str()); _unit->PlaySoundToSet(spells[i].soundid); } m_spellcheck[i] = false; return; } if ((val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) || !spells[i].casttime) { _unit->setAttackTimer(spells[i].attackstoptimer, false); m_spellcheck[i] = true; } comulativeperc += spells[i].perctrigger; } } }
bool FleeingMovementGenerator<T>::_setMoveData(T &owner) { float cur_dist_xyz = owner.GetDistance(i_caster_x, i_caster_y, i_caster_z); if (i_to_distance_from_caster > 0.0f) { if ((i_last_distance_from_caster > i_to_distance_from_caster && cur_dist_xyz < i_to_distance_from_caster) || // if we reach lower distance (i_last_distance_from_caster > i_to_distance_from_caster && cur_dist_xyz > i_last_distance_from_caster) || // if we can't be close (i_last_distance_from_caster < i_to_distance_from_caster && cur_dist_xyz > i_to_distance_from_caster) || // if we reach bigger distance (cur_dist_xyz > MAX_QUIET_DISTANCE) || // if we are too far (i_last_distance_from_caster > MIN_QUIET_DISTANCE && cur_dist_xyz < MIN_QUIET_DISTANCE) ) // if we leave 'quiet zone' { // we are very far or too close, stopping i_to_distance_from_caster = 0.0f; i_nextCheckTime.Reset( urand(500,1000) ); return false; } else { // now we are running, continue i_last_distance_from_caster = cur_dist_xyz; return true; } } float cur_dist; float angle_to_caster; Unit * fright = ObjectAccessor::GetUnit(owner, i_frightGUID); if (fright) { cur_dist = fright->GetDistance(&owner); if (cur_dist < cur_dist_xyz) { i_caster_x = fright->GetPositionX(); i_caster_y = fright->GetPositionY(); i_caster_z = fright->GetPositionZ(); angle_to_caster = fright->GetAngle(&owner); } else { cur_dist = cur_dist_xyz; angle_to_caster = owner.GetAngle(i_caster_x, i_caster_y) + M_PI; } } else { cur_dist = cur_dist_xyz; angle_to_caster = owner.GetAngle(i_caster_x, i_caster_y) + M_PI; } // if we too close may use 'path-finding' else just stop i_only_forward = cur_dist >= MIN_QUIET_DISTANCE/3; //get angle and 'distance from caster' to run float angle; if (i_cur_angle == 0.0f && i_last_distance_from_caster == 0.0f) //just started, first time { angle = rand_norm()*(1.0f - cur_dist/MIN_QUIET_DISTANCE) * M_PI/3 + rand_norm()*M_PI*2/3; i_to_distance_from_caster = MIN_QUIET_DISTANCE; i_only_forward = true; } else if (cur_dist < MIN_QUIET_DISTANCE) { angle = M_PI/6 + rand_norm()*M_PI*2/3; i_to_distance_from_caster = cur_dist*2/3 + rand_norm()*(MIN_QUIET_DISTANCE - cur_dist*2/3); } else if (cur_dist > MAX_QUIET_DISTANCE) { angle = rand_norm()*M_PI/3 + M_PI*2/3; i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); } else { angle = rand_norm()*M_PI; i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); } int8 sign = rand_norm() > 0.5f ? 1 : -1; i_cur_angle = sign*angle + angle_to_caster; // current distance i_last_distance_from_caster = cur_dist; return true; }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; switch (m_uiStage) { case 0: if (m_uiFerociousButtTimer <= uiDiff) { DoCastVictim(SPELL_FEROCIOUS_BUTT); m_uiFerociousButtTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); } else m_uiFerociousButtTimer -= uiDiff; if (m_uiArticBreathTimer <= uiDiff) { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_ARCTIC_BREATH); m_uiArticBreathTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS); } else m_uiArticBreathTimer -= uiDiff; if (m_uiWhirlTimer <= uiDiff) { DoCastAOE(SPELL_WHIRL); m_uiWhirlTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); } else m_uiWhirlTimer -= uiDiff; if (m_uiMassiveCrashTimer <= uiDiff) { me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 10.0f, 20.0f); // 1: Middle of the room m_uiStage = 7; //Invalid (Do nothing more than move) m_uiMassiveCrashTimer = 30*IN_MILLISECONDS; } else m_uiMassiveCrashTimer -= uiDiff; DoMeleeAttackIfReady(); break; case 1: DoCastAOE(SPELL_MASSIVE_CRASH); m_uiStage = 2; break; case 2: if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) { m_uiTrampleTargetGUID = pTarget->GetGUID(); me->SetUInt64Value(UNIT_FIELD_TARGET, m_uiTrampleTargetGUID); DoScriptText(SAY_TRAMPLE_STARE, me, pTarget); m_bTrampleCasted = false; SetCombatMovement(false); me->GetMotionMaster()->MoveIdle(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_uiTrampleTimer = 4*IN_MILLISECONDS; m_uiStage = 3; } else m_uiStage = 6; break; case 3: if (m_uiTrampleTimer <= uiDiff) { if (Unit* pTarget = Unit::GetPlayer(*me, m_uiTrampleTargetGUID)) { m_bTrampleCasted = false; m_bMovementStarted = true; m_fTrampleTargetX = pTarget->GetPositionX(); m_fTrampleTargetY = pTarget->GetPositionY(); m_fTrampleTargetZ = pTarget->GetPositionZ(); me->GetMotionMaster()->MoveJump(2*me->GetPositionX()-m_fTrampleTargetX, 2*me->GetPositionY()-m_fTrampleTargetY, me->GetPositionZ(), 10.0f, 20.0f); // 2: Hop Backwards m_uiStage = 7; //Invalid (Do nothing more than move) } else m_uiStage = 6; } else m_uiTrampleTimer -= uiDiff; break; case 4: DoScriptText(SAY_TRAMPLE_START, me); me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1); me->SetUInt64Value(UNIT_FIELD_TARGET, 0); m_uiStage = 5; break; case 5: if (m_bMovementFinish) { if (m_uiTrampleTimer <= uiDiff) DoCastAOE(SPELL_TRAMPLE); m_bMovementFinish = false; m_uiStage = 6; return; } if (m_uiTrampleTimer <= uiDiff) { Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) { if (Unit* pPlayer = itr->getSource()) if (pPlayer->isAlive() && pPlayer->IsWithinDistInMap(me, 6.0f)) { DoCastAOE(SPELL_TRAMPLE); m_uiTrampleTimer = IN_MILLISECONDS; break; } } } else m_uiTrampleTimer -= uiDiff; break; case 6: if (!m_bTrampleCasted) { DoCast(me, SPELL_STAGGERED_DAZE); DoScriptText(SAY_TRAMPLE_FAIL, me); } m_bMovementStarted = false; me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MoveChase(me->getVictim()); SetCombatMovement(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_uiStage = 0; break; } }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (me->getVictim() && me->isAlive()) { if (HealthAbovePct(50)) { if (Charge_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { DoCast(target, SPELL_CHARGE); AttackStart(target); } Charge_Timer = urand(15000, 30000); } else Charge_Timer -= diff; if (SonicBurst_Timer <= diff) { DoCast(me->getVictim(), SPELL_SONICBURST); SonicBurst_Timer = urand(8000, 13000); } else SonicBurst_Timer -= diff; if (Screech_Timer <= diff) { DoCast(me->getVictim(), SPELL_SCREECH); Screech_Timer = urand(18000, 26000); } else Screech_Timer -= diff; if (SpawnBats_Timer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); Creature* Bat = NULL; Bat = me->SummonCreature(11368, -12291.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); Bat = me->SummonCreature(11368, -12289.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); Bat = me->SummonCreature(11368, -12293.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); Bat = me->SummonCreature(11368, -12291.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); Bat = me->SummonCreature(11368, -12289.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); Bat = me->SummonCreature(11368, -12293.6220f, -1380.2640f, 144.8304f, 5.483f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (target && Bat) Bat ->AI()->AttackStart(target); SpawnBats_Timer = 60000; } else SpawnBats_Timer -= diff; } else { if (PhaseTwo) { if (PhaseTwo && ShadowWordPain_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { DoCast(target, SPELL_SHADOW_WORD_PAIN); ShadowWordPain_Timer = urand(12000, 18000); } } ShadowWordPain_Timer -=diff; if (MindFlay_Timer <= diff) { DoCast(me->getVictim(), SPELL_MIND_FLAY); MindFlay_Timer = 16000; } MindFlay_Timer -=diff; if (ChainMindFlay_Timer <= diff) { me->InterruptNonMeleeSpells(false); DoCast(me->getVictim(), SPELL_CHAIN_MIND_FLAY); ChainMindFlay_Timer = urand(15000, 30000); } ChainMindFlay_Timer -=diff; if (GreaterHeal_Timer <= diff) { me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_GREATERHEAL); GreaterHeal_Timer = urand(25000, 35000); } GreaterHeal_Timer -=diff; if (SpawnFlyingBats_Timer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (!target) return; Creature* FlyingBat = me->SummonCreature(14965, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+15, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (FlyingBat) FlyingBat->AI()->AttackStart(target); SpawnFlyingBats_Timer = urand(10000, 15000); } else SpawnFlyingBats_Timer -=diff; } else { me->SetDisplayId(15219); DoResetThreat(); PhaseTwo = true; } } DoMeleeAttackIfReady(); } }