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


C++ Pet::GetPetOwner方法代码示例

本文整理汇总了C++中Pet::GetPetOwner方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::GetPetOwner方法的具体用法?C++ Pet::GetPetOwner怎么用?C++ Pet::GetPetOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pet的用法示例。


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

示例1: OnLoad

    void OnLoad()
    {
        if (_unit->IsPet())
        {
            Pet* s = TO< Pet* >(_unit);
            Player* owner = s->GetPetOwner();

            float owner_bonus = static_cast<float>(owner->GetDamageDoneMod(SCHOOL_SHADOW) * 0.375f); // 37.5%
            s->BaseAttackType = SCHOOL_SHADOW; // Melee hits are supposed to do damage with the shadow school
            s->SetBaseAttackTime(MELEE, 1500); // Shadowfiend is supposed to do 10 attacks, sometimes it can be 11
            s->SetMinDamage(s->GetMinDamage() + owner_bonus);
            s->SetMaxDamage(s->GetMaxDamage() + owner_bonus);
            s->BaseDamage[0] += owner_bonus;
            s->BaseDamage[1] += owner_bonus;

            Unit* uTarget = s->GetMapMgr()->GetUnit(owner->GetTargetGUID());
            if ((uTarget != NULL) && isAttackable(owner, uTarget))
            {
                s->GetAIInterface()->AttackReaction(uTarget, 1);
                s->GetAIInterface()->setNextTarget(uTarget);
            }
        }
    }
开发者ID:lev1976g,项目名称:easywow,代码行数:23,代码来源:PetAISpells.cpp

示例2: FillTargetMap

void Spell::FillTargetMap(uint32 i)
{
	//Spell::prepare() has already a m_caster->IsInWorld() check so if now the caster is no more in world something bad happened.
	ARCEMU_ASSERT(m_caster->IsInWorld());

	uint32 TargetType = 0;
	TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetA[i], i);

	//never get info from B if it is 0 :P
	if(m_spellInfo->EffectImplicitTargetB[i] != 0)
		TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetB[i], i);

	if(TargetType & SPELL_TARGET_NOT_IMPLEMENTED)
		return;
	if(TargetType & SPELL_TARGET_NO_OBJECT)  //summon spells that appear infront of caster
	{
		HandleTargetNoObject();
		return;
	}


	//always add this guy :P
	if(!(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF | SPELL_TARGET_AREA_CURTARGET | SPELL_TARGET_AREA_CONE | SPELL_TARGET_OBJECT_SELF | SPELL_TARGET_OBJECT_PETOWNER)))
	{
		Object* target = m_caster->GetMapMgr()->_GetObject(m_targets.m_unitTarget);
		AddTarget(i, TargetType, target);
	}

	if(TargetType & SPELL_TARGET_OBJECT_SELF)
		AddTarget(i, TargetType, m_caster);
	if(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF))  //targetted aoe
		AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
	//TODO: arcemu, doesn't support summon slots?
	/*if (TargetType & SPELL_TARGET_OBJECT_CURTOTEMS && u_caster != NULL)
		for (uint32 i=1; i<5; ++i) //totem slots are 1, 2, 3, 4
			AddTarget(i, TargetType, u_caster->m_summonslot[i]);*/
	if(TargetType & SPELL_TARGET_OBJECT_CURPET && p_caster != NULL)
		AddTarget(i, TargetType, p_caster->GetSummon());
	if(TargetType & SPELL_TARGET_OBJECT_PETOWNER)
	{
		uint64 guid = m_targets.m_unitTarget;
		if(GET_TYPE_FROM_GUID(guid) == HIGHGUID_TYPE_PET)
		{
			Pet* p = m_caster->GetMapMgr()->GetPet(GET_LOWGUID_PART(guid));

			if(p != NULL)
				AddTarget(i, TargetType, p->GetPetOwner());
		}
	}
	//targets party, not raid
	if((TargetType & SPELL_TARGET_AREA_PARTY) && !(TargetType & SPELL_TARGET_AREA_RAID))
	{
		if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
			AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
		else
			AddPartyTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //players/pets/totems
	}
	if(TargetType & SPELL_TARGET_AREA_RAID)
	{
		if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
			AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
		else
			AddRaidTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets, (TargetType & SPELL_TARGET_AREA_PARTY) ? true : false); //players/pets/totems
	}
	if(TargetType & SPELL_TARGET_AREA_CHAIN)
		AddChainTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
	//target cone
	if(TargetType & SPELL_TARGET_AREA_CONE)
		AddConeTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);

	if(TargetType & SPELL_TARGET_OBJECT_SCRIPTED)
		AddScriptedOrSpellFocusTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
}
开发者ID:Selenah,项目名称:ArcEmu,代码行数:73,代码来源:SpellTarget.cpp

示例3: FillTargetMap

/// Fill the target map with the targets
/// the targets are specified with numbers and handled accordingly
void Spell::FillTargetMap(uint32 i)
{
    if(!m_caster->IsInWorld())
        return;

    uint32 TargetType = SPELL_TARGET_NONE;

    // Get our info from A regardless of nullity
    TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetA[i], i);

    //never get info from B if it is 0 :P
    if(m_spellInfo->EffectImplicitTargetB[i] != 0)
        TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetB[i], i);
    if(TargetType & SPELL_TARGET_NOT_IMPLEMENTED)
        return;
    if(TargetType & SPELL_TARGET_NO_OBJECT)  //summon spells that appear infront of caster
    {
        HandleTargetNoObject();
        return;
    }

    //always add this guy :P
    if(!(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF | SPELL_TARGET_AREA_CURTARGET | SPELL_TARGET_AREA_CONE | SPELL_TARGET_OBJECT_SELF | SPELL_TARGET_OBJECT_PETOWNER)))
    {
        Object* target = m_caster->GetMapMgr()->_GetObject(m_targets.m_unitTarget);
        AddTarget(i, TargetType, target);
    }

    if(TargetType & SPELL_TARGET_OBJECT_SELF)
        AddTarget(i, TargetType, m_caster);

    if(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF))  //targetted aoe
        AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
    if (TargetType & SPELL_TARGET_OBJECT_CURTOTEMS && u_caster != NULL)
    {
        std::vector<Creature*> m_totemList;
        u_caster->FillSummonList(m_totemList, SUMMON_TYPE_TOTEM);
        for(std::vector<Creature*>::iterator itr = m_totemList.begin(); itr != m_totemList.end(); itr++)
            AddTarget(i, TargetType, *itr);
    }

    if(TargetType & SPELL_TARGET_OBJECT_CURPET && p_caster != NULL)
        AddTarget(i, TargetType, p_caster->GetSummon());

    if(TargetType & SPELL_TARGET_OBJECT_PETOWNER)
    {
        uint64 guid = m_targets.m_unitTarget;
        if(GUID_HIPART(guid) == HIGHGUID_TYPE_PET)
        {
            Pet* p = m_caster->GetMapMgr()->GetPet(GUID_LOPART(guid));

            if(p != NULL)
                AddTarget(i, TargetType, p->GetPetOwner());
        }
    }

    //targets party, not raid
    if((TargetType & SPELL_TARGET_AREA_PARTY) && !(TargetType & SPELL_TARGET_AREA_RAID))
    {
        if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
            AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
        else
            AddPartyTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //players/pets/totems
    }

    if(TargetType & SPELL_TARGET_AREA_RAID)
    {
        if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
            AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
        else
            AddRaidTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets, (TargetType & SPELL_TARGET_AREA_PARTY) ? true : false); //players/pets/totems
    }

    if(TargetType & SPELL_TARGET_AREA_CHAIN)
        AddChainTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);

    //target cone
    if(TargetType & SPELL_TARGET_AREA_CONE)
        AddConeTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);

    if(TargetType & SPELL_TARGET_OBJECT_SCRIPTED)
        AddScriptedOrSpellFocusTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
}
开发者ID:WowDevs,项目名称:Sandshroud,代码行数:85,代码来源:SpellTarget.cpp


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