本文整理汇总了C++中DoCast函数的典型用法代码示例。如果您正苦于以下问题:C++ DoCast函数的具体用法?C++ DoCast怎么用?C++ DoCast使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DoCast函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAI
void UpdateAI(const uint32 diff)
{
if(!UpdateVictim())
return;
if(CloseDoorTimer)
{
if(CloseDoorTimer <= diff)
{
if(pInstance)
{
pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false);
CloseDoorTimer = 0;
}
} else CloseDoorTimer -= diff;
}
//Cooldowns for casts
if(ArcaneCooldown)
{
if(ArcaneCooldown >= diff)
ArcaneCooldown -= diff;
else ArcaneCooldown = 0;
}
if(FireCooldown)
{
if(FireCooldown >= diff)
FireCooldown -= diff;
else FireCooldown = 0;
}
if(FrostCooldown)
{
if(FrostCooldown >= diff)
FrostCooldown -= diff;
else FrostCooldown = 0;
}
if(!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 20)
{
Drinking = true;
me->InterruptNonMeleeSpells(false);
DoScriptText(SAY_DRINK, me);
if(!DrinkInturrupted)
{
DoCast(me, SPELL_MASS_POLY, true);
DoCast(me, SPELL_CONJURE, false);
DoCast(me, SPELL_DRINK, false);
me->SetStandState(UNIT_STAND_STATE_SIT);
DrinkInterruptTimer = 10000;
}
}
//Drink Interrupt
if(Drinking && DrinkInturrupted)
{
Drinking = false;
me->RemoveAurasDueToSpell(SPELL_DRINK);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)-32000);
DoCast(me, SPELL_POTION, false);
}
//Drink Interrupt Timer
if(Drinking && !DrinkInturrupted)
{
if(DrinkInterruptTimer >= diff)
DrinkInterruptTimer -= diff;
else
{
me->SetStandState(UNIT_STAND_STATE_STAND);
DoCast(me, SPELL_POTION, true);
DoCast(me, SPELL_AOE_PYROBLAST, false);
DrinkInturrupted = true;
Drinking = false;
}
}
//Don't execute any more code if we are drinking
if(Drinking)
return;
//Normal casts
if(NormalCastTimer <= diff)
{
if(!me->IsNonMeleeSpellCasted(false))
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if(!target)
return;
uint32 Spells[3];
uint8 AvailableSpells = 0;
//Check for what spells are not on cooldown
if(!ArcaneCooldown)
{
//.........这里部分代码省略.........
示例2: UpdateAI
void UpdateAI(const uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
return;
//No instance
if (!instance)
return;
uint32 currentPhase = instance->GetData(DATA_CTHUN_PHASE);
if (currentPhase == PHASE_EYE_GREEN_BEAM || currentPhase == PHASE_EYE_RED_BEAM)
{
// EyeTentacleTimer
if (EyeTentacleTimer <= diff)
{
//Spawn the 8 Eye Tentacles in the corret spots
SpawnEyeTentacle(0, 20); //south
SpawnEyeTentacle(10, 10); //south west
SpawnEyeTentacle(20, 0); //west
SpawnEyeTentacle(10, -10); //north west
SpawnEyeTentacle(0, -20); //north
SpawnEyeTentacle(-10, -10); //north east
SpawnEyeTentacle(-20, 0); // east
SpawnEyeTentacle(-10, 10); // south east
EyeTentacleTimer = 45000;
} else EyeTentacleTimer -= diff;
}
switch (currentPhase)
{
case PHASE_EYE_GREEN_BEAM:
//BeamTimer
if (BeamTimer <= diff)
{
//SPELL_GREEN_BEAM
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
me->InterruptNonMeleeSpells(false);
DoCast(target, SPELL_GREEN_BEAM);
//Correctly update our target
me->SetTarget(target->GetGUID());
}
//Beam every 3 seconds
BeamTimer = 3000;
} else BeamTimer -= diff;
//ClawTentacleTimer
if (ClawTentacleTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
Creature* Spawned = NULL;
//Spawn claw tentacle on the random target
Spawned = me->SummonCreature(MOB_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500);
if (Spawned && Spawned->AI())
Spawned->AI()->AttackStart(target);
}
//One claw tentacle every 12.5 seconds
ClawTentacleTimer = 12500;
} else ClawTentacleTimer -= diff;
//PhaseTimer
if (PhaseTimer <= diff)
{
//Switch to Dark Beam
instance->SetData(DATA_CTHUN_PHASE, PHASE_EYE_RED_BEAM);
me->InterruptNonMeleeSpells(false);
me->SetReactState(REACT_PASSIVE);
//Remove any target
me->SetTarget(0);
//Select random target for dark beam to start on
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
//Face our target
DarkGlareAngle = me->GetAngle(target);
DarkGlareTickTimer = 1000;
DarkGlareTick = 0;
ClockWise = RAND(true, false);
}
//Add red coloration to C'thun
DoCast(me, SPELL_RED_COLORATION, true);
//Freeze animation
DoCast(me, SPELL_FREEZE_ANIM);
me->SetOrientation(DarkGlareAngle);
me->StopMoving();
me->GetMotionMaster()->MoveRotate(35000, ClockWise ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);
//.........这里部分代码省略.........
示例3: UpdateAI
void UpdateAI(uint32 uiDiff) override
{
if (!UpdateVictim())
return;
//START NOT TRANSFORMED
if (!m_bTransformed)
{
//MindBlast
if (m_uiMindBlast_Timer <= uiDiff)
{
DoCastVictim(SPELL_MINDBLAST);
m_uiMindBlast_Timer = urand(15000, 20000);
} else m_uiMindBlast_Timer -= uiDiff;
//CrusadersHammer
if (m_uiCrusadersHammer_Timer <= uiDiff)
{
DoCastVictim(SPELL_CRUSADERSHAMMER);
m_uiCrusadersHammer_Timer = 12000;
} else m_uiCrusadersHammer_Timer -= uiDiff;
//CrusaderStrike
if (m_uiCrusaderStrike_Timer <= uiDiff)
{
DoCastVictim(SPELL_CRUSADERSTRIKE);
m_uiCrusaderStrike_Timer = 15000;
} else m_uiCrusaderStrike_Timer -= uiDiff;
//HolyStrike
if (m_uiHolyStrike_Timer <= uiDiff)
{
DoCastVictim(SPELL_HOLYSTRIKE);
m_uiHolyStrike_Timer = 15000;
} else m_uiHolyStrike_Timer -= uiDiff;
//BalnazzarTransform
if (HealthBelowPct(40))
{
if (me->IsNonMeleeSpellCast(false))
me->InterruptNonMeleeSpells(false);
//restore hp, mana and stun
DoCast(me, SPELL_BALNAZZARTRANSFORM);
me->UpdateEntry(NPC_BALNAZZAR);
m_bTransformed = true;
}
}
else
{
//MindBlast
if (m_uiMindBlast_Timer <= uiDiff)
{
DoCastVictim(SPELL_MINDBLAST);
m_uiMindBlast_Timer = urand(15000, 20000);
} else m_uiMindBlast_Timer -= uiDiff;
//ShadowShock
if (m_uiShadowShock_Timer <= uiDiff)
{
DoCastVictim(SPELL_SHADOWSHOCK);
m_uiShadowShock_Timer = 11000;
} else m_uiShadowShock_Timer -= uiDiff;
//PsychicScream
if (m_uiPsychicScream_Timer <= uiDiff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_PSYCHICSCREAM);
m_uiPsychicScream_Timer = 20000;
} else m_uiPsychicScream_Timer -= uiDiff;
//DeepSleep
if (m_uiDeepSleep_Timer <= uiDiff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_SLEEP);
m_uiDeepSleep_Timer = 15000;
} else m_uiDeepSleep_Timer -= uiDiff;
//MindControl
if (m_uiMindControl_Timer <= uiDiff)
{
DoCastVictim(SPELL_MINDCONTROL);
m_uiMindControl_Timer = 15000;
} else m_uiMindControl_Timer -= uiDiff;
}
DoMeleeAttackIfReady();
}
示例4: UpdateAI
void UpdateAI(uint32 const diff)
{
if(!UpdateVictim() || !CheckInRoom())
return;
events.Update(diff);
if(me->HasUnitState(UNIT_STAT_CASTING))
return;
while(uint32 eventId = events.ExecuteEvent())
{
switch(eventId)
{
case EVENT_INHALE_BLIGHT:
{
RemoveBlight();
if(_inhaleCounter == 3)
{
Talk(EMOTE_WARN_PUNGENT_BLIGHT);
Talk(SAY_PUNGENT_BLIGHT);
DoCast(me, SPELL_PUNGENT_BLIGHT);
_inhaleCounter = 0;
if(Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_FESTERGUT_GAS);
events.RescheduleEvent(EVENT_GAS_SPORE, urand(20000, 25000));
}
else
{
DoCast(me, SPELL_INHALE_BLIGHT);
// just cast and dont bother with target, conditions will handle it
++_inhaleCounter;
if(_inhaleCounter < 3)
me->CastSpell(me, gaseousBlight[_inhaleCounter], true, NULL, NULL, me->GetGUID());
}
events.ScheduleEvent(EVENT_INHALE_BLIGHT, urand(33500, 35000));
break;
}
case EVENT_VILE_GAS:
{
std::list<Unit*> targets;
uint32 minTargets = RAID_MODE<uint32>(3, 8, 3, 8);
SelectTargetList(targets, minTargets, SELECT_TARGET_RANDOM, -10.0f, true);
float minDist = 0.0f;
if(targets.size() >= minTargets)
minDist = -15.0f;
if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, minDist, true))
DoCast(target, SPELL_VILE_GAS);
events.ScheduleEvent(EVENT_VILE_GAS, urand(28000, 35000));
break;
}
case EVENT_GAS_SPORE:
Talk(EMOTE_WARN_GAS_SPORE);
Talk(EMOTE_GAS_SPORE);
me->CastCustomSpell(SPELL_GAS_SPORE, SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 3, 2, 3), me);
events.ScheduleEvent(EVENT_GAS_SPORE, urand(40000, 45000));
events.RescheduleEvent(EVENT_VILE_GAS, urand(28000, 35000));
break;
case EVENT_GASTRIC_BLOAT:
DoCastVictim(SPELL_GASTRIC_BLOAT);
events.ScheduleEvent(EVENT_GASTRIC_BLOAT, urand(15000, 17500));
break;
case EVENT_BERSERK:
DoCast(me, SPELL_BERSERK2);
Talk(SAY_BERSERK);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
示例5: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if (HealthAbovePct(50))
{
if (Dispell_Timer <= diff)
{
DoCast(me, SPELL_DISPELL);
Dispell_Timer = 15000 + rand()%15000;
} else Dispell_Timer -= diff;
if (Renew_Timer <= diff)
{
DoCast(me, SPELL_RENEW);
Renew_Timer = 20000 + rand()%10000;
} else Renew_Timer -= diff;
if (HolyWrath_Timer <= diff)
{
DoCast(me->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 *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, i))
if (me->IsWithinMeleeRange(pTarget))
++TargetInRange;
}
if (TargetInRange > 1)
{
DoCast(me->getVictim(), SPELL_HOLY_NOVA);
HolyNova_Timer = 1000;
}
else
{
HolyNova_Timer = 2000;
}
} else HolyNova_Timer -= diff;
if (HolyFire_Timer < diff && TargetInRange < 3)
{
if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
DoCast(pTarget, SPELL_HOLY_FIRE);
HolyFire_Timer = 8000;
} else HolyFire_Timer -= diff;
}
else
{
if (!PhaseTwo)
{
DoScriptText(SAY_TRANSFORM, me);
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_SNAKE_FORM);
me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f);
const CreatureInfo *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 25)));
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 25)));
me->UpdateDamagePhysical(BASE_ATTACK);
DoResetThreat();
PhaseTwo = true;
}
if (PhaseTwo && PoisonCloud_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_POISON_CLOUD);
PoisonCloud_Timer = 15000;
}PoisonCloud_Timer -=diff;
if (PhaseTwo && VenomSpit_Timer <= diff)
{
if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
DoCast(pTarget, SPELL_VENOMSPIT);
VenomSpit_Timer = 15000 + rand()%5000;
} else VenomSpit_Timer -= diff;
if (PhaseTwo && HealthBelowPct(11))
{
if (!InBerserk)
{
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_BERSERK);
InBerserk = true;
}
}
}
DoMeleeAttackIfReady();
}
示例6: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!CanAttack && Intro)
{
if (AggroTimer <= diff)
{
CanAttack = true;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
AggroTimer=19000;
}else
{
AggroTimer-=diff;
return;
}
}
//to prevent abuses during phase 2
if (Phase == 2 && !me->getVictim() && me->isInCombat())
{
EnterEvadeMode();
return;
}
//Return since we have no target
if (!UpdateVictim())
return;
if (Phase == 1 || Phase == 3)
{
//ShockBlast_Timer
if (ShockBlast_Timer <= diff)
{
//Shock Burst
//Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list.
DoCast(me->getVictim(), SPELL_SHOCK_BLAST);
me->TauntApply(me->getVictim());
ShockBlast_Timer = 1000+rand()%14000; //random cooldown
} else ShockBlast_Timer -= diff;
//StaticCharge_Timer
if (StaticCharge_Timer <= diff)
{
//Static Charge
//Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic.
Unit *pTarget = NULL;
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true);
if (pTarget && !pTarget->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
//cast Static Charge every 2 seconds for 20 seconds
DoCast(pTarget, SPELL_STATIC_CHARGE_TRIGGER);
StaticCharge_Timer = 10000+rand()%20000; //blizzlike
} else StaticCharge_Timer -= diff;
//Entangle_Timer
if (Entangle_Timer <= diff)
{
if (!Entangle)
{
//Entangle
//Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom.
DoCast(me->getVictim(), SPELL_ENTANGLE);
Entangle = true;
Entangle_Timer = 10000;
}
else
{
CastShootOrMultishot();
Entangle = false;
Entangle_Timer = 20000+rand()%5000;
}
} else Entangle_Timer -= diff;
//Phase 1
if (Phase == 1)
{
//Start phase 2
if (HealthBelowPct(70))
{
//Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable.
Phase = 2;
me->GetMotionMaster()->Clear();
DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z);
Creature *pCreature;
for (uint8 i = 0; i < 4; ++i)
{
pCreature = me->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0);
if (pCreature)
ShieldGeneratorChannel[i] = pCreature->GetGUID();
}
DoScriptText(SAY_PHASE2, me);
}
}
//Phase 3
else
{
//SummonSporebat_Timer
if (SummonSporebat_Timer <= diff)
{
//.........这里部分代码省略.........
示例7: UpdateAI
void UpdateAI(const uint32 diff)
{
if (IsNihil)
{
if (NihilSpeech_Phase)
{
if (NihilSpeech_Timer <= diff)
{
switch(NihilSpeech_Phase)
{
case 1:
DoScriptText(SAY_NIHIL_1, me);
++NihilSpeech_Phase;
break;
case 2:
DoScriptText(SAY_NIHIL_2, me);
++NihilSpeech_Phase;
break;
case 3:
DoScriptText(SAY_NIHIL_3, me);
++NihilSpeech_Phase;
break;
case 4:
DoScriptText(SAY_NIHIL_4, me);
++NihilSpeech_Phase;
break;
case 5:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
// + MOVEFLAG_LEVITATING
me->AddUnitMovementFlag(MOVEFLAG_ONTRANSPORT);
//then take off to random location. creature is initially summoned, so don't bother do anything else.
me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+100, me->GetPositionY(), me->GetPositionZ()+100);
NihilSpeech_Phase = 0;
break;
}
NihilSpeech_Timer = 5000;
} else NihilSpeech_Timer -=diff;
}
return; //anything below here is not interesting for Nihil, so skip it
}
if (!UpdateVictim())
return;
if (IntangiblePresence_Timer <= diff)
{
DoCast(me->getVictim(),SPELL_INTANGIBLE_PRESENCE);
IntangiblePresence_Timer = 15000+rand()%15000;
} else IntangiblePresence_Timer -= diff;
if (ManaBurn_Timer <= diff)
{
Unit* pTarget = me->getVictim();
if (pTarget && pTarget->getPowerType() == POWER_MANA)
DoCast(pTarget,SPELL_MANA_BURN);
ManaBurn_Timer = 8000+rand()%8000;
} else ManaBurn_Timer -= diff;
if (ArcaneBlast_Timer <= diff)
{
DoCast(me->getVictim(),SPELL_ARCANE_BLAST);
ArcaneBlast_Timer = 2500+rand()%5000;
} else ArcaneBlast_Timer -= diff;
DoMeleeAttackIfReady();
}
示例8: EnterEvadeMode
// Override Evade Mode event, recast buff that was removed by standard handler
void EnterEvadeMode() override
{
npc_escortAI::EnterEvadeMode();
DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true);
}
示例9: UpdateAI
void UpdateAI(uint32 diff) override
{
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_BARADAS_TALK:
switch (step)
{
case 0:
me->SetFacingTo(1.513286f);
me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
events.ScheduleEvent(EVENT_BARADAS_TALK, 3000);
step++;
break;
case 1:
DoCast(SPELL_BARADAS_COMMAND);
events.ScheduleEvent(EVENT_BARADAS_TALK, 5000);
step++;
break;
case 2:
Talk(SAY_BARADA_3);
events.ScheduleEvent(EVENT_BARADAS_TALK, 7000);
step++;
break;
case 3:
if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
jules->AI()->Talk(SAY_JULES_2);
events.ScheduleEvent(EVENT_BARADAS_TALK, 18000);
step++;
break;
case 4:
DoCast(SPELL_BARADA_FALTERS);
me->HandleEmoteCommand(EMOTE_STAND_STATE_NONE);
if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
jules->AI()->DoAction(ACTION_JULES_HOVER);
events.ScheduleEvent(EVENT_BARADAS_TALK, 11000);
step++;
break;
case 5:
if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
jules->AI()->Talk(SAY_JULES_3);
events.ScheduleEvent(EVENT_BARADAS_TALK, 13000);
step++;
break;
case 6:
Talk(SAY_BARADA_4);
events.ScheduleEvent(EVENT_BARADAS_TALK, 5000);
step++;
break;
case 7:
if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
jules->AI()->Talk(SAY_JULES_3);
events.ScheduleEvent(EVENT_BARADAS_TALK, 13000);
step++;
break;
case 8:
Talk(SAY_BARADA_4);
events.ScheduleEvent(EVENT_BARADAS_TALK, 12000);
step++;
break;
case 9:
if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
jules->AI()->Talk(SAY_JULES_4);
events.ScheduleEvent(EVENT_BARADAS_TALK, 12000);
step++;
break;
case 10:
Talk(SAY_BARADA_4);
events.ScheduleEvent(EVENT_BARADAS_TALK, 5000);
step++;
break;
case 11:
if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
jules->AI()->DoAction(ACTION_JULES_FLIGHT);
events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
step++;
break;
case 12:
if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
jules->AI()->Talk(SAY_JULES_4);
events.ScheduleEvent(EVENT_BARADAS_TALK, 8000);
step++;
break;
case 13:
Talk(SAY_BARADA_5);
events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
step++;
break;
//.........这里部分代码省略.........
示例10: UpdateAI
void UpdateAI(const uint32 diff)
{
if (ghost)
{
if (instance && instance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS)
me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
if (!UpdateVictim())
return;
if (AggroYell_Timer)
{
if (AggroYell_Timer <= diff)
{
DoScriptText(YELL_DALRONN_AGGRO, me);
AggroYell_Timer = 0;
} else AggroYell_Timer -= diff;
}
if (!ghost)
{
if (Check_Timer)
{
if (Check_Timer <= diff)
{
Check_Timer = 5000;
Unit* skarvald = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_SKARVALD) : 0);
if (skarvald && skarvald->isDead())
{
Skarvald_isDead = true;
Response_Timer = 2000;
Check_Timer = 0;
}
} else Check_Timer -= diff;
}
if (Response_Timer && Skarvald_isDead)
{
if (Response_Timer <= diff)
{
DoScriptText(YELL_DALRONN_SKA_DIEDFIRST, me);
Response_Timer = 0;
} else Response_Timer -= diff;
}
}
if (ShadowBolt_Timer <= diff)
{
if (!me->IsNonMeleeSpellCasted(false))
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT);
ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells
}
} else ShadowBolt_Timer -= diff;
if (Debilitate_Timer <= diff)
{
if (!me->IsNonMeleeSpellCasted(false))
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE);
Debilitate_Timer = 5000+rand()%5000;
}
} else Debilitate_Timer -= diff;
if (IsHeroic())
{
if (Summon_Timer <= diff)
{
if (!me->IsNonMeleeSpellCasted(false))
{
DoCast(me, H_SPELL_SUMMON_SKELETONS);
Summon_Timer = (rand()%10000) + 20000;
}
} else Summon_Timer -= diff;
}
DoMeleeAttackIfReady();
}
示例11: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (bEventInProgress)
{
if (uiResurrectTimer <= uiDiff)
{
me->SetFullHealth();
DoCast(me, SPELL_BLACK_KNIGHT_RES, true);
uiPhase++;
uiResurrectTimer = 4000;
bEventInProgress = false;
me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);
} else uiResurrectTimer -= uiDiff;
}
switch (uiPhase)
{
case PHASE_UNDEAD:
case PHASE_SKELETON:
{
if (uiIcyTouchTimer <= uiDiff)
{
DoCastVictim(SPELL_ICY_TOUCH);
uiIcyTouchTimer = urand(5000, 7000);
} else uiIcyTouchTimer -= uiDiff;
if (uiPlagueStrikeTimer <= uiDiff)
{
DoCastVictim(SPELL_ICY_TOUCH);
uiPlagueStrikeTimer = urand(12000, 15000);
} else uiPlagueStrikeTimer -= uiDiff;
if (uiObliterateTimer <= uiDiff)
{
DoCastVictim(SPELL_OBLITERATE);
uiObliterateTimer = urand(17000, 19000);
} else uiObliterateTimer -= uiDiff;
switch (uiPhase)
{
case PHASE_UNDEAD:
{
if (uiDeathRespiteTimer <= uiDiff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
if (target && target->isAlive())
DoCast(target, SPELL_DEATH_RESPITE);
}
uiDeathRespiteTimer = urand(15000, 16000);
} else uiDeathRespiteTimer -= uiDiff;
break;
}
case PHASE_SKELETON:
{
if (!bSummonArmy)
{
bSummonArmy = true;
me->AddUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);
DoCast(me, SPELL_ARMY_DEAD);
}
if (!bDeathArmyDone)
{
if (uiDeathArmyCheckTimer <= uiDiff)
{
me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);
uiDeathArmyCheckTimer = 0;
bDeathArmyDone = true;
} else uiDeathArmyCheckTimer -= uiDiff;
}
if (uiDesecration <= uiDiff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
if (target && target->isAlive())
DoCast(target, SPELL_DESECRATION);
}
uiDesecration = urand(15000, 16000);
} else uiDesecration -= uiDiff;
if (uiGhoulExplodeTimer <= uiDiff)
{
DoCast(me, SPELL_GHOUL_EXPLODE);
uiGhoulExplodeTimer = 8000;
} else uiGhoulExplodeTimer -= uiDiff;
break;
}
break;
}
break;
}
case PHASE_GHOST:
{
if (uiDeathBiteTimer <= uiDiff)
{
DoCastAOE(SPELL_DEATH_BITE);
uiDeathBiteTimer = urand (2000, 4000);
} else uiDeathBiteTimer -= uiDiff;
if (uiMarkedDeathTimer <= uiDiff)
{
//.........这里部分代码省略.........
示例12: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (AppearDelay)
{
m_creature->StopMoving();
m_creature->AttackStop();
if (AppearDelay_Timer < diff)
{
AppearDelay = false;
if (Phase == 2)
{
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetVisibility(VISIBILITY_OFF);
}
AppearDelay_Timer = 2000;
}else AppearDelay_Timer -= diff;
}
if (Phase == 1)
{
//ArcaneMissiles_Timer
if (ArcaneMissiles_Timer < diff)
{
//Solarian casts Arcane Missiles on on random targets in the raid.
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (target && !m_creature->HasInArc(2.5f, target))
target = m_creature->getVictim();
if (target)
DoCast(target, SPELL_ARCANE_MISSILES);
ArcaneMissiles_Timer = 3000;
}else ArcaneMissiles_Timer -= diff;
//Wrath of the Astromancer targets a random player which will explode after 6 secondes
if (m_uiWrathOfTheAstromancer_Timer < diff)
{
m_creature->InterruptNonMeleeSpells(false);
//Target the tank ?
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))
{
if (pTarget->GetTypeId() == TYPEID_PLAYER)
{
DoCast(pTarget, SPELL_WRATH_OF_THE_ASTROMANCER);
m_uiWrathOfTheAstromancer_Timer = 25000;
}
else
m_uiWrathOfTheAstromancer_Timer = 1000;
}
}else m_uiWrathOfTheAstromancer_Timer -= diff;
//BlindingLight_Timer
if (BlindingLight_Timer < diff)
{
//She casts this spell every 45 seconds. It is a kind of Moonfire spell, which she strikes down on the whole raid simultaneously. It hits everyone in the raid for 2280 to 2520 arcane damage.
DoCast(m_creature->getVictim(), SPELL_BLINDING_LIGHT);
BlindingLight_Timer = 45000;
}else BlindingLight_Timer -= diff;
//Phase1_Timer
if (Phase1_Timer < diff)
{
Phase = 2;
Phase1_Timer = 50000;
//After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind.
m_creature->GetMotionMaster()->Clear();
m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);
for(int i = 0; i <= 2; ++i)
{
if (!i)
{
Portals[i][0] = Portal_X(SMALL_PORTAL_RADIUS);
Portals[i][1] = Portal_Y(Portals[i][0], SMALL_PORTAL_RADIUS);
Portals[i][2] = CENTER_Z;
}
else
{
Portals[i][0] = Portal_X(LARGE_PORTAL_RADIUS);
Portals[i][1] = Portal_Y(Portals[i][0], LARGE_PORTAL_RADIUS);
Portals[i][2] = PORTAL_Z;
}
}
if ((abs(int(Portals[2][0]) - int(Portals[1][0])) < 7) && (abs(int(Portals[2][1]) - int(Portals[1][1])) < 7))
{
int i = 1;
if (abs(int(CENTER_X) + int(26.0f) - int(Portals[2][0])) < 7)
i = -1;
Portals[2][0] = Portals[2][0]+7*i;
Portals[2][1] = Portal_Y(Portals[2][0], LARGE_PORTAL_RADIUS);
}
//.........这里部分代码省略.........
示例13: UpdateAI
void UpdateAI(const uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT))
{
Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_MAULGAREVENT_TANK));
if (target)
{
AttackStart(target);
}
}
//Return since we have no target
if (!UpdateVictim())
return;
//someone evaded!
if (instance && !instance->GetData(DATA_MAULGAREVENT))
{
EnterEvadeMode();
return;
}
//GreaterFireball_Timer
if (GreaterFireball_Timer < diff || me->IsWithinDist(me->GetVictim(), 30))
{
DoCastVictim(SPELL_GREATER_FIREBALL);
GreaterFireball_Timer = 2000;
} else GreaterFireball_Timer -= diff;
//SpellShield_Timer
if (SpellShield_Timer <= diff)
{
me->InterruptNonMeleeSpells(false);
DoCastVictim(SPELL_SPELLSHIELD);
SpellShield_Timer = 30000;
} else SpellShield_Timer -= diff;
//BlastWave_Timer
if (BlastWave_Timer <= 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());
//15 yard radius minimum
if (target && target->IsWithinDist(me, 15, false))
target_list.push_back(target);
target = NULL;
}
if (!target_list.empty())
target = *(target_list.begin()+rand()%target_list.size());
me->InterruptNonMeleeSpells(false);
DoCast(target, SPELL_BLAST_WAVE);
BlastWave_Timer = 60000;
} else BlastWave_Timer -= diff;
}
示例14: UpdateAI
void UpdateAI(const uint32 diff)
{
if (IsEvent)
{
//Must update npc_escortAI
npc_escortAI::UpdateAI(diff);
if(!go)
{
go = true;
if(pInstance)
{
((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 5492.91, -2404.61, 1462.63);
((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 5531.76, -2460.87, 1469.55);
((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 5554.58, -2514.66, 1476.12);
((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 5554.16, -2567.23, 1479.90);
((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 5540.67, -2625.99, 1480.89);
((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5508.16, -2659.2, 1480.15);
((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5489.62, -2704.05, 1482.18);
((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5457.04, -2726.26, 1485.10);
((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
}
}
}
//Return since we have no target
if (!UpdateVictim() )
return;
if(RainTimer < diff)
{
DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE);
RainTimer = 20000+rand()%15000;
}else RainTimer -= diff;
if(DoomTimer < diff)
{
DoCast(SelectUnit(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank
DoomTimer = 45000+rand()%5000;
}else DoomTimer -= diff;
if(HowlTimer < diff)
{
DoCast(m_creature, SPELL_HOWL_OF_AZGALOR);
HowlTimer = 30000;
}else HowlTimer -= diff;
if(CleaveTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
CleaveTimer = 10000+rand()%5000;
}else CleaveTimer -= diff;
if(EnrageTimer < diff && !enraged)
{
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature, SPELL_BERSERK, true);
enraged = true;
EnrageTimer = 600000;
}else EnrageTimer -= diff;
DoMeleeAttackIfReady();
}
示例15: Reset
void Reset()
{
BossAI::Reset();
DoCast(me, SPELL_MAGMASPLASH, true);
}