• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetClosestGameObjectWithEntry函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetClosestGameObjectWithEntry函数的典型用法代码示例。如果您正苦于以下问题:C++ GetClosestGameObjectWithEntry函数的具体用法?C++ GetClosestGameObjectWithEntry怎么用?C++ GetClosestGameObjectWithEntry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetClosestGameObjectWithEntry函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: WaypointReached

 void WaypointReached(uint32 uiPointId) override
 {
     switch (uiPointId)
     {
         case 24:
             DoScriptText(SAY_PREPARE, m_creature);
             break;
         case 25:
             DoScriptText(SAY_CAMP_ENTER, m_creature);
             SetRun(false);
             break;
         case 46:
             // despawn the Ark
             if (GameObject* pArk = GetClosestGameObjectWithEntry(m_creature, GO_ARK_OF_SSSLITH, 10.0f))
                 pArk->SetLootState(GO_JUST_DEACTIVATED);
             // spawn npcs
             m_creature->SummonCreature(NPC_ENCHANTRESS, 526.12f, 8136.96f, 21.64f, 0.57f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_SLAVEDRIVER, 524.09f, 8138.67f, 21.49f, 0.58f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_SLAVEDRIVER, 526.93f, 8133.88f, 21.56f, 0.58f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             break;
         case 70:
             DoScriptText(SAY_AMBUSH, m_creature);
             // spawn npcs
             m_bIsAmbush = true;
             m_creature->SummonCreature(NPC_SSSLITH, 162.91f, 8192.08f, 22.55f, 5.98f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_ENCHANTRESS, 162.34f, 8193.99f, 22.85f, 5.98f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_SLAVEDRIVER, 163.07f, 8187.04f, 22.71f, 0.10f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             SetEscortPaused(true);
             break;
         case 71:
             DoScriptText(SAY_AMBUSH_CLEARED, m_creature);
             SetRun();
             break;
         case 92:
             SetRun(false);
             break;
         case 93:
             DoScriptText(SAY_ESCORT_COMPLETE, m_creature);
             if (Player* pPlayer = GetPlayerForEscort())
                 pPlayer->GroupEventHappens(QUEST_ID_FHWOOR_SMASH, m_creature);
             break;
     }
 }
开发者ID:kelemeto76,项目名称:ScriptDev3,代码行数:43,代码来源:zangarmarsh.cpp


示例2: WaypointStart

		void WaypointStart(uint32 uiPointId) {
			switch (uiPointId) {
			case 0: {
				GameObject* pCage = NULL;
				if (m_uiGalensCageGUID)
					pCage = me->GetMap()->GetGameObject(m_uiGalensCageGUID);
				else
					pCage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE,
							INTERACTION_DISTANCE);
				if (pCage) {
					pCage->UseDoorOrButton();
					m_uiGalensCageGUID = pCage->GetGUID();
				}
				break;
			}
			case 21:
				DoScriptText(EMOTE_DISAPPEAR, me);
				break;
			}
		}
开发者ID:Bootz,项目名称:DeepshjirRepack,代码行数:20,代码来源:swamp_of_sorrows.cpp


示例3: EffectDummy

    bool EffectDummy(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override
    {
        if (uiEffIndex == EFFECT_INDEX_0)
        {
            Creature *pCreatureTarget = pTarget->ToCreature();
            if (!pCreatureTarget || pCreatureTarget->GetEntry() != NPC_SMOLDERING_SCRAP_BUNNY)
                return true;

            if (GameObject* pScrap = GetClosestGameObjectWithEntry(pCreatureTarget, GO_SMOLDERING_SCRAP, 5.0f))
            {
                if (pScrap->GetRespawnTime() != 0)
                    return true;

                pCreatureTarget->CastSpell(pCreatureTarget, SPELL_FROZEN_IRON_SCRAP, true);
                pScrap->SetLootState(GO_JUST_DEACTIVATED);
                pCreatureTarget->ForcedDespawn(1000);
            }
        }
        return true;
    }
开发者ID:Chuck5ta,项目名称:ScriptDev3,代码行数:20,代码来源:spell_scripts.cpp


示例4: MovementInform

        void MovementInform(uint32 uiType, uint32 uiPointId) override
        {
            if (uiType != POINT_MOTION_TYPE || !uiPointId)
                return;

            if (GameObject* pTrap = m_creature->GetMap()->GetGameObject(m_trapGuid))
            {
                // respawn the Quality Fur
                if (GameObject* pGoFur = GetClosestGameObjectWithEntry(pTrap, GO_QUALITY_FUR, INTERACTION_DISTANCE))
                {
                    if (!pGoFur->isSpawned())
                    {
                        pGoFur->SetRespawnTime(10);
                        pGoFur->Refresh();
                    }
                }
            }

            m_uiPhaseTimer = 2000;
        }
开发者ID:Chuck5ta,项目名称:ScriptDev3,代码行数:20,代码来源:borean_tundra.cpp


示例5: EffectAuraDummy_spell_aura_dummy_crystal_spike_visual

bool EffectAuraDummy_spell_aura_dummy_crystal_spike_visual(const Aura* pAura, bool bApply)
{
    if (pAura->GetId() == SPELL_CRYSTAL_SPIKE_PRE && pAura->GetEffIndex() == EFFECT_INDEX_0 && !bApply)
    {
        if (Creature* pTarget = (Creature*)pAura->GetTarget())
        {
            if (pTarget->GetEntry() != NPC_CRYSTAL_SPIKE_TRIGGER)
                return true;

            // Use the Spike gameobject so we can summon the npc which actual does the damage
            if (GameObject* pSpike = GetClosestGameObjectWithEntry(pTarget, GO_CRYSTAL_SPIKE, 10.0f))
            {
                pSpike->Use(pTarget);
                // Note: the following command should be handled in core by the trap GO code
                pSpike->SetLootState(GO_JUST_DEACTIVATED);
            }
        }
    }
    return true;
}
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:20,代码来源:boss_ormorok.cpp


示例6: MoveInLineOfSight

        void MoveInLineOfSight(Unit* who)
        {
            if (!who)
                return;

            if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40))
            {
                Phase = INTRO;
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                if (GameObject* mirror = GetClosestGameObjectWithEntry(me, OBJECT_UTGARDE_MIRROR, 100.0f))
                    mirror->SetGoState(GO_STATE_READY);

                if (Creature* arthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN))
                {
                    arthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
                    arthasGUID = arthas->GetGUID();
                }
            }
        }
开发者ID:4m1g0,项目名称:TrinityCore,代码行数:20,代码来源:boss_svala.cpp


示例7: WaypointReached

 void WaypointReached(uint32 uiPointId) override
 {
     switch (uiPointId)
     {
         case 5:
             DoScriptText(SAY_STINKY_FIRST_STOP, m_creature);
             break;
         case 10:
             DoScriptText(SAY_STINKY_SECOND_STOP, m_creature);
             break;
         case 24:
             DoScriptText(SAY_STINKY_THIRD_STOP_1, m_creature);
             break;
         case 25:
             DoScriptText(SAY_STINKY_THIRD_STOP_2, m_creature);
             if (GameObject* pBogbeanPlant = GetClosestGameObjectWithEntry(m_creature, GO_BOGBEAN_PLANT, DEFAULT_VISIBILITY_DISTANCE))
             {
                 m_bogbeanPlantGuid = pBogbeanPlant->GetObjectGuid();
                 m_creature->SetFacingToObject(pBogbeanPlant);
             }
             break;
         case 26:
             if (Player* pPlayer = GetPlayerForEscort())
                 DoScriptText(SAY_STINKY_THIRD_STOP_3, m_creature, pPlayer);
             break;
         case 29:
             m_creature->HandleEmote(EMOTE_STATE_USESTANDING);
             break;
         case 30:
             DoScriptText(SAY_STINKY_PLANT_GATHERED, m_creature);
             break;
         case 39:
             if (Player* pPlayer = GetPlayerForEscort())
             {
                 pPlayer->GroupEventHappens(pPlayer->GetTeam() == ALLIANCE ? QUEST_ID_STINKYS_ESCAPE_ALLIANCE : QUEST_ID_STINKYS_ESCAPE_HORDE, m_creature);
                 DoScriptText(SAY_STINKY_END, m_creature, pPlayer);
             }
             break;
     }
 }
开发者ID:conan513,项目名称:mangos-wotlk,代码行数:40,代码来源:dustwallow_marsh.cpp


示例8: UpdateAI

        void UpdateAI(const uint32 uiDiff)
        {
            npc_escortAI::UpdateAI(uiDiff);

            if (bTake)
            {
                if (uiTakeTimer < uiDiff)
                {
                    me->HandleEmoteCommand(EMOTE_STATE_NONE);
                    if (GameObject* pGO = GetClosestGameObjectWithEntry(me, GO_DRAENEI_MACHINE, INTERACTION_DISTANCE))
                    {
                        SetEscortPaused(false);
                        bTake=false;
                        uiTakeTimer = 3000;
                        pGO->Delete();
                    }
                }
                else
                    uiTakeTimer -= uiDiff;
            }
            DoMeleeAttackIfReady();
        }
开发者ID:Albis,项目名称:TrinityCore,代码行数:22,代码来源:netherstorm.cpp


示例9: WaypointStart

 void WaypointStart(uint32 uiPointId)
 {
     switch (uiPointId)
     {
     case 0:
         {
             GameObject* cage = NULL;
             if (galensCageGUID)
                 cage = me->GetMap()->GetGameObject(galensCageGUID);
             else
                 cage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE);
             if (cage)
             {
                 cage->UseDoorOrButton();
                 galensCageGUID = cage->GetGUID();
             }
             break;
         }
     case 21:
         Talk(EMOTE_DISAPPEAR);
         break;
     }
 }
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:23,代码来源:zone_swamp_of_sorrows.cpp


示例10: KnotQuestRewarded

bool KnotQuestRewarded(Player*, Creature* cr, Quest const* quest)
{
	if((quest->GetQuestId() != 5525 && quest->GetQuestId() != 7429) || cr->GetEntry() != 14338)
	{
		return false;
	}

	if(cr->GetInstanceData() == nullptr)
		return false;

	bool spawned = ((ScriptedInstance*)cr->GetInstanceData())->GetData(TYPE_KNOT_CHEST) == DONE;
	if(spawned)
		return false;

	auto existing = GetClosestGameObjectWithEntry(cr, GO_KNOTS_CACHE, 100.0f);
	if(existing)
	{
		return false;
	}

	cr->SummonObject(cr->GetMap(), GO_KNOTS_CACHE, 583.688f, 523.646f, -25.401f, 1.545f);
	return true;
}
开发者ID:yyhhrr,项目名称:mangospriv,代码行数:23,代码来源:knot_quest_suit.cpp


示例11: WaypointStarted

 void WaypointStarted(uint32 uiPointId, uint32 /*pathId*/) override
 {
     switch (uiPointId)
     {
         case 0:
         {
             GameObject* cage = nullptr;
             if (galensCageGUID)
                 cage = ObjectAccessor::GetGameObject(*me, galensCageGUID);
             else
                 cage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE);
             if (cage)
             {
                 cage->UseDoorOrButton();
                 galensCageGUID = cage->GetGUID();
             }
             break;
         }
         case 21:
             Talk(EMOTE_DISAPPEAR);
             break;
     }
 }
开发者ID:Refuge89,项目名称:TrinityCore,代码行数:23,代码来源:zone_swamp_of_sorrows.cpp


示例12: DoOpenPortal

    //"opens" the portal and does the "opening" whisper
    void DoOpenPortal()
    {
        // there are 4 portal spawn locations, each are expected to be spawned with negative spawntimesecs in database

        // using a grid search here seem to be more efficient than caching all four guids
        // in instance script and calculate range to each.
        GameObject* pPortal = GetClosestGameObjectWithEntry(m_creature, GO_TWILIGHT_PORTAL, 50.0f);
        DoScriptText(EMOTE_OPEN_PORTAL, m_creature);

        // By using SetRespawnTime() we will actually "spawn" the object with our defined time.
        // Once time is up, portal will disappear again.
        if (pPortal && !pPortal->isSpawned())
        {
            pPortal->SetRespawnTime(HOUR * IN_MILLISECONDS);
            pPortal->Refresh();
        }

        // set portal status as active when Sartharion is in progress
        if (m_pInstance && m_pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS)
            m_pInstance->SetPortalStatus(m_uiPortalId, true);

        // Unclear what are expected to happen if one drake has a portal open already
        // Refresh respawnTime so time again are set to 30secs?
    }
开发者ID:jviljoen82,项目名称:ScriptDev3,代码行数:25,代码来源:boss_sartharion.cpp


示例13: GOUse_go_caribou_trap

bool GOUse_go_caribou_trap(Player* pPlayer, GameObject* pGo)
{
    float fX, fY, fZ;
    pGo->GetClosePoint(fX, fY, fZ, pGo->GetObjectBoundingRadius(), 2*INTERACTION_DISTANCE, frand(0, M_PI_F*2));

    if (Creature* pCreature = pGo->SummonCreature(NPC_NESINGWARY_TRAPPER, fX, fY, fZ, pGo->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10000))
    {
        if (npc_nesingwary_trapperAI* pTrapperAI = dynamic_cast<npc_nesingwary_trapperAI*>(pCreature->AI()))
            pTrapperAI->StartAction(pPlayer, pGo);

        pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);

        if (GameObject* pGoFur = GetClosestGameObjectWithEntry(pGo, GO_QUALITY_FUR, INTERACTION_DISTANCE))
        {
            if (!pGoFur->isSpawned())
            {
                pGoFur->SetRespawnTime(10);
                pGoFur->Refresh();
            }
        }
    }

    return true;
}
开发者ID:Shutok,项目名称:StrawberryCore-501Beta,代码行数:24,代码来源:borean_tundra.cpp


示例14: UpdateEscortAI

    void UpdateEscortAI(const uint32 uiDiff) override
    {
        if (HasEscortState(STATE_ESCORT_PAUSED))
        {
            if (m_uiRitualTimer < uiDiff)
            {
                switch (m_uiRitualPhase)
                {
                    case 0:
                        DoCastSpellIfCan(m_creature, SPELL_IDOL_SHUTDOWN);
                        m_uiRitualTimer = 1000;
                        break;
                    case 1:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 39000;
                        break;
                    case 2:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 20000;
                        break;
                    case 3:
                        DoScriptText(SAY_BELNISTRASZ_3_MIN, m_creature, m_creature);
                        m_uiRitualTimer = 20000;
                        break;
                    case 4:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 40000;
                        break;
                    case 5:
                        DoSummonSpawner(irand(1, 3));
                        DoScriptText(SAY_BELNISTRASZ_2_MIN, m_creature, m_creature);
                        m_uiRitualTimer = 40000;
                        break;
                    case 6:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 20000;
                        break;
                    case 7:
                        DoScriptText(SAY_BELNISTRASZ_1_MIN, m_creature, m_creature);
                        m_uiRitualTimer = 40000;
                        break;
                    case 8:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 20000;
                        break;
                    case 9:
                        DoScriptText(SAY_BELNISTRASZ_FINISH, m_creature, m_creature);
                        m_uiRitualTimer = 3000;
                        break;
                    case 10:
                    {
                        if (Player* pPlayer = GetPlayerForEscort())
                        {
                            pPlayer->GroupEventHappens(QUEST_EXTINGUISHING_THE_IDOL, m_creature);

                            if (GameObject* pGo = GetClosestGameObjectWithEntry(m_creature, GO_BELNISTRASZ_BRAZIER, 10.0f))
                            {
                                if (!pGo->isSpawned())
                                {
                                    pGo->SetRespawnTime(HOUR * IN_MILLISECONDS);
                                    pGo->Refresh();
                                }
                            }
                        }

                        m_creature->RemoveAurasDueToSpell(SPELL_IDOL_SHUTDOWN);
                        SetEscortPaused(false);
                        break;
                    }
                }

                ++m_uiRitualPhase;
            }
            else
            {
                m_uiRitualTimer -= uiDiff;
            }

            return;
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        {
            return;
        }

        if (m_uiFireballTimer < uiDiff)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIREBALL);
            m_uiFireballTimer  = urand(2000, 3000);
        }
        else
            { m_uiFireballTimer -= uiDiff; }

        if (m_uiFrostNovaTimer < uiDiff)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_NOVA);
            m_uiFrostNovaTimer = urand(10000, 15000);
        }
        else
//.........这里部分代码省略.........
开发者ID:0jpq0,项目名称:server,代码行数:101,代码来源:razorfen_downs.cpp


示例15: EffectDummyCreature_spell_dummy_npc


//.........这里部分代码省略.........
            pCreatureTarget->UpdateEntry(NPC_FREED_GREENGILL_SLAVE);

            pCreatureTarget->CastSpell(pCreatureTarget, SPELL_ENRAGE, true);

            return true;
        }
        case SPELL_FUMPING:
        {
            if (uiEffIndex == EFFECT_INDEX_2)
            {
                switch (urand(0, 2))
                {
                    case 0:
                    {
                        pCaster->CastSpell(pCreatureTarget, SPELL_SUMMON_HAISHULUD, true);
                        break;
                    }
                    case 1:
                    {
                        for (int i = 0; i < 2; ++i)
                        {
                            if (Creature* pSandGnome = pCaster->SummonCreature(NPC_SAND_GNOME, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 30000))
                                pSandGnome->AI()->AttackStart(pCaster);
                        }
                        break;
                    }
                    case 2:
                    {
                        for (int i = 0; i < 2; ++i)
                        {
                            if (Creature* pMatureBoneSifter = pCaster->SummonCreature(NPC_MATURE_BONE_SIFTER, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 30000))
                                pMatureBoneSifter->AI()->AttackStart(pCaster);
                        }
                        break;
                    }
                }
                pCreatureTarget->ForcedDespawn();
            }
            return true;
        }
        case SPELL_THROW_GORDAWG_BOULDER:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                for (int i = 0; i < 3; ++i)
                {
                    if (irand(i, 2))                        // 2-3 summons
                        pCreatureTarget->SummonCreature(NPC_MINION_OF_GUROK, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 5000);
                }

                if (pCreatureTarget->getVictim())
                {
                    pCaster->DealDamage(pCreatureTarget, pCreatureTarget->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                    return true;
                }

                // If not in combat, no xp or loot
                pCreatureTarget->SetDeathState(JUST_DIED);
                pCreatureTarget->SetHealth(0);
                return true;
            }
            return true;
        }
        case SPELL_EXPOSE_RAZORTHORN_ROOT:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                if (pCreatureTarget->GetEntry() != NPC_RAZORTHORN_RAVAGER)
                    return true;

                if (GameObject* pMound = GetClosestGameObjectWithEntry(pCreatureTarget, GO_RAZORTHORN_DIRT_MOUND, 20.0f))
                {
                    if (pMound->GetRespawnTime() != 0)
                        return true;

                    pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_RAZORTHORN_ROOT, true);
                    pMound->SetLootState(GO_JUST_DEACTIVATED);
                }
            }
            return true;
        }
        case SPELL_MELODIOUS_RAPTURE:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                if (pCaster->GetTypeId() != TYPEID_PLAYER && pCreatureTarget->GetEntry() != NPC_DEEPRUN_RAT)
                    return true;

                pCreatureTarget->UpdateEntry(NPC_ENTHRALLED_DEEPRUN_RAT);
                pCreatureTarget->CastSpell(pCreatureTarget, SPELL_MELODIOUS_RAPTURE_VISUAL, false);
                pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, frand(0.5f, 3.0f), frand(M_PI_F * 0.8f, M_PI_F * 1.2f));

                ((Player*)pCaster)->KilledMonsterCredit(NPC_ENTHRALLED_DEEPRUN_RAT);
            }
            return true;
        }
    }

    return false;
}
开发者ID:SakhWoW,项目名称:blizzlikecore,代码行数:101,代码来源:spell_scripts.cpp


示例16: EffectDummyCreature_spell_dummy_npc


//.........这里部分代码省略.........
            return true;
        }
        case SPELL_MISS_APPLE:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                switch (urand(1, 3))
                {
                    case 1: DoScriptText(SAY_LUCKY_HIT_1, pCreatureTarget); break;
                    case 2: DoScriptText(SAY_LUCKY_HIT_2, pCreatureTarget); break;
                    case 3: DoScriptText(SAY_LUCKY_HIT_3, pCreatureTarget); break;
                }

                if (Creature* pDrostan = GetClosestCreatureWithEntry(pCreatureTarget, NPC_DROSTAN, 4 * INTERACTION_DISTANCE))
                    DoScriptText(urand(0, 1) ? SAY_DROSTAN_GOT_LUCKY_1 : SAY_DROSTAN_GOT_LUCKY_2, pDrostan);
            }
            return true;
        }
        case SPELL_MISS_APPLE_HIT_BIRD:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                if (Creature* pDrostan = GetClosestCreatureWithEntry(pCreatureTarget, NPC_DROSTAN, 5 * INTERACTION_DISTANCE))
                    DoScriptText(urand(0, 1) ? SAY_DROSTAN_HIT_BIRD_1 : SAY_DROSTAN_HIT_BIRD_2, pDrostan);

                pCreatureTarget->DealDamage(pCreatureTarget, pCreatureTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
            }
            return true;
        }
        case SPELL_LURIELLES_PENDANT:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                if (pCreatureTarget->GetEntry() != NPC_CHILL_NYMPH || pCaster->GetTypeId() != TYPEID_PLAYER)
                    return true;

                switch (urand(0, 2))
                {
                    case 0: DoScriptText(SAY_FREE_1, pCreatureTarget); break;
                    case 1: DoScriptText(SAY_FREE_2, pCreatureTarget); break;
                    case 2: DoScriptText(SAY_FREE_3, pCreatureTarget); break;
                }

                ((Player*)pCaster)->KilledMonsterCredit(NPC_LURIELLE);
                pCreatureTarget->SetFactionTemporary(FACTION_FRIENDLY, TEMPFACTION_RESTORE_RESPAWN);
                pCreatureTarget->DeleteThreatList();
                pCreatureTarget->AttackStop(true);
                pCreatureTarget->GetMotionMaster()->MoveFleeing(pCaster, 7);
                pCreatureTarget->ForcedDespawn(7 * IN_MILLISECONDS);
            }
            return true;
        }
        case SPELL_SAMPLING_ENERGY:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                if (pCaster->GetTypeId() != TYPEID_PLAYER)
                    return true;

                ((Player*)pCaster)->KilledMonsterCredit(pCreatureTarget->GetEntry());
            }
            return true;
        }
        case SPELL_EXPOSE_RAZORTHORN_ROOT:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                if (pCreatureTarget->GetEntry() != NPC_RAZORTHORN_RAVAGER)
                    return true;

                if (GameObject* pMound = GetClosestGameObjectWithEntry(pCreatureTarget, GO_RAZORTHORN_DIRT_MOUND, 20.0f))
                {
                    if (pMound->GetRespawnTime() != 0)
                        return true;

                    pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_RAZORTHORN_ROOT, true);
                    pMound->SetLootState(GO_JUST_DEACTIVATED);
                }
            }
            return true;
        }
        case SPELL_MELODIOUS_RAPTURE:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                if (pCaster->GetTypeId() != TYPEID_PLAYER && pCreatureTarget->GetEntry() != NPC_DEEPRUN_RAT)
                    return true;

                pCreatureTarget->UpdateEntry(NPC_ENTHRALLED_DEEPRUN_RAT);
                pCreatureTarget->CastSpell(pCreatureTarget, SPELL_MELODIOUS_RAPTURE_VISUAL, false);
                pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, frand(0.5f, 3.0f), frand(M_PI_F * 0.8f, M_PI_F * 1.2f));

                ((Player*)pCaster)->KilledMonsterCredit(NPC_ENTHRALLED_DEEPRUN_RAT);
            }
            return true;
        }
    }

    return false;
}
开发者ID:aduosi1212,项目名称:scripts,代码行数:101,代码来源:spell_scripts.cpp


示例17: WaypointReached

 void WaypointReached(uint32 uiPointId) override
 {
     switch (uiPointId)
     {
         case 0:
             if (Player* pPlayer = GetPlayerForEscort())
                 DoScriptText(SAY_ESCORT_START, m_creature, pPlayer);
             break;
         case 14:
             DoScriptText(SAY_FIRST_STOP, m_creature);
             break;
         case 34:
             DoScriptText(SAY_SECOND_STOP, m_creature);
             SetRun();
             break;
         case 38:
             if (GameObject* pChest = GetClosestGameObjectWithEntry(m_creature, GO_ARKONARIN_CHEST, 5.0f))
                 pChest->Use(m_creature);
             m_creature->HandleEmote(EMOTE_ONESHOT_KNEEL);
             break;
         case 39:
             DoCastSpellIfCan(m_creature, SPELL_STRENGTH_ARKONARIN);
             break;
         case 40:
             m_creature->UpdateEntry(NPC_ARKONARIN);
             if (Player* pPlayer = GetPlayerForEscort())
                 m_creature->SetFacingToObject(pPlayer);
             m_bCanAttack = true;
             DoScriptText(SAY_FOUND_EQUIPMENT, m_creature);
             break;
         case 41:
             DoScriptText(SAY_ESCAPE_DEMONS, m_creature);
             m_creature->SummonCreature(NPC_JAEDENAR_LEGIONNAIRE, 5082.068f, -490.084f, 296.856f, 5.15f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_JAEDENAR_LEGIONNAIRE, 5084.135f, -489.187f, 296.832f, 5.15f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_JAEDENAR_LEGIONNAIRE, 5085.676f, -488.518f, 296.824f, 5.15f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             break;
         case 43:
             SetRun(false);
             break;
         case 104:
             DoScriptText(SAY_FRESH_AIR, m_creature);
             break;
         case 105:
             m_creature->SummonCreature(NPC_SPIRT_TREY, 4844.839f, -395.763f, 350.603f, 6.25f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             break;
         case 106:
             DoScriptText(SAY_TREY, m_creature);
             break;
         case 107:
             if (Creature* pTrey = m_creature->GetMap()->GetCreature(m_treyGuid))
                 AttackStart(pTrey);
             break;
         case 108:
             if (Player* pPlayer = GetPlayerForEscort())
                 m_creature->SetFacingToObject(pPlayer);
             DoScriptText(SAY_ESCORT_COMPLETE, m_creature);
             break;
         case 109:
             if (Player* pPlayer = GetPlayerForEscort())
                 pPlayer->GroupEventHappens(QUEST_ID_RESCUE_JAEDENAR, m_creature);
             SetRun();
             break;
     }
 }
开发者ID:520lly,项目名称:mangos-classic,代码行数:64,代码来源:felwood.cpp


示例18: UpdateAI

    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        // If we are < 30% cast enrage
        if (HealthBelowPct(30))
            DoCastSpellIfCan(m_creature, SPELL_ENRAGE, CAST_AURA_NOT_PRESENT);        

        // Mortal Wound
        if (m_uiMortalWoundTimer <= uiDiff)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_WOUND);
            m_uiMortalWoundTimer = urand(8000,12000);
        }
        else
            m_uiMortalWoundTimer -= uiDiff;

        // Sand Trap
        if (m_uiSandTrapTimer <= uiDiff)
        {
            if(!m_bIsSandTrap)
            {
                if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                {
					pTarget->CastSpell(pTarget, SPELL_SAND_TRAP, true, 0, 0, m_creature->GetObjectGuid());
                    m_bIsSandTrap = true;
                }
                m_uiSandTrapTimer = 5000;//3000;
            }
            else
            {
                if (GameObject* pTrap = GetClosestGameObjectWithEntry(m_creature, GO_SAND_TRAP, DEFAULT_VISIBILITY_INSTANCE))
                {
                    float fX, fY, fZ;
                    pTrap->GetPosition(fX, fY, fZ);

                    if (Creature* pTrigger = m_creature->SummonCreature(NPC_AHNQIRAJ_TRIGGER, fX, fY, fZ, 0, TEMPSUMMON_TIMED_DESPAWN, 2000))
                        pTrigger->CastSpell(pTrigger, SPELL_SAND_TRAP_EFFECT, false, 0, 0, m_creature->GetObjectGuid());

                    m_creature->SendObjectDeSpawnAnim(pTrap->GetObjectGuid());
                    pTrap->Delete();
                }
                m_uiSandTrapTimer = 5000;
                m_bIsSandTrap = false;
            }
        }
        else
            m_uiSandTrapTimer -= uiDiff;

        // Summon Player
        if (m_uiSummonPlayerTimer <= uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
            {
                float x, y, z;
                m_creature->GetPosition(x, y, z);

                float o = m_creature->GetOrientation();

                pTarget->NearTeleportTo(x + 9.f * cosf(o), y + 9.f * sinf(o), z + 2.f, 0);
            }
            m_uiSummonPlayerTimer = urand(8000,10000);
        }
        else
            m_uiSummonPlayerTimer -= uiDiff;

        // Trash
        if (m_uiTrashTimer <= uiDiff)
        {
            DoCastSpellIfCan(m_creature, SPELL_TRASH);
            m_uiTrashTimer = urand(4000,6000);
        }
        else
            m_uiTrashTimer -= uiDiff;

        // Wide Slash
        if (m_uiWideSlashTimer <= uiDiff)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_WIDE_SLASH);
            m_uiWideSlashTimer = urand(5000,10000);
        }
        else
            m_uiWideSlashTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
开发者ID:Phatcat,项目名称:mangos,代码行数:87,代码来源:boss_kurinnaxx.cpp


示例19: UpdateAI

    void UpdateAI(const uint32 uiDiff) override
    {
        if (m_uiTaskTimer)
        {
            if (m_uiTaskTimer <= uiDiff)
            {
                switch (m_uiTaskIndex)
                {
                        // fruit tasks
                    case 0:
                    case 1:
                    case 3:
                    case 6:
                    case 7:
                    {
                        uint8 uiIndex = urand(0, 2);
                        DoScriptText(aStillAtItFruits[uiIndex].iText, m_creature);
                        m_uiTaskOwnerEntry = aStillAtItFruits[uiIndex].uiOwnerEntry;

                        m_uiTaskTimer = 0;
                        m_uiActionTimer = 5000;
                        break;
                    }
                    // valve or fire task
                    case 2:
                    case 4:
                    case 5:
                    case 8:
                    {
                        uint8 uiIndex = urand(0, 1);
                        DoScriptText(aStillAtItMachines[uiIndex].iText, m_creature);
                        m_uiTaskOwnerEntry = aStillAtItMachines[uiIndex].uiOwnerEntry;

                        m_uiTaskTimer = 0;
                        m_uiActionTimer = 5000;
                        break;
                    }
                    // complete event
                    case 9:
                        DoScriptText(SAY_DISTILLATION_COMPLETE, m_creature);
                        if (GameObject* pPunch = GetClosestGameObjectWithEntry(m_creature, GO_THUNDERBREW_JUNGLE_PUNCH, 10.0f))
                        {
                            pPunch->SetRespawnTime(30);
                            pPunch->Refresh();
                        }
                        m_uiTaskTimer = 20000;
                        break;
                    case 10:
                        EnterEvadeMode();
                        m_uiTaskTimer = 0;
                        break;
                }
                ++m_uiTaskIndex;
            }
            else
                m_uiTaskTimer -= uiDiff;
        }

        // timer delay to allow player to complete the task
        if (m_uiActionTimer)
        {
            if (m_uiActionTimer <= uiDiff)
            {
                DoScriptText(SAY_DISTILLATION_FAIL, m_creature);
                EnterEvadeMode();
                m_uiActionTimer = 0;
            }
            else
                m_uiActionTimer -= uiDiff;
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        DoMeleeAttackIfReady();
    }
开发者ID:AwkwardDev,项目名称:mangos-d3,代码行数:76,代码来源:sholazar_basin.cpp


示例20: UpdateAI

    void UpdateAI(const uint32 diff)
    {
        if (bCanEat || bIsEating)
        {
            if (EatTimer < diff)
            {
                if (bCanEat && !bIsEating)
                {
                    if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid))
                    {
                        GameObject* pGo = pPlayer->GetGameObject(SPELL_PLACE_CARCASS);

                        // Workaround for broken function GetGameObject
                        if (!pGo)
                        {
                            if (SpellEntry const* pSpell = GetSpellStore()->LookupEntry(SPELL_PLACE_CARCASS))
                            {
                                if (SpellEffectEntry const * effect = pSpell->GetSpellEffect(EFFECT_INDEX_0))
                                {
                                    uint32 uiGameobjectEntry = effect->EffectMiscValue;

                                    pGo = GetClosestGameObjectWithEntry(pPlayer, uiGameobjectEntry, 2*INTERACTION_DISTANCE);
                                }
                            }
                        }

                        if (pGo)
                        {
                            if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
                                m_creature->GetMotionMaster()->MovementExpired();

                            m_creature->GetMotionMaster()->MoveIdle();
                            m_creature->StopMoving();

                            float fX, fY, fZ;
                            pGo->GetContactPoint(m_creature, fX, fY, fZ, CONTACT_DISTANCE);

                            m_creature->GetMotionMaster()->MovePoint(POINT_ID, fX, fY, fZ);
                        }
                    }
                    bCanEat = false;
                }
                else if (bIsEating)
                {
                    DoCastSpellIfCan(m_creature, SPELL_JUST_EATEN);
                    DoScriptText(SAY_JUST_EATEN, m_creature);

                    if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid))
                        pPlayer->KilledMonsterCredit(NPC_EVENT_PINGER, m_creature->GetObjectGuid());

                    Reset();
                    m_creature->GetMotionMaster()->Clear();
                }
            }
            else
                EatTimer -= diff;

            return;
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (CastTimer < diff)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_NETHER_BREATH);
            CastTimer = 5000;
        }else CastTimer -= diff;

        DoMeleeAttackIfReady();
    }
开发者ID:Calixa,项目名称:murlocs_434,代码行数:71,代码来源:shadowmoon_valley.cpp



注:本文中的GetClosestGameObjectWithEntry函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetCmd函数代码示例发布时间:2022-05-30
下一篇:
C++ GetClock函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap