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


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

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


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

//.pet create
bool ChatHandler::HandlePetCreateCommand(const char* args, WorldSession* m_session)
{
    Player* selected_player = GetSelectedPlayer(m_session, true, true);
    if (selected_player == nullptr)
        return true;

    if (!*args)
        return false;

    uint32 entry = atol(args);
    CreatureProperties const* creature_proto = sMySQLStore.GetCreatureProperties(entry);
    if (creature_proto == nullptr)
    {
        RedSystemMessage(m_session, "Creature Entry: %u is not a valid endtry!", entry);
        return true;
    }

    selected_player->DismissActivePets();
    selected_player->RemoveFieldSummon();

    float followangle = -M_PI_FLOAT * 2;
    LocationVector vector(selected_player->GetPosition());
    vector.x += (3 * (cosf(followangle + selected_player->GetOrientation())));
    vector.y += (3 * (sinf(followangle + selected_player->GetOrientation())));

    Pet* pet = objmgr.CreatePet(entry);
    if (!pet->CreateAsSummon(entry, creature_proto, nullptr, selected_player, nullptr, 1, 0, &vector, true))
    {
        pet->DeleteMe();
        return true;
    }

    pet->GetAIInterface()->SetUnitToFollowAngle(followangle);

    if (selected_player != m_session->GetPlayer())
    {
        sGMLog.writefromsession(m_session, "used created pet with entry %u for player %s", entry, selected_player->GetName());
        BlueSystemMessage(m_session, "Pet with entry %u created for player %s.", entry, selected_player->GetName());
        BlueSystemMessage(selected_player->GetSession(), "%s created a pet with entry %u for you.", m_session->GetPlayer()->GetName(), entry);

    }
    else
    {
        BlueSystemMessage(m_session, "Pet with entry %u created.", entry);
    }

    return true;
}
开发者ID:master312,项目名称:AscEmu,代码行数:49,代码来源:PetCommands.cpp


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