本文整理汇总了C++中DoResetThreat函数的典型用法代码示例。如果您正苦于以下问题:C++ DoResetThreat函数的具体用法?C++ DoResetThreat怎么用?C++ DoResetThreat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DoResetThreat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAI
void UpdateAI(uint32 diff)
{
events2.Update(diff);
switch (events2.ExecuteEvent())
{
case EVENT_SHADE_GATHER_NPCS:
{
std::list<Creature*> ChannelerList;
me->GetCreaturesWithEntryInRange(ChannelerList, 100.0f, NPC_ASHTONGUE_CHANNELER);
for (std::list<Creature*>::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr)
summonsChanneler.Summon(*itr);
std::list<Creature*> SpawnerList;
me->GetCreaturesWithEntryInRange(SpawnerList, 100.0f, NPC_CREATURE_GENERATOR_AKAMA);
for (std::list<Creature*>::const_iterator itr = SpawnerList.begin(); itr != SpawnerList.end(); ++itr)
summonsGenerator.Summon(*itr);
summonsChanneler.Respawn();
summonsGenerator.Respawn();
ChannelersAction(ACTION_CHANNELERS_START_CHANNEL);
if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE)))
akama->Respawn(true);
break;
}
case EVENT_SHADE_RESET_ENCOUNTER:
me->SetVisible(true);
summonsGenerator.Respawn();
summonsChanneler.Respawn();
ChannelersAction(ACTION_CHANNELERS_START_CHANNEL);
if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE)))
akama->Respawn(true);
break;
}
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_SHADE_CHECK_DISTANCE:
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)
{
int32 slow = me->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED);
if (slow > -100)
{
me->SetWalk(true);
me->GetMotionMaster()->MovePoint(POINT_START, 510.0f, 400.7993f, 112.7837f);
}
}
else
{
int32 slow = me->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED);
if (slow < -100)
me->GetMotionMaster()->Clear();
else if (slow == 0)
{
summonsGenerator.DoAction(ACTION_NO_SORCERERS);
me->SetWalk(false);
}
}
if (me->IsWithinMeleeRange(me->GetVictim()))
{
me->SetReactState(REACT_AGGRESSIVE);
DoResetThreat();
me->GetVictim()->InterruptNonMeleeSpells(false);
me->AddThreat(me->GetVictim(), 1000000.0f);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE);
summonsGenerator.DoAction(ACTION_STOP_SPAWNING);
break;
}
events.ScheduleEvent(EVENT_SHADE_CHECK_DISTANCE, 1000);
break;
}
DoMeleeAttackIfReady();
EnterEvadeIfOutOfCombatArea();
}
示例2: DoCast
void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff)
{
if(ResetTimer)
{
if(ResetTimer <= diff)
{
ResetTimer = 0;
Unit* pMidnight = Unit::GetUnit(*me, Midnight);
if(pMidnight)
{
pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pMidnight->SetVisible(true);
}
Midnight = 0;
me->SetVisible(false);
me->Kill(me);
}
} else ResetTimer -= diff;
//Return since we have no target
if(!UpdateVictim())
return;
if(me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
return;
if(CleaveTimer <= diff)
{
DoCast(me->getVictim(), SPELL_SHADOWCLEAVE);
CleaveTimer = urand(10000, 15000);
} else CleaveTimer -= diff;
if(CurseTimer <= diff)
{
DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE);
CurseTimer = 30000;
} else CurseTimer -= diff;
if(RandomYellTimer <= diff)
{
DoScriptText(RAND(SAY_RANDOM1, SAY_RANDOM2), me);
RandomYellTimer = urand(30000, 60000);
} else RandomYellTimer -= diff;
if(me->GetUInt32Value(UNIT_FIELD_DISPLAYID) == MOUNTED_DISPLAYID)
{
if(ChargeTimer <= diff)
{
Unit* target = NULL;
std::list<HostileReference *> t_list = me->getThreatManager().getThreatList();
std::vector<Unit* > target_list;
for(std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if(target && !target->IsWithinDist(me, ATTACK_DISTANCE, false))
target_list.push_back(target);
target = NULL;
}
if(!target_list.empty())
target = *(target_list.begin()+rand()%target_list.size());
DoCast(target, SPELL_BERSERKER_CHARGE);
ChargeTimer = 20000;
} else ChargeTimer -= diff;
}
else
{
if(HealthBelowPct(25))
{
Creature* pMidnight = Unit::GetCreature(*me, Midnight);
if(pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT)
{
CAST_AI(boss_midnight::boss_midnightAI, (pMidnight->AI()))->Mount(me);
me->SetHealth(pMidnight->GetHealth());
DoResetThreat();
}
}
}
DoMeleeAttackIfReady();
}
示例3: UpdateAI
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
// Note: because the Vanish spell adds invisibility effect on the target, the timers won't be decreased during the vanish phase
if (m_uiWaitTimer)
{
if (m_uiWaitTimer <= uiDiff)
{
// It's not very clear how to handle this spell
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
DoScriptText(urand(0, 1) ? SAY_SPECIAL_1 : SAY_SPECIAL_2, m_creature);
DoResetThreat();
AttackStart(pTarget);
pTarget->CastSpell(pTarget, SPELL_GARROTE, TRIGGERED_OLD_TRIGGERED);
}
m_uiWaitTimer = 0;
}
else
m_uiWaitTimer -= uiDiff;
// Don't user other abilities in vanish
return;
}
if (!m_bEnrage && m_creature->GetHealthPercent() < 30.0f)
{
if (DoCastSpellIfCan(m_creature, SPELL_FRENZY) == CAST_OK)
m_bEnrage = true;
}
// No other spells are cast after enrage
if (!m_bEnrage)
{
if (m_uiVanishTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_VANISH) == CAST_OK)
{
m_uiVanishTimer = 30000;
m_uiWaitTimer = 1000;
}
}
else
m_uiVanishTimer -= uiDiff;
// Gouge highest aggro, and attack second highest
if (m_uiGougeTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_GOUGE) == CAST_OK)
m_uiGougeTimer = 40000;
}
else
m_uiGougeTimer -= uiDiff;
if (m_uiBlindTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_BLIND, SELECT_FLAG_PLAYER))
{
if (DoCastSpellIfCan(pTarget, SPELL_BLIND) == CAST_OK)
m_uiBlindTimer = 40000;
}
}
else
m_uiBlindTimer -= uiDiff;
}
DoMeleeAttackIfReady();
}
示例4: UpdateAI
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
// Bat phase
if (m_bIsPhaseOne)
{
// Phase Switch at 50%
if (m_creature->GetHealthPercent() < 50.0f)
{
m_creature->RemoveAurasDueToSpell(SPELL_BAT_FORM);
m_creature->SetLevitate(false);
DoResetThreat();
m_bIsPhaseOne = false;
return;
}
if (m_uiChargeTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
if (DoCastSpellIfCan(pTarget, SPELL_CHARGE) == CAST_OK)
m_uiChargeTimer = urand(15000, 30000);
}
}
else
m_uiChargeTimer -= uiDiff;
if (m_uiSwoopTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SWOOP) == CAST_OK)
m_uiSwoopTimer = urand(4000, 9000);
}
else
m_uiSwoopTimer -= uiDiff;
if (m_uiSonicBurstTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_SONIC_BURST) == CAST_OK)
m_uiSonicBurstTimer = urand(8000, 13000);
}
else
m_uiSonicBurstTimer -= uiDiff;
if (m_uiSpawnBatsTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_SUMMON_FRENZIED_BATS) == CAST_OK)
{
DoScriptText(SAY_SHRIEK, m_creature);
m_uiSpawnBatsTimer = 60000;
}
}
else
m_uiSpawnBatsTimer -= uiDiff;
}
// Troll phase
else
{
if (m_uiShadowWordPainTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
if (DoCastSpellIfCan(pTarget, SPELL_SHADOW_WORD_PAIN) == CAST_OK)
m_uiShadowWordPainTimer = urand(12000, 18000);
}
}
else
m_uiShadowWordPainTimer -= uiDiff;
if (m_uiMindFlayTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIND_FLAY) == CAST_OK)
m_uiMindFlayTimer = 16000;
}
else
m_uiMindFlayTimer -= uiDiff;
if (m_uiChainMindFlayTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_BLOOD_LEECH) == CAST_OK)
m_uiChainMindFlayTimer = urand(15000, 30000);
}
else
m_uiChainMindFlayTimer -= uiDiff;
if (m_uiGreaterHealTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_GREATERHEAL, CAST_INTERRUPT_PREVIOUS) == CAST_OK)
{
DoScriptText(SAY_HEAL, m_creature);
m_uiGreaterHealTimer = urand(25000, 35000);
}
}
else
m_uiGreaterHealTimer -= uiDiff;
if (m_uiFlyingBatsTimer)
{
if (m_uiFlyingBatsTimer <= uiDiff)
//.........这里部分代码省略.........
示例5: UpdateAI
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_MANA_STORM:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true))
DoCast(target, SPELL_MANA_STORM);
events.ScheduleEvent(EVENT_MANA_STORM, urand(7500, 12500));
break;
case EVENT_CHILL:
DoCastVictim(SPELL_CHILL);
events.ScheduleEvent(EVENT_CHILL, urand(13000, 25000));
break;
case EVENT_BREATH:
DoCastVictim(SPELL_FROST_BREATH);
events.ScheduleEvent(EVENT_BREATH, urand(10000, 15000));
break;
case EVENT_TELEPORT:
{
Talk(SAY_TELEPORT);
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
if (Player* player = ObjectAccessor::GetPlayer(*me, (*i)->getUnitGuid()))
DoTeleportPlayer(player, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, player->GetOrientation());
}
DoResetThreat();
events.ScheduleEvent(EVENT_TELEPORT, 30000);
break;
}
case EVENT_REFLECT:
DoCast(me, SPELL_REFLECT);
events.ScheduleEvent(EVENT_REFLECT, urand(20000, 35000));
break;
case EVENT_CLEAVE:
DoCastVictim(SPELL_CLEAVE);
events.ScheduleEvent(EVENT_CLEAVE, 7000);
break;
default:
break;
}
}
if (HealthBelowPct(26) && !_enraged)
{
DoCast(me, SPELL_ENRAGE);
_enraged = true;
}
DoMeleeAttackIfReady();
}
示例6: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if(phase == 2 && boss_phase == 1)
{
events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000));
events.RescheduleEvent(EVENT_OVERLOAD, urand(60000,125000));
events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000));
boss_phase++;
}
if(phase == 3 && boss_phase == 2)
{
events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000));
events.RescheduleEvent(EVENT_OVERLOAD, urand(60000,125000));
events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000));
DoCast(me, SPELL_STORMSHIELD);
events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, urand(40000,80000));
}
events.Update(diff);
if(!me->HasAura(SPELL_OVERLOAD) && overload == true)
{
DoCast(63480);
overload = false;
}
while (uint32 eventId = events.ExecuteEvent())
{
switch(eventId)
{
case EVENT_ENRAGE:
DoScriptText(SAY_BRUNDIR_BERSERK, me);
DoCast(SPELL_BERSERK);
break;
case EVENT_CHAIN_LIGHTNING:
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
DoCast(pTarget, RAID_MODE(SPELL_CHAIN_LIGHTNING_N , SPELL_CHAIN_LIGHTNING_H));
events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000));
break;
case EVENT_OVERLOAD:
DoCast(SPELL_OVERLOAD);
overload = true;
events.ScheduleEvent(EVENT_OVERLOAD, urand(60000,125000));
break;
case EVENT_LIGHTNING_WHIRL:
DoCast(RAID_MODE(SPELL_LIGHTNING_WHIRL , SPELL_LIGHTNING_WHIRL_H));
DoCast(RAID_MODE(61916, 63482));
events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000));
break;
case EVENT_LIGHTNING_TENDRILS:
DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H));
DoCast(RAID_MODE(61886, 63485));
events.DelayEvents(15000, 5000);
DoResetThreat();
break;
}
}
DoMeleeAttackIfReady();
}
示例7: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > 50))
{
if (Dispell_Timer < diff)
{
DoCast(m_creature, SPELL_DISPELL);
Dispell_Timer = 15000 + rand()%15000;
}else Dispell_Timer -= diff;
if (Renew_Timer < diff)
{
DoCast(m_creature, SPELL_RENEW);
Renew_Timer = 20000 + rand()%10000;
}else Renew_Timer -= diff;
if (HolyWrath_Timer < diff)
{
DoCast(m_creature->getVictim(), SPELL_HOLY_WRATH);
HolyWrath_Timer = 15000 + rand()%10000;
}else HolyWrath_Timer -= diff;
if (HolyNova_Timer < diff)
{
TargetInRange = 0;
for(uint8 i=0; i<10; ++i)
{
if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO,i))
if (m_creature->IsWithinMeleeRange(target))
TargetInRange++;
}
if (TargetInRange > 1)
{
DoCast(m_creature->getVictim(),SPELL_HOLY_NOVA);
HolyNova_Timer = 1000;
}
else
{
HolyNova_Timer = 2000;
}
}else HolyNova_Timer -= diff;
if (HolyFire_Timer < diff && TargetInRange < 3)
{
if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
DoCast(target, SPELL_HOLY_FIRE);
HolyFire_Timer = 8000;
}else HolyFire_Timer -= diff;
}
else
{
if (!PhaseTwo)
{
DoScriptText(SAY_TRANSFORM, m_creature);
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature,SPELL_SNAKE_FORM);
m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f);
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 25)));
m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 25)));
m_creature->UpdateDamagePhysical(BASE_ATTACK);
DoResetThreat();
PhaseTwo = true;
}
if (PhaseTwo && PoisonCloud_Timer < diff)
{
DoCast(m_creature->getVictim(), SPELL_POISON_CLOUD);
PoisonCloud_Timer = 15000;
}PoisonCloud_Timer -=diff;
if (PhaseTwo && VenomSpit_Timer < diff)
{
if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
DoCast(target, SPELL_VENOMSPIT);
VenomSpit_Timer = 15000 + rand()%5000;
}else VenomSpit_Timer -= diff;
if (PhaseTwo && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 11))
{
if (!InBerserk)
{
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature, SPELL_BERSERK);
InBerserk = true;
}
}
}
DoMeleeAttackIfReady();
}
示例8: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
//Check_Timer for the death of LorKhan and Zath.
if (!WasDead && Check_Timer <= diff)
{
if (m_pInstance)
{
if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL)
{
//Resurrect LorKhan
if (Unit *pLorKhan = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_LORKHAN)))
{
pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pLorKhan->setFaction(14);
pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pLorKhan->SetFullHealth();
m_pInstance->SetData(TYPE_LORKHAN, DONE);
}
}
if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL)
{
//Resurrect Zath
Unit *pZath = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ZATH));
if (pZath)
{
pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pZath->setFaction(14);
pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pZath->SetFullHealth();
m_pInstance->SetData(TYPE_ZATH, DONE);
}
}
}
Check_Timer = 5000;
} else Check_Timer -= diff;
if (!PhaseTwo && MortalCleave_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_MORTALCLEAVE);
MortalCleave_Timer = 15000 + rand()%5000;
} else MortalCleave_Timer -= diff;
if (!PhaseTwo && Silence_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SILENCE);
Silence_Timer = 20000 + rand()%5000;
} else Silence_Timer -= diff;
if (!PhaseTwo && !WasDead && !HealthAbovePct(5))
{
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->AttackStop();
if (m_pInstance)
m_pInstance->SetData(TYPE_THEKAL, SPECIAL);
WasDead=true;
}
//Thekal will transform to Tiger if he died and was not resurrected after 10 seconds.
if (!PhaseTwo && WasDead)
{
if (Resurrect_Timer <= diff)
{
DoCast(me, SPELL_TIGER_FORM);
me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFullHealth();
const CreatureTemplate *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40)));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40)));
me->UpdateDamagePhysical(BASE_ATTACK);
DoResetThreat();
PhaseTwo = true;
} else Resurrect_Timer -= diff;
}
if (me->IsFullHealth() && WasDead)
{
WasDead = false;
}
if (PhaseTwo)
{
if (Charge_Timer <= diff)
{
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0))
{
DoCast(pTarget, SPELL_CHARGE);
//.........这里部分代码省略.........
示例9: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
switch(getStage())
{
case 0:
if (timedQuery(SPELL_BONE_STRIKE, diff))
if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f, isHeroic()))
if (doCast(SPELL_BONE_STRIKE, pTarget) == CAST_OK)
{
doSummonSpike(pTarget);
switch (urand(0,1)) {
case 0:
DoScriptText(-1631003,m_creature,pTarget);
break;
case 1:
DoScriptText(-1631004,m_creature,pTarget);
break;
case 2:
DoScriptText(-1631005,m_creature,pTarget);
break;
};
};
if (timedQuery(SPELL_BONE_STORM, diff)) setStage(1);
if (timedQuery(SPELL_CALL_COLD_FLAME, diff))
{
if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
else doCast(SPELL_CALL_COLD_FLAME_1);
if (m_creature->GetHealthPercent() <= 30.0f)
{
if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
else doCast(SPELL_CALL_COLD_FLAME_1);
}
}
timedCast(SPELL_SABER_LASH, diff);
DoMeleeAttackIfReady();
break;
case 1:
m_creature->InterruptNonMeleeSpells(true);
doCast(SPELL_BONE_STORM);
setStage(2);
DoScriptText(-1631002,m_creature);
DoResetThreat();
m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
m_creature->SetSpeedRate(MOVE_RUN, 3);
m_creature->SetSpeedRate(MOVE_WALK, 3);
break;
case 2:
if (!m_creature->IsNonMeleeSpellCasted(false)) setStage(3);
break;
case 3:
if (isHeroic())
if (timedQuery(SPELL_BONE_STRIKE, diff, true))
if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f))
doSummonSpike(pTarget);
if (timedQuery(SPELL_CALL_COLD_FLAME, diff, true)
&& m_creature->IsWithinDistInMap(m_creature->getVictim(),2.0f))
{
pInstance->SetData(DATA_DIRECTION, (uint32)(1000*2.0f*M_PI_F*((float)urand(1,16)/16.0f)));
// if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
// else doCast(SPELL_CALL_COLD_FLAME_1);
float fPosX, fPosY, fPosZ;
m_creature->GetPosition(fPosX, fPosY, fPosZ);
doSummon(NPC_COLD_FLAME, fPosX, fPosY, fPosZ);
DoResetThreat();
if (Unit* pTarget = doSelectRandomPlayerAtRange(60.0f))
AttackStart(pTarget);
}
if (!hasAura(SPELL_BONE_STORM_STRIKE, m_creature) && !hasAura(SPELL_BONE_STORM, m_creature)) setStage(4);
break;
case 4:
pInstance->SetData(DATA_DIRECTION, 0);
m_creature->SetSpeedRate(MOVE_RUN, 1);
m_creature->SetSpeedRate(MOVE_WALK, 1);
// m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);
setStage(0);
break;
default:
break;
}
if (timedQuery(SPELL_BERSERK, diff))
{
doCast(SPELL_BERSERK);
DoScriptText(-1631008,m_creature);
}
}
示例10: UpdateAI
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
switch (m_uiPhase)
{
case PHASE_FAKE_DEATH:
if (m_uiResurrectTimer < uiDiff)
{
// resurrect him in any case
DoCastSpellIfCan(m_creature, SPELL_RESURRECT);
m_uiPhase = PHASE_WAITING;
if (m_pInstance)
{
CanPreventAddsResurrect();
m_pInstance->SetData(TYPE_THEKAL, IN_PROGRESS);
}
}
else
m_uiResurrectTimer -= uiDiff;
// No break needed here
case PHASE_WAITING:
return;
case PHASE_NORMAL:
if (m_uiMortalCleaveTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_CLEAVE) == CAST_OK)
m_uiMortalCleaveTimer = urand(15000, 20000);
}
else
m_uiMortalCleaveTimer -= uiDiff;
if (m_uiSilenceTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
if (DoCastSpellIfCan(pTarget, SPELL_SILENCE) == CAST_OK)
m_uiSilenceTimer = urand(20000, 25000);
}
}
else
m_uiSilenceTimer -= uiDiff;
break;
case PHASE_TIGER:
if (m_uiChargeTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
if (DoCastSpellIfCan(pTarget, SPELL_CHARGE) == CAST_OK)
{
DoResetThreat();
AttackStart(pTarget);
m_uiChargeTimer = urand(15000, 22000);
}
}
}
else
m_uiChargeTimer -= uiDiff;
if (m_uiFrenzyTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_FRENZY) == CAST_OK)
m_uiFrenzyTimer = 30000;
}
else
m_uiFrenzyTimer -= uiDiff;
if (m_uiForcePunchTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_FORCE_PUNCH) == CAST_OK)
m_uiForcePunchTimer = urand(16000, 21000);
}
else
m_uiForcePunchTimer -= uiDiff;
if (m_uiSummonTigersTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_SUMMON_TIGERS) == CAST_OK)
m_uiSummonTigersTimer = 50000;
}
else
m_uiSummonTigersTimer -= uiDiff;
if (!m_bEnraged && m_creature->GetHealthPercent() < 11.0f)
{
if (DoCastSpellIfCan(m_creature, SPELL_ENRAGE) == CAST_OK)
m_bEnraged = true;
}
break;
}
DoMeleeAttackIfReady();
}
示例11: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if(Check_Timer < diff)
{
if(!m_creature->IsWithinDistInMap(&wLoc, 80.0f))
EnterEvadeMode();
Check_Timer = 2000;
}else Check_Timer -= diff;
//Spell Enrage, when hp <= 20% gain enrage
if (((m_creature->GetHealth()*100)/ m_creature->GetMaxHealth()) <= 20)
{
if(Enrage_Timer < diff)
{
m_creature->RemoveAurasDueToSpell(SPELL_ENRAGE);
DoCast(m_creature,SPELL_ENRAGE);
Enrage_Timer = 600000;
InEnrage = true;
}else Enrage_Timer -= diff;
}
//Spell Overrun
if (Overrun_Timer < diff)
{
DoScriptText(RAND(SAY_OVERRUN_1, SAY_OVERRUN_2), m_creature);
DoCast(m_creature->getVictim(),SPELL_OVERRUN);
DoResetThreat();
Overrun_Timer = 25000 + rand()%15000;
}else Overrun_Timer -= diff;
//Spell Earthquake
if (Quake_Timer < diff)
{
if (rand()%2)
return;
DoScriptText(RAND(SAY_EARTHQUAKE_1, SAY_EARTHQUAKE_2), m_creature);
//remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead
if (InEnrage)
m_creature->RemoveAura(SPELL_ENRAGE, 0);
DoCast(m_creature,SPELL_EARTHQUAKE);
Enrage_Timer = 8000;
Quake_Timer = 30000 + rand()%25000;
}else Quake_Timer -= diff;
//Spell Chain Lightning
if (Chain_Timer < diff)
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,1, GetSpellMaxRange(SPELL_CHAIN_LIGHTNING), true, m_creature->getVictimGUID());
if (!target)
target = m_creature->getVictim();
if (target)
DoCast(target,SPELL_CHAIN_LIGHTNING);
Chain_Timer = 10000 + rand()%25000;
}else Chain_Timer -= diff;
//Spell Sunder Armor
if (Armor_Timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_SUNDER_ARMOR);
Armor_Timer = 10000 + rand()%15000;
}else Armor_Timer -= diff;
DoMeleeAttackIfReady();
}
示例12: UpdateAI
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
switch (m_uiPhase)
{
case PHASE_SPEECH:
if (m_uiSpeechTimer < uiDiff)
{
switch (m_uiSpeech)
{
case 1: DoScriptText(SAY_SPEECH_1, m_creature); m_uiSpeechTimer = 4 * IN_MILLISECONDS; break;
case 2: DoScriptText(SAY_SPEECH_2, m_creature); m_uiSpeechTimer = 6 * IN_MILLISECONDS; break;
case 3: DoScriptText(SAY_SPEECH_3, m_creature); m_uiSpeechTimer = 5 * IN_MILLISECONDS; break;
case 4: DoScriptText(SAY_SPEECH_4, m_creature); m_uiPhase = PHASE_BALCONY; break;
}
m_uiSpeech++;
}
else
m_uiSpeechTimer -= uiDiff;
// No break here
case PHASE_BALCONY: // Do summoning
if (m_uiTraineeTimer < uiDiff)
{
SummonAdds(true, NPC_UNREL_TRAINEE);
m_uiTraineeTimer = 20 * IN_MILLISECONDS;
}
else
m_uiTraineeTimer -= uiDiff;
if (m_uiDeathKnightTimer < uiDiff)
{
SummonAdds(true, NPC_UNREL_DEATH_KNIGHT);
m_uiDeathKnightTimer = 25 * IN_MILLISECONDS;
}
else
m_uiDeathKnightTimer -= uiDiff;
if (m_uiRiderTimer < uiDiff)
{
SummonAdds(true, NPC_UNREL_RIDER);
m_uiRiderTimer = 30 * IN_MILLISECONDS;
}
else
m_uiRiderTimer -= uiDiff;
if (m_uiPhaseTimer < uiDiff)
{
m_uiPhase = PHASE_STOP_SUMMONING;
m_uiPhaseTimer = 50 * IN_MILLISECONDS;
}
else
m_uiPhaseTimer -= uiDiff;
break;
case PHASE_STOP_SUMMONING:
if (m_uiPhaseTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_TELEPORT_RIGHT, CAST_TRIGGERED) == CAST_OK)
{
m_uiPhase = m_pInstance ? PHASE_TELEPORTING : PHASE_STOP_TELEPORTING;
DoScriptText(SAY_TELEPORT, m_creature);
DoScriptText(EMOTE_TO_FRAY, m_creature);
// Remove Immunity
m_creature->ApplySpellImmune(nullptr, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, false);
DoResetThreat();
m_creature->SetInCombatWithZone();
}
}
else
m_uiPhaseTimer -= uiDiff;
break;
case PHASE_TELEPORTING: // Phase is only reached if m_pInstance is valid
if (m_uiTeleportTimer < uiDiff)
{
uint32 uiTeleportSpell = m_pInstance->IsInRightSideGothArea(m_creature) ? SPELL_TELEPORT_LEFT : SPELL_TELEPORT_RIGHT;
if (DoCastSpellIfCan(m_creature, uiTeleportSpell) == CAST_OK)
{
m_uiTeleportTimer = urand(30000, 45000); // Teleports between 30 seconds and 45 seconds.
m_uiShadowboltTimer = 2 * IN_MILLISECONDS;
}
}
else
m_uiTeleportTimer -= uiDiff;
if (m_creature->GetHealthPercent() <= 30.0f)
{
m_uiPhase = PHASE_STOP_TELEPORTING;
ProcessCentralDoor();
// as the doors now open, recheck whether mobs are standing around
m_uiControlZoneTimer = 1;
}
// no break here
//.........这里部分代码省略.........
示例13: Revive
void Revive()
{
DoResetThreat();
PauseCombatMovement();
Reset();
}
示例14: UpdateAI
//.........这里部分代码省略.........
else
m_uiPhaseTimer -= uiDiff;
break;
}
// ***** Weapons phase ********
case PHASE_2_WEAPON:
{
if (m_uiPhaseTimer < uiDiff)
{
// Switch to next phase, no matter if the weapons are killed or not
if (DoCastSpellIfCan(m_creature, SPELL_RESURRECTION) == CAST_OK)
{
DoScriptText(SAY_PHASE3_ADVANCE, m_creature);
m_uiPhaseSubphase = 0;
m_uiPhaseTimer = 180000;
m_uiPhase = PHASE_3_ADVISOR_ALL;
}
}
else
m_uiPhaseTimer -= uiDiff;
break;
}
// ***** All advisors phase ********
case PHASE_3_ADVISOR_ALL:
{
if (m_uiPhaseTimer < uiDiff)
{
DoScriptText(SAY_PHASE4_INTRO2, m_creature);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
DoResetThreat();
m_creature->SetInCombatWithZone();
m_uiPhase = PHASE_4_SOLO;
m_uiPhaseTimer = 30000;
}
else
m_uiPhaseTimer -= uiDiff;
break;
}
// ***** Solo phases ********
case PHASE_4_SOLO:
case PHASE_7_GRAVITY:
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (m_uiGravityExpireTimer)
{
if (m_uiNetherBeamTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_NETHER_BEAM) == CAST_OK)
m_uiNetherBeamTimer = urand(2000, 4000);
}
else
m_uiNetherBeamTimer -= uiDiff;
// Switch to the other spells after gravity lapse expired
if (m_uiGravityExpireTimer <= uiDiff)
m_uiGravityExpireTimer = 0;
else
m_uiGravityExpireTimer -= uiDiff;
示例15: UpdateAI
//.........这里部分代码省略.........
DoCast(pTarget, SPELL_WILLOFHAKKAR);
WillOfHakkar_Timer = 25000 + rand()%10000;
} else WillOfHakkar_Timer -= diff;
if (!Enraged && Enrage_Timer <= diff)
{
DoCast(me, SPELL_ENRAGE);
Enraged = true;
} else Enrage_Timer -= diff;
//Checking if Jeklik is dead. If not we cast her Aspect
if (CheckJeklik_Timer <= diff)
{
if (m_pInstance)
{
if (m_pInstance->GetData(TYPE_JEKLIK) != DONE)
{
if (AspectOfJeklik_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_ASPECT_OF_JEKLIK);
AspectOfJeklik_Timer = 10000 + rand()%4000;
} else AspectOfJeklik_Timer -= diff;
}
}
CheckJeklik_Timer = 1000;
} else CheckJeklik_Timer -= diff;
//Checking if Venoxis is dead. If not we cast his Aspect
if (CheckVenoxis_Timer <= diff)
{
if (m_pInstance)
{
if (m_pInstance->GetData(TYPE_VENOXIS) != DONE)
{
if (AspectOfVenoxis_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_ASPECT_OF_VENOXIS);
AspectOfVenoxis_Timer = 8000;
} else AspectOfVenoxis_Timer -= diff;
}
}
CheckVenoxis_Timer = 1000;
} else CheckVenoxis_Timer -= diff;
//Checking if Marli is dead. If not we cast her Aspect
if (CheckMarli_Timer <= diff)
{
if (m_pInstance)
{
if (m_pInstance->GetData(TYPE_MARLI) != DONE)
{
if (AspectOfMarli_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI);
AspectOfMarli_Timer = 10000;
} else AspectOfMarli_Timer -= diff;
}
}
CheckMarli_Timer = 1000;
} else CheckMarli_Timer -= diff;
//Checking if Thekal is dead. If not we cast his Aspect
if (CheckThekal_Timer <= diff)
{
if (m_pInstance)
{
if (m_pInstance->GetData(TYPE_THEKAL) != DONE)
{
if (AspectOfThekal_Timer <= diff)
{
DoCast(me, SPELL_ASPECT_OF_THEKAL);
AspectOfThekal_Timer = 15000;
} else AspectOfThekal_Timer -= diff;
}
}
CheckThekal_Timer = 1000;
} else CheckThekal_Timer -= diff;
//Checking if Arlokk is dead. If yes we cast her Aspect
if (CheckArlokk_Timer <= diff)
{
if (m_pInstance)
{
if (m_pInstance->GetData(TYPE_ARLOKK) != DONE)
{
if (AspectOfArlokk_Timer <= diff)
{
DoCast(me, SPELL_ASPECT_OF_ARLOKK);
DoResetThreat();
AspectOfArlokk_Timer = 10000 + rand()%5000;
} else AspectOfArlokk_Timer -= diff;
}
}
CheckArlokk_Timer = 1000;
} else CheckArlokk_Timer -= diff;
DoMeleeAttackIfReady();
}