本文整理汇总了C++中Creature::GetAI方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::GetAI方法的具体用法?C++ Creature::GetAI怎么用?C++ Creature::GetAI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::GetAI方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnterCombat
void EnterCombat(Unit* u)
{
if (!pInstance)
return;
me->CastSpell(me, SPELL_GATHERING_DOUBT, false);
events.ScheduleEvent(EVENT_GATHERING_DOUBT, 1000);
events.ScheduleEvent(EVENT_SIPHON_ESSENCE, 8000);
switch (_class)
{
case CLASS_DPS:
events.ScheduleEvent(EVENT_SPELL_FURY, 5000);
events.ScheduleEvent(EVENT_BLADE_SONG, 13000);
events.ScheduleEvent(EVENT_GLIMPSE_OF_MADNESS, 8000);
break;
case CLASS_HEAL:
events.ScheduleEvent(EVENT_SPELL_PHANTOM_STRIKE, 20000);
events.ScheduleEvent(EVENT_STUN, 7000);
break;
case CLASS_TANK:
events.ScheduleEvent(EVENT_SPELL_ARMOR_BUFF, 10000);
events.ScheduleEvent(EVENT_SANCTUARY, 10000);
events.ScheduleEvent(EVENT_STUN, 7000);
break;
}
Creature* sha = me->GetMap()->GetCreature(pInstance->GetObjectGuid(pInstance->GetData64(CREATURE_SHA_OF_DOUBT)));
if(sha && sha->GetAI())
sha->GetAI()->DoAction(ACTION_FIGMENT_POP);
}
示例2: JustDied
void JustDied(Unit* killer)
{
if (!pInstance)
return;
me->CastSpell(me, SPELL_DROWNED_STATE, false);
me->RemoveAura(SPELL_GATHERING_DOUBT);
me->DespawnOrUnsummon(5000);
Creature* sha = me->GetMap()->GetCreature(pInstance->GetObjectGuid(pInstance->GetData64(CREATURE_SHA_OF_DOUBT)));
if(sha && sha->GetAI())
sha->GetAI()->DoAction(ACTION_FIGMENT_DIED);
}
示例3: MovementInform
void MovementInform(uint32 type, uint32 id)
{
if (type == POINT_MOTION_TYPE)
{
switch (id)
{
case POINT_DRAHGA_GO_TO_THE_LAVA:
me->MonsterYell(SAY_JUMP_DOWN, LANG_UNIVERSAL, NULL);
pValiona->GetAI()->DoAction(ACTION_DRAGAH_CALLS_VALIONA_FOR_HELP);
me->SetSpeed(MOVE_RUN, 1.0f);
me->GetMotionMaster()->Clear();
me->JumpTo(pValiona,2);
events.ScheduleEvent(EVENT_DRAGAH_ENTER_VEHICLE,2000);
break;
default:
break;
}
}
}
示例4: HandleQuestgiverHelloOpcode
void WorldSession::HandleQuestgiverHelloOpcode(WorldPackets::Quest::QuestGiverHello& packet)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO %s", packet.QuestGiverGUID.ToString().c_str());
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.QuestGiverGUID, UNIT_NPC_FLAG_QUESTGIVER);
if (!creature)
{
TC_LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - %s not found or you can't interact with him.",
packet.QuestGiverGUID.ToString().c_str());
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
creature->StopMoving();
if (sScriptMgr->OnGossipHello(_player, creature))
return;
_player->PrepareGossipMenu(creature, creature->GetCreatureTemplate()->GossipMenuId, true);
_player->SendPreparedGossip(creature);
creature->GetAI()->sGossipHello(_player);
}
示例5: JustDied
void JustDied(Unit* /*killer*/)
{
if (jules)
{
jules->GetAI()->DoAction(ACTION_JULES_MOVE_HOME);
jules->RemoveAllAuras();
}
}
示例6: UpdateAI
void UpdateAI(uint32 /*diff*/) override
{
if (!bInChase)
{
Player* target = ObjectAccessor::GetPlayer(*me, kologarn->GetAI()->GetGUID(DATA_EYEBEAM_TARGET));
me->Attack(target, false);
me->GetMotionMaster()->MoveChase(target);
bInChase = true;
}
}
示例7: Reset
void Reset()
{
if (!pInstance)
return;
me->CastSpell(me, SPELL_GROW, false);
Player* owner = NULL;
if (TempSummon* tempMe = me->ToTempSummon())
if (Unit* summoner = tempMe->GetSummoner())
owner = summoner->ToPlayer();
if (!owner)
return;
me->SetDisplayId(owner->GetDisplayId()); // A check au cas où ça crasherait
uint8 role = lfg::PLAYER_ROLE_DAMAGE;
if(owner && owner->GetGroup())
// role = owner->GetGroup()->GetMemberRole(GetGUID(owner->GetGUID()));
role = owner->GetGroup()->GetLfgRoles(owner->GetGUID());
if (role & lfg::PLAYER_ROLE_DAMAGE)
_class = CLASS_DPS;
else if (role & lfg::PLAYER_ROLE_HEALER)
_class = CLASS_HEAL;
else if (role & lfg::PLAYER_ROLE_TANK)
_class = CLASS_TANK;
owner->CastSpell(me, SPELL_FIGMENT_OF_DOUBT_2, true);
Creature* sha = me->GetMap()->GetCreature(pInstance->GetObjectGuid(pInstance->GetData64(CREATURE_SHA_OF_DOUBT)));
if(sha && sha->GetAI())
sha->GetAI()->DoAction(ACTION_FIGMENT_POP);
}
示例8: EnterCombat
void EnterCombat(Unit* who)
{
if (!slatedrake->HasAura(SPELL_UNRESPONSIVE_DRAKE))
slatedrake->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP);
if (!stormrider->HasAura(SPELL_UNRESPONSIVE_DRAKE))
stormrider->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP);
if (!netherscion->HasAura(SPELL_UNRESPONSIVE_DRAKE))
netherscion->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP);
if (!timewarden->HasAura(SPELL_UNRESPONSIVE_DRAKE))
timewarden->GetAI()->DoAction(ACTION_ACTIVE_GOSSIP);
if (bWhelps)
if (GameObject* pGo = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_WHELP_CAGE)))
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
if (me->HasAura(SPELL_SHADOW_WARPED))
events.ScheduleEvent(EVENT_SHADOW_NOVA, 7000);
events.ScheduleEvent(EVENT_BERSERK, 6 * MINUTE * IN_MILLISECONDS);
proto->AddThreat(who, 10.0f);
proto->SetInCombatWith(who);
Talk(SAY_AGGRO);
DoZoneInCombat();
instance->SetBossState(DATA_HALFUS,IN_PROGRESS);
}
示例9: DamageTaken
void DamageTaken(Unit* who, uint32 &damage)
{// every hit that originally should have hit for more than 15k will cause rhyolith to steer
if (!me || !me->isAlive())
return;
uint32 treshold = 15000; //threshold of damage that will cause rhyolith to steer
uint32 stacks =0;
if (me->GetAura(SPELL_OBSIDIAN_ARMOR))
stacks = me->GetAura(SPELL_OBSIDIAN_ARMOR)->GetStackAmount();
treshold -= treshold /100 * stacks;
if (!rhyolith)
rhyolith = me->FindNearestCreature(BOSS_RHYOLITH, 100, true);
if (damage >= treshold && rhyolith)
{
me->MonsterSay("steer left", LANG_UNIVERSAL, 0);
rhyolith->GetAI()->DoAction(ACTION_STEER_LEFT); //steer that direction
}
}
示例10: SetData_trial_of_the_king
void SetData_trial_of_the_king(uint32 type, uint32 data)
{
switch (type)
{
case TYPE_OUTRO_05:
{
if (Creature* haiyan = instance->GetCreature(haiyan_guid))
if (haiyan->GetAI())
haiyan->GetAI()->DoAction(1); //ACTION_OUTRO_02
}
break;
case TYPE_OUTRO_04:
{
if (Creature* kuai = instance->GetCreature(kuai_guid))
if (kuai->GetAI())
kuai->GetAI()->DoAction(3); //ACTION_OUTRO_02
}
break;
case TYPE_OUTRO_03:
{
if (Creature* ming = instance->GetCreature(ming_guid))
if (ming->GetAI())
ming->GetAI()->DoAction(2); //ACTION_OUTRO_02
}
break;
case TYPE_OUTRO_02:
{
if (Creature* haiyan = instance->GetCreature(haiyan_guid))
if (haiyan->GetAI())
haiyan->GetAI()->DoAction(0); //ACTION_OUTRO_01
}
break;
case TYPE_OUTRO_01:
{
if (Creature* ming = instance->GetCreature(ming_guid))
if (ming->GetAI())
ming->GetAI()->DoAction(1); //ACTION_OUTRO_01
}
break;
case TYPE_MING_INTRO:
{
if (Creature* ming = instance->GetCreature(ming_guid))
if (ming->GetAI())
ming->GetAI()->DoAction(0); //ACTION_INTRO
}
break;
case TYPE_WIPE_FIRST_BOSS:
{
Creature* xin = instance->GetCreature(xin_guid);
if (!xin)
return;
xin->SetVisible(true);
if (xin->GetAI())
xin->GetAI()->Reset();
switch (data)
{
case 0:
for (auto guid : adepts)
{
Creature* creature = instance->GetCreature(guid);
if (!creature)
continue;
if (creature && creature->GetAI())
creature->GetAI()->DoAction(1); //EVENT_RETIRE
creature->RemoveAura(121569);
}
break;
case 1:
for (auto guid : scrappers)
{
Creature* creature = instance->GetCreature(guid);
if (!creature)
continue;
if (creature && creature->GetAI())
creature->GetAI()->DoAction(1); //EVENT_RETIRE
creature->RemoveAura(121569);
}
break;
case 2:
for (auto guid : grunts)
{
Creature* creature = instance->GetCreature(guid);
if (!creature)
continue;
if (creature && creature->GetAI())
creature->GetAI()->DoAction(1); //EVENT_RETIRE
creature->RemoveAura(121569);
}
break;
}
}
break;
case TYPE_MING_ATTACK:
{
//Move the adepts
for (auto guid : adepts)
{
//.........这里部分代码省略.........
示例11: HandleQuestgiverChooseRewardOpcode
//.........这里部分代码省略.........
for (QuestPackageItemEntry const* questPackageItem : *questPackageItems)
{
if (questPackageItem->ItemID != packet.ItemChoiceID)
continue;
itemValid = true;
break;
}
}
}
}
if (!itemValid)
{
TC_LOG_ERROR("entities.player.cheat", "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (%s) tried to get reward item (Item Entry: %u) wich is not a reward for quest %u (possible packet-hacking detected)", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), packet.ItemChoiceID, packet.QuestID);
return;
}
}
Object* object = _player;
if (!quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE))
{
object = ObjectAccessor::GetObjectByTypeMask(*_player, packet.QuestGiverGUID, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!object || !object->hasInvolvedQuest(packet.QuestID))
return;
// some kind of WPE protection
if (!_player->CanInteractWithQuestGiver(object))
return;
}
if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(packet.QuestID) == QUEST_STATUS_NONE) ||
(_player->GetQuestStatus(packet.QuestID) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete()))
{
TC_LOG_ERROR("network", "Error in QUEST_STATUS_COMPLETE: player %s (%s) tried to complete quest %u, but is not allowed to do so (possible packet-hacking or high latency)",
_player->GetName().c_str(), _player->GetGUID().ToString().c_str(), packet.QuestID);
return;
}
if (_player->CanRewardQuest(quest, packet.ItemChoiceID, true))
{
_player->RewardQuest(quest, packet.ItemChoiceID, object);
switch (object->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
{
//For AutoSubmition was added plr case there as it almost same exclute AI script cases.
Creature* creatureQGiver = object->ToCreature();
if (!creatureQGiver || !sScriptMgr->OnQuestReward(_player, creatureQGiver, quest, packet.ItemChoiceID))
{
// Send next quest
if (Quest const* nextQuest = _player->GetNextQuest(packet.QuestGiverGUID, quest))
{
// Only send the quest to the player if the conditions are met
if (_player->CanTakeQuest(nextQuest, false))
{
if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true))
_player->AddQuestAndCheckCompletion(nextQuest, object);
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false);
}
}
if (creatureQGiver)
creatureQGiver->GetAI()->sQuestReward(_player, quest, packet.ItemChoiceID);
}
break;
}
case TYPEID_GAMEOBJECT:
{
GameObject* questGiver = object->ToGameObject();
if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, packet.ItemChoiceID))
{
// Send next quest
if (Quest const* nextQuest = _player->GetNextQuest(packet.QuestGiverGUID, quest))
{
// Only send the quest to the player if the conditions are met
if (_player->CanTakeQuest(nextQuest, false))
{
if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true))
_player->AddQuestAndCheckCompletion(nextQuest, object);
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false);
}
}
questGiver->AI()->QuestReward(_player, quest, packet.ItemChoiceID);
}
break;
}
default:
break;
}
}
else
_player->PlayerTalkClass->SendQuestGiverOfferReward(quest, packet.QuestGiverGUID, true);
}
示例12: UpdateAI
void UpdateAI(uint32 const diff)
{
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 (jules)
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 (jules)
jules->GetAI()->DoAction(ACTION_JULES_HOVER);
events.ScheduleEvent(EVENT_BARADAS_TALK, 11000);
step++;
break;
case 5:
if (jules)
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 (jules)
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 (jules)
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 (jules)
jules->GetAI()->DoAction(ACTION_JULES_FLIGH);
events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
step++;
break;
case 12:
if (jules)
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;
//.........这里部分代码省略.........
示例13: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING))
return;
if(phase == PHASE_CASTER_PHASE && !HealthAbovePct(30))
{
phase = PHASE_DRAGON_PHASE;
me->SetSpeed(MOVE_RUN, 1.5f);
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveAllAuras(); // He should not die when he is jumping down...
DoCast(me, SPELL_TWILIGHT_PROTECTION, true);
events.Reset(); // He Should not cast while he is flying
me->GetMotionMaster()->MovePoint(POINT_DRAHGA_GO_TO_THE_LAVA, position[0]);
pValiona = me->SummonCreature(NPC_VALIONA,-375.33f,-667.291f,270.0f,3.29545f, TEMPSUMMON_CORPSE_DESPAWN);
}
if(phase == PHASE_DRAGON_PHASE && !HealthAbovePct(10))
{
phase = PHASE_FINAL_PHASE;
me->SetReactState(REACT_AGGRESSIVE);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveChase(me->getVictim());
pValiona->GetAI()->DoAction(ACTION_VALIONA_SHOULD_FLY_AWAY);
pValiona = NULL;
}
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_BURNING_SHADOWBOLT:
if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
DoCast(pTarget, RAID_MODE(SPELL_BURNING_SHADOWBOLT,SPELL_BURNING_SHADOWBOLT_H));
events.ScheduleEvent(EVENT_BURNING_SHADOWBOLT,4000);
break;
case EVENT_SUMMON_INVOKED_FLAME_SPIRIT:
me->MonsterYell(SAY_SUMMON, LANG_UNIVERSAL, NULL);
DoCast(SPELL_INVOCATION_OF_FLAME);
events.ScheduleEvent(EVENT_SUMMON_INVOKED_FLAME_SPIRIT,20000);
break;
case EVENT_DRAGAH_ENTER_VEHICLE:
me->GetMotionMaster()->Clear();
// me->EnterVehicle(pValiona, 1);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
示例14: DoWipe
// Wipe has been detected. Perform cleanup and reset.
void DoWipe()
{
if (GetData(DATA_WAVES_STATE) == IN_PROGRESS) // are the waves already done ?
{
HandleGameObject(uiFrontDoor, true);
HandleGameObject(uiFrostwornDoor, false);
// Reset - set down to the last uiEncounter that was fulfilled
if (GetData(DATA_FALRIC_EVENT) != DONE)
{
SetData(DATA_WAVES_STATE, FAIL);
uiWaveCount = 0;
events.Reset();
DoUpdateWorldState(WORLD_STATE_HOR, 1);
DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount);
if (GetData(DATA_INTRO_EVENT) == DONE)
{
if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
pMarwyn->SetVisible(true);
if (Creature* pFalric = instance->GetCreature(uiFalric))
pFalric->SetVisible(true);
}
}
else if (GetData(DATA_MARWYN_EVENT) != DONE)
{
SetData(DATA_WAVES_STATE, FAIL);
uiWaveCount = 5;
events.Reset();
DoUpdateWorldState(WORLD_STATE_HOR, 1);
DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount);
if (GetData(DATA_INTRO_EVENT) == DONE)
{
if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
pMarwyn->SetVisible(true);
}
}
}
else
{
// Falric and Marwyn have been finished by the group
if (GetData(DATA_LICHKING_EVENT) == NOT_STARTED)
{
// Lichking-Event was not started yet, i.e. the group has wiped on the Frostworn General
HandleGameObject(uiFrontDoor, true);
if (GetData(DATA_MARWYN_EVENT) == DONE)
HandleGameObject(uiFrostwornDoor, true);
}
else
{
// Group has wiped on escape
SetData(DATA_LICHKING_EVENT, NOT_STARTED);
SetData(DATA_WIPE, 1);
Creature* pSylvanasOrJaina = instance->GetCreature(GetData64(DATA_ESCAPE_LEADER));
if (pSylvanasOrJaina && pSylvanasOrJaina->GetAI())
{
pSylvanasOrJaina->Respawn(true);
pSylvanasOrJaina->GetAI()->Reset();
}
Creature* pLichKing = instance->GetCreature(GetData64(DATA_LICHKING));
if (pLichKing && pLichKing->GetAI())
{
pLichKing->Respawn(true);
pLichKing->GetAI()->Reset();
}
// TODO: maybe something is missing here
}
}
}