当前位置: 首页>>代码示例>>C++>>正文


C++ GetTargetUnit函数代码示例

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


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


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