當前位置: 首頁>>代碼示例>>C++>>正文


C++ AssistPlayerInCombat函數代碼示例

本文整理匯總了C++中AssistPlayerInCombat函數的典型用法代碼示例。如果您正苦於以下問題:C++ AssistPlayerInCombat函數的具體用法?C++ AssistPlayerInCombat怎麽用?C++ AssistPlayerInCombat使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AssistPlayerInCombat函數的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GetScript

void SmartAI::MoveInLineOfSight(Unit* who)
{
    if (!who)
        return;
    
    GetScript()->OnMoveInLineOfSight(who);
    
    if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who))
        return;

    if (!CanAIAttack(who))
        return;
    
    if (!me->canStartAttack(who, false))
        return;

    if (me->IsHostileTo(who))
    {
        float fAttackRadius = me->GetAttackDistance(who);
        if (me->IsWithinDistInMap(who, fAttackRadius) && me->IsWithinLOSInMap(who))
        {
            if (!me->getVictim())
            {
                who->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
                AttackStart(who);
            }
            else/* if (me->GetMap()->IsDungeon())*/
            {
                who->SetInCombatWith(me);
                me->AddThreat(who, 0.0f);
            }
        }
    }
}
開發者ID:AdrElecTro,項目名稱:TrinityCore,代碼行數:34,代碼來源:SmartAI.cpp

示例2: MoveInLineOfSight

void npc_escortAI::MoveInLineOfSight(Unit* pWho)
{
    if (pWho->isTargetableForAttack() && pWho->isInAccessablePlaceFor(m_creature))
    {
        // AssistPlayerInCombat can start attack, so return if true
        if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(pWho))
            return;

        if (!m_creature->CanInitiateAttack())
            return;

        if (!m_creature->CanFly() && m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE)
            return;

        if (m_creature->IsHostileTo(pWho))
        {
            float fAttackRadius = m_creature->GetAttackDistance(pWho);
            if (m_creature->IsWithinDistInMap(pWho, fAttackRadius) && m_creature->IsWithinLOSInMap(pWho))
            {
                if (!m_creature->getVictim())
                {
                    pWho->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
                    AttackStart(pWho);
                }
                else if (m_creature->GetMap()->IsDungeon())
                {
                    pWho->SetInCombatWith(m_creature);
                    m_creature->AddThreat(pWho);
                }
            }
        }
    }
}
開發者ID:Naincapable,項目名稱:scriptdev2,代碼行數:33,代碼來源:escort_ai.cpp

示例3: MoveInLineOfSight

void FollowerAI::MoveInLineOfSight(Unit* pWho)
{
    if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && pWho->isInAccessablePlaceFor(m_creature))
    {
        if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(pWho))
            return;

       // if (!m_creature->canFly() && m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE)
         //   return;

        if (m_creature->IsHostileTo(pWho))
        {
            float fAttackRadius = m_creature->GetAttackDistance(pWho);
            if (m_creature->IsWithinDistInMap(pWho, fAttackRadius) && m_creature->IsWithinLOSInMap(pWho))
            {
                if (!m_creature->getVictim())
                {
                    pWho->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
                    AttackStart(pWho);
                }
                else if (m_creature->GetMap()->IsDungeon())
                {
                    pWho->SetInCombatWith(m_creature);
                    m_creature->AddThreat(pWho);
                }
            }
        }
    }
}
開發者ID:sd0,項目名稱:scriptdevzero,代碼行數:29,代碼來源:follower_ai.cpp

示例4: MoveInLineOfSight

void npc_escortAI::MoveInLineOfSight(Unit* who)
{
    if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
    {
        if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(who))
            return;

        if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
            return;

        if (me->IsHostileTo(who))
        {
            float fAttackRadius = me->GetAttackDistance(who);
            if (me->IsWithinDistInMap(who, fAttackRadius) && me->IsWithinLOSInMap(who))
            {
                if (!me->getVictim())
                {
                    who->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
                    AttackStart(who);
                }
                else if (me->GetMap()->IsDungeon())
                {
                    who->SetInCombatWith(me);
                    me->AddThreat(who, 0.0f);
                }
            }
        }
    }
}
開發者ID:S-proyect,項目名稱:Emu-S,代碼行數:29,代碼來源:ScriptedEscortAI.cpp

示例5: CheckForHelp

void UnitAI::MoveInLineOfSight(Unit* who)
{
    if (!HasReactState(REACT_AGGRESSIVE))
        return;

    if (!m_unit->CanFly() && m_unit->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
        return;

    if (m_unit->getVictim() && !m_unit->GetMap()->IsDungeon())
        return;

    if (m_unit->IsNeutralToAll())
        return;

    if (who->GetObjectGuid().IsCreature() && who->isInCombat())
        CheckForHelp(who, m_unit, 10.0);

    if (m_unit->CanInitiateAttack() && who->isInAccessablePlaceFor(m_unit))
    {
        if (AssistPlayerInCombat(who))
            return;

        if (m_unit->CanAttackOnSight(who))
            DetectOrAttack(who);
    }
}
開發者ID:michalpolko,項目名稱:cmangos,代碼行數:26,代碼來源:UnitAI.cpp

示例6: MoveInLineOfSight

void FollowerAI::MoveInLineOfSight(Unit* pWho)
{
    if (!me->HasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlaceFor(me))
    {
        if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(pWho))
            return;

        if (!me->canFly() && me->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE)
            return;

        if (me->IsHostileTo(pWho))
        {
            float fAttackRadius = me->GetAttackDistance(pWho);
            if (me->IsWithinDistInMap(pWho, fAttackRadius) && me->IsWithinLOSInMap(pWho))
            {
                if (!me->getVictim())
                {
                    pWho->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
                    AttackStart(pWho);
                }
                else if (me->GetMap()->IsDungeon())
                {
                    pWho->SetInCombatWith(me);
                    me->AddThreat(pWho, 0.0f);
                }
            }
        }
    }
}
開發者ID:Zakamurite,項目名稱:TrilliumEMU,代碼行數:29,代碼來源:ScriptedFollowerAI.cpp

示例7: MoveInLineOfSight

void FollowerAI::MoveInLineOfSight(Unit* who)
{
    if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
    {
        if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who))
            return;

        if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
            return;

        if (me->IsHostileTo(who))
        {
            float fAttackRadius = me->GetAttackDistance(who);
            if (me->IsWithinDistInMap(who, fAttackRadius) && me->IsWithinLOSInMap(who))
            {
                if (!me->GetVictim())
                {
                    // Clear distracted state on combat
                    if (me->HasUnitState(UNIT_STATE_DISTRACTED))
                    {
                        me->ClearUnitState(UNIT_STATE_DISTRACTED);
                        me->GetMotionMaster()->Clear();
                    }

                    AttackStart(who);
                }
                else if (me->GetMap()->IsDungeon())
                {
                    who->SetInCombatWith(me);
                    me->AddThreat(who, 0.0f);
                }
            }
        }
    }
}
開發者ID:FixCore,項目名稱:335source,代碼行數:35,代碼來源:ScriptedFollowerAI.cpp

示例8: MoveInLineOfSight

void npc_escortAI::MoveInLineOfSight(Unit* pWho)
{
    if (!me->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlacefor(me))
    {
        if (!HasEscortState(STATE_ESCORT_ESCORTING)) // Xpearlis: No escort state, so ignore enemy 
            return;

        if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(pWho))
            return;

        if (!me->CanFly() && me->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE)
            return;

        if (me->IsHostileTo(pWho) && IsActiveAttacker)
        {
            float fAttackRadius = me->GetAttackDistance(pWho);
            if (me->IsWithinDistInMap(pWho, fAttackRadius) && me->IsWithinLOSInMap(pWho))
            {
                if (!me->getVictim())
                {
                    pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH);
                    AttackStart(pWho);
                }
                else if (me->GetMap()->IsDungeon())
                {
                    pWho->SetInCombatWith(me);
                    me->AddThreat(pWho, 0.0f);
                }
            }
        }
    }
}
開發者ID:Blumfield,項目名稱:ptc2,代碼行數:32,代碼來源:escort_ai.cpp

示例9: GetScript

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

    GetScript()->OnMoveInLineOfSight(who);

    if (AssistPlayerInCombat(who))
        return;

    CreatureAI::MoveInLineOfSight(who);
}
開發者ID:DraenorCore,項目名稱:DraenorCore,代碼行數:12,代碼來源:SmartAI.cpp

示例10: MoveInLineOfSight

void FollowerAI::MoveInLineOfSight(Unit* who)
{
    if (me->GetVictim())
        return;

    if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack(true, me) && who->isInAccessiblePlaceFor(me))
        if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who))
            return;

    if (me->CanStartAttack(who))
        AttackStart(who);
}
開發者ID:Matt-One,項目名稱:azerothcore-wotlk,代碼行數:12,代碼來源:ScriptedFollowerAI.cpp

示例11: GetScript

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

    GetScript()->OnMoveInLineOfSight(who);

    if (me->GetVictim())
        return;

    if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who))
        return;

    if (me->CanStartAttack(who))
        AttackStart(who);
}
開發者ID:Matt-One,項目名稱:azerothcore-wotlk,代碼行數:16,代碼來源:SmartAI.cpp

示例12: GetScript

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

    GetScript()->OnMoveInLineOfSight(who);

    if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who))
        return;

    if (!CanAIAttack(who))
        return;

    if (!me->CanStartAttack(who, false))
        return;

    if (me->IsHostileTo(who))
    {
        float fAttackRadius = me->GetAttackDistance(who);
        if (me->IsWithinDistInMap(who, fAttackRadius) && me->IsWithinLOSInMap(who))
        {
            if (!me->GetVictim())
            {
                // Clear distracted state on combat
                if (me->HasUnitState(UNIT_STATE_DISTRACTED))
                {
                   me->ClearUnitState(UNIT_STATE_DISTRACTED);
                   me->GetMotionMaster()->Clear();
                }

                AttackStart(who);
            }
            else/* if (me->GetMap()->IsDungeon())*/
            {
                who->SetInCombatWith(me);
                me->AddThreat(who, 0.0f);
            }
        }
    }
}
開發者ID:Palabola,項目名稱:WoD,代碼行數:40,代碼來源:SmartAI.cpp


注:本文中的AssistPlayerInCombat函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。