本文整理汇总了C++中Creature::AddThreat方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::AddThreat方法的具体用法?C++ Creature::AddThreat怎么用?C++ Creature::AddThreat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::AddThreat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if(!m_bIsEnrage && m_uiEnrage2Timer < uiDiff)
{
DoCast(m_creature, SPELL_BERSERK);
m_bIsEnrage = true;
}else m_uiEnrage2Timer -= uiDiff;
if(m_bIsBloom && m_uiBloomTimer < uiDiff)
{
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
for(std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
Unit *TargetedPlayer = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
if (TargetedPlayer && TargetedPlayer->GetTypeId() == TYPEID_PLAYER && TargetedPlayer->isAlive())
TargetedPlayer->CastSpell(TargetedPlayer, m_bIsRegularMode ? SPELL_BLOOM : SPELL_BLOOM_H, false);
}
m_uiBloomTimer = 20000;
m_bIsBloom = false;
}else m_uiBloomTimer -= uiDiff;
if(m_uiNecroticAuraTimer < uiDiff)
{
if(m_creature->getVictim())
m_creature->CastSpell(m_creature->getVictim(), SPELL_NECROTIC_AURA, false);
m_uiNecroticAuraTimer = 20000;
}else m_uiNecroticAuraTimer -= uiDiff;
if(m_uiDeatchBloomTimer < uiDiff)
{
if(m_creature->getVictim())
m_creature->CastSpell(m_creature->getVictim(), m_bIsRegularMode ? SPELL_DEATHBLOOM : SPELL_DEATHBLOOM_H, false);
m_uiDeatchBloomTimer = (m_bIsRegularMode ? 30000 : 20000);
m_uiBloomTimer = 6000;
m_bIsBloom = true;
}else m_uiDeatchBloomTimer -= uiDiff;
if(m_uiDoomTimer < uiDiff)
{
if(m_creature->getVictim())
m_creature->CastSpell(m_creature->getVictim(), m_bIsRegularMode ? SPELL_DOOM : SPELL_DOOM_H, false);
m_uiDoomTimer = 30000;
if(m_uiEnrageTimer < uiDiff)
m_uiDoomTimer = 15000;
else m_uiEnrageTimer -= uiDiff;
}else m_uiDoomTimer -= uiDiff;
if (m_uiSummonTimer < uiDiff)
{
for(uint8 i=0; i<3; ++i)
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
{
Creature* pSummonedSpores = m_creature->SummonCreature(CREATURE_SPORE, pTarget->GetPositionX()+1, pTarget->GetPositionY()+1, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN,80000);
if (pSummonedSpores)
{
pSummonedSpores->AddThreat(pTarget);
pSummonedSpores->AI()->AttackStart(pTarget);
}
}
m_uiSummonTimer = 30000;
}else m_uiSummonTimer -= uiDiff;
DoMeleeAttackIfReady();
}
示例2: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (m_bIsActiveCheck)
{
if (!m_bIsActived && Active_Timer < uiDiff)
{
m_bIsActived = true;
Active_Timer = 1000;
}else Active_Timer -= uiDiff;
}
else
{
if (Active_Timer < uiDiff)
{
if(m_pInstance)
{
bool m_bIsAlive = false;
Creature* pStalagg;
Creature* pFeugen;
if (pStalagg = ((Creature*)Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_STALAGG))))
if (pStalagg->isAlive())
m_bIsAlive = true;
if (pFeugen = ((Creature*)Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_FEUGEN))))
if (pFeugen->isAlive())
m_bIsAlive = true;
if (!m_bIsAlive)
{
m_bIsActiveCheck = true;
Active_Timer = 15000;
}
else
{
if (pStalagg->isInCombat() && pFeugen->isInCombat())
{
if (SwitchTarget_Timer < uiDiff)
{
Unit* pStalaggTarget;
Unit* pFeugenTarget;
float StalaggTargetThreat;
float FeugenTargetThreat;
// Get Stalagg's target threat
if (pStalagg && pStalagg->isAlive())
{
if (pStalaggTarget = pStalagg->getVictim())
StalaggTargetThreat = m_creature->getThreatManager().getThreat(pStalaggTarget);
}
// Get Feugen's target threat
if (pFeugen && pFeugen->isAlive())
{
if (pFeugenTarget = pFeugen->getVictim())
FeugenTargetThreat = m_creature->getThreatManager().getThreat(pFeugenTarget);
}
// Switch Feugen's target from Stalagg
if (pStalagg && pStalagg->isAlive())
{
if (pFeugen && pFeugen->isAlive())
{
HostilReference* ref = pFeugen->getThreatManager().getOnlineContainer().getReferenceByTarget(pFeugenTarget);
if (ref)
{
pStalagg->CastSpell(pFeugenTarget, 54517, true);
((Player*)pFeugenTarget)->TeleportTo(pFeugenTarget->GetMapId(), pStalagg->GetPositionX(), pStalagg->GetPositionY(), pStalagg->GetPositionZ(), 0, TELE_TO_NOT_LEAVE_COMBAT);
ref->removeReference();
pStalagg->AddThreat(pFeugenTarget, FeugenTargetThreat);
pStalagg->AI()->AttackStart(pFeugenTarget);
}
}
}
// Switch Stalagg's target from Feugen
if (pFeugen && pFeugen->isAlive())
{
if (pStalagg && pStalagg->isAlive())
{
HostilReference* ref = pStalagg->getThreatManager().getOnlineContainer().getReferenceByTarget(pStalaggTarget);
if (ref)
{
pFeugen->CastSpell(pStalaggTarget, 54517, true);
((Player*)pStalaggTarget)->TeleportTo(pStalaggTarget->GetMapId(), pFeugen->GetPositionX(), pFeugen->GetPositionY(), pFeugen->GetPositionZ(), 0, TELE_TO_NOT_LEAVE_COMBAT);
ref->removeReference();
pFeugen->AddThreat(pStalaggTarget, StalaggTargetThreat);
pFeugen->AI()->AttackStart(pStalaggTarget);
}
}
}
SwitchTarget_Timer = 20000;
}else SwitchTarget_Timer -= uiDiff;
}
else if (pStalagg->isInCombat() || pFeugen->isInCombat())
{
if (m_pInstance)
m_pInstance->SetData(TYPE_THADDIUS, IN_PROGRESS);
}
else if (!pStalagg->isInCombat() && !pFeugen->isInCombat())
{
if (m_pInstance)
m_pInstance->SetData(TYPE_THADDIUS, NOT_STARTED);
//.........这里部分代码省略.........
示例3: UpdateAI
//.........这里部分代码省略.........
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true);
if (!target)
{
EnterEvadeMode();
return;
}
target->CastSpell(target, 44007, true); // cloud visual
DoCast(target, SPELL_ELECTRICAL_STORM, false); // storm cyclon + visual
float x, y, z;
target->GetPosition(x, y, z);
/// @todo: fix it in correct way, that causes player to can fly until logout
/*
if (target)
{
target->SetDisableGravity(true);
target->MonsterMoveWithSpeed(x, y, me->GetPositionZ()+15, 0);
}
*/
Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000);
if (Cloud)
{
CloudGUID = Cloud->GetGUID();
Cloud->SetDisableGravity(true);
Cloud->StopMoving();
Cloud->SetObjectScale(1.0f);
Cloud->setFaction(35);
Cloud->SetMaxHealth(9999999);
Cloud->SetHealth(9999999);
Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
StormCount = 1;
events.ScheduleEvent(EVENT_ELECTRICAL_STORM, 60000); // 60 seconds(bosskillers)
events.ScheduleEvent(EVENT_RAIN, urand(47000, 52000));
break;
}
case EVENT_RAIN:
if (!isRaining)
{
SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f);
isRaining = true;
}
else
events.ScheduleEvent(EVENT_RAIN, 1000);
break;
case EVENT_STORM_SEQUENCE:
{
Unit* target = ObjectAccessor::GetUnit(*me, CloudGUID);
if (!target || !target->IsAlive())
{
EnterEvadeMode();
return;
}
else if (Unit* Cyclone = ObjectAccessor::GetUnit(*me, CycloneGUID))
Cyclone->CastSpell(target, SPELL_SAND_STORM, true); // keep casting or...
HandleStormSequence(target);
break;
}
case EVENT_SUMMON_EAGLES:
Talk(SAY_SUMMON);
float x, y, z;
me->GetPosition(x, y, z);
for (uint8 i = 0; i < 8; ++i)
{
Unit* bird = ObjectAccessor::GetUnit(*me, BirdGUIDs[i]);
if (!bird) //they despawned on die
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
x = target->GetPositionX() + irand(-10, 10);
y = target->GetPositionY() + irand(-10, 10);
z = target->GetPositionZ() + urand(16, 20);
if (z > 95)
z = 95.0f - urand(0, 5);
}
Creature* creature = me->SummonCreature(NPC_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (creature)
{
creature->AddThreat(me->GetVictim(), 1.0f);
creature->AI()->AttackStart(me->GetVictim());
BirdGUIDs[i] = creature->GetGUID();
}
}
}
break;
case EVENT_ENRAGE:
Talk(SAY_ENRAGE);
DoCast(me, SPELL_BERSERK, true);
events.ScheduleEvent(EVENT_ENRAGE, 600000);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
示例4: UpdateAI
void UpdateAI(const uint32 diff)
{
if (Intro && !Done)
{
if (AggroTimer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Talk(SAY_AGGRO);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
Done = true;
if (AggroTargetGUID)
{
Unit* unit = Unit::GetUnit(*me, AggroTargetGUID);
if (unit)
AttackStart(unit);
DoZoneInCombat();
}
else
{
EnterEvadeMode();
return;
}
} else AggroTimer -= diff;
}
if (!UpdateVictim() || !Done)
return;
if (SummonShadowsTimer <= diff)
{
//MindControlGhost();
for (uint8 i = 0; i < 2; ++i)
{
Creature* Shadow = NULL;
float X = CalculateRandomLocation(me->GetPositionX(), 10);
Shadow = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0);
if (Shadow)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (!target)
target = me->getVictim();
if (target)
Shadow->AI()->AttackStart(target);
}
}
SummonShadowsTimer = 60000;
} else SummonShadowsTimer -= diff;
if (SummonDoomBlossomTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
float X = CalculateRandomLocation(target->GetPositionX(), 20);
float Y = CalculateRandomLocation(target->GetPositionY(), 20);
float Z = target->GetPositionZ();
Z = me->GetMap()->GetHeight(me->GetPhaseMask(), X, Y, Z);
Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000);
if (DoomBlossom)
{
DoomBlossom->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoomBlossom->setFaction(me->getFaction());
DoomBlossom->AddThreat(target, 1.0f);
CAST_AI(mob_doom_blossom::mob_doom_blossomAI, DoomBlossom->AI())->SetTeronGUID(me->GetGUID());
target->CombatStart(DoomBlossom);
SetThreatList(DoomBlossom);
SummonDoomBlossomTimer = 35000;
}
}
} else SummonDoomBlossomTimer -= diff;
if (IncinerateTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (!target)
target = me->getVictim();
if (target)
{
Talk(SAY_SPECIAL);
DoCast(target, SPELL_INCINERATE);
IncinerateTimer = urand(20, 51) * 1000;
}
} else IncinerateTimer -= diff;
if (CrushingShadowsTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target && target->isAlive())
DoCast(target, SPELL_CRUSHING_SHADOWS);
CrushingShadowsTimer = urand(10, 26) * 1000;
} else CrushingShadowsTimer -= diff;
/*** NOTE FOR FUTURE DEV: UNCOMMENT BELOW ONLY IF MIND CONTROL IS FULLY IMPLEMENTED **/
/*if (ShadowOfDeathTimer <= diff)
{
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
//.........这里部分代码省略.........
示例5: UpdateAI
void UpdateAI(const uint32 diff)
{
if(!UpdateVictim())
return;
if(CheckKilrekTimer < diff)
{
CheckKilrekTimer = 5000;
if(pInstance)
uint64 KilrekGUID = pInstance->GetData64(DATA_KILREK);
else ERROR_INST_DATA(me);
Creature* Kilrek = (Unit::GetCreature(*me, pInstance->GetData64(DATA_KILREK)));
if(SummonKilrek && Kilrek)
{
Kilrek->Respawn();
if(Kilrek->AI())
{
Kilrek->AI()->AttackStart(me->getVictim());
me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT);
}
else DoCast(me, SPELL_SUMMON_IMP, true);
}
if(!Kilrek || !Kilrek->isDead())
{
DoCast(me, SPELL_SUMMON_IMP, true);
CheckKilrekTimer = 40000;
}
}else CheckKilrekTimer -= diff;
if(SacrificeTimer < diff)
{
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
if (target && target->isAlive())
{
DoCast(target, SPELL_SACRIFICE, true);
Creature* Chains = me->SummonCreature(CREATURE_DEMONCHAINS, -11234.077148, -1698.314209, 179.237320, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 21000);
if(Chains)
{
CAST_AI(mob_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID();
Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true);
DoScriptText(RAND(SAY_SACRIFICE1,SAY_SACRIFICE2), me);
SacrificeTimer = 30000;
}
}
}else SacrificeTimer -= diff;
if(ShadowboltTimer < diff)
{
DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT);
ShadowboltTimer = 10000;
}else ShadowboltTimer -= diff;
if(SummonTimer < diff)
{
if(!SummonedPortals)
{
for(uint8 i = 0; i < 2; ++i)
{
Creature* Portal = me->SummonCreature(CREATURE_PORTAL, PortalLocations[i][0], PortalLocations[i][1], PORTAL_Z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if(Portal)
PortalGUID[i] = Portal->GetGUID();
}
SummonedPortals = true;
switch(rand()%2)
{
case 0: DoScriptText(SAY_SUMMON1, me); break;
case 1: DoScriptText(SAY_SUMMON2, me); break;
}
}
uint32 random = rand()%2;
Creature* Imp = me->SummonCreature(CREATURE_FIENDISHIMP, PortalLocations[random][0], PortalLocations[random][1], PORTAL_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 15000);
if(Imp)
{
Imp->AddThreat(me->getVictim(), 1.0f);
Imp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 1));
}
SummonTimer = 5000;
}else SummonTimer -= diff;
if(!Berserk)
{
if(BerserkTimer < diff)
{
DoCast(me, SPELL_BERSERK);
Berserk = true;
}else BerserkTimer -= diff;
}
DoMeleeAttackIfReady();
}
示例6: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!SisterDeath)
{
if (pInstance)
{
Unit* Temp = NULL;
Temp = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_ALYTHESS));
if (Temp && Temp->isDead())
{
DoScriptText(YELL_SISTER_ALYTHESS_DEAD, m_creature);
DoCast(m_creature, SPELL_EMPOWER);
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
SisterDeath = true;
}
}
}
if (!UpdateVictim())
return;
if (SisterDeath)
{
if (ConflagrationTimer <= diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
{
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (pTarget)
DoCast(pTarget, SPELL_CONFLAGRATION);
ConflagrationTimer = 30000+(rand()%5000);
}
} else ConflagrationTimer -= diff;
}
else
{
if (ShadownovaTimer <= diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
{
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (pTarget)
DoCast(pTarget, SPELL_SHADOW_NOVA);
if (!SisterDeath)
{
if (pTarget)
DoScriptText(EMOTE_SHADOW_NOVA, m_creature, pTarget);
DoScriptText(YELL_SHADOW_NOVA, m_creature);
}
ShadownovaTimer = 30000+(rand()%5000);
}
} else ShadownovaTimer -=diff;
}
if (ConfoundingblowTimer <= diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
{
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (pTarget)
DoCast(pTarget, SPELL_CONFOUNDING_BLOW);
ConfoundingblowTimer = 20000 + (rand()%5000);
}
} else ConfoundingblowTimer -=diff;
if (ShadowimageTimer <= diff)
{
Unit *pTarget = NULL;
Creature* temp = NULL;
for (uint8 i = 0; i<3; ++i)
{
pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
temp = DoSpawnCreature(MOB_SHADOW_IMAGE,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN,10000);
if (temp && pTarget)
{
temp->AddThreat(pTarget,1000000);//don't change target(healers)
temp->AI()->AttackStart(pTarget);
}
}
ShadowimageTimer = 20000;
} else ShadowimageTimer -=diff;
if (ShadowbladesTimer <= diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
{
DoCast(m_creature, SPELL_SHADOW_BLADES);
ShadowbladesTimer = 10000;
}
} else ShadowbladesTimer -=diff;
if (EnrageTimer < diff && !Enraged)
{
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
DoScriptText(YELL_ENRAGE, m_creature);
//.........这里部分代码省略.........
示例7: UpdateAI
void UpdateAI(uint32 diff)
{
if (!me->IsInCombat())
return;
if (IsBanished)
{
// Akama is set in the threatlist so when we reset, we make sure that he is not included in our check
if (me->getThreatManager().getThreatList().size() < 2)
{
EnterEvadeMode();
return;
}
if (DefenderTimer <= diff)
{
uint32 ran = rand()%2;
Creature* Defender = me->SummonCreature(NPC_DEFENDER, SpawnLocations[ran].x, SpawnLocations[ran].y, Z_SPAWN, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000);
if (Defender)
{
Defender->SetWalk(false);
bool move = true;
if (AkamaGUID)
{
if (Creature* Akama = Unit::GetCreature(*me, AkamaGUID))
{
float x, y, z;
Akama->GetPosition(x, y, z);
// They move towards AKama
Defender->GetMotionMaster()->MovePoint(0, x, y, z);
Defender->AI()->AttackStart(Akama);
} else move = false;
} else move = false;
if (!move)
Defender->GetMotionMaster()->MovePoint(0, AKAMA_X, AKAMA_Y, AKAMA_Z);
}
DefenderTimer = 15000;
} else DefenderTimer -= diff;
if (SummonTimer <= diff)
{
SummonCreature();
SummonTimer = 35000;
} else SummonTimer -= diff;
if (DeathCount >= 6)
{
if (AkamaGUID)
{
Creature* Akama = Unit::GetCreature((*me), AkamaGUID);
if (Akama && Akama->IsAlive())
{
IsBanished = false;
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveChase(Akama);
Akama->GetMotionMaster()->Clear();
// Shade should move to Akama, not the other way around
Akama->GetMotionMaster()->MoveIdle();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
// Crazy amount of threat
me->AddThreat(Akama, 10000000.0f);
Akama->AddThreat(me, 10000000.0f);
me->Attack(Akama, true);
Akama->Attack(me, true);
}
}
}
}
else // No longer banished, let's fight Akama now
{
if (ReduceHealthTimer <= diff)
{
if (AkamaGUID)
{
Creature* Akama = Unit::GetCreature((*me), AkamaGUID);
if (Akama && Akama->IsAlive())
{
//10 % less health every few seconds.
me->DealDamage(Akama, Akama->GetMaxHealth()/10, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
ReduceHealthTimer = 12000;
}
}
} else ReduceHealthTimer -= diff;
if (HasKilledAkama)
{
if (!HasKilledAkamaAndReseting)//do not let players kill Shade if Akama is dead and Shade is waiting for ResetTimer!! event would bug
{
HasKilledAkamaAndReseting = true;
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop();
//me->SetFullHealth();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->GetMotionMaster()->MoveTargetedHome();
}
if (ResetTimer <= diff)
{
EnterEvadeMode();// Reset a little while after killing Akama, evade and respawn Akama
return;
//.........这里部分代码省略.........
示例8: UpdateAI
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (Channeling == true)
{
for(int ind = 0 ; ind < 4; ind++) m_creature->CastSpell(m_creature->getVictim(),SPELL_SUMMON_CARRION_BEETLES,true);
Channeling = false;
}
if (Phase == 1)
{
if (SPELL_IMPALE_Timer < diff)
{
if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
m_creature->CastSpell(target, HEROIC(SPELL_IMPALE,H_SPELL_IMPALE), true);
SPELL_IMPALE_Timer = 9000;
}else SPELL_IMPALE_Timer -= diff;
if(!Summoned_Guardian)
{
Creature* Guardian;
for(uint8 i=0; i < 2; ++i)
{
Guardian = m_creature->SummonCreature(CREATURE_GUARDIAN,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0);
if(Guardian)
{
Guardian->AddThreat(m_creature->getVictim(), 0.0f);
DoZoneInCombat(Guardian);
}
}
Summoned_Guardian = true;
}
if(!Summoned_Venomancer)
{
if(VENOMANCER_Timer < diff)
{
if(Phase_Time > 1)
{
Creature* Venomancer;
for(uint8 i=0; i < 2; ++i)
{
Venomancer = m_creature->SummonCreature(CREATURE_VENOMANCER,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0);
if(Venomancer)
{
Venomancer->AddThreat(m_creature->getVictim(), 0.0f);
DoZoneInCombat(Venomancer);
}
}
Summoned_Venomancer = true;
}
}else VENOMANCER_Timer -= diff;
}
if(!Summoned_Datter)
{
if(DATTER_Timer < diff)
{
if(Phase_Time > 2)
{
Creature* Datter;
for(uint8 i=0; i < 2; ++i)
{
Datter = m_creature->SummonCreature(CREATURE_DATTER,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0);
if(Datter)
{
Datter->AddThreat(m_creature->getVictim(), 0.0f);
DoZoneInCombat(Datter);
}
}
Summoned_Datter = true;
}
}else DATTER_Timer -= diff;
}
if (UNDERGROUND_Timer < diff)
{
m_creature->RemoveAura(SPELL_SUBMERGE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Phase = 0;
}else UNDERGROUND_Timer -= diff;
}
if (Phase == 0)
{
if (SPELL_LEECHING_SWARM_Timer < diff)
{
//.........这里部分代码省略.........
示例9: UpdateAI
//.........这里部分代码省略.........
}else Enrage_Timer -= diff;
if (StaticDisruption_Timer < diff) {
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
if(!target) target = m_creature->getVictim();
TargetGUID = target->GetGUID();
m_creature->CastSpell(target, SPELL_STATIC_DISRUPTION, false);
m_creature->SetInFront(m_creature->getVictim());
StaticDisruption_Timer = (10+rand()%8)*1000; // < 20s
float dist = m_creature->GetDistance(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
if (dist < 5.0f) dist = 5.0f;
SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);
}else StaticDisruption_Timer -= diff;
if (SDisruptAOEVisual_Timer < diff) {
Unit* SDVictim = Unit::GetUnit((*m_creature), TargetGUID);
if(SDVictim && SDVictim->isAlive())
SDVictim->CastSpell(SDVictim, SPELL_STATIC_VISUAL, true);
SDisruptAOEVisual_Timer = 99999;
TargetGUID = 0;
}else SDisruptAOEVisual_Timer -= diff;
if (GustOfWind_Timer < diff) {
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
if(!target) target = m_creature->getVictim();
DoCast(target, SPELL_GUST_OF_WIND);
GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers)
} else GustOfWind_Timer -= diff;
if (CallLighting_Timer < diff) {
DoCast(m_creature->getVictim(), SPELL_CALL_LIGHTNING);
CallLighting_Timer = (12 + rand()%5)*1000; //totaly random timer. can't find any info on this
} else CallLighting_Timer -= diff;
if (!isRaining && ElectricalStorm_Timer < 8000 + rand()%5000) {
SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f);
isRaining = true;
}
if (ElectricalStorm_Timer < diff) {
Unit* target = SelectRandomPlayer(50);
if(!target) target = m_creature->getVictim();
float x, y, z;
target->GetPosition(x, y, z);
Creature *Cloud = m_creature->SummonCreature(MOB_TEMP_TRIGGER, x, y, m_creature->GetPositionZ() + 10, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
if(Cloud)
{
CloudGUID = Cloud->GetGUID();
Cloud->AddMonsterMoveFlag(MONSTER_MOVE_LEVITATING);
Cloud->StopMoving();
Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f);
Cloud->setFaction(35);
Cloud->SetMaxHealth(9999999);
Cloud->SetHealth(9999999);
Cloud->CastSpell(Cloud, 45213, true); // cloud visual
m_creature->StopMoving();
Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->CastSpell(Cloud, 43501, false); // siphon soul
}
Unit *Cyclone = m_creature->SummonCreature(MOB_TEMP_TRIGGER, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
if(Cyclone)
{
Cyclone->CastSpell(Cyclone, 25160, true); // wind visual
CycloneGUID = Cyclone->GetGUID();
}
ElectricalStorm_Timer = 60000; //60 seconds(bosskillers)
StormCount = 1;
StormSequenceTimer = 0;
} else ElectricalStorm_Timer -= diff;
if (SummonEagles_Timer < diff)
{
DoYell(SAY_ONSUMMON, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_ONSUMMON);
float x, y, z;
m_creature->GetPosition(x, y, z);
for (uint8 i = 0; i < 6 + rand()%3; i++)
{
if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
{
x = target->GetPositionX() + 10 - rand()%20;
y = target->GetPositionY() + 10 - rand()%20;
z = target->GetPositionZ() + 6 + rand()%5 + 10;
if(z > 95) z = 95 - rand()%5;
}
Creature *pCreature = m_creature->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (pCreature)
{
pCreature->AddThreat(m_creature->getVictim(), 1.0f);
pCreature->AI()->AttackStart(m_creature->getVictim());
}
}
SummonEagles_Timer = 999999;
} else SummonEagles_Timer -= diff;
DoMeleeAttackIfReady();
}
示例10: Update
void instance_blackwing_lair::Update(uint32 uiDiff)
{
//IN_PROGRESS = Razorgore Phase 1
if (GetData(TYPE_RAZORGORE) == IN_PROGRESS)
{
if (m_uiRazorgoreSummonTimer <= uiDiff)
{
if (Creature* pRazorgore = GetSingleCreatureFromStorage(NPC_RAZORGORE))
{
for (uint32 i = 0; i < 8; i++)
{
/* SPAWNS BY VALUE
* ===========
* 0 = nothing
* 1 - 3 = orc
* 4 = dragon
*/
uint8 orcCount = 0;
if (m_uiOrcSummoned < MAX_BLACKWING_ORC)
orcCount = 3;
uint8 dragonCount = 0;
if (m_uiDragonkinSummoned < MAX_BLACKWING_DRAGONKIN)
dragonCount = 1;
if (orcCount || dragonCount)
{
uint32 spawnType = urand(1, orcCount + dragonCount);
if (!orcCount)
spawnType = 4;
Creature* spawnedOrcs = 0;
Creature* spawnedDragon = 0;
if (spawnType < 4)
{
++m_uiOrcSummoned;
spawnedOrcs = pRazorgore->SummonCreature(urand(0, 1) ? NPC_BLACKWING_LEGIONNAIRE : NPC_BLACKWING_MAGE, Corner[i].x,
Corner[i].y, Corner[i].z, Corner[i].o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
}
else
{
++m_uiDragonkinSummoned;
spawnedDragon = pRazorgore->SummonCreature(NPC_DEATH_TALON_DRAGONSPAWN, Corner[i].x, Corner[i].y, Corner[i].z, Corner[i].o,
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
}
//All adds have initial aggro on the Razorgore controller. The mage types will run to the center of the room and start to attack the controller with their ranged fireballs
Unit* pController = pRazorgore->GetCharmerOrOwner();
if (spawnedOrcs)
{
razorgoreAdds.push_back(spawnedOrcs);
if (pController && pController->isAlive())
spawnedOrcs->AI()->AttackStart(pController);
else
{
if (Unit* pTarget = spawnedOrcs->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
spawnedOrcs->AI()->AttackStart(pTarget);
}
}
if (spawnedDragon)
{
razorgoreAdds.push_back(spawnedDragon);
if (pRazorgore->isAlive())
{
spawnedDragon->AI()->AttackStart(pRazorgore);
spawnedDragon->AddThreat(pRazorgore, 100.0f);
}
else
{
if (Unit* pTarget = spawnedDragon->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
spawnedDragon->AI()->AttackStart(pTarget);
}
}
}
}
}
m_uiRazorgoreSummonTimer = TIMER_NEXT_ADD_SPAWN;
}
else
m_uiRazorgoreSummonTimer -= uiDiff;
}
/*if (GetData(TYPE_RAZORGORE) == DONE)
{
HandleGameObject(GO_PORTCULLIS_RAZORGORE, true);
for(auto& creature : m_lBlackwingGuardsman)
{
if (Creature* guardsman = instance->GetCreature(creature))
guardsman->ForcedDespawn();
}
if (Creature* grethok = GetSingleCreatureFromStorage(NPC_GRETHOK_THE_CONTROLLER))
grethok->ForcedDespawn();
}*/
//.........这里部分代码省略.........
示例11: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if (SummonKilrekTimer <= diff && SummonedKilrek == false)
{
Creature* Kilrek = me->SummonCreature(CREATURE_KILREK, -11237.955078, -1693.597412, 179.237823, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 15000);
if (Kilrek)
{
Kilrek->SetReactState(REACT_AGGRESSIVE);
Kilrek->AddThreat(me->GetVictim(), 1.0f);
Kilrek->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 1));
SummonedKilrek = true;
}
}
else SummonKilrekTimer -= diff;
if (ReSummonKilrek_Timer <= diff && SummonedKilrek == true && ReSummonedKilrek == false)
{
if (me->HasAura(SPELL_BROKEN_PACT, 0))
me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT);
Creature* Kilrek = me->SummonCreature(CREATURE_KILREK, -11237.955078, -1693.597412, 179.237823, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 15000);
if (Kilrek)
{
Kilrek->SetReactState(REACT_AGGRESSIVE);
Kilrek->AddThreat(me->GetVictim(), 1.0f);
Kilrek->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 1));
ReSummonedKilrek = true;
}
}
else ReSummonKilrek_Timer -= diff;
if (SacrificeTimer <= diff)
{
Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); // target tank as well patch pre 2.1.0
if (pTarget && pTarget->IsAlive())
{
DoCast(pTarget, SPELL_SACRIFICE, true);
me->SummonCreature(17248, -11233.81f, -1698.38f, 179.236f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30500);
if (Creature* Chains = me->FindNearestCreature(CREATURE_DEMONCHAINS, 5000))
{
CAST_AI(mob_demon_chainAI, Chains->AI())->SacrificeGUID = pTarget->GetGUID();
Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true);
DoScriptText(RAND(SAY_SACRIFICE1, SAY_SACRIFICE2), me);
SacrificeTimer = 30000;
}
}
}
else SacrificeTimer -= diff;
if (ShadowboltTimer <= diff)
{
DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT);
ShadowboltTimer = 10000;
}
else ShadowboltTimer -= diff;
if (SummonTimer <= diff)
{
if (!SummonedPortals)
{
for (uint8 i = 0; i < 2; ++i)
{
Creature* Portal = me->SummonCreature(CREATURE_PORTAL, PortalLocations[i][0], PortalLocations[i][1], PORTAL_Z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (Portal)
PortalGUID[i] = Portal->GetGUID();
}
SummonedPortals = true;
}
uint32 random = rand() % 2;
Creature* Imp = me->SummonCreature(CREATURE_FIENDISHIMP, PortalLocations[random][0], PortalLocations[random][1], PORTAL_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 15000);
if (Imp)
{
Imp->AddThreat(me->GetVictim(), 1.0f);
Imp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0));
}
SummonTimer = urand(1500, 5000);
}
else SummonTimer -= diff;
if (!Berserk)
{
if (BerserkTimer <= diff)
{
DoCast(me, SPELL_BERSERK);
Berserk = true;
}
else BerserkTimer -= diff;
}
DoMeleeAttackIfReady();
}
示例12: UpdateAI
//Called at World update tick
void UpdateAI(uint32 const diff)
{
if (!me->getVictim())
{
if (!Unit::GetCreature(*me, m_uiJalootGuid))
{
if (TempSummon* jaloot = me->SummonCreature(NPC_JALOOT, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30 * IN_MILLISECONDS))
{
m_uiJalootGuid = jaloot->GetGUID();
jaloot->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, jaloot);
jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
} else
{
if (Creature * jaloot = Unit::GetCreature(*me, m_uiJalootGuid))
if (jaloot->isAlive() && me->isAlive())
{
jaloot->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, jaloot);
jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
jaloot->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
}
if (!Unit::GetCreature(*me, m_uiZepikGuid))
{
if (TempSummon* zepik = me->SummonCreature(NPC_ZEPIK, SpawnLocations[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30 * IN_MILLISECONDS))
{
m_uiZepikGuid = zepik->GetGUID();
zepik->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, zepik);
zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
} else
{
if (Creature * zepik = Unit::GetCreature(*me, m_uiZepikGuid))
if (zepik->isAlive() && me->isAlive())
{
zepik->AddAura(SPELL_TOMB_OF_THE_HEARTLESS, zepik);
zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
zepik->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
}
}
//Return since we have no target
if (!UpdateVictim())
return;
if (HealthBelowPct(30) && m_uiArtriusPhase == 0)
{
m_uiArtriusPhase = 1;
if (Creature* jaloot = Unit::GetCreature(*me, m_uiJalootGuid))
{
jaloot->RemoveAllAuras();
jaloot->setFaction(FACTION_MONSTER);
jaloot->SetInCombatWith(me->getVictim());
jaloot->AddThreat(me->getVictim(), 0.0f);
me->CastSpell(jaloot, SPELL_BINDINGS_OF_SUBMISSION);
}
if (Creature* zepik = Unit::GetCreature(*me, m_uiZepikGuid))
{
zepik->RemoveAllAuras();
zepik->setFaction(FACTION_MONSTER);
zepik->SetInCombatWith(me->getVictim());
zepik->AddThreat(me->getVictim(), 0.0f);
me->CastSpell(zepik, SPELL_BINDINGS_OF_SUBMISSION);
}
}
if ( m_uiArtriusPhase == 0 || m_uiArtriusPhase == 2 )
{
if ( m_uiFrostboltTimer <= diff )
{
DoCast(me->getVictim(), SPELL_FROSTBOLT);
m_uiFrostboltTimer = 5 * IN_MILLISECONDS;
} else m_uiFrostboltTimer -= diff;
if ( m_uiFrostNovaTimer <= diff )
{
if ( me->IsInRange(me->getVictim(), 5.0f, 10.0f) )
{
DoCast(SPELL_FROST_NOVA);
m_uiFrostNovaTimer = 5 * IN_MILLISECONDS;
}
} else m_uiFrostNovaTimer -= diff;
if ( m_uiIceLanceTimer <= diff )
{
if (me->getVictim()->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
{
DoCast(me->getVictim(), SPELL_ICE_LANCE);
m_uiIceLanceTimer = 5 * IN_MILLISECONDS;
}
} else m_uiIceLanceTimer -= diff;
if ( m_uiIcyVeinsTimer <= diff )
//.........这里部分代码省略.........
示例13: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (m_uiEnfeebleResetTimer)
{
if (m_uiEnfeebleResetTimer <= uiDiff) //Let's not forget to reset that
{
EnfeebleResetHealth();
m_uiEnfeebleResetTimer=0;
}
else
m_uiEnfeebleResetTimer -= uiDiff;
}
if (m_creature->hasUnitState(UNIT_STAT_STUNNED)) //While shifting to m_uiPhase 2 m_malchezaarGuid stuns himself
return;
if (m_creature->GetTargetGuid() != m_creature->getVictim()->GetObjectGuid())
m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid());
if (m_uiPhase == 1)
{
if (m_creature->GetHealthPercent() < 60.0f)
{
m_creature->InterruptNonMeleeSpells(false);
m_uiPhase = 2;
//animation
DoCastSpellIfCan(m_creature, SPELL_EQUIP_AXES);
//text
DoScriptText(SAY_AXE_TOSS1, m_creature);
//passive thrash aura
m_creature->CastSpell(m_creature, SPELL_THRASH_AURA, true);
//models
SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE);
//damage
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg);
m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg);
m_creature->UpdateDamagePhysical(BASE_ATTACK);
m_creature->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg);
m_creature->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg);
//Sigh, updating only works on main attack , do it manually ....
m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg);
m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg);
m_creature->SetAttackTime(OFF_ATTACK, (m_creature->GetAttackTime(BASE_ATTACK)*150)/100);
}
}
else if (m_uiPhase == 2)
{
if (m_creature->GetHealthPercent() < 30.0f)
{
InfernalTimer = 15000;
m_uiPhase = 3;
ClearWeapons();
//remove thrash
m_creature->RemoveAurasDueToSpell(SPELL_THRASH_AURA);
DoScriptText(SAY_AXE_TOSS2, m_creature);
Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0);
for (uint32 i = 0; i < 2; ++i)
{
Creature* pAxe = m_creature->SummonCreature(MALCHEZARS_AXE, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
if (pAxe)
{
pAxe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pAxe->setFaction(m_creature->getFaction());
m_aAxeGuid[i] = pAxe->GetObjectGuid();
if (pTarget)
{
pAxe->AI()->AttackStart(pTarget);
// pAxe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly
// So we'll use a hack to add a lot of threat to our pTarget
pAxe->AddThreat(pTarget, 10000000.0f);
}
}
}
if (m_uiShadowNovaTimer > 35000)
m_uiShadowNovaTimer = m_uiEnfeebleTimer + 5000;
return;
}
if (SunderArmorTimer < uiDiff)
{
//.........这里部分代码省略.........
示例14: UpdateAI
//.........这里部分代码省略.........
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (!target) target = me->getVictim();
TargetGUID = target->GetGUID();
DoCast(target, SPELL_STATIC_DISRUPTION, false);
me->SetInFront(me->getVictim());
StaticDisruption_Timer = (10+rand()%8)*1000; // < 20s
/*if (float dist = me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f) dist = 5.0f;
SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/
} else StaticDisruption_Timer -= diff;
if (GustOfWind_Timer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (!target) target = me->getVictim();
DoCast(target, SPELL_GUST_OF_WIND);
GustOfWind_Timer = urand(20, 30) * 1000; //20 to 30 seconds(bosskillers)
} else GustOfWind_Timer -= diff;
if (CallLighting_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_CALL_LIGHTNING);
CallLighting_Timer = urand(12, 17) * 1000; //totaly random timer. can't find any info on this
} else CallLighting_Timer -= diff;
if (!isRaining && ElectricalStorm_Timer < uint32(8000 + rand() % 5000))
{
SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f);
isRaining = true;
}
if (ElectricalStorm_Timer <= diff) {
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true);
if (!target)
{
EnterEvadeMode();
return;
}
target->CastSpell(target, 44007, true);//cloud visual
DoCast(target, SPELL_ELECTRICAL_STORM, false);//storm cyclon + visual
float x, y, z;
target->GetPosition(x, y, z);
if (target)
{
target->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING);
target->MonsterMoveWithSpeed(x, y, me->GetPositionZ()+15, 0);
}
Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000);
if (Cloud)
{
CloudGUID = Cloud->GetGUID();
Cloud->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING);
Cloud->StopMoving();
Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
Cloud->setFaction(35);
Cloud->SetMaxHealth(9999999);
Cloud->SetHealth(9999999);
Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
ElectricalStorm_Timer = 60000; //60 seconds(bosskillers)
StormCount = 1;
StormSequenceTimer = 0;
} else ElectricalStorm_Timer -= diff;
if (SummonEagles_Timer <= diff)
{
me->MonsterYell(SAY_ONSUMMON, LANG_UNIVERSAL, 0);
DoPlaySoundToSet(me, SOUND_ONSUMMON);
float x, y, z;
me->GetPosition(x, y, z);
for (uint8 i = 0; i < 8; ++i)
{
Unit* bird = Unit::GetUnit(*me, BirdGUIDs[i]);
if (!bird) //they despawned on die
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
x = target->GetPositionX() + irand(-10, 10);
y = target->GetPositionY() + irand(-10, 10);
z = target->GetPositionZ() + urand(16, 20);
if (z > 95)
z = 95.0f - urand(0, 5);
}
Creature* creature = me->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (creature)
{
creature->AddThreat(me->getVictim(), 1.0f);
creature->AI()->AttackStart(me->getVictim());
BirdGUIDs[i] = creature->GetGUID();
}
}
}
SummonEagles_Timer = 999999;
} else SummonEagles_Timer -= diff;
DoMeleeAttackIfReady();
}
示例15: UpdateAI
void UpdateAI(const uint32 diff)
{
if(!m_creature->getVictim() && !m_creature->SelectHostilTarget())
return;
switch(Phase)
{
case 0:
{
// *Heroic mode only:
if(Heroic)
if(PyroblastTimer < diff)
{
DoCast(m_creature, SPELL_SHOCK_BARRIER, true);
DoCast(m_creature->getVictim(), SPELL_PYROBLAST);
PyroblastTimer = 60000;
}else PyroblastTimer -= diff;
if(FireballTimer < diff)
{
// *Normal/Heroic mode support
if(Heroic) DoCast(m_creature->getVictim(), SPELL_FIREBALL_HEROIC);
else DoCast(m_creature->getVictim(), SPELL_FIREBALL_NORMAL);
FireballTimer = 2000 + rand()%4000;
}else FireballTimer -= diff;
if(PhoenixTimer < diff)
{
uint32 random = rand()%2 + 1;
float x = KaelLocations[random][0];
float y = KaelLocations[random][1];
Creature* Phoenix = m_creature->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_CORPSE_DESPAWN, 60000);
if(Phoenix)
{
Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE);
SetThreatList(Phoenix);
Unit *target = SelectUnit(SELECT_TARGET_RANDOM,1);
if(target)
{
Phoenix->AddThreat(target,1000);
Phoenix->Attack(target,true);
Phoenix->GetMotionMaster()->MoveChase(target);
}
else
{
Phoenix->AddThreat(m_creature->getVictim(),1000);
Phoenix->Attack(m_creature->getVictim(),true);
Phoenix->GetMotionMaster()->MoveChase(m_creature->getVictim());
}
}
DoYell(SAY_PHOENIX, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature,SOUND_PHOENIX);
PhoenixTimer = 40000;
}else PhoenixTimer -= diff;
if(FlameStrikeTimer < diff)
{
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target)
{
m_creature->InterruptNonMeleeSpells(false);
DoCast(target, SPELL_FLAMESTRIKE3, true);
FlameStrikeTimer = 20000 + rand()%5000;
DoYell(SAY_FLAMESTRIKE, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_FLAMESTRIKE);
}
}else FlameStrikeTimer -= diff;
// Below 50%
if(m_creature->GetMaxHealth() * 0.5 > m_creature->GetHealth())
{
m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
m_creature->StopMoving();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
GravityLapseTimer = 0;
GravityLapsePhase = 0;
Phase = 1;
}
DoMeleeAttackIfReady();
}
break;
case 1:
{
m_creature->StopMoving();
if(GravityLapseTimer < diff)
{
switch(GravityLapsePhase)
{
case 0:
if(FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse
{
DoYell(SAY_GRAVITY_LAPSE,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_GRAVITY_LAPSE);
FirstGravityLapse = false;
if(pInstance)
//.........这里部分代码省略.........