本文整理汇总了C++中DoTeleportTo函数的典型用法代码示例。如果您正苦于以下问题:C++ DoTeleportTo函数的具体用法?C++ DoTeleportTo怎么用?C++ DoTeleportTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DoTeleportTo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reset
void Reset()
{
uiSinsterStrikeTimer = 7 * IN_MILLISECONDS;
uiCallFlamesTimer = 10 * IN_MILLISECONDS;
uiRitualOfSwordTimer = 20 * IN_MILLISECONDS;
uiSacrificeTimer = 8 * IN_MILLISECONDS;
bSacrificed = false;
Phase = NORMAL;
DoTeleportTo(296.632f, -346.075f, 90.6307f);
me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING);
summons.DespawnAll();
if (pInstance)
{
pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED);
pInstance->SetData64(DATA_SACRIFICED_PLAYER, 0);
}
}
示例2: SpellHit
void SpellHit(Unit * caster, const SpellEntry * spell)
{
if (spell->Id == SPELL_SUMMON_BLIZZARD)
{
uint64 AranGUID = 0;
if (instance)
AranGUID = instance->GetData64(DATA_SHADE_OF_ARAN);
me->CastSpell(me, SPELL_CIRCULAR_BLIZZARD, false, 0, 0, AranGUID);
ChangeBlizzardWaypointsOrder(urand(0, 7));
pos.m_positionX = blizzardWaypoints[0][0];
pos.m_positionY = blizzardWaypoints[1][0];
pos.m_positionZ = me->GetPositionZ();
DoTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
currentWaypoint = 0;
waypointTimer = 0;
move = true;
}
}
示例3: EnterCombat
void EnterCombat(Unit* /*who*/) override
{
for (uint32 i = 0; i < POS_LIVE; ++i)
if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i]))
LiveTriggerGUID.push_back(trigger->GetGUID());
for (uint32 i = 0; i < POS_DEAD; ++i)
if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i]))
DeadTriggerGUID.push_back(trigger->GetGUID());
if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD)
{
TC_LOG_ERROR("scripts", "Script Gothik: cannot summon triggers!");
EnterEvadeMode();
return;
}
_EnterCombat();
waveCount = 0;
events.ScheduleEvent(EVENT_SUMMON, 30000);
DoTeleportTo(PosPlatform);
Talk(SAY_SPEECH);
instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY);
}
示例4: UpdateAI
void UpdateAI(const uint32 diff)
{
if (bPointReached)
{
if (bClockwise)
{
y = my - r * sin(c);
x = mx - r * cos(c);
}
else
{
y = my + r * sin(c);
x = mx + r * cos(c);
}
bPointReached = false;
uiCheckTimer = 1000;
me->GetMotionMaster()->MovePoint(1,x, y, SHIELD_ORB_Z);
c += M_PI/32;
if (c >= 2*M_PI) c = 0;
}
else
{
if (uiCheckTimer <= diff)
{
DoTeleportTo(x,y,SHIELD_ORB_Z);
bPointReached = true;
}
else uiCheckTimer -= diff;
}
if (uiTimer <= diff)
{
if (Unit* random = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0))
DoCast(random, SPELL_SHADOW_BOLT, false);
uiTimer = urand(500,1000);
} else uiTimer -= diff;
}
示例5: UpdateAI
void UpdateAI(uint32 diff) override
{
if (MustDie)
{
if (MustDieTimer <= diff)
{
me->DespawnOrUnsummon();
return;
} else MustDieTimer -= diff;
}
if (!Escape)
{
if (!PlayerGUID)
return;
if (SpellEscapeTimer <= diff)
{
DoCast(me, SPELL_RIZZLE_ESCAPE, false);
SpellEscapeTimer = 10000;
} else SpellEscapeTimer -= diff;
if (TeleportTimer <= diff)
{
// temp solution - unit can't be teleported by core using spelleffect 5, only players
DoTeleportTo(3706.39f, -3969.15f, 35.9118f);
//begin swimming and summon depth charges
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
if (!player)
return;
Talk(MSG_ESCAPE_NOTICE, player);
DoCast(me, SPELL_PERIODIC_DEPTH_CHARGE);
me->SetHover(true);
me->SetSwim(true);
me->SetSpeedRate(MOVE_RUN, 0.85f);
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]);
Escape = true;
} else TeleportTimer -= diff;
return;
}
if (ContinueWP)
{
me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]);
ContinueWP = false;
}
if (GrenadeTimer <= diff)
{
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
{
Talk(SAY_RIZZLE_GRENADE, player);
DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true);
}
GrenadeTimer = 30000;
} else GrenadeTimer -= diff;
if (CheckTimer <= diff)
{
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
if (!player)
{
me->DespawnOrUnsummon();
return;
}
if (me->IsWithinDist(player, 10) && me->GetPositionX() > player->GetPositionX() && !Reached)
{
Talk(SAY_RIZZLE_FINAL);
me->SetUInt32Value(UNIT_NPC_FLAGS, 1);
me->setFaction(35);
me->GetMotionMaster()->MoveIdle();
me->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE);
Reached = true;
}
CheckTimer = 1000;
} else CheckTimer -= diff;
}
示例6: UpdateAI
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
//Invisible_Timer
if (Invisible_Timer <= diff)
{
me->InterruptSpell(CURRENT_GENERIC_SPELL);
SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
me->SetDisplayId(11686);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Invisible = true;
Invisible_Timer = urand(15000, 30000);
} else Invisible_Timer -= diff;
if (Invisible)
{
if (Ambush_Timer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
{
DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
DoCast(target, SPELL_AMBUSH);
}
Ambushed = true;
Ambush_Timer = 3000;
} else Ambush_Timer -= diff;
}
if (Ambushed)
{
if (Visible_Timer <= diff)
{
me->InterruptSpell(CURRENT_GENERIC_SPELL);
me->SetDisplayId(15268);
SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Invisible = false;
Visible_Timer = 4000;
} else Visible_Timer -= diff;
}
//Resetting some aggro so he attacks other gamers
if (!Invisible)
{
if (Aggro_Timer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
{
if (DoGetThreat(me->GetVictim()))
DoModifyThreatPercent(me->GetVictim(), -50);
AttackStart(target);
}
Aggro_Timer = urand(7000, 20000);
} else Aggro_Timer -= diff;
if (ThousandBlades_Timer <= diff)
{
DoCastVictim(SPELL_THOUSANDBLADES);
ThousandBlades_Timer = urand(7000, 12000);
} else ThousandBlades_Timer -= diff;
}
DoMeleeAttackIfReady();
}
示例7: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
//Only do this if we haven't spawned nef yet
if (SpawnedAdds < 42)
{
//ShadowBoltTimer
if (ShadowBoltTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
DoCast(target, SPELL_SHADOWBOLT);
ShadowBoltTimer = urand(3000, 10000);
} else ShadowBoltTimer -= diff;
//FearTimer
if (FearTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
DoCast(target, SPELL_FEAR);
FearTimer = 10000 + (rand()%10000);
} else FearTimer -= diff;
//Add spawning mechanism
if (AddSpawnTimer <= diff)
{
//Spawn 2 random types of creatures at the 2 locations
uint32 CreatureID;
Creature* Spawned = NULL;
Unit* target = NULL;
//1 in 3 chance it will be a chromatic
if (urand(0, 2) == 0)
CreatureID = CREATURE_CHROMATIC_DRAKANOID;
else
CreatureID = DrakType1;
++SpawnedAdds;
//Spawn Creature and force it to start attacking a random target
Spawned = me->SummonCreature(CreatureID, ADD_X1, ADD_Y1, ADD_Z1, 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target && Spawned)
{
Spawned->AI()->AttackStart(target);
Spawned->setFaction(103);
}
//1 in 3 chance it will be a chromatic
if (urand(0, 2) == 0)
CreatureID = CREATURE_CHROMATIC_DRAKANOID;
else
CreatureID = DrakType2;
++SpawnedAdds;
Spawned = me->SummonCreature(CreatureID, ADD_X2, ADD_Y2, ADD_Z2, 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target && Spawned)
{
Spawned->AI()->AttackStart(target);
Spawned->setFaction(103);
}
//Begin phase 2 by spawning Nefarian and what not
if (SpawnedAdds >= 42)
{
//Teleport Victor Nefarius way out of the map
//sMapMgr->GetMap(me->GetMapId(), me)->CreatureRelocation(me, 0, 0, -5000, 0);
//Interrupt any spell casting
me->InterruptNonMeleeSpells(false);
//Root self
DoCast(me, 33356);
//Make super invis
DoCast(me, 8149);
//Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues)
DoTeleportTo(HIDE_X, HIDE_Y, HIDE_Z);
me->AddUnitState(UNIT_STATE_FLEEING);
//Spawn nef and have him attack a random target
Creature* Nefarian = me->SummonCreature(CREATURE_NEFARIAN, NEF_X, NEF_Y, NEF_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (target && Nefarian)
{
Nefarian->AI()->AttackStart(target);
Nefarian->setFaction(103);
NefarianGUID = Nefarian->GetGUID();
}
else sLog->outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly.");
}
AddSpawnTimer = 4000;
} else AddSpawnTimer -= diff;
//.........这里部分代码省略.........
示例8: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
events.Update(diff);
if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo)
{
thirtyPercentReached = true;
if (instance)
instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
}
if (me->HasUnitState(UNIT_STAT_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch(eventId)
{
case EVENT_SUMMON:
if (waves[waveCount].entry)
{
if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))
DoGothikSummon(waves[waveCount].entry);
else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))
DoGothikSummon(waves[waveCount].entry);
else if (waves[waveCount].mode == 1)
DoGothikSummon(waves[waveCount].entry);
// if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11)
if (waveCount == 11)
{
if (!CheckGroupSplitted())
{
if (instance)
instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
summons.DoAction(0, 0);
summons.DoZoneInCombat();
mergedSides = true;
}
}
if (waves[waveCount].mode == 1)
events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);
else if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))
events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);
else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))
events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);
else
events.ScheduleEvent(EVENT_SUMMON, 0);
++waveCount;
}
else
{
phaseTwo = true;
DoScriptText(SAY_TELEPORT, me);
DoTeleportTo(PosGroundLiveSide);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
summons.DoAction(0, 0);
summons.DoZoneInCombat();
events.ScheduleEvent(EVENT_BOLT, 1000);
events.ScheduleEvent(EVENT_HARVEST, urand(3000, 15000));
events.ScheduleEvent(EVENT_TELEPORT, 20000);
}
break;
case EVENT_BOLT:
DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT));
events.ScheduleEvent(EVENT_BOLT, 1000);
break;
case EVENT_HARVEST:
DoCast(me->getVictim(), SPELL_HARVEST_SOUL, true);
events.ScheduleEvent(EVENT_HARVEST, urand(20000, 25000));
break;
case EVENT_TELEPORT:
if (!thirtyPercentReached)
{
me->AttackStop();
if (IN_LIVE_SIDE(me))
{
DoTeleportTo(PosGroundDeadSide);
}
else
{
DoTeleportTo(PosGroundLiveSide);
}
me->getThreatManager().resetAggro(NotOnSameSide(me));
if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0))
{
me->getThreatManager().addThreat(pTarget, 100.0f);
AttackStart(pTarget);
}
events.ScheduleEvent(EVENT_TELEPORT, 20000);
}
break;
//.........这里部分代码省略.........
示例9: UpdateAI
void UpdateAI(uint32 const Diff)
{
if (!UpdateVictim())
return;
// Waterspout on 60% and 30% of health
if((me->GetHealthPct() < 60 && !WaterSpoutCounter && me->GetHealthPct() > 30) || (me->GetHealthPct() < 30 && WaterSpoutCounter))
{
Talk(WaterSpoutCounter ? SAY_33_PRECENT : SAY_66_PRECENT);
WaterSpoutCounter = !WaterSpoutCounter;
IsWaterSpoutPhase = true;
WaterSpoutPhaseTimer = 60000;
if (IsHeroic())
DoTeleportTo(192.056f, 802.527f, 807.638f, 3.13f);
// Stop movement
SetCombatMovement(false);
for(uint8 i = 0; i < 3; ++i)
if (Creature * creature = me->SummonCreature(Info[i].entry, Info[i].x, Info[i].y, Info[i].z, Info[i].o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000))
{
DoZoneInCombat(creature);
float x,y,z;
creature->GetClosePoint(x, y, z, creature->GetObjectSize(), 10);
creature->GetMotionMaster()->MoveJump(x, y, 807.638f, 15, 15);
}
SummonCount = 3;
me->CastSpell(me, SPELL_WATERSPOUT, false);
// On heroic apply aura to summon tornado periodically
if (IsHeroic())
me->AddAura(SPELL_WATERSPOUT_SUMMON, me);
}
if (IsWaterSpoutPhase)
{
if (WaterSpoutPhaseTimer < Diff || SummonCount == 0)
{
me->RemoveAurasDueToSpell(SPELL_WATERSPOUT);
me->RemoveAurasDueToSpell(SPELL_WATERSPOUT_SUMMON);
SetCombatMovement(true);
IsWaterSpoutPhase = false;
}
else
WaterSpoutPhaseTimer -= Diff;
return;
}
if (ShockBlastTimer <= Diff)
{
if (me->IsNonMeleeSpellCasted(false))
return;
DoCastVictim(SPELL_SHOCK_BLAST);
ShockBlastTimer = 16000;
}
else
ShockBlastTimer -= Diff;
if (GeyserTimer <= Diff)
{
if (me->IsNonMeleeSpellCasted(false))
return;
if (Unit * pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
me->CastSpell(pTarget, SPELL_SUMMON_GEYSER, false);
GeyserTimer = urand(9000, 14000);
}
else
GeyserTimer -= Diff;
if (FungalSporeTimer <= Diff)
{
if (me->IsNonMeleeSpellCasted(false))
return;
if (Unit * pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
me->CastSpell(pTarget, SPELL_FUNGAL_SPORE, false);
FungalSporeTimer = urand(12000, 16000);
}
else
FungalSporeTimer -= Diff;
DoMeleeAttackIfReady();
}
示例10: UpdateAI
void UpdateAI(const uint32 diff)
{
if (Must_Die)
{
if (Must_Die_Timer <= diff)
{
Despawn();
return;
}
else Must_Die_Timer -= diff;
}
if (!Escape)
{
if (!PlayerGUID)
return;
if (spellEscape_Timer <= diff)
{
DoCast(me, SPELL_RIZZLE_ESCAPE, false);
spellEscape_Timer = 10000;
}
else spellEscape_Timer -= diff;
if (Teleport_Timer <= diff)
{
// temp solution - unit can't be teleported by core using spelleffect 5, only players
DoTeleportTo(3706.39f, -3969.15f, 35.9118f);
//begin swimming and summon depth charges
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (!player)
return;
DoScriptText(EMOTE_START, me);
DoCast(me, SPELL_PERIODIC_DEPTH_CHARGE);
me->SetSwim(true);
me->SetSpeed(MOVE_RUN, 0.85f, true);
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]);
Escape = true;
}
else Teleport_Timer -= diff;
return;
}
if (ContinueWP)
{
me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]);
ContinueWP = false;
}
if (Grenade_Timer <= diff)
{
Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID);
if (pPlayer)
{
DoScriptText(SAY_RIZZLE_GRENADE, me, pPlayer);
DoCast(pPlayer, SPELL_RIZZLE_FROST_GRENADE, true);
}
Grenade_Timer = 30000;
}
else Grenade_Timer -= diff;
if (Check_Timer <= diff)
{
Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID);
if (!pPlayer)
{
Despawn();
return;
}
float dist = me->GetDistance(pPlayer);
if (dist < 10 && me->GetPositionX() > pPlayer->GetPositionX() && !Reached)
{
DoScriptText(SAY_RIZZLE_FINAL, me);
me->SetUInt32Value(UNIT_NPC_FLAGS, 1);
me->SetFaction(35);
me->GetMotionMaster()->MoveIdle();
me->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE);
Reached = true;
}
Check_Timer = 1000;
}
else Check_Timer -= diff;
}
示例11: UpdateAI
void UpdateAI(const uint32 diff)
{
if(isFlameBreathing)
{
if(!m_creature->IsNonMeleeSpellCasted(false))
{
isFlameBreathing = false;
}else
{
if(EnrageTimer > diff)
EnrageTimer -= diff;
else
EnrageTimer = 0;
if(HatcherTimer > diff)
HatcherTimer -= diff;
else
HatcherTimer = 0;
return;
}
}
if(isBombing)
{
if(BombSequenceTimer < diff)
{
HandleBombSequence();
}else
BombSequenceTimer -= diff;
if(EnrageTimer > diff)
EnrageTimer -= diff;
else
EnrageTimer = 0;
if(HatcherTimer > diff)
HatcherTimer -= diff;
else
HatcherTimer = 0;
return;
}
if(!UpdateVictim())
return;
if (checkTimer < diff)
{
if (!m_creature->IsWithinDistInMap(&wLoc, 25))
EnterEvadeMode();
else
DoZoneInCombat();
checkTimer = 3000;
}
else
checkTimer -= diff;
//enrage if under 25% hp before 5 min.
if(!enraged && m_creature->GetHealth() * 4 < m_creature->GetMaxHealth())
EnrageTimer = 0;
if(EnrageTimer < diff)
{
if(!enraged)
{
m_creature->CastSpell(m_creature, SPELL_ENRAGE, true);
enraged = true;
EnrageTimer = 300000;
}
else
{
DoScriptText(SAY_BERSERK, m_creature);
m_creature->CastSpell(m_creature, SPELL_BERSERK, true);
EnrageTimer = 300000;
}
}else EnrageTimer -= diff;
if(BombTimer < diff)
{
DoScriptText(SAY_FIRE_BOMBS, m_creature);
m_creature->AttackStop();
m_creature->GetMotionMaster()->Clear();
DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]);
m_creature->StopMoving();
m_creature->CastSpell(m_creature, SPELL_FIRE_BOMB_CHANNEL, false);
//DoTeleportPlayer(m_creature, JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2], 0);
//m_creature->CastSpell(m_creature, SPELL_TELE_TO_CENTER, true);
FireWall();
SpawnBombs();
isBombing = true;
BombSequenceTimer = 100;
//Teleport every Player into the middle
Map *map = m_creature->GetMap();
if(!map->IsDungeon()) return;
Map::PlayerList const &PlayerList = map->GetPlayers();
for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (Player* i_pl = i->getSource())
if(i_pl->isAlive())
DoTeleportPlayer(i_pl, JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0);
//.........这里部分代码省略.........
示例12: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if (m_checkTimer < diff)
{
if (me->IsWithinDistInMap(&wLoc, 100.0f))
DoZoneInCombat();
else
{
EnterEvadeMode();
return;
}
uint32 damage = 0;
SharedRule(damage);
me->SetSpeed(MOVE_RUN, 2.0);
// move always after stun recovery
if (!me->hasUnitState(UNIT_STAT_STUNNED) && !me->HasAura(SPELL_VANISH, 1))
DoStartMovement(me->getVictim());
m_checkTimer = 1000;
}
else
m_checkTimer -= diff;
if (m_vanishTimer < diff)
{
if (me->HasAuraType(SPELL_AURA_MOD_STUN)) // remove stun
me->RemoveSpellsCausingAura(SPELL_AURA_MOD_STUN);
if (me->HasAuraType(SPELL_AURA_MOD_STALKED)) // remove Hunter's Marks and similar trackers
me->RemoveSpellsCausingAura(SPELL_AURA_MOD_STALKED);
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true);
ForceSpellCast(me, SPELL_VANISH, INTERRUPT_AND_CAST_INSTANTLY);
ForceSpellCast(me, SPELL_DEADLY_POISON, INTERRUPT_AND_CAST_INSTANTLY);
Position dest;
if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 35.0f, true))
target->GetValidPointInAngle(dest, 5.0f, frand(0.0f, 2*M_PI), true);
else
me->GetValidPointInAngle(dest, 30.0f, frand(0.0f, 2*M_PI), true);
DoTeleportTo(dest.x, dest.y, dest.z);
// drop movement :P
me->GetMotionMaster()->MoveIdle();
m_vanishTimer = 60000;
}
else
m_vanishTimer -= diff;
if (me->HasAura(SPELL_VANISH, 1))
return;
DoMeleeAttackIfReady();
CastNextSpellIfAnyAndReady();
}
示例13: UpdateAI
void UpdateAI(uint32 diff) override
{
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)
{
// ShockBlastTimer
if (ShockBlastTimer <= 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.
DoCastVictim(SPELL_SHOCK_BLAST);
me->TauntApply(me->GetVictim());
ShockBlastTimer = 1000 + rand32() % 14000; // random cooldown
} else ShockBlastTimer -= diff;
// StaticChargeTimer
if (StaticChargeTimer <= 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* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true);
if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); // cast Static Charge every 2 seconds for 20 seconds
StaticChargeTimer = 10000 + rand32() % 20000;
} else StaticChargeTimer -= diff;
// EntangleTimer
if (EntangleTimer <= 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.
DoCastVictim(SPELL_ENTANGLE);
Entangle = true;
EntangleTimer = 10000;
}
else
{
CastShootOrMultishot();
Entangle = false;
EntangleTimer = 20000 + rand32() % 5000;
}
} else EntangleTimer -= 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);
for (uint8 i = 0; i < 4; ++i)
if (Creature* creature = me->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0))
ShieldGeneratorChannel[i] = creature->GetGUID();
Talk(SAY_PHASE2);
}
}
// Phase 3
else
{
// SummonSporebatTimer
if (SummonSporebatTimer <= diff)
{
if (Creature* sporebat = me->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0))
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
sporebat->AI()->AttackStart(target);
// summon sporebats faster and faster
//.........这里部分代码省略.........
示例14: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
//Invisible_Timer
if (Invisible_Timer <= diff)
{
me->InterruptSpell(CURRENT_GENERIC_SPELL);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 218171138);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO + 1, 3);
me->SetDisplayId(11686);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Invisible = true;
Invisible_Timer = 15000 + rand()%15000;
} else Invisible_Timer -= diff;
if (Invisible)
{
if (Ambush_Timer <= diff)
{
Unit* pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
if (pTarget)
{
DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ());
DoCast(pTarget, SPELL_AMBUSH);
}
Ambushed = true;
Ambush_Timer = 3000;
} else Ambush_Timer -= diff;
}
if (Ambushed)
{
if (Visible_Timer <= diff)
{
me->InterruptSpell(CURRENT_GENERIC_SPELL);
me->SetDisplayId(15268);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 31818);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 218171138);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO + 1, 3);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Invisible = false;
Visible_Timer = 4000;
} else Visible_Timer -= diff;
}
//Resetting some aggro so he attacks other gamers
if (!Invisible)
{
if (Aggro_Timer <= diff)
{
Unit* pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
if (DoGetThreat(me->getVictim()))
DoModifyThreatPercent(me->getVictim(),-50);
if (pTarget)
AttackStart(pTarget);
Aggro_Timer = 7000 + rand()%13000;
} else Aggro_Timer -= diff;
}
if (!Invisible)
{
if (ThousandBlades_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_THOUSANDBLADES);
ThousandBlades_Timer = 7000 + rand()%5000;
} else ThousandBlades_Timer -= diff;
}
DoMeleeAttackIfReady();
}
示例15: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if (SpawnCount == 0 && Phase == PHASE_WATERSPOUT)
{
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false);
SpawnCount = 3;
SetCombatMovement(true);
Phase = PHASE_NORMAL;
Phased = false;
FungalSporesTimer = urand(8000,13000);
ShockBlastTimer = 22000;
SummonGeyserTimer = urand(11000,16000);
me->RemoveAurasDueToSpell(SPELL_WATERSPOUT);
me->RemoveAurasDueToSpell(SPELL_WATERSPOUT_SUMMON);
}
if (me->HealthBelowPct(67) && Phase == PHASE_NORMAL && PhaseCount == 0)
{
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
DoScriptText(SAY_66_PRECENT, me);
PhaseCount++;
SetCombatMovement(false);
Phase = PHASE_WATERSPOUT;
DoTeleportTo(192.056f, 802.527f, 807.638f, 3);
DoCast(me, SPELL_WATERSPOUT);
me->AddAura(SPELL_WATERSPOUT_SUMMON, me);
Position pos;
me->GetPosition(&pos);
me->SummonCreature(NPC_SUMMONED_WITCH, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
me->SummonCreature(NPC_SUMMONED_WITCH, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
me->SummonCreature(NPC_SUMMONED_GUARD, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
Phase2EndTimer = 60000;
}
if (me->HealthBelowPct(34) && Phase == PHASE_NORMAL && PhaseCount == 1)
{
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
DoScriptText(SAY_33_PRECENT, me);
PhaseCount++;
SetCombatMovement(false);
Phase = PHASE_WATERSPOUT;
DoTeleportTo(192.056f, 802.527f, 807.638f, 3);
DoCast(me, SPELL_WATERSPOUT);
me->AddAura(SPELL_WATERSPOUT_SUMMON, me);
Position pos;
me->GetPosition(&pos);
me->SummonCreature(NPC_SUMMONED_WITCH, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
me->SummonCreature(NPC_SUMMONED_WITCH, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
me->SummonCreature(NPC_SUMMONED_GUARD, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
Phase2EndTimer = 60000;
}
if (FungalSporesTimer <= diff && Phase == PHASE_NORMAL)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
DoCast(target, SPELL_FUNGAL_SPORES);
FungalSporesTimer = urand(5000,7000);
} else FungalSporesTimer -= diff;
if (ShockBlastTimer <= diff && Phase == PHASE_NORMAL)
{
DoCastVictim(SPELL_SHOCK_BLAST);
ShockBlastTimer = urand(12000,15000);
} else ShockBlastTimer -= diff;
if (SummonGeyserTimer <= diff && Phase == PHASE_NORMAL)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
DoCast(target, SPELL_SUMMON_GEYSER);
SummonGeyserTimer = urand(13000,16000);
} else SummonGeyserTimer -= diff;
if (Phase == PHASE_WATERSPOUT)
{
if (Phase2EndTimer <= diff)
{
SpawnCount = 3;
SetCombatMovement(true);
Phase = PHASE_NORMAL;
Phased = false;
FungalSporesTimer = urand(8000,13000);
ShockBlastTimer = 22000;
SummonGeyserTimer = urand(11000,16000);
me->RemoveAurasDueToSpell(SPELL_WATERSPOUT);
me->RemoveAurasDueToSpell(SPELL_WATERSPOUT_SUMMON);
} else Phase2EndTimer -= diff;
}
DoMeleeAttackIfReady();
}