本文整理汇总了C++中EventMap::GetPhaseMask方法的典型用法代码示例。如果您正苦于以下问题:C++ EventMap::GetPhaseMask方法的具体用法?C++ EventMap::GetPhaseMask怎么用?C++ EventMap::GetPhaseMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventMap
的用法示例。
在下文中一共展示了EventMap::GetPhaseMask方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HealReceived
void HealReceived(Unit* /*healer*/, uint32& heal)
{
if (me->GetHealth() + heal >= me->GetMaxHealth())
if (events.GetPhaseMask() & PHASE_EGG_MASK)
{
Birth = true;
uiBirthTimer = 2500;
me->RemoveAura(SPELL_BLAZE_OF_THE_HEAVENS_TRANSFORM);
events.SetPhase(PHASE_BLAZE);
}
}
示例2: DamageTaken
void DamageTaken(Unit* /*done_by*/, uint32 &damage)
{
if (damage >= me->GetHealth())
{
damage = 0;
me->SetHealth(1);
if (events.GetPhaseMask() & PHASE_BLAZE_MASK)
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
me->AttackStop();
events.SetPhase(PHASE_EGG);
me->RemoveAura(SPELL_BLAZE_OF_THE_HEAVENS_PERIODIC);
me->CastSpell(me, SPELL_BLAZE_OF_THE_HEAVENS_TRANSFORM, false);
}
}
}
示例3: SummonedCreatureDies
void SummonedCreatureDies(Creature* summon, Unit*)
{
summons.Despawn(summon);
if (events.GetPhaseMask() & 0x01)
events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0);
}
示例4: UpdateAI
void UpdateAI(uint32 diff)
{
events2.Update(diff);
switch (events2.ExecuteEvent())
{
case EVENT_INIT_COMBAT:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
if (Unit* target = SelectTargetFromPlayerList(50.0f))
AttackStart(target);
return;
case EVENT_FINISH_TALK:
Unit::Kill(me, me);
return;
}
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (uint32 eventId = events.ExecuteEvent())
{
case EVENT_SPELL_FIREBALL:
me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_FIREBALL_N, SPELL_FIREBALL_H), false);
events.ScheduleEvent(EVENT_SPELL_FIREBALL, urand(3000, 4500));
break;
case EVENT_SPELL_FLAMESTRIKE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
me->CastSpell(target, SPELL_FLAMESTRIKE_SUMMON, true);
Talk(SAY_FLAMESTRIKE);
}
events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 25000);
break;
case EVENT_SPELL_SHOCK_BARRIER:
me->CastSpell(me, SPELL_SHOCK_BARRIER, true);
me->CastCustomSpell(SPELL_PYROBLAST, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false);
events.ScheduleEvent(EVENT_SPELL_SHOCK_BARRIER, 50000);
break;
case EVENT_SPELL_PHOENIX:
Talk(SAY_PHOENIX);
me->CastSpell(me, SPELL_PHOENIX, false);
events.ScheduleEvent(EVENT_SPELL_PHOENIX, 60000);
break;
case EVENT_CHECK_HEALTH:
if (HealthBelowPct(50))
{
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
me->CastSpell(me, SPELL_TELEPORT_CENTER, true);
events.Reset();
me->StopMoving();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
events.SetPhase(1);
events.ScheduleEvent(EVENT_GRAVITY_LAPSE_1_1, 0);
break;
}
events.ScheduleEvent(EVENT_CHECK_HEALTH, 500);
break;
case EVENT_GRAVITY_LAPSE_1_1:
case EVENT_GRAVITY_LAPSE_1_2:
Talk(eventId == EVENT_GRAVITY_LAPSE_1_1 ? SAY_GRAVITY_LAPSE : SAY_RECAST_GRAVITY);
me->CastSpell(me, SPELL_GRAVITY_LAPSE_INITIAL, false);
events.ScheduleEvent(EVENT_GRAVITY_LAPSE_2, 2000);
break;
case EVENT_GRAVITY_LAPSE_2:
LapseAction(ACTION_TELEPORT_PLAYERS);
events.ScheduleEvent(EVENT_GRAVITY_LAPSE_3, 1000);
break;
case EVENT_GRAVITY_LAPSE_3:
LapseAction(ACTION_KNOCKUP);
events.ScheduleEvent(EVENT_GRAVITY_LAPSE_4, 1000);
break;
case EVENT_GRAVITY_LAPSE_4:
LapseAction(ACTION_ALLOW_FLY);
for (uint8 i = 0; i < 3; ++i)
me->CastSpell(me, SPELL_SUMMON_ARCANE_SPHERE, true);
me->CastSpell(me, SPELL_GRAVITY_LAPSE_CHANNEL, false);
events.ScheduleEvent(EVENT_GRAVITY_LAPSE_5, 30000);
break;
case EVENT_GRAVITY_LAPSE_5:
LapseAction(ACTION_REMOVE_FLY);
me->InterruptNonMeleeSpells(false);
Talk(SAY_TIRED);
me->CastSpell(me, SPELL_POWER_FEEDBACK, false);
events.ScheduleEvent(EVENT_GRAVITY_LAPSE_1_2, 10000);
break;
}
if (events.GetPhaseMask() == 0)
DoMeleeAttackIfReady();
}
示例5: UpdateAI
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING) && events.GetPhaseMask() != PHASE_WAILING_WINDS_MASK)
return;
if (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_STATIC_SHOCK:
{
uint8 dist = urand(5, 30);
float angle = frand(0, M_PI);
float x, y;
me->GetNearPoint2D(x, y, (float)dist, angle);
me->CastSpell(x, y, FLOR_COORD_Z, StaticShock[uiStaticShockId], false);
++uiStaticShockId;
if (uiStaticShockId < 3)
events.ScheduleEvent(EVENT_STATIC_SHOCK, 32000, 0, PHASE_DEFLECTING_WINDS);
}
break;
case EVENT_DEFLECTING_WINDS:
me->CastSpell(me, SPELL_DEFLECTING_WINDS, false);
break;
case EVENT_CALL_OF_SKY:
{
uint8 dist = urand(5, 30);
float angle = frand(0, M_PI);
float x, y;
me->GetNearPoint2D(x, y, (float)dist, angle);
me->CastSpell(x, y, FLOR_COORD_Z, SPELL_CALL_OF_SKY, false);
events.ScheduleEvent(EVENT_CALL_OF_SKY, urand(15000, 35000));
}
break;
case EVENT_CLOUD_BURST:
{
events.ScheduleEvent(EVENT_CLOUD_BURST, urand(10000, 25000), 0, PHASE_DEFLECTING_WINDS);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
{
float x, y, z;
target->GetPosition(x, y, z);
me->CastSpell(x, y, z, SPELL_CLOUD_BURST_SUMMON, false);
}
}
break;
case EVENT_WAILING_WINDS:
{
me->CastSpell(me, SPELL_WAILING_WINDS, false);
if (Spell* spell = me->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{
if (const SpellInfo* spellInfo = spell->GetSpellInfo())
if (spellInfo->Id == SPELL_WAILING_WINDS_AURA)
events.ScheduleEvent(EVENT_WAILING_WINDS, 1000, 0, PHASE_WAILING_WINDS);
}
else
{
events.SetPhase(PHASE_SIAMAT);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
me->GetMotionMaster()->MoveChase(me->GetVictim());
events.ScheduleEvent(EVENT_ABSORB_STORMS, 15000, 0, PHASE_SIAMAT);
events.ScheduleEvent(EVENT_STORM_BOLT_S, urand(10000, 25000), 0, PHASE_SIAMAT);
}
}
break;
case EVENT_ABSORB_STORMS:
me->CastSpell(me, SPELL_ABSORB_STORMS, false);
events.ScheduleEvent(EVENT_ABSORB_STORMS, 33000, 0, PHASE_SIAMAT);
break;
case EVENT_STORM_BOLT_DW:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
me->CastSpell(target, SPELL_STORM_BOLT_PHASE_DW, false);
events.ScheduleEvent(EVENT_STORM_BOLT_DW, 2500, 0, PHASE_DEFLECTING_WINDS);
}
break;
case EVENT_STORM_BOLT_S:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
me->CastSpell(target, SPELL_STORM_BOLT_PHASE_S, false);
events.ScheduleEvent(EVENT_STORM_BOLT_S, urand(10000, 25000), 0, PHASE_SIAMAT);
}
break;
}
}
DoMeleeAttackIfReady();
}
示例6: UpdateAI
void UpdateAI(uint32 const diff)
{
if (!intro)
{
me->SummonCreature(NPC_SLIPPERY_FLOOR, SummonPositions[0]); // floor ambient
me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
me->SetReactState(REACT_AGGRESSIVE);
intro = true;
}
if (!UpdateVictim())
return;
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_SWITCH_PHASE:
if (events.GetPhaseMask() & PHASE_MASK_ONE)
{
// Emote: Ahune retreats. His defenses diminish.
// me->MonsterTextEmote(EMOTE_SUBMERGE, 0, true); //Hack Fix by jacob
events.SetPhase(PHASE_TWO);
events.ScheduleEvent(EVENT_SWITCH_PHASE, 30000);
DoCast(me, SPELL_MAKE_BONFIRE);
me->AttackStop();
me->SetReactState(REACT_PASSIVE);
me->setFaction(35);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);
me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
me->SummonCreature(NPC_FROZEN_CORE, SummonPositions[0], TEMPSUMMON_CORPSE_DESPAWN);
}
else
{
events.SetPhase(PHASE_ONE);
events.ScheduleEvent(EVENT_SWITCH_PHASE, 90000);
events.ScheduleEvent(EVENT_COLD_SLAP, 500, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_SUMMON_HAILSTONE, 1000, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_SUMMON_COLDWEAVE, 8000, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_SUMMON_FROSTWIND, 9000, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_ICE_SPEAR, 9500, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_EARTHEN_RING_ATTACK, 10000, 0, PHASE_ONE);
me->SetReactState(REACT_AGGRESSIVE);
me->setFaction(14);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
DoCastVictim(SPELL_RESURFACE);
summons.DespawnEntry(NPC_FROZEN_CORE);
}
break;
case EVENT_COLD_SLAP:
if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 8.0f, true))
{
DoCast(target, SPELL_COLD_SLAP);
Position targetPos;
target->GetNearPosition(targetPos, float(rand_norm()) * 5.0f + 35.0f, me->GetAngle(target));
target->GetMotionMaster()->MoveJump(targetPos.GetPositionX(), targetPos.GetPositionY(), targetPos.GetPositionZ(), target->GetExactDist2d(targetPos.GetPositionX(), targetPos.GetPositionY()), 10.0f);
}
events.ScheduleEvent(EVENT_COLD_SLAP, 500, 0, PHASE_ONE);
break;
case EVENT_ICE_SPEAR:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 120.0f, true))
{
target->CastSpell(target, SPELL_ICESPEAR_SUMMON_BUNNY);
target->CastSpell(target, SPELL_ICESPEAR_SUMMON_GO);
events.ScheduleEvent(EVENT_ICE_SPEAR_KNOCKBACK, 2000);
}
events.ScheduleEvent(EVENT_ICE_SPEAR, 7000, 0, PHASE_ONE);
break;
case EVENT_ICE_SPEAR_KNOCKBACK:
if (GameObject* go = me->FindNearestGameObject(GO_ICE_SPEAR, 120.0f))
{
go->UseDoorOrButton();
Map::PlayerList const& playerList = me->GetMap()->GetPlayers();
if (!playerList.isEmpty())
for (Map::PlayerList::const_iterator i = playerList.begin(); i != playerList.end(); ++i)
if (i->getSource() && go->GetDistance(i->getSource()) <= 2.0f)
i->getSource()->CastSpell(i->getSource(), SPELL_ICESPEAR_KNOCKBACK);
go->Delete();
}
break;
case EVENT_SUMMON_HAILSTONE:
me->SummonCreature(NPC_AHUNITE_HAILSTONE, SummonPositions[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
break;
case EVENT_SUMMON_COLDWEAVE:
me->SummonCreature(NPC_AHUNITE_COLDWEAVE, SummonPositions[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
me->SummonCreature(NPC_AHUNITE_COLDWEAVE, SummonPositions[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000);
events.ScheduleEvent(EVENT_SUMMON_COLDWEAVE, 5000, 0, PHASE_ONE);
//.........这里部分代码省略.........
示例7: UpdateAI
void UpdateAI(uint32 diff)
{
if (!intro)
{
me->SummonCreature(NPC_SLIPPERY_FLOOR, SummonPositions[0]); // floor ambient
me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
me->SetReactState(REACT_AGGRESSIVE);
intro = true;
}
if (!UpdateVictim())
return;
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_SWITCH_PHASE:
if (events.GetPhaseMask() & PHASE_ONE)
{
// Emote: Ahune retreats. His defenses diminish.
me->TextEmote(EMOTE_SUBMERGE, 0, true);
events.SetPhase(PHASE_TWO);
events.ScheduleEvent(EVENT_SWITCH_PHASE, 40000);
events.ScheduleEvent(EVENT_GHOST_VISUAL, 10000);
events.ScheduleEvent(EVENT_GHOST_VISUAL, 20000);
events.ScheduleEvent(EVENT_GHOST_VISUAL, 30000);
me->CastSpell(me, SPELL_MAKE_BONFIRE);
// Handle Submerge. This is essentially a copy of how Ragnaros submerges... :) minus the threatwipe
me->AttackStop();
me->SetReactState(REACT_PASSIVE);
me->setFaction(35);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveAurasDueToSpell(SPELL_AHUNES_SHIELD);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);
me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
// spawn core
me->SummonCreature(NPC_FROZEN_CORE, SummonPositions[0], TEMPSUMMON_CORPSE_DESPAWN);
}
else
{
events.SetPhase(PHASE_ONE);
events.ScheduleEvent(EVENT_SWITCH_PHASE, 95000);
events.ScheduleEvent(EVENT_COLD_SLAP, 500, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_SUMMON_HAILSTONE, 1000, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_SUMMON_COLDWEAVE, 8000, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_SUMMON_FROSTWIND, 9000, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_ICE_SPEAR, 9500, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_EARTHEN_RING_ATTACK, 10000, 0, PHASE_ONE);
me->SetReactState(REACT_AGGRESSIVE);
me->RestoreFaction();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
me->AddAura(SPELL_AHUNES_SHIELD, me);
me->CastSpell(me, SPELL_RESURFACE, true);
// despawn core
summons.DespawnEntry(NPC_FROZEN_CORE);
}
break;
case EVENT_COLD_SLAP:
if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 8.0f, true))
{
DoCast(target, SPELL_COLD_SLAP);
Position targetPos = target->GetNearPosition(float(rand_norm()) * 5.0f + 35.0f, me->GetAngle(target));
//target->GetNearPosition(targetPos, float(rand_norm()) * 5.0f + 35.0f, me->GetAngle(target));
target->GetMotionMaster()->MoveJump(targetPos.GetPositionX(), targetPos.GetPositionY(), targetPos.GetPositionZ(), target->GetExactDist2d(targetPos.GetPositionX(), targetPos.GetPositionY()), 10.0f);
}
events.ScheduleEvent(EVENT_COLD_SLAP, 500, 0, PHASE_ONE);
break;
case EVENT_ICE_SPEAR: // FIXME: should make use of all the proper spells...
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 120.0f, true))
{
target->CastSpell(target, SPELL_ICESPEAR_SUMMON_BUNNY);
target->CastSpell(target, SPELL_ICESPEAR_SUMMON_GO);
events.ScheduleEvent(EVENT_ICE_SPEAR_KNOCKBACK, 2000);
}
events.ScheduleEvent(EVENT_ICE_SPEAR, 7000, 0, PHASE_ONE);
break;
case EVENT_ICE_SPEAR_KNOCKBACK:
if (GameObject* go = me->FindNearestGameObject(GO_ICE_SPEAR, 200.0f))
{
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
go->UseDoorOrButton();
Map::PlayerList const& playerList = me->GetMap()->GetPlayers();
if (!playerList.isEmpty())
for (Map::PlayerList::const_iterator i = playerList.begin(); i != playerList.end(); ++i)
if (i->GetSource() && go->GetDistance(i->GetSource()) <= 2.0f)
i->GetSource()->CastSpell(i->GetSource(), SPELL_ICESPEAR_KNOCKBACK);
go->Delete();
//.........这里部分代码省略.........