本文整理匯總了C++中EnterEvadeIfOutOfCombatArea函數的典型用法代碼示例。如果您正苦於以下問題:C++ EnterEvadeIfOutOfCombatArea函數的具體用法?C++ EnterEvadeIfOutOfCombatArea怎麽用?C++ EnterEvadeIfOutOfCombatArea使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EnterEvadeIfOutOfCombatArea函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: UpdateAI
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
{
return;
}
// Cleave Timer
if (m_uiCleaveTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK)
{
m_uiCleaveTimer = 7000;
}
}
else
{
m_uiCleaveTimer -= uiDiff;
}
// Blast Wave
if (m_uiBlastWaveTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_BLAST_WAVE) == CAST_OK)
{
m_uiBlastWaveTimer = urand(8000, 16000);
}
}
else
{
m_uiBlastWaveTimer -= uiDiff;
}
// Mortal Strike Timer
if (m_uiMortalStrikeTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_STRIKE) == CAST_OK)
{
m_uiMortalStrikeTimer = urand(25000, 35000);
}
}
else
{
m_uiMortalStrikeTimer -= uiDiff;
}
if (m_uiKnockAwayTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY);
// Drop 50% aggro - TODO should be scriptedEffect?
if (m_creature->GetThreatManager().getThreat(m_creature->getVictim()))
{
m_creature->GetThreatManager().modifyThreatPercent(m_creature->getVictim(), -50);
}
m_uiKnockAwayTimer = urand(15000, 30000);
}
else
{
m_uiKnockAwayTimer -= uiDiff;
}
DoMeleeAttackIfReady();
if (EnterEvadeIfOutOfCombatArea(uiDiff))
{
DoScriptText(SAY_LEASH, m_creature);
}
}
示例2: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (EnterEvadeIfOutOfCombatArea(uiDiff))
return;
if (m_bBlink)
{
DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_ARCANE_EXPLOSION : SPELL_ARCANE_EXPLOSION_H);
DoCastSpellIfCan(m_creature, SPELL_ARCANE_BUBBLE, CAST_TRIGGERED);
DoResetThreat();
m_bBlink = false;
}
if (m_uiArcaneVolleyTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_ARCANE_VOLLEY : SPELL_ARCANE_VOLLEY_H) == CAST_OK)
m_uiArcaneVolleyTimer = urand(8000, 12000);
}
else
m_uiArcaneVolleyTimer -= uiDiff;
if (m_uiSheepTimer < uiDiff)
{
// second top aggro target in normal, random target in heroic
if (Unit* pTarget = m_bIsRegularMode ? m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 1) : m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_POLYMORPH : SPELL_POLYMORPH_H);
m_uiSheepTimer = urand(15000, 17500);
}
else
m_uiSheepTimer -= uiDiff;
if (!m_bManaShield && m_creature->GetHealthPercent() < 15.0f)
{
if (DoCastSpellIfCan(m_creature, SPELL_MANA_SHIELD) == CAST_OK)
m_bManaShield = true;
}
if (!m_bIsRegularMode)
{
if (m_uiSlowTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_SLOW_H) == CAST_OK)
m_uiSlowTimer = urand(15000, 24000);
}
else
m_uiSlowTimer -= uiDiff;
}
if (m_creature->GetHealthPercent() < m_fHealthCheck)
{
if (DoCastSpellIfCan(m_creature, SPELL_BLINK, CAST_INTERRUPT_PREVIOUS) == CAST_OK)
{
m_bBlink = true;
DoScriptText(EMOTE_ARCANE_EXP, m_creature);
// There is no relationship between the health percentages
switch (m_uiBlinkPhase)
{
case 0: m_fHealthCheck = 50.0f; break;
case 1: m_fHealthCheck = 25.0f; break;
case 2: m_fHealthCheck = 0.0f; break;
}
++m_uiBlinkPhase;
}
}
if (!m_bBlink)
DoMeleeAttackIfReady();
}
示例3: UpdateAI
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_SPELL_BERSERK:
Talk(SAY_ENRAGE);
me->CastSpell(me, SPELL_BERSERK, true);
break;
case EVENT_SPELL_BLOOD_BOIL:
me->CastCustomSpell(SPELL_BLOODBOIL, SPELLVALUE_MAX_TARGETS, 5, me, false);
events.ScheduleEvent(EVENT_SPELL_BLOOD_BOIL, 10000);
break;
case EVENT_SPELL_BEWILDERING_STRIKE:
me->CastSpell(me->GetVictim(), SPELL_BEWILDERING_STRIKE, false);
events.ScheduleEvent(EVENT_SPELL_BEWILDERING_STRIKE, 30000, GROUP_DELAY);
break;
case EVENT_SPELL_FEL_ACID_BREATH:
me->CastSpell(me->GetVictim(), me->HasAura(SPELL_FEL_RAGE_SELF) ? SPELL_FEL_ACID_BREATH2 : SPELL_FEL_ACID_BREATH1, false);
events.ScheduleEvent(EVENT_SPELL_FEL_ACID_BREATH, 30000);
break;
case EVENT_SPELL_EJECT:
me->CastSpell(me->GetVictim(), me->HasAura(SPELL_FEL_RAGE_SELF) ? SPELL_EJECT2 : SPELL_EJECT1, false);
events.ScheduleEvent(EVENT_SPELL_EJECT, 20000);
break;
case EVENT_SPELL_ARCING_SMASH:
me->CastSpell(me->GetVictim(), me->HasAura(SPELL_FEL_RAGE_SELF) ? SPELL_ARCING_SMASH2 : SPELL_ARCING_SMASH1, false);
events.ScheduleEvent(EVENT_SPELL_ARCING_SMASH, 15000);
break;
case EVENT_SPELL_FEL_GEYSER:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 40.0f, true))
{
me->RemoveAurasByType(SPELL_AURA_MOD_TAUNT);
me->CastSpell(me, SPELL_FEL_RAGE_SELF, true);
me->CastSpell(target, SPELL_FEL_RAGE_TARGET, true);
me->CastSpell(target, SPELL_FEL_RAGE_2, true);
me->CastSpell(target, SPELL_FEL_RAGE_3, true);
me->CastSpell(target, SPELL_FEL_RAGE_SIZE, true);
target->CastSpell(me, SPELL_TAUNT_GURTOGG, true);
me->CastSpell(target, SPELL_FEL_GEYSER_SUMMON, true);
me->CastSpell(me, SPELL_FEL_GEYSER_STUN, true);
me->CastSpell(me, SPELL_INSIGNIFICANCE, true);
events.ScheduleEvent(EVENT_SPELL_CHARGE, 2000);
events.DelayEvents(30000, GROUP_DELAY);
}
events.ScheduleEvent(EVENT_SPELL_FEL_GEYSER, 90000);
break;
case EVENT_SPELL_CHARGE:
me->CastSpell(me->GetVictim(), SPELL_CHARGE, true);
break;
}
DoMeleeAttackIfReady();
EnterEvadeIfOutOfCombatArea();
}
示例4: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
// Check if out of range
if (EnterEvadeIfOutOfCombatArea(uiDiff))
{
DoScriptText(SAY_EVADE, m_creature);
return;
}
if (m_uiAssassinsTimer)
{
if (m_uiAssassinsTimer <= uiDiff)
{
SpawnAssassin();
m_uiAssassinsTimer = 0;
}
else
m_uiAssassinsTimer -= uiDiff;
}
if (m_bInBlade)
{
if (m_uiWaitTimer)
{
if (m_uiWaitTimer <= uiDiff)
{
if (m_uiTargetNum == 0)
{
// stop bladedance
m_bInBlade = false;
m_creature->SetSpeedRate(MOVE_RUN, 2.0f);
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
m_uiWaitTimer = 0;
if (!m_bIsRegularMode)
m_uiChargeTimer = 5000;
}
else
{
// move in bladedance
float x, y, randx, randy;
randx = (rand()%40);
randy = (rand()%40);
x = 210+ randx ;
y = -60- randy ;
m_creature->GetMotionMaster()->MovePoint(1, x, y, m_creature->GetPositionZ());
m_uiWaitTimer = 0;
}
}
else
m_uiWaitTimer -= uiDiff;
}
}
else // !m_bInBlade
{
if (m_uiBladeDanceTimer < uiDiff)
{
m_uiTargetNum = TARGET_NUM;
m_uiWaitTimer = 1;
m_bInBlade = true;
m_uiBladeDanceTimer = 30000;
m_creature->SetSpeedRate(MOVE_RUN, 4.0f);
return;
}
else
m_uiBladeDanceTimer -= uiDiff;
if (m_uiChargeTimer)
{
if (m_uiChargeTimer <= uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
DoCastSpellIfCan(pTarget, SPELL_CHARGE_H);
m_uiChargeTimer = 0;
}
else
m_uiChargeTimer -= uiDiff;
}
if (m_uiSummonAssistantTimer < uiDiff)
{
for (uint32 i = 0; i < m_uiSummoned; ++i)
{
switch (urand(0, 2))
{
case 0: m_creature->SummonCreature(NPC_HEARTHEN_GUARD, AddsEntrance[0], AddsEntrance[1], AddsEntrance[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); break;
case 1: m_creature->SummonCreature(NPC_SHARPSHOOTER_GUARD, AddsEntrance[0], AddsEntrance[1], AddsEntrance[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); break;
case 2: m_creature->SummonCreature(NPC_REAVER_GUARD, AddsEntrance[0], AddsEntrance[1], AddsEntrance[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); break;
}
}
if (!urand(0, 4))
++m_uiSummoned;
m_uiSummonAssistantTimer = urand(25000, 35000);
}
else
//.........這裏部分代碼省略.........
示例5: UpdateAI
//.........這裏部分代碼省略.........
// flame tsunami
if (m_uiFlameTsunamiTimer < uiDiff)
{
SendFlameTsunami();
m_uiFlameTsunamiTimer = 30000;
}
else
m_uiFlameTsunamiTimer -= uiDiff;
// flame breath
if (m_uiFlameBreathTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_FLAME_BREATH : SPELL_FLAME_BREATH_H) == CAST_OK)
{
DoScriptText(SAY_SARTHARION_BREATH, m_creature);
m_uiFlameBreathTimer = urand(25000, 35000);
}
}
else
m_uiFlameBreathTimer -= uiDiff;
// Tail Sweep
if (m_uiTailSweepTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_TAIL_LASH : SPELL_TAIL_LASH_H) == CAST_OK)
m_uiTailSweepTimer = urand(15000, 20000);
}
else
m_uiTailSweepTimer -= uiDiff;
// Cleave
if (m_uiCleaveTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK)
m_uiCleaveTimer = urand(7000, 10000);
}
else
m_uiCleaveTimer -= uiDiff;
// Lavas Strike
if (m_uiLavaStrikeTimer < uiDiff)
{
if (m_pInstance)
{
if (Creature* pCyclone = m_creature->GetMap()->GetCreature(m_pInstance->SelectRandomFireCycloneGuid()))
pCyclone->CastSpell(pCyclone, SPELL_CYCLONE_AURA_STRIKE, true);
switch (urand(0, 5))
{
case 0: DoScriptText(SAY_SARTHARION_SPECIAL_1, m_creature); break;
case 1: DoScriptText(SAY_SARTHARION_SPECIAL_2, m_creature); break;
case 2: DoScriptText(SAY_SARTHARION_SPECIAL_3, m_creature); break;
case 3: DoScriptText(SAY_SARTHARION_SPECIAL_4, m_creature); break;
}
}
m_uiLavaStrikeTimer = 30000;
}
else
m_uiLavaStrikeTimer -= uiDiff;
// call tenebron
if (!m_bHasCalledTenebron)
{
if (m_uiTenebronTimer < uiDiff)
{
CallDragon(NPC_TENEBRON);
m_bHasCalledTenebron = true;
}
else
m_uiTenebronTimer -= uiDiff;
}
// call shadron
if (!m_bHasCalledShadron)
{
if (m_uiShadronTimer < uiDiff)
{
CallDragon(NPC_SHADRON);
m_bHasCalledShadron = true;
}
else
m_uiShadronTimer -= uiDiff;
}
// call vesperon
if (!m_bHasCalledVesperon)
{
if (m_uiVesperonTimer < uiDiff)
{
CallDragon(NPC_VESPERON);
m_bHasCalledVesperon = true;
}
else
m_uiVesperonTimer -= uiDiff;
}
DoMeleeAttackIfReady();
EnterEvadeIfOutOfCombatArea(uiDiff);
}
示例6: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
// Pounding
if (m_uiPoundingTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_POUNDING) == CAST_OK)
{
DoScriptText(urand(0, 1) ? SAY_POUNDING1 : SAY_POUNDING2, m_creature);
m_uiPoundingTimer = 14000;
}
}
else
m_uiPoundingTimer -= uiDiff;
// Arcane Orb
if (m_uiArcaneOrbTimer < uiDiff)
{
// Search only for players which are not within 18 yards of the boss
std::vector<Unit*> suitableTargets;
ThreatList const& threatList = m_creature->getThreatManager().getThreatList();
ThreatList::const_iterator itr = threatList.begin();
for (itr; itr != threatList.end(); ++itr)
{
if (Unit* pTarget = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()))
{
if (pTarget->GetTypeId() == TYPEID_PLAYER && !pTarget->IsWithinDist(m_creature, 18.0f))
suitableTargets.push_back(pTarget);
}
}
if (suitableTargets.empty())
m_uiArcaneOrbTimer = 3000;
else
{
Unit* pTarget = suitableTargets[urand(0, suitableTargets.size() - 1)];
if (pTarget)
m_creature->SummonCreature(NPC_ARCANE_ORB_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
m_uiArcaneOrbTimer = 3000;
}
}
else
m_uiArcaneOrbTimer -= uiDiff;
// Single Target knock back, reduces aggro
if (m_uiKnockAwayTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK)
m_uiKnockAwayTimer = 30000;
}
else
m_uiKnockAwayTimer -= uiDiff;
// Berserk
if (m_uiBerserkTimer)
{
if (m_uiBerserkTimer <= uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
m_uiBerserkTimer = 0;
}
else
m_uiBerserkTimer -= uiDiff;
}
DoMeleeAttackIfReady();
EnterEvadeIfOutOfCombatArea(uiDiff);
}
示例7: UpdateAI
//.........這裏部分代碼省略.........
{
SetVisible(0);
m_creature->SetObjectScale(0.1f);
m_creature->UpdateModelData();
}
else
m_uiSetInvisTimer -= uiDiff;
if (m_uiSetVisibleTimer <= uiDiff)
{
SetVisible(1);
// set scale 0.4f scale is the smallest
m_creature->SetObjectScale(m_creature->GetHealthPercent() * 0.0084 + 0.358); // set Viscidus' size depending on the blobs that are alive 1/ too small?
m_creature->UpdateModelData();
m_creature->RemoveAllAuras(AuraRemoveMode::AURA_REMOVE_BY_DEFAULT);
if(!m_creature->HasAura(SPELL_MEMBRANE_VISCIDUS))
m_creature->CastSpell(m_creature, SPELL_MEMBRANE_VISCIDUS, true); // reapply dmg reduction
}
else
m_uiSetVisibleTimer -= uiDiff;
if (!m_bSummoned)
{
if (m_uiGlobSpawnTimer <= uiDiff)
{
SpawnGlobs();
m_bSummoned = true;
}
else
m_uiGlobSpawnTimer -= uiDiff;
}
}
if (m_bCanDoDamage)
{
if (m_uiPoisonBoltCastTimer)
{
if (m_uiPoisonBoltCastTimer > uiDiff)
{
m_uiPoisonBoltCastTimer -= uiDiff;
Unit* pTarget = m_creature->GetMap()->GetUnit(m_PoisonTargetGuid);
if (m_uiPoisonBoltCastTimer < 500 && pTarget)
{
m_creature->SetTargetGuid(pTarget->GetObjectGuid());
m_creature->SetFacingToObject(pTarget);
return;
}
}
else
{
if (m_creature->SelectHostileTarget() && m_creature->getVictim())
m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid());
m_uiPoisonBoltCastTimer = 0;
return;
}
}
//Return since we have no target
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (m_uiPoisonShockTimer <= uiDiff)
{
m_creature->CastSpell(m_creature, SPELL_POISON_SHOCK, false);
m_uiPoisonShockTimer = 10000;
}
else
m_uiPoisonShockTimer -= uiDiff;
if (m_uiPoisonVolleyTimer <= uiDiff)
{
m_creature->CastSpell(m_creature, SPELL_POISONBOLT_VOLLEY, false);
m_uiPoisonVolleyTimer = 10000;
}
else
m_uiPoisonVolleyTimer -= uiDiff;
if (m_uiToxicCloudTimer <= uiDiff) // redo this, should probably not cast a spell, just visually cast it. Missing that the boss should turn towards the victim during cast.
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
m_creature->CastSpell(pTarget, SPELL_POISON_BOLT, true);
m_PoisonTargetGuid = pTarget->GetObjectGuid();
m_uiPoisonBoltCastTimer = 2800;
}
m_uiToxicCloudTimer = urand(30000,40000);
return;
}
else
m_uiToxicCloudTimer -= uiDiff;
DoMeleeAttackIfReady();
EnterEvadeIfOutOfCombatArea(uiDiff);
}
}
示例8: UpdateAI
//.........這裏部分代碼省略.........
if (m_uiPhase == SINDRAGOSA_PHASE_GROUND)
{
// Health Check
if (m_creature->GetHealthPercent() <= 30.0f)
{
if (DoCastSpellIfCan(m_creature, SPELL_MYSTIC_BUFFET) == CAST_OK)
{
m_uiPhase = SINDRAGOSA_PHASE_THREE;
DoScriptText(SAY_PHASE_3, m_creature);
}
}
// Phase 2 (air)
if (m_uiPhaseTimer <= uiDiff)
{
m_uiPhaseTimer = 35000;
DoScriptText(SAY_TAKEOFF, m_creature);
SetCombatMovement(false);
m_creature->GetMotionMaster()->MovePoint(SINDRAGOSA_POINT_GROUND_CENTER, SindragosaPosition[0][0], SindragosaPosition[0][1], SindragosaPosition[0][2], false);
}
else
m_uiPhaseTimer -= uiDiff;
}
// Cleave
if (m_uiCleaveTimer <= uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK)
m_uiCleaveTimer = urand(5000, 15000);
}
else
m_uiCleaveTimer -= uiDiff;
// Tail Smash
if (m_uiTailSmashTimer <= uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_TAIL_SMASH) == CAST_OK)
m_uiTailSmashTimer = urand(10000, 20000);
}
else
m_uiTailSmashTimer -= uiDiff;
// Frost Breath
if (m_uiFrostBreathTimer <= uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_BREATH) == CAST_OK)
m_uiFrostBreathTimer = urand(15000, 20000);
}
else
m_uiFrostBreathTimer -= uiDiff;
// Unchained Magic
if (m_uiUnchainedMagicTimer <= uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_UNCHAINED_MAGIC) == CAST_OK)
{
m_uiUnchainedMagicTimer = urand(40000, 60000);
DoScriptText(SAY_UNCHAINED_MAGIC, m_creature);
}
}
else
m_uiUnchainedMagicTimer -= uiDiff;
// Icy Grip and Blistering Cold
if (m_uiIcyGripTimer <= uiDiff)
{
if (DoCastSpellIfCan(m_creature, SPELL_ICY_GRIP) == CAST_OK)
{
m_uiIcyGripTimer = 70000;
DoScriptText(SAY_BLISTERING_COLD, m_creature);
}
}
else
m_uiIcyGripTimer -= uiDiff;
DoMeleeAttackIfReady();
break;
}
case SINDRAGOSA_PHASE_FLYING_TO_GROUND:
case SINDRAGOSA_PHASE_FLYING_TO_AIR:
break;
case SINDRAGOSA_PHASE_AIR:
{
// Phase One (ground)
if (m_uiPhaseTimer <= uiDiff)
{
m_uiPhase = SINDRAGOSA_PHASE_FLYING_TO_GROUND;
m_uiPhaseTimer = 42000;
m_creature->GetMotionMaster()->MovePoint(SINDRAGOSA_POINT_AIR_CENTER, SindragosaPosition[1][0], SindragosaPosition[1][1], SindragosaPosition[1][2], false);
}
else
m_uiPhaseTimer -= uiDiff;
break;
}
}
// evade on top of the stairs
EnterEvadeIfOutOfCombatArea(uiDiff);
}
示例9: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
// respawntime is calculated duration of GO_sapphirons birth special animation
// if sapphiron assemble is in progres TYPE_SAPPHIRON = SPECIAL
if (m_pInstance && m_pInstance->GetData(TYPE_SAPPHIRON) == SPECIAL && m_creature->GetVisibility() == VISIBILITY_OFF)
{
GameObject* pSapphironBirth = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_SAPPHIRON_BIRTH));
if (pSapphironBirth && pSapphironBirth->GetRespawnTime() == 0)
{
pSapphironBirth->SetRespawnTime(604800);
pSapphironBirth->Delete();
}
if (m_uiRespawnTime < uiDiff)
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE));
m_creature->SetVisibility(VISIBILITY_ON);
}
else
m_uiRespawnTime -= uiDiff;
}
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (m_bHundredClub)
{
if (m_uiHundredClubCheckTimer <= uiDiff)
{
m_bHundredClub = DoHundredClubCheck();
m_uiHundredClubCheckTimer = 5000;
}else m_uiHundredClubCheckTimer -= uiDiff;
}
if (m_uiBeserkTimer < uiDiff)
{
DoCastSpellIfCan(m_creature, SPELL_BESERK);
m_uiBeserkTimer = 300000;
DoScriptText(EMOTE_ENRAGE, m_creature);
}
else
m_uiBeserkTimer -= uiDiff;
switch(m_uiPhase)
{
case PHASE_FIGHT_ON_GROUND:
if (m_creature->GetHealthPercent() > 10.0f)
{
if (m_uiFlyTimer < uiDiff)
{
m_creature->InterruptNonMeleeSpells(false);
SetCombatMovement(false);
m_creature->GetMotionMaster()->MovePoint(POINT_HOME, fHomeX, fHomeY, fHomeZ);
m_uiPhase = PHASE_RETURN_TO_THE_CENTER;
return;
}
else
m_uiFlyTimer -= uiDiff;
}
if (m_uiLifeDrainTimer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_LIFE_DRAIN : H_SPELL_LIFE_DRAIN);
m_uiLifeDrainTimer = 24000;
}
else
m_uiLifeDrainTimer -= uiDiff;
if (m_uiBlizzardTimer < uiDiff)
{
DoCastSpellIfCan(m_creature, SPELL_ACTIVATE_BLIZZARD);
m_uiBlizzardTimer = 20000;
}
else
m_uiBlizzardTimer -= uiDiff;
if (m_uiCleaveTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE);
m_uiCleaveTimer = urand(7000, 10000);
}
else
m_uiCleaveTimer -= uiDiff;
if (m_uiTailSweepTimer < uiDiff)
{
DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_TAIL_SWEEP : H_SPELL_TAIL_SWEEP);
m_uiTailSweepTimer = urand(10000, 15000);
}
else
m_uiTailSweepTimer -= uiDiff;
DoMeleeAttackIfReady();
EnterEvadeIfOutOfCombatArea(uiDiff);
break;
// walking back to the center, he is supposed to do nothing at this time
case PHASE_RETURN_TO_THE_CENTER:
return;
//.........這裏部分代碼省略.........
示例10: UpdateAI
//.........這裏部分代碼省略.........
if (DoCastSpellIfCan(m_creature, SPELL_CARRION_BEETLES) == CAST_OK)
m_uiCarrionBeetlesTimer = 25000;
}
else
m_uiCarrionBeetlesTimer -= uiDiff;
if (m_uiPoundTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_POUND : SPELL_POUND_H) == CAST_OK)
m_uiPoundTimer = 16000;
}
else
m_uiPoundTimer -= uiDiff;
if (m_creature->GetHealthPercent() < 100 - 25*m_uiSubmergePhase)
{
DoCastSpellIfCan(m_creature, SPELL_IMPALE_AURA, CAST_TRIGGERED);
DoCastSpellIfCan(m_creature, SPELL_SUBMERGE, CAST_TRIGGERED);
DoScriptText(urand(0, 1) ? SAY_SUBMERGE_1 : SAY_SUBMERGE_2, m_creature);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
m_uiPhase = PHASE_SUBMERGED;
m_bIsFirstWave = true;
m_uiSummonTimer = 5000;
// Emerge timers aren't the same. They depend on the submerge phase
switch (m_uiSubmergePhase)
{
case 1:
m_uiEmergeTimer = 20000;
break;
case 2:
m_uiEmergeTimer = 45000;
break;
case 3:
m_uiEmergeTimer = 50000;
break;
}
++m_uiSubmergePhase;
}
DoMeleeAttackIfReady();
}
else if (m_uiPhase == PHASE_SUBMERGED)
{
if (m_uiSummonTimer < uiDiff)
{
if (!m_pInstance)
return;
// Summon 2 Assassins
for (uint8 i = 0; i < 2; ++i)
{
if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_pInstance->GetRandomAssassinTrigger()))
pTrigger->CastSpell(pTrigger, SPELL_SUMMON_ASSASSIN, true, NULL, NULL, m_creature->GetObjectGuid());
}
// on the first wave summon a guardian; on the second wave summon a venonmancer
if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_pInstance->GetGuardianTrigger()))
{
pTrigger->CastSpell(pTrigger, m_bIsFirstWave ? SPELL_SUMMON_GUARDIAN : SPELL_SUMMON_VENOMANCER, true, NULL, NULL, m_creature->GetObjectGuid());
m_bIsFirstWave = false;
}
m_uiSummonTimer = 26000;
}
else
m_uiSummonTimer -= uiDiff;
// only on the last submerge phase
if (m_uiSubmergePhase == 4)
{
if (m_uiDarterTimer < uiDiff)
{
if (!m_pInstance)
return;
if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_pInstance->GetDarterTrigger()))
{
pTrigger->CastSpell(pTrigger, SPELL_SUMMON_DARTER, true, NULL, NULL, m_creature->GetObjectGuid());
m_uiDarterTimer = urand(10000, 15000);
}
}
else
m_uiDarterTimer -= uiDiff;
}
if (m_uiEmergeTimer < uiDiff)
{
DoCastSpellIfCan(m_creature, SPELL_EMERGE, CAST_INTERRUPT_PREVIOUS);
m_creature->RemoveAurasDueToSpell(SPELL_SUBMERGE);
m_creature->RemoveAurasDueToSpell(SPELL_IMPALE_AURA);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
m_uiPhase = PHASE_GROUND;
}
else
m_uiEmergeTimer -= uiDiff;
}
EnterEvadeIfOutOfCombatArea(uiDiff);
}
示例11: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
return;
// Pounding
if (Pounding_Timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_POUNDING);
switch(rand()%2)
{
case 0: DoScriptText(SAY_POUNDING1, m_creature); break;
case 1: DoScriptText(SAY_POUNDING2, m_creature); break;
}
Pounding_Timer = 15000; //cast time(3000) + cooldown time(12000)
}else Pounding_Timer -= diff;
// Arcane Orb
if (ArcaneOrb_Timer < diff)
{
Unit *target = 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)
{
target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
// exclude pets & totems
if (target->GetTypeId() != TYPEID_PLAYER)
continue;
//18 yard radius minimum
if (target && !target->IsWithinDist(m_creature, 18.0f, false))
target_list.push_back(target);
target = NULL;
}
if (target_list.size())
target = *(target_list.begin()+rand()%target_list.size());
else
target = m_creature->getVictim();
if (target)
DoCast(target, SPELL_ARCANE_ORB_MISSILE);
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 (m_creature->getThreatManager().getThreat(m_creature->getVictim()))
m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(),-25);
KnockAway_Timer = 30000;
}else KnockAway_Timer -= diff;
//Berserk
if (Berserk_Timer < diff)
{
if (m_creature->IsNonMeleeSpellCasted(false))
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature,SPELL_BERSERK);
Berserk_Timer = 600000;
}else Berserk_Timer -= diff;
DoMeleeAttackIfReady();
EnterEvadeIfOutOfCombatArea(diff);
}
示例12: UpdateAI
//.........這裏部分代碼省略.........
if (!UpdateVictim())
{
if (events.ExecuteEvent() == EVENT_DRAIN_SPIRIT_ESSENCE_COSMETIC_INTRO)
{
me->CastSpell(me, SPELL_DRAIN_SPIRIT_ESSENCE, false);
events.ScheduleEvent(EVENT_DRAIN_SPIRIT_ESSENCE_COSMETIC_INTRO, urand(10000, 20000));
}
return;
}
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
if (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_DEADZONE:
me->CastSpell(me, SPELL_DEADZONE, false);
events.ScheduleEvent(EVENT_DEADZONE, 21000);
events.ScheduleEvent(EVENT_SHADOWS_OF_HAKKAR, urand(5000, 10000));
break;
case EVENT_SHADOWS_OF_HAKKAR:
Talk(JINDO_EMOTE_SHADOWS_OF_HAKKAR);
me->CastSpell(me, SPELL_SHADOWS_OF_HAKKAR, false);
break;
case EVENT_SET_FACING:
me->SetFacingTo(1.570796f);
events.ScheduleEvent(EVENT_SPIRIT_WORLD, 500);
break;
case EVENT_SPIRIT_WORLD:
me->CastSpell(me, SPELL_ADD_PLAYERS_THREAD, false);
me->CastSpell(me, SPELL_SPIRIT_WORLD, false);
me->CastSpell(me, SPELL_VANISH, false);
events.ScheduleEvent(EVENT_SPIRIT_WORLD_SUMMON, 3000);
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
break;
case EVENT_SPIRIT_WORLD_SUMMON:
{
me->SummonCreature(52150, JindoSpiritSP);
uint8 id = urand(0, 1);
for (int i = 0; i < 3; ++i)
me->SummonCreature(52430, HakkarChainSP[id][i]);
for (int i = 0; i < 15; ++i)
me->SummonCreature(52532, SpiritPortalSP[i]);
for (int i = 0; i < 4; ++i)
me->SummonCreature(SpiritTrollSpawMask & 1 << i ? 52730 : 52732, SpiritWarriorSP[i]);
if (Creature* hakkar = me->SummonCreature(52222, HakkarSP))
hakkar->AI()->Talk(HAKKAR_YELL_SPIT);
}
break;
case EVENT_HAKKAR_SET_FACING:
{
if (Creature* hakkar = ObjectAccessor::GetCreature(*me, HakkarGUID))
hakkar->SetFacingTo(4.712389f);
events.ScheduleEvent(EVENT_HAKKAR_KILL_JINDO, 17000);
}
break;
case EVENT_HAKKAR_KILL_JINDO:
{
if (Creature* hakkar = ObjectAccessor::GetCreature(*me, HakkarGUID))
hakkar->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK1H);
me->RemoveAura(SPELL_SPIRIT_WORLD);
events.ScheduleEvent(EVENT_HAKKAR_YELL_BYE, 2500);
}
break;
case EVENT_HAKKAR_YELL_BYE:
{
if (Creature* hakkar = ObjectAccessor::GetCreature(*me, HakkarSpiritGUID))
{
hakkar->AI()->Talk(HAKKAR_SPIRIT_YELL_INSECTS);
hakkar->DespawnOrUnsummon(5000);
}
events.ScheduleEvent(EVENT_JINDO_KILL_SELF, 5000);
}
break;
case EVENT_JINDO_KILL_SELF:
{
me->RemoveAllAuras();
me->CastSpell(me, SPELL_TRANSFORM, false);
if (!me->getThreatManager().getThreatList().empty())
if (Unit* killer = ObjectAccessor::GetUnit(*me, (*me->getThreatManager().getThreatList().begin())->getUnitGuid()))
killer->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
break;
}
}
DoMeleeAttackIfReady();
EnterEvadeIfOutOfCombatArea(diff);
}
示例13: UpdateAI
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
switch (events.ExecuteEvent())
{
case EVENT_SUMMON_FETID_TROLL:
if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET))
trigger->CastSpell(trigger, SPELL_SUMMON_FETID_TROLL_CORPSE, true, NULL, NULL, me->GetGUID());
events.ScheduleEvent(EVENT_SUMMON_FETID_TROLL, 3000);
break;
case EVENT_SUMMON_HULKING_CORPSE:
if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET))
trigger->CastSpell(trigger, SPELL_SUMMON_HULKING_CORPSE, true, NULL, NULL, me->GetGUID());
events.ScheduleEvent(EVENT_SUMMON_HULKING_CORPSE, 30000);
break;
case EVENT_SUMMON_SHADOWCASTER:
if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET))
trigger->CastSpell(trigger, SPELL_SUMMON_RISEN_SHADOWCASTER, true, NULL, NULL, me->GetGUID());
events.ScheduleEvent(EVENT_SUMMON_SHADOWCASTER, 10000);
break;
case EVENT_SUMMON_CRYSTAL_HANDLER:
if (_crystalCounter++ < 4)
{
Talk(SAY_SUMMONING_ADDS);
Talk(EMOTE_SUMMONING_ADDS);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f))
target->CastSpell(target, SPELL_SUMMON_CRYSTAL_HANDLER, true, NULL, NULL, me->GetGUID());
events.ScheduleEvent(EVENT_SUMMON_CRYSTAL_HANDLER, 20000);
}
break;
case EVENT_CHECK_PHASE:
if (me->HasAura(SPELL_BEAM_CHANNEL))
{
events.ScheduleEvent(EVENT_CHECK_PHASE, 2000);
break;
}
events.Reset();
events.ScheduleEvent(EVENT_CAST_OFFENSIVE_SPELL, 3000);
events.ScheduleEvent(EVENT_SPELL_SUMMON_MINIONS, 10000);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->InterruptNonMeleeSpells(false);
break;
case EVENT_CAST_OFFENSIVE_SPELL:
if (!me->HasUnitState(UNIT_STATE_CASTING))
if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
me->CastSpell(target, RAND(SPELL_BLIZZARD,SPELL_FROSTBOLT,SPELL_TOUCH_OF_MISERY), false);
events.ScheduleEvent(EVENT_CAST_OFFENSIVE_SPELL, 500);
break;
case EVENT_SPELL_SUMMON_MINIONS:
if (me->HasUnitState(UNIT_STATE_CASTING))
{
me->CastSpell(me, SPELL_SUMMON_MINIONS, false);
events.ScheduleEvent(EVENT_SPELL_SUMMON_MINIONS, 15000);
break;
}
events.ScheduleEvent(EVENT_SPELL_SUMMON_MINIONS, 500);
break;
}
EnterEvadeIfOutOfCombatArea();
}
示例14: 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();
}
示例15: UpdateAI
//.........這裏部分代碼省略.........
// hard enrage
if (!m_bIsHardEnraged)
{
if (m_uiEnrageTimer < uiDiff)
{
DoCastSpellIfCan(m_creature, SPELL_PYROBUFFET, CAST_TRIGGERED);
m_bIsHardEnraged = true;
}
else
m_uiEnrageTimer -= uiDiff;
}
// flame tsunami
if (m_uiFlameTsunamiTimer < uiDiff)
{
SendFlameTsunami();
m_uiFlameTsunamiTimer = 30000;
}
else
m_uiFlameTsunamiTimer -= uiDiff;
// flame breath
if (m_uiFlameBreathTimer < uiDiff)
{
DoScriptText(SAY_SARTHARION_BREATH, m_creature);
DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_FLAME_BREATH : SPELL_FLAME_BREATH_H);
m_uiFlameBreathTimer = urand(25000, 35000);
}
else
m_uiFlameBreathTimer -= uiDiff;
// Tail Sweep
if (m_uiTailSweepTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_TAIL_LASH : SPELL_TAIL_LASH_H);
m_uiTailSweepTimer = urand(15000, 20000);
}
else
m_uiTailSweepTimer -= uiDiff;
// Cleave
if (m_uiCleaveTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE);
m_uiCleaveTimer = urand(7000, 10000);
}
else
m_uiCleaveTimer -= uiDiff;
// Lavas Strike
if (m_uiLavaStrikeTimer < uiDiff)
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
{
DoCastSpellIfCan(pTarget, SPELL_LAVA_STRIKE);
switch(urand(0, 15))
{
case 0: DoScriptText(SAY_SARTHARION_SPECIAL_1, m_creature); break;
case 1: DoScriptText(SAY_SARTHARION_SPECIAL_2, m_creature); break;
case 2: DoScriptText(SAY_SARTHARION_SPECIAL_3, m_creature); break;
}
}
m_uiLavaStrikeTimer = urand(5000, 20000);
}
else
m_uiLavaStrikeTimer -= uiDiff;
// call tenebron
if (!m_bHasCalledTenebron && m_uiTenebronTimer < uiDiff)
{
CallDragon(DATA_TENEBRON);
m_bHasCalledTenebron = true;
}
else
m_uiTenebronTimer -= uiDiff;
// call shadron
if (!m_bHasCalledShadron && m_uiShadronTimer < uiDiff)
{
CallDragon(DATA_SHADRON);
m_bHasCalledShadron = true;
}
else
m_uiShadronTimer -= uiDiff;
// call vesperon
if (!m_bHasCalledVesperon && m_uiVesperonTimer < uiDiff)
{
CallDragon(DATA_VESPERON);
m_bHasCalledVesperon = true;
}
else
m_uiVesperonTimer -= uiDiff;
DoMeleeAttackIfReady();
EnterEvadeIfOutOfCombatArea(uiDiff);
}