本文整理汇总了C++中map::playerlist::const_iterator::getSource方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::getSource方法的具体用法?C++ const_iterator::getSource怎么用?C++ const_iterator::getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map::playerlist::const_iterator
的用法示例。
在下文中一共展示了const_iterator::getSource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (!bDone && GrandChampionsOutVehicle(me))
{
bDone = true;
if (instance && me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1))
me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f);
else if (instance && me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2))
me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f);
else if (instance && me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3))
me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f);
EnterEvadeMode();
bHome = true;
}
if (uiPhaseTimer <= uiDiff)
{
if (uiPhase == 1)
{
AggroAllPlayers(me);
uiPhase = 0;
}
}else uiPhaseTimer -= uiDiff;
if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
return;
if (uiInterceptTimer <= uiDiff)
{
Map::PlayerList const& players = me->GetMap()->GetPlayers();
if (me->GetMap()->IsDungeon() && !players.isEmpty())
{
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
Player* player = itr->getSource();
if (player && !player->isGameMaster() && me->IsInRange(player, 8.0f, 25.0f, false))
{
DoResetThreat();
me->AddThreat(player, 5.0f);
DoCast(player, SPELL_INTERCEPT);
break;
}
}
}
uiInterceptTimer = 7000;
} else uiInterceptTimer -= uiDiff;
if (uiBladeStormTimer <= uiDiff)
{
DoCastVictim(SPELL_BLADESTORM);
uiBladeStormTimer = urand(15000, 20000);
} else uiBladeStormTimer -= uiDiff;
if (uiMortalStrikeTimer <= uiDiff)
{
DoCastVictim(SPELL_MORTAL_STRIKE);
uiMortalStrikeTimer = urand(8000, 12000);
} else uiMortalStrikeTimer -= uiDiff;
DoMeleeAttackIfReady();
}
示例2: SetData
void instance_dire_maul::SetData(uint32 uiType, uint32 uiData)
{
switch (uiType)
{
// East
case TYPE_ZEVRIM:
if (uiData == DONE)
{
// Update Old Ironbark so he can open the conservatory door
if (Creature* pIronbark = GetSingleCreatureFromStorage(NPC_OLD_IRONBARK))
{
DoScriptText(SAY_IRONBARK_REDEEM, pIronbark);
pIronbark->UpdateEntry(NPC_IRONBARK_REDEEMED);
}
}
m_auiEncounter[uiType] = uiData;
break;
case TYPE_IRONBARK:
m_auiEncounter[uiType] = uiData;
break;
case TYPE_ALZZIN: // This Encounter is expected to be handled within Acid (reason handling at 50% hp)
if (uiData == DONE)
{
if (!m_bWallDestroyed)
{
DoUseDoorOrButton(GO_CRUMBLE_WALL);
m_bWallDestroyed = true;
}
DoUseDoorOrButton(GO_CORRUPT_VINE);
if (!m_lFelvineShardGUIDs.empty())
{
for (GuidList::const_iterator itr = m_lFelvineShardGUIDs.begin(); itr != m_lFelvineShardGUIDs.end(); ++itr)
DoRespawnGameObject(*itr);
}
}
else if (uiData == SPECIAL && !m_bWallDestroyed)
{
DoUseDoorOrButton(GO_CRUMBLE_WALL);
m_bWallDestroyed = true;
}
m_auiEncounter[uiType] = uiData;
break;
// West
case TYPE_WARPWOOD:
if (uiData == DONE)
DoUseDoorOrButton(GO_WARPWOOD_DOOR);
m_auiEncounter[uiType] = uiData;
break;
case TYPE_IMMOLTHAR:
if (uiData == DONE)
{
if (Creature* pPrince = GetSingleCreatureFromStorage(NPC_PRINCE_TORTHELDRIN))
{
DoScriptText(SAY_FREE_IMMOLTHAR, pPrince);
pPrince->setFaction(FACTION_HOSTILE);
// Despawn Chest-Aura
if (GameObject* pChestAura = GetSingleGameObjectFromStorage(GO_PRINCES_CHEST_AURA))
pChestAura->Use(pPrince);
}
}
m_auiEncounter[uiType] = uiData;
break;
case TYPE_PRINCE:
m_auiEncounter[uiType] = uiData;
break;
case TYPE_PYLON_1:
case TYPE_PYLON_2:
case TYPE_PYLON_3:
case TYPE_PYLON_4:
case TYPE_PYLON_5:
m_auiEncounter[uiType] = uiData;
if (uiData == DONE)
{
DoUseDoorOrButton(m_aCrystalGeneratorGuid[uiType - TYPE_PYLON_1]);
if (CheckAllGeneratorsDestroyed())
ProcessForceFieldOpening();
}
break;
// North
case TYPE_KING_GORDOK:
m_auiEncounter[uiType] = uiData;
if (uiData == DONE)
{
// Apply Aura to players in the map
Map::PlayerList const& players = instance->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if (Player* pPlayer = itr->getSource())
pPlayer->CastSpell(pPlayer, SPELL_KING_OF_GORDOK, true);
}
}
break;
}
if (uiData == DONE)
{
//.........这里部分代码省略.........
示例3: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if(!UpdateVictim())
return;
if (!m_pInstance || m_pInstance->GetData(DATA_SAURFANG_EVENT) != IN_PROGRESS)
{
Map::PlayerList const &PlList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
if (Player* pPlayer = i->getSource())
{
pPlayer->RemoveAurasDueToSpell(72293);
}
}
}
if (m_uiBoilingBloodTimer < uiDiff)
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))
DoCast(pTarget, SPELL_BOILING_BLOOD_10_NORMAL);
m_uiBoilingBloodTimer = 20000;
} else m_uiBoilingBloodTimer -= uiDiff;
if (m_uiBloodNovaTimer < uiDiff)
{
uint32 count = RAID_MODE(1,3,1,3);
for (uint8 i = 1; i <= count; i++)
{
Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1);
DoCast(pTarget, RAID_MODE(SPELL_BLOOD_NOVA_10_NORMAL,SPELL_BLOOD_NOVA_25_NORMAL,SPELL_BLOOD_NOVA_10_HEROIC,SPELL_BLOOD_NOVA_25_HEROIC));
m_uiBloodNovaTimer = 23000;
}
} else m_uiBloodNovaTimer -= uiDiff;
if (m_uiSummonBloodBeastTimer <= uiDiff)
{
DoCast(me, SPELL_SUMMON_BLOOD_BEAST_1);
DoCast(me, SPELL_SUMMON_BLOOD_BEAST_2);
if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC)
{
DoCast(me, SPELL_SUMMON_BLOOD_BEAST_3);
DoCast(me, SPELL_SUMMON_BLOOD_BEAST_4);
DoCast(me, SPELL_SUMMON_BLOOD_BEAST_5);
}
DoScriptText(SAY_BLOODBEASTS, me);
m_uiSummonBloodBeastTimer = 48000;
} else m_uiSummonBloodBeastTimer -= uiDiff;
if (me->GetPower(POWER_ENERGY) == 100)
{
Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1);
DoCast(pTarget, SPELL_FALLEN_CHAMPION);
DoScriptText(SAY_FALLENCHAMPION, me);
me->SetPower(me->getPowerType(), 0);
}
if (m_uiRuneOfBloodTimer < uiDiff)
{
Unit* pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0);
DoCast(pTarget, RAID_MODE(SPELL_RUNE_OF_BLOOD_10_NORMAL,SPELL_RUNE_OF_BLOOD_25_NORMAL,SPELL_RUNE_OF_BLOOD_10_HEROIC,SPELL_RUNE_OF_BLOOD_25_HEROIC));
// me->ModifyHealth(me->GetMaxHealth() * 0.05);
m_uiRuneOfBloodTimer = 40000;
} else m_uiRuneOfBloodTimer -= uiDiff;
if(me->GetHealth()*100 / me->GetMaxHealth() < 30)
{
if (!me->HasAura(SPELL_FRENZY))
{
DoCast(me, SPELL_FRENZY);
}
}
if (m_uiBerserkTimer < uiDiff)
{
DoCast(SPELL_BERSERK);
DoScriptText(SAY_BERSERK, me);
m_uiBerserkTimer = 480000;
} else m_uiBerserkTimer -= uiDiff;
DoMeleeAttackIfReady();
}
示例4: UpdateAI
void UpdateAI(const uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
{
//No target so we'll use this section to do our random wispers instance wide
//WisperTimer
if (WisperTimer < diff)
{
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())
{
//Play random sound to the zone
i_pl->SendPlaySound(RANDOM_SOUND_WHISPER, true);
}
}
//One random wisper every 90 - 300 seconds
WisperTimer = 90000 + (rand()% 210000);
}else WisperTimer -= diff;
return;
}
m_creature->SetSelection(0);
//No instance
if (!pInstance)
return;
switch (pInstance->GetData(DATA_CTHUN_PHASE))
{
//Transition phase
case 2:
{
//PhaseTimer
if (PhaseTimer < diff)
{
//Switch
pInstance->SetData(DATA_CTHUN_PHASE, 3);
//Switch to c'thun model
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature, SPELL_TRANSFORM, false);
m_creature->SetHealth(m_creature->GetMaxHealth());
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
//Emerging phase
//AttackStart(Unit::GetUnit(*m_creature, HoldPlayer));
DoZoneInCombat();
//Place all units in threat list on outside of stomach
Stomach_Map.clear();
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
{
//Outside stomach
Stomach_Map[(*i)->getUnitGuid()] = false;
}
//Spawn 2 flesh tentacles
FleshTentaclesKilled = 0;
Creature* Spawned;
//Spawn flesh tentacle
Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Spawned)
FleshTentaclesKilled++;
else
((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
//Spawn flesh tentacle
Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Spawned)
FleshTentaclesKilled++;
else
((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID());
PhaseTimer = 0;
}else PhaseTimer -= diff;
}break;
//Body Phase
case 3:
{
//Remove Target field
m_creature->SetSelection(0);
//Weaken
//.........这里部分代码省略.........
示例5: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
if (!UpdateVictim())
return;
switch (m_uiStage)
{
case 0:
if (m_uiFerociousButtTimer <= uiDiff)
{
DoCastVictim(SPELL_FEROCIOUS_BUTT);
m_uiFerociousButtTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
} else m_uiFerociousButtTimer -= uiDiff;
if (m_uiArticBreathTimer <= uiDiff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_ARCTIC_BREATH);
m_uiArticBreathTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS);
} else m_uiArticBreathTimer -= uiDiff;
if (m_uiWhirlTimer <= uiDiff)
{
DoCastAOE(SPELL_WHIRL);
m_uiWhirlTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
} else m_uiWhirlTimer -= uiDiff;
if (m_uiMassiveCrashTimer <= uiDiff)
{
me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 10.0f, 20.0f); // 1: Middle of the room
m_uiStage = 7; //Invalid (Do nothing more than move)
m_uiMassiveCrashTimer = 30*IN_MILLISECONDS;
} else m_uiMassiveCrashTimer -= uiDiff;
DoMeleeAttackIfReady();
break;
case 1:
DoCastAOE(SPELL_MASSIVE_CRASH);
m_uiStage = 2;
break;
case 2:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
{
m_uiTrampleTargetGUID = target->GetGUID();
me->SetTarget(m_uiTrampleTargetGUID);
DoScriptText(SAY_TRAMPLE_STARE, me, target);
m_bTrampleCasted = false;
SetCombatMovement(false);
me->GetMotionMaster()->MoveIdle();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_uiTrampleTimer = 4*IN_MILLISECONDS;
m_uiStage = 3;
} else m_uiStage = 6;
break;
case 3:
if (m_uiTrampleTimer <= uiDiff)
{
if (Unit* target = Unit::GetPlayer(*me, m_uiTrampleTargetGUID))
{
m_bTrampleCasted = false;
m_bMovementStarted = true;
m_fTrampleTargetX = target->GetPositionX();
m_fTrampleTargetY = target->GetPositionY();
m_fTrampleTargetZ = target->GetPositionZ();
me->GetMotionMaster()->MoveJump(2*me->GetPositionX()-m_fTrampleTargetX,
2*me->GetPositionY()-m_fTrampleTargetY,
me->GetPositionZ(),
10.0f, 20.0f); // 2: Hop Backwards
m_uiStage = 7; //Invalid (Do nothing more than move)
} else m_uiStage = 6;
} else m_uiTrampleTimer -= uiDiff;
break;
case 4:
DoScriptText(SAY_TRAMPLE_START, me);
me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1);
me->SetTarget(0);
m_uiStage = 5;
break;
case 5:
if (m_bMovementFinish)
{
if (m_uiTrampleTimer <= uiDiff) DoCastAOE(SPELL_TRAMPLE);
m_bMovementFinish = false;
m_uiStage = 6;
return;
}
if (m_uiTrampleTimer <= uiDiff)
{
Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
{
if (Unit* player = itr->getSource())
if (player->isAlive() && player->IsWithinDistInMap(me, 6.0f))
{
DoCastAOE(SPELL_TRAMPLE);
m_uiTrampleTimer = IN_MILLISECONDS;
break;
}
}
} else m_uiTrampleTimer -= uiDiff;
//.........这里部分代码省略.........
示例6: Aggro
void Aggro(Unit* pWho)
{
for (uint8 i = 0; i < 4; ++i)
m_PlagueFissureGUID[i].clear();
for (uint32 i = 10; i <= 52; ++i)
if (GameObject* pPlagueFissure = GetClosestGameObjectWithEntry(m_creature, 181500+i, 100.0f))
{
if (i != 10 && i != 17 && i != 18 && i != 19 && i != 20 && i != 21 && i != 22 && i != 23 && i != 24 && i != 26)
m_PlagueFissureGUID[0].push_back(pPlagueFissure->GetGUID());
if (i != 11 && i != 12 && i != 13 && i != 14 && i != 15 && i != 16 && i != 25 && i != 27 && i != 28 && i != 29 && i != 30 && i != 31)
m_PlagueFissureGUID[1].push_back(pPlagueFissure->GetGUID());
if (i != 32 && i != 33 && i != 34 && i != 35 && i != 36 && i != 40 && i != 41 && i != 42 && i != 43 && i != 44 && i != 45)
m_PlagueFissureGUID[2].push_back(pPlagueFissure->GetGUID());
if (i != 37 && i != 48 && i != 39 && i != 46 && i != 47 && i != 48 && i != 49 && i != 50 && i != 51 && i != 52)
m_PlagueFissureGUID[3].push_back(pPlagueFissure->GetGUID());
}
std::list<GameObject*> lList;
GetGameObjectListWithEntryInGrid(lList, m_creature, 181678, 100.0f);
if (!lList.empty())
for (std::list<GameObject*>::iterator itr = lList.begin(); itr != lList.end(); ++itr)
{
m_PlagueFissureGUID[1].push_back((*itr)->GetGUID());
m_PlagueFissureGUID[2].push_back((*itr)->GetGUID());
m_PlagueFissureGUID[3].push_back((*itr)->GetGUID());
}
lList.clear();
GetGameObjectListWithEntryInGrid(lList, m_creature, 181676, 100.0f);
if (!lList.empty())
for (std::list<GameObject*>::iterator itr = lList.begin(); itr != lList.end(); ++itr)
{
m_PlagueFissureGUID[0].push_back((*itr)->GetGUID());
m_PlagueFissureGUID[2].push_back((*itr)->GetGUID());
m_PlagueFissureGUID[3].push_back((*itr)->GetGUID());
}
lList.clear();
GetGameObjectListWithEntryInGrid(lList, m_creature, 181677, 100.0f);
if (!lList.empty())
for (std::list<GameObject*>::iterator itr = lList.begin(); itr != lList.end(); ++itr)
{
m_PlagueFissureGUID[0].push_back((*itr)->GetGUID());
m_PlagueFissureGUID[1].push_back((*itr)->GetGUID());
m_PlagueFissureGUID[3].push_back((*itr)->GetGUID());
}
lList.clear();
GetGameObjectListWithEntryInGrid(lList, m_creature, 181695, 100.0f);
if (!lList.empty())
for (std::list<GameObject*>::iterator itr = lList.begin(); itr != lList.end(); ++itr)
{
m_PlagueFissureGUID[0].push_back((*itr)->GetGUID());
m_PlagueFissureGUID[1].push_back((*itr)->GetGUID());
m_PlagueFissureGUID[2].push_back((*itr)->GetGUID());
}
switch (rand()%3)
{
case 0: DoScriptText(SAY_AGGRO1, m_creature); break;
case 1: DoScriptText(SAY_AGGRO2, m_creature); break;
case 2: DoScriptText(SAY_AGGRO3, m_creature); break;
}
// Teleport "cheaters" to center of room
Map* map = m_creature->GetMap();
if (map->IsDungeon())
{
Map::PlayerList const &PlayerList = map->GetPlayers();
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
i->getSource()->TeleportTo(NAXXRAMAS, 2804.946f, -3678.315f, 273.666f, 4.385f);
}
if(m_pInstance)
m_pInstance->SetData(TYPE_HEIGAN, IN_PROGRESS);
}
示例7: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (m_uiDeathCheckTimer < diff)
{
Map* pMap = m_creature->GetMap();
if(pMap)
{
Map::PlayerList const &lPlayers = pMap->GetPlayers();
for (Map::PlayerList::const_iterator iter = lPlayers.begin(); iter != lPlayers.end(); ++iter)
{
Player* pPlayer = iter->getSource();
if(!pPlayer->isAlive())
m_bIsPlayerDeath = true;
}
}
m_uiDeathCheckTimer = 1000;
}else m_uiDeathCheckTimer -= diff;
if (m_uiEvadeCheckCooldown < diff)
{
if (m_creature->GetDistance2d(2769.68f, -3684.61f) > 48.0f)
EnterEvadeMode();
m_uiEvadeCheckCooldown = 2000;
}else m_uiEvadeCheckCooldown -= diff;
if (m_bDelay)
{
m_bDelay = false;
DoCast(m_creature, SPELL_PLAGUED_CLOUD);
}
if (Phase_Timer < diff)
{
if (m_bCombatPhase)
{
m_creature->InterruptNonMeleeSpells(true);
m_creature->StopMoving();
m_creature->GetMotionMaster()->Clear(false);
m_creature->GetMotionMaster()->MoveIdle();
m_creature->GetMap()->CreatureRelocation(m_creature, PLATFORM_X, PLATFORM_Y, PLATFORM_Z, PLATFORM_O);
m_creature->SendMonsterMove(PLATFORM_X, PLATFORM_Y, PLATFORM_Z, SPLINETYPE_NORMAL, SPLINEFLAG_DONE, 0);
SetCombatMovement(false);
m_bDelay = true;
Phase_Timer = 45000;
}
else
{
SetCombatMovement(true);
DoStartMovement(m_creature->getVictim());
Phase_Timer = 90000;
Disruption_Timer = 0;
}
m_bCombatPhase = !m_bCombatPhase;
m_uiSafeSection = 0;
Erupt_Timer = 10000;
m_bEruptDirection = false;
}
else
Phase_Timer -= diff;
if (Erupt_Timer < diff)
{
for (std::list<uint64>::iterator itr = m_PlagueFissureGUID[m_uiSafeSection].begin(); itr != m_PlagueFissureGUID[m_uiSafeSection].end(); ++itr)
{
if (GameObject* pGo = m_creature->GetMap()->GetGameObject(*itr))
if (pGo)
{
WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM,8+4);
data << pGo->GetGUID();
data << 0;
pGo->SendMessageToSet(&data,true);
if (Creature* pTemp = m_creature->SummonCreature(14667, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 100))
{
pTemp->SetLevel(80);
pTemp->CastSpell(pTemp, SPELL_ERUPTION, true);
}
}
}
if (m_uiSafeSection == 0 || m_uiSafeSection == 3)
m_bEruptDirection = !m_bEruptDirection;
m_bEruptDirection ? ++m_uiSafeSection : --m_uiSafeSection;
m_bCombatPhase ? Erupt_Timer = 10000 : Erupt_Timer = 3000;
// Teleport "cheaters" to center of room (until LOS with GOs will be implemented)
Map* map = m_creature->GetMap();
if (map->IsDungeon())
{
Map::PlayerList const &PlayerList = map->GetPlayers();
//.........这里部分代码省略.........
示例8: UpdateAI
void UpdateAI(const uint32 diff)
{
if(isFlameBreathing)
{
if(!m_creature->IsNonMeleeSpellCasted(false))
{
isFlameBreathing = false;
} else return;
}
if(isBombing)
{
if(BombSequenceTimer < diff)
{
HandleBombSequence();
} else BombSequenceTimer -= diff;
return;
}
if(!m_creature->SelectHostileTarget() && !m_creature->getVictim())
return;
//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();
m_creature->Relocate(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2],0);
m_creature->GetMotionMaster()->MovePoint(0, 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();
if (!PlayerList.isEmpty())
return;
for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if(i->getSource()->isAlive())
DoTeleportPlayer(i->getSource(), JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0);
}
/*Test*/ m_creature->CastSpell(JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], SPELL_SUMMON_PLAYERS, true); // core bug, spell does not work if too far
return;
} else BombTimer -= diff;
if (!noeggs)
{
if(100 * m_creature->GetHealth() < 35 * m_creature->GetMaxHealth())
{
m_creature->AttackStop();
m_creature->GetMotionMaster()->Clear();
m_creature->Relocate(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2],0);
m_creature->GetMotionMaster()->MovePoint(0, JanalainPos[0][0], JanalainPos[0][1], JanalainPos[0][2]);
m_creature->StopMoving();
m_creature->CastSpell(m_creature, SPELL_HATCH_ALL, false);
HatchAllEggs(2);
noeggs = true;
}
else if(HatcherTimer < diff)
{
if(HatchAllEggs(0))
{
DoScriptText(SAY_SUMMON_HATCHER, m_creature);
m_creature->SummonCreature(MOB_AMANI_HATCHER,hatcherway[0][0][0],hatcherway[0][0][1],hatcherway[0][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
m_creature->SummonCreature(MOB_AMANI_HATCHER,hatcherway[1][0][0],hatcherway[1][0][1],hatcherway[1][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
HatcherTimer = 90000;
}
else
//.........这里部分代码省略.........
示例9: UpdateAI
//.........这里部分代码省略.........
DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102f, 227.211f, -102.752f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372f, 235.149f, -102.826f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524f, 251.113f, -102.558f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208f, 266.466f, -102.977f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167f, 274.759f, -102.962f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
}
else
if (eventProgress == 5)
{
++eventProgress;
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
DoScriptText(EMOTE_HORRENDOUS_VISION, naralex);
me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
DoScriptText(SAY_MUTANUS_THE_DEVOURER, me);
pInstance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS);
}
else
if (eventProgress == 6 && pInstance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE)
{
++eventProgress;
eventTimer = 3000;
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
{
AchievementEntry const *AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS);
if (AchievWC)
{
Map* pMap = me->GetMap();
if (pMap && pMap->IsDungeon())
{
Map::PlayerList const &players = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
itr->getSource()->CompletedAchievement(AchievWC);
}
}
if (me->HasAura(SPELL_NARALEXS_AWAKENING))
me->RemoveAura(SPELL_NARALEXS_AWAKENING);
naralex->SetStandState(UNIT_STAND_STATE_STAND);
DoScriptText(SAY_I_AM_AWAKE, naralex);
}
DoScriptText(SAY_NARALEX_AWAKES, me);
}
else
if (eventProgress == 7)
{
++eventProgress;
eventTimer = 6000;
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
DoScriptText(SAY_THANK_YOU, naralex);
}
else
if (eventProgress == 8)
{
++eventProgress;
eventTimer = 8000;
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
{
DoScriptText(SAY_FAREWELL, naralex);
naralex->AddAura(SPELL_FLIGHT_FORM, naralex);
}
SetRun();
me->SetStandState(UNIT_STAND_STATE_STAND);
me->AddAura(SPELL_FLIGHT_FORM, me);
}
else
if (eventProgress == 9)
{
++eventProgress;
eventTimer = 1500;
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ());
}
else
if (eventProgress == 10)
{
++eventProgress;
eventTimer = 2500;
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
{
naralex->GetMotionMaster()->MovePoint(0, 117.095512f, 247.107971f, -96.167870f);
naralex->GetMotionMaster()->MovePoint(1, 90.388809f, 276.135406f, -83.389801f);
}
me->GetMotionMaster()->MovePoint(26, 117.095512f, 247.107971f, -96.167870f);
me->GetMotionMaster()->MovePoint(27, 144.375443f, 281.045837f, -82.477135f);
}
else
if (eventProgress == 11)
{
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
naralex->SetVisible(false);
me->SetVisible(false);
pInstance->SetData(TYPE_NARALEX_PART3, DONE);
}
break;
}
}
} else eventTimer -= diff;
}
示例10: SetData
void SetData(uint32 type, uint32 data)
{
switch (type)
{
case DATA_RAGEWINTERCHILLEVENT:
m_auiEncounter[0] = data;
break;
case DATA_ANETHERONEVENT:
m_auiEncounter[1] = data;
break;
case DATA_KAZROGALEVENT:
m_auiEncounter[2] = data;
break;
case DATA_AZGALOREVENT:
{
m_auiEncounter[3] = data;
if (data == DONE)
{
if (ArchiYell)
break;
ArchiYell = true;
Creature* creature = instance->GetCreature(Azgalor);
if (creature)
{
Creature* unit = creature->SummonCreature(21987, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000);
Map* map = creature->GetMap();
if (map->IsDungeon() && unit)
{
unit->SetVisible(false);
Map::PlayerList const &PlayerList = map->GetPlayers();
if (PlayerList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->getSource())
{
WorldPacket packet(SMSG_MESSAGECHAT, 200);
unit->BuildMonsterChat(&packet, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID());
i->getSource()->GetSession()->SendPacket(&packet);
WorldPacket data2(SMSG_PLAY_SOUND, 4);
data2 << 10986;
i->getSource()->GetSession()->SendPacket(&data2);
}
}
}
}
}
}
break;
case DATA_ARCHIMONDEEVENT:
m_auiEncounter[4] = data;
break;
case DATA_RESET_TRASH_COUNT:
Trash = 0;
break;
case DATA_TRASH:
if (data)
Trash = data;
else
Trash--;
DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
break;
case TYPE_RETREAT:
if (data == SPECIAL)
{
if (!m_uiAncientGemGUID.empty())
{
for (std::list<uint64>::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr)
{
//don't know how long it expected
DoRespawnGameObject(*itr, DAY);
}
}
}
break;
case DATA_ALLIANCE_RETREAT:
allianceRetreat = data;
HandleGameObject(HordeGate, true);
SaveToDB();
break;
case DATA_HORDE_RETREAT:
hordeRetreat = data;
HandleGameObject(ElfGate, true);
SaveToDB();
break;
case DATA_RAIDDAMAGE:
RaidDamage += data;
if (RaidDamage >= MINRAIDDAMAGE)
RaidDamage = MINRAIDDAMAGE;
break;
case DATA_RESET_RAIDDAMAGE:
RaidDamage = 0;
break;
}
//.........这里部分代码省略.........
示例11: SetData
void SetData(uint32 type, uint32 data)
{
switch(type)
{
case TYPE_MEDIVH:
if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS)
{
--mShieldPercent;
DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent);
if (!mShieldPercent)
{
if (Creature* pMedivh = instance->GetCreature(MedivhGUID))
{
if (pMedivh->isAlive())
{
pMedivh->DealDamage(pMedivh, pMedivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_auiEncounter[0] = FAIL;
m_auiEncounter[1] = NOT_STARTED;
}
}
}
}
else
{
if (data == IN_PROGRESS)
{
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Starting event.");
InitWorldState();
m_auiEncounter[1] = IN_PROGRESS;
NextPortal_Timer = 15000;
}
if (data == DONE)
{
//this may be completed further out in the post-event
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Event completed.");
Map::PlayerList const& players = instance->GetPlayers();
if (!players.isEmpty())
{
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if (Player* pPlayer = itr->getSource())
{
if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE)
pPlayer->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL);
if (pPlayer->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE)
pPlayer->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH);
}
}
}
}
m_auiEncounter[0] = data;
}
break;
case TYPE_RIFT:
if (data == SPECIAL)
{
if (mRiftPortalCount < 7)
NextPortal_Timer = 5000;
}
else
m_auiEncounter[1] = data;
break;
}
}
示例12: UpdateAI
void UpdateAI(const uint32 diff)
{
//Inhibitmagic_Timer
if (Inhibitmagic_Timer <= diff)
{
float dist;
Map* map = me->GetMap();
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() && (dist = i_pl->IsWithinDist(me, 45)))
{
i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC);
me->AddAura(SPELL_INHIBITMAGIC, i_pl);
if (dist < 35)
me->AddAura(SPELL_INHIBITMAGIC, i_pl);
if (dist < 25)
me->AddAura(SPELL_INHIBITMAGIC, i_pl);
if (dist < 15)
me->AddAura(SPELL_INHIBITMAGIC, i_pl);
}
Inhibitmagic_Timer = 3000+(rand()%1000);
} else Inhibitmagic_Timer -= diff;
//Return since we have no target
if (!UpdateVictim())
return;
//Attractmagic_Timer
if (Attractmagic_Timer <= diff)
{
DoCast(me, SPELL_ATTRACTMAGIC);
Attractmagic_Timer = 30000;
Carnivorousbite_Timer = 1500;
} else Attractmagic_Timer -= diff;
//Carnivorousbite_Timer
if (Carnivorousbite_Timer <= diff)
{
DoCast(me, SPELL_CARNIVOROUSBITE);
Carnivorousbite_Timer = 10000;
} else Carnivorousbite_Timer -= diff;
//FocusFire_Timer
if (FocusFire_Timer <= diff)
{
// Summon Focus Fire & Emote
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (target && target->GetTypeId() == TYPEID_PLAYER && target->isAlive())
{
FocusedTargetGUID = target->GetGUID();
me->SummonCreature(ENTRY_FOCUS_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 5500);
// TODO: Find better way to handle emote
// Emote
std::string emote(EMOTE_FOCUSES_ON);
emote.append(target->GetName());
emote.push_back('!');
me->MonsterTextEmote(emote.c_str(), 0, true);
}
FocusFire_Timer = 15000+(rand()%5000);
} else FocusFire_Timer -= diff;
DoMeleeAttackIfReady();
}
示例13: UpdateAI
void UpdateAI(const uint32 diff)
{
// If WG is disabled, don't do anything.
if (!sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
return;
if (OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197))
{
// Get playerlist if there is.
if (pvpWG->isWarTime() && Check == true)
{
Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (!PlayerList.isEmpty())
{
if (i->getSource()->GetDistance2d(me) <= 75)
{
Player = true;
Check = false;
}
else
{
Player = false;
Check = false;
Check2 = true;
}
}
else
{
Player = false;
Check = false;
Check2 = true;
}
}
}
if (pvpWG->m_changeHorde != true) // If wg is switching (.wg switch)
{
if (pvpWG->isWarTime())
{
if (Player == true) //(false) If there isn't any player, then, don't cast the portal spell. Just summon gameobject.
{
if (uiPortalTimer <= diff)
{
switch (uiPortalPhase)
{
case 0:
me->SetOrientation(4.356160f);
me->SendMovementFlagUpdate();
++uiPortalPhase;
uiPortalTimer = 100;
break;
case 1:
me->AI()->DoCast(SPELL_PORTAL_VISUAL);
++uiPortalPhase;
uiPortalTimer = 900;
break;
case 2:
WintergraspPortal = me->SummonGameObject(GO_WINTERGRASP_PORTAL, 5924.042969f, 570.354492f, 661.087280f, 5.930885f, 0, 0, 0.324484f, -0.945891f, 0);
me->SetOrientation(6.003930f);
me->SendMovementFlagUpdate();
++uiPortalPhase;
uiPortalTimer = 1000;
break;
}
}else uiPortalTimer -= diff;
}
else
{
if (Check2 == true) // If the portal isn't exist
{
WintergraspPortal = me->SummonGameObject(GO_WINTERGRASP_PORTAL, 5686.974609f, 773.303711f, 647.753235f, 5.572729f, 0, 0, 0.324484f, -0.945891f, 0);
Check2 = false;
}
}
}
else
{
if (pvpWG->getDefenderTeam() == TEAM_HORDE)
{
if (pvpWG->m_timer <= 3600000) // An hour before battle begin, the portal will disappear.
{
uiPortalTimer = 0;
uiPortalPhase = 0;
Check = true;
Check2 = false;
if (GameObject* WintergraspPortal = me->FindNearestGameObject(GO_WINTERGRASP_PORTAL, 5.0f)) // If the portal is exist
WintergraspPortal->RemoveFromWorld();
}
}
else
{
uiPortalTimer = 0;
uiPortalPhase = 0;
Check = true;
Check2 = false;
if (GameObject* WintergraspPortal = me->FindNearestGameObject(GO_WINTERGRASP_PORTAL, 5.0f)) // If the portal is exist
WintergraspPortal->RemoveFromWorld();
}
//.........这里部分代码省略.........
示例14: _BSWSpellSelector
CanCastResult BossSpellWorker::_BSWSpellSelector(uint8 m_uiSpellIdx, Unit* pTarget)
{
if (_bossSpellCount == 0) return CAST_FAIL_OTHER;
SpellEntry const *spell;
SpellTable* pSpell = &m_BossSpell[m_uiSpellIdx];
Unit* pSummon = NULL;
debug_log("BSW: Casting spell number %u type %u",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget);
switch (pSpell->m_CastTarget) {
case DO_NOTHING:
return CAST_OK;
case CAST_ON_SELF:
if (!pSpell->m_IsBugged) return _DoCastSpellIfCan(boss, pSpell->m_uiSpellEntry[currentDifficulty]);
else return _BSWDoCast(m_uiSpellIdx, boss);
break;
case CAST_ON_SUMMONS:
if (!pTarget) return CAST_FAIL_OTHER;
else return _DoCastSpellIfCan(pTarget, pSpell->m_uiSpellEntry[currentDifficulty]);
break;
case CAST_ON_VICTIM:
pTarget = boss->getVictim();
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
break;
case CAST_ON_RANDOM:
pTarget = SelectUnit(SELECT_TARGET_RANDOM);
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
break;
case CAST_ON_BOTTOMAGGRO:
pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
break;
case CAST_ON_TARGET:
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
break;
case APPLY_AURA_SELF:
if (spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty]))
if(boss->AddAura(new BossAura(spell, EFFECT_INDEX_0, &pSpell->varData, boss, boss)))
return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case APPLY_AURA_TARGET:
if (!pTarget) return CAST_FAIL_OTHER;
if (spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty]))
if (pTarget->AddAura(new BossAura(spell, EFFECT_INDEX_0, &pSpell->varData, pTarget, pTarget)))
return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case SUMMON_NORMAL:
pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
if(pSummon) return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case SUMMON_TEMP:
pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,
urand(pSpell->m_uiSpellTimerMin[currentDifficulty],pSpell->m_uiSpellTimerMax[currentDifficulty]));
if(pSummon) return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case SUMMON_INSTANT:
pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_MANUAL_DESPAWN,0);
if(pSummon) return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case CAST_ON_ALLPLAYERS:
{
CanCastResult res1 = CAST_FAIL_OTHER;
Map::PlayerList const& pPlayers = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr)
{
pTarget = itr->getSource();
if (pTarget && pTarget->isAlive() && pTarget->IsWithinDistInMap(boss, pSpell->LocData.x))
if (!pSpell->m_IsBugged) {
res1 = _DoCastSpellIfCan(pTarget, pSpell->m_uiSpellEntry[currentDifficulty]);
}
else {
_BSWDoCast(m_uiSpellIdx, pTarget);
res1 = CAST_OK;
};
return res1;
}
break;
}
case CAST_ON_FRENDLY:
pTarget = SelectLowHPFriendly();
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
//.........这里部分代码省略.........
示例15: UpdateAI
void UpdateAI(const uint32 diff)
{
if (instance)
{
if (!leotherasGUID)
leotherasGUID = instance->GetData64(DATA_LEOTHERAS);
if (!me->isInCombat() && instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
{
Unit* victim = NULL;
victim = Unit::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER));
if (victim)
AttackStart(victim);
}
}
if (!UpdateVictim())
{
CastChanneling();
return;
}
if (instance && !instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
{
EnterEvadeMode();
return;
}
if (Mindblast_Timer <= diff)
{
Unit* target = NULL;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)DoCast(target, SPELL_MINDBLAST);
Mindblast_Timer = urand(10000, 15000);
} else Mindblast_Timer -= diff;
if (Earthshock_Timer <= diff)
{
Map* map = me->GetMap();
Map::PlayerList const &PlayerList = map->GetPlayers();
for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
{
if (Player* i_pl = itr->getSource())
{
bool isCasting = false;
for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
if (i_pl->GetCurrentSpell(i))
isCasting = true;
if (isCasting)
{
DoCast(i_pl, SPELL_EARTHSHOCK);
break;
}
}
}
Earthshock_Timer = urand(8000, 15000);
} else Earthshock_Timer -= diff;
DoMeleeAttackIfReady();
}