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

C++ GetTargetUnit函数代码示例

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

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



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

示例1: CheckCast

 SpellCastResult CheckCast()
 {
     Player* caster = GetCaster()->ToPlayer();
     if (GetTargetUnit())
         if (Unit* target = GetTargetUnit())
             if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target))
                 return SPELL_FAILED_BAD_TARGETS;
     return SPELL_CAST_OK;
 }
开发者ID:BlackWolfsDen,项目名称:Justicar-WoW,代码行数:9,代码来源:spell_paladin.cpp


示例2: CheckCast

 SpellCastResult CheckCast()
 {
     Player* caster = GetCaster()->ToPlayer();
     if (GetTargetUnit())
         if (Player* target = GetTargetUnit()->ToPlayer())
             if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target))
                 return SPELL_FAILED_BAD_TARGETS;
     return SPELL_CAST_OK;
 }
开发者ID:WingsEmulation,项目名称:WingsEMU,代码行数:9,代码来源:spell_priest.cpp


示例3: CheckTarget

            void CheckTarget(SpellEffIndex effIndex)
            {
                PreventHitDefaultEffect(EFFECT_0);
                if (!GetTargetUnit())
                    return;

                uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell;

                // let Rotface handle the cast - caster dies before this executes
                if (InstanceScript* script = GetTargetUnit()->GetInstanceScript())
                    if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE)))
                        rotface->CastSpell(GetTargetUnit(), triggered_spell_id, true, NULL, NULL, GetCaster()->GetGUID());
            }
开发者ID:Archives,项目名称:MMOCore,代码行数:13,代码来源:boss_rotface.cpp


示例4: CheckCast

            SpellCastResult CheckCast()
            {
                Player* caster = GetCaster()->ToPlayer();
                if (GetTargetUnit())
                    if (Player* target = GetTargetUnit()->ToPlayer())
						// Fix Penance after Mind Control in arena, 
						// probably bugged because of the crossfaction script
						if (caster->GetOTeam() != target->GetOTeam() && !caster->IsValidAttackTarget(target) 
							// AllowTwoSide.Interaction.Group will break this spell so
					        // set friendly also players in your party or raid group
							&& !caster->IsInRaidWith(target))
						    return SPELL_FAILED_BAD_TARGETS;
                return SPELL_CAST_OK;
            }
开发者ID:Laintime,项目名称:BattleArenas,代码行数:14,代码来源:spell_priest.cpp


示例5: FilterTargets

            void FilterTargets(std::list<Unit*>& unitList)
            {
                if (!GetCaster()->ToPlayer()->GetGroup())
                {
                    unitList.clear();
                    unitList.push_back(GetCaster());
                }
                else
                {
                    unitList.remove(GetTargetUnit());
                    std::list<Unit*> tempTargets;
                    for (std::list<Unit*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
                        if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr))
                            tempTargets.push_back(*itr);

                    if (tempTargets.empty())
                    {
                        unitList.clear();
                        FinishCast(SPELL_FAILED_DONT_REPORT);
                        return;
                    }

                    std::list<Unit*>::const_iterator it2 = tempTargets.begin();
                    std::advance(it2, urand(0, tempTargets.size() - 1));
                    unitList.clear();
                    unitList.push_back(*it2);
                }
            }
开发者ID:Frimost,项目名称:IceLands,代码行数:28,代码来源:spell_druid.cpp


示例6: HandleDummy

 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if (Unit* target = GetTargetUnit())
         if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
             // Make sure nobody else is channeling the same target
             if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER))
                 GetCaster()->CastSpell(target, SPELL_SCOURGING_CRYSTAL_CONTROLLER, true, GetCastItem());
 }
开发者ID:AwkwardDev,项目名称:TcMmaps,代码行数:8,代码来源:spell_quest.cpp


示例7: HandleForceCast

            void HandleForceCast(SpellEffIndex i)
            {
                Player * plr = GetHitPlayer();
                if (!plr)
                    return;

                plr->CastSpell(GetTargetUnit(), GetSpellInfo()->EffectTriggerSpell[i], true);     // Don't send m_originalCasterGUID param here or underlying
                PreventHitEffect(i);                                                                   // AureEffect::HandleAuraControlVehicle will fail on caster == target
            }
开发者ID:AwkwardDev,项目名称:StrawberryCore,代码行数:9,代码来源:boss_kologarn.cpp


示例8: HandleScript

        void HandleScript(SpellEffIndex /*eff*/)
        {
            Unit* target = GetTargetUnit();
            if (!target)
                return;

            target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            target->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND);
        }
开发者ID:krislley,项目名称:TrinityCore,代码行数:9,代码来源:boss_xt002.cpp


示例9: CheckTarget

 SpellCastResult CheckTarget()
 {
     Unit* target = GetTargetUnit();
     if(!target)
         return SPELL_FAILED_BAD_TARGETS;
     if(target->GetEntry() == NPC_OZZIE_TOGGLEVOLT || target->GetEntry() == NPC_MILLI_FEATHERWHISTLE || target->GetEntry() == NPC_TOG_RUSTSPROCKET)
         return SPELL_CAST_OK;
     return SPELL_FAILED_BAD_TARGETS;
 }
开发者ID:StarCore,项目名称:MythCore,代码行数:9,代码来源:ironforge.cpp


示例10: CheckCast

        SpellCastResult CheckCast()
        {
            if (Player* caster = GetCaster()->ToPlayer())
            {
                // Death Grip should not be castable while jumping/falling
                if (caster->HasUnitState(UNIT_STATE_JUMPING) || caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
                    return SPELL_FAILED_MOVING;

                float x = GetTargetUnit()->GetPositionX();
                float y = GetTargetUnit()->GetPositionY();
                float z = GetTargetUnit()->GetPositionZ();

                // Death Grip's minimum range set to 8 yards in PvE
                if (GetTargetUnit()->GetTypeId() != TYPEID_PLAYER)
                    if (caster->GetDistance(x, y, z) < 8)
                        return SPELL_FAILED_TOO_CLOSE;
            }
            return SPELL_CAST_OK;
        }
开发者ID:Laintime,项目名称:BattleArenas,代码行数:19,代码来源:spell_dk.cpp


示例11: CheckTarget

        SpellCastResult CheckTarget()
        {
            Unit* target = GetTargetUnit();
            if(!target || target->GetTypeId() != TYPEID_PLAYER || target->isAlive())
                return SPELL_FAILED_BAD_TARGETS;
            else if(GetCaster()->ToPlayer()->InArena())
                return SPELL_FAILED_NOT_IN_ARENA;

            return SPELL_CAST_OK;
        }
开发者ID:ahuraa,项目名称:ServerMythCore,代码行数:10,代码来源:spell_dk.cpp


示例12: CheckRequirement

            SpellCastResult CheckRequirement()
            {
                if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
                    return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct

                if (!GetTargetUnit())
                    return SPELL_FAILED_BAD_TARGETS;

                return SPELL_CAST_OK;
            }
开发者ID:AwkwardDev,项目名称:TcMmaps,代码行数:10,代码来源:dustwallow_marsh.cpp


示例13: CheckTarget

            SpellCastResult CheckTarget()
            {
                if (IsVampire(GetTargetUnit()))
                {
                    SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES);
                    return SPELL_FAILED_CUSTOM_ERROR;
                }

                return SPELL_CAST_OK;
            }
开发者ID:VistaWoW,项目名称:VistaTC,代码行数:10,代码来源:boss_blood_queen_lana_thel.cpp


示例14: CheckRequirement

            SpellCastResult CheckRequirement()
            {
                if(!GetCaster()->HasAura(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_1)))
                    return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct

                if(!GetTargetUnit())
                    return SPELL_FAILED_BAD_TARGETS;

                return SPELL_CAST_OK;
            }
开发者ID:StarCore,项目名称:MythCore,代码行数:10,代码来源:dustwallow_marsh.cpp


示例15: HandleTriggerMissile

 void HandleTriggerMissile(SpellEffIndex effIndex)
 {
     PreventHitDefaultEffect(effIndex);
     Unit* caster = GetCaster();
     Unit* target = GetTargetUnit();
     if (caster && target)
     {
         uint32 id = uint32(caster->GetMap()->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 61912 : 63494);
         caster->CastSpell(target, id, true);
     }
 }
开发者ID:AwkwardDev,项目名称:TrinityCore,代码行数:11,代码来源:boss_assembly_of_iron.cpp


示例16: FilterTargets

            void FilterTargets(std::list<Unit*>& unitList)
            {
                unitList.remove(GetTargetUnit());
                std::list<Unit*> tempTargets;
                std::list<Unit*>::iterator end = unitList.end(), itr = unitList.begin();
                for (; itr != end; ++itr)
                    if (GetCaster()->IsInRaidWith(*itr))
                        tempTargets.push_back(*itr);

                itr = tempTargets.begin();
                std::advance(itr, urand(0, tempTargets.size()-1));
                unitList.clear();
                unitList.push_back(*itr);
            }
开发者ID:LiteCrowd,项目名称:SkyFireEMU,代码行数:14,代码来源:spell_druid.cpp


示例17: HandleScriptEffect

 void HandleScriptEffect(SpellEffIndex /*effIndex*/)
 {
     if (Unit * target = GetHitUnit())
     {
         target->CastSpell(target, GetEffectValue(), true);
         target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, true);
         // there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that
         // it's more likely that on on retail it's possible to call target selector based on dbc values
         // anyways, we're using GetTargetUnit() here and it's ok
         if (Unit * ally = GetTargetUnit())
         {
             target->CastSpell(ally, GetEffectValue(), true);
             target->CastSpell(ally, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_0), true);
         }
     }
 }
开发者ID:Bootz,项目名称:S6.RO.WoW,代码行数:16,代码来源:spell_hunter.cpp


示例18: FilterTargets

            void FilterTargets(std::list<Unit*>& unitList)
            {
                totalTargets = NULL;
                for (std::list<Unit*>::iterator itr = unitList.begin() ; itr != unitList.end(); ++itr)
                {
                    Unit *target = (*itr);
                    if (!target)
                        continue;

                    if (!target->IsWithinDist(GetTargetUnit(), 10.0f))
                    {
                        unitList.remove(target);
                        continue;
                    }

                    totalTargets++;
                }
            }
开发者ID:BoThay,项目名称:ArkCORE,代码行数:18,代码来源:boss_koralon.cpp


示例19: CheckCast

        SpellCastResult CheckCast()
        {
            if (Player* caster = GetCaster()->ToPlayer())
            {
                if (Pet* pet = caster->GetPet())
                {
                    if (!pet->isAlive())
                        return SPELL_FAILED_NO_PET;

                    if (pet->HasUnitState(UNIT_STATE_STUNNED) || caster->HasUnitState(UNIT_STATE_STUNNED))
                        return SPELL_FAILED_STUNNED;

                    if (!pet->IsWithinLOS(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()))
                        return SPELL_FAILED_LINE_OF_SIGHT;

                    if (Unit* target = GetTargetUnit())
                    {
                        if (!pet->IsWithinLOS(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()))
                            return SPELL_FAILED_LINE_OF_SIGHT;
                    }
                }
            }
            return SPELL_CAST_OK;
        }
开发者ID:tinymac,项目名称:123,代码行数:24,代码来源:spell_hunter.cpp


示例20: FilterTargets

 void FilterTargets(std::list<Unit*>& unitList)
 {
     unitList.remove(GetTargetUnit());
 }
开发者ID:aedansilver,项目名称:CzechFunCore,代码行数:4,代码来源:spell_warlock.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetTeam函数代码示例发布时间:2022-05-30
下一篇:
C++ GetTargetApplication函数代码示例发布时间: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