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


C++ GetAI函数代码示例

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


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

示例1: GetAI

void Player::SetAutoPilotActive(bool on)
{
	IAI *ai = GetAI();
	
	AutoPilotActive = on;
	ai->SetActive(on);
	/*AIAutoPilotStrategy *auto_pilot = ai->GetAutoPilotStrategy();
	if (auto_pilot)
	{
		auto_pilot->SetActive(on);		
	}*/
}
开发者ID:beorc,项目名称:flare_star,代码行数:12,代码来源:Player.cpp

示例2: GetAI

//----------------------------------------------------------------------------
//              
//	ROUTINE:	CAIHumanStrategyShootStream::CalculateStreamTime()
//              
//	PURPOSE:	Calculate how long we should next fire a stream for.
//              
//----------------------------------------------------------------------------
void CAIHumanStrategyShootStream::CalculateStreamTime()
{
	CWeapon* pWeapon = GetAI()->GetCurrentWeapon();

	AIASSERT( pWeapon && pWeapon->GetWeaponData(), m_pAIHuman->GetHOBJECT(), "" );
	if ( !pWeapon || ( pWeapon && !pWeapon->GetWeaponData()) )
	{
		return;
	}

	m_flStreamTime = g_pLTServer->GetTime() + GetRandom(pWeapon->GetWeaponData()->fAIMinBurstInterval, pWeapon->GetWeaponData()->fAIMaxBurstInterval);
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:19,代码来源:AIHumanStrategyShootStream.cpp

示例3: GetAI

void PlayerbotDruidAI::_DoNextPVECombatManeuverHeal(Unit* /*pTarget*/)
{
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

    uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();

    Player *m_bot = GetPlayerBot();

    if (TREE_OF_LIFE > 0 && !m_bot->HasAura(TREE_OF_LIFE, EFFECT_INDEX_0))
        ai->CastSpell(TREE_OF_LIFE, *m_bot);

    if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
    {
        m_bot->RemoveAurasDueToSpell(CAT_FORM_1);
        //ai->TellMaster("FormClearCat");
        return;
    }
    if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
    {
        m_bot->RemoveAurasDueToSpell(BEAR_FORM_1);
        //ai->TellMaster("FormClearBear");
        return;
    }
    if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
    {
        m_bot->RemoveAurasDueToSpell(DIRE_BEAR_FORM_1);
        //ai->TellMaster("FormClearDireBear");
        return;
    }
    // spellcasting form, but disables healing spells so it's got to go
    if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
    {
        m_bot->RemoveAurasDueToSpell(MOONKIN_FORM_1);
        //ai->TellMaster("FormClearMoonkin");
        return;
    }

    if (ai->GetHealthPercent() <= 60)
    {
        HealTarget(m_bot);
        return;
    }
    if (masterHP <= 50)
    {
        HealTarget(GetMaster());
        return;
    }
    // TODO: err... what about the other teammates?

    DruidSpellCombat = 0;
}
开发者ID:AngelX,项目名称:portal,代码行数:53,代码来源:PlayerbotDruidAI.cpp

示例4: switch

void CAIHumanStateLaunch::Update()
{
	super::Update();

	switch( m_eStateStatus )
	{
		case kSStat_Initialized:
			{
				// Setup the AI Movement to launch AI.

				GetAI()->GetAIMovement()->SetMovementDest( m_vLaunchDest );
				GetAI()->GetAIMovement()->FaceDest( LTTRUE );
				GetAI()->GetAIMovement()->SetSpeed( m_fLaunchSpeed );
				GetAI()->GetAIMovement()->SetParabola( m_fLaunchHeight );
				GetAI()->GetAIMovement()->IgnoreVolumes( LTTRUE );

				m_eStateStatus = kSStat_Moving;
			}
			break;

		case kSStat_Moving:
			if( GetAI()->GetAIMovement()->IsDone() )
			{
				m_eStateStatus = kSStat_StateComplete;
			}
			break;
	}
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:28,代码来源:AIHumanStateLaunch.cpp

示例5: if

LTBOOL CAIPoodleStrategyFollowPath::UpdateMoveTo(CAIPathWaypoint* pWaypoint)
{
	if ( m_AIMovement.IsSet() )
	{
		if ( !m_AIMovement.Update() )
		{
            return LTFALSE;
		}

		if ( m_AIMovement.IsDone() )
		{
			m_pPath->IncrementWaypointIndex();
		}
	}
	else if ( m_AIMovement.IsUnset() || m_AIMovement.IsDone() )
	{
		if  ( !GetAI()->FacePos(pWaypoint->GetArgumentVector1()) )
		{
			// If we're not yet facing the point, don't move, and start to face it.
			// We need to clear in order to disable the steerings.

			GetAI()->Stop();
		}
		else
		{
			// We're facing the point, so we can start moving.

			SetMovement(m_eMovement);
			m_AIMovement.Set(pWaypoint->GetArgumentVector1());
		}
	}
	else // Stuck
	{

	}

	GetAnimator()->SetMain(m_eMovement);

    return LTTRUE;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:40,代码来源:AIAnimalStrategy.cpp

示例6: CalculateStreamTime

//----------------------------------------------------------------------------
//              
//	ROUTINE:	CAIHumanStrategyShootStream::UpdateAiming()
//              
//	PURPOSE:	
//              
//----------------------------------------------------------------------------
/*virtual*/ void CAIHumanStrategyShootStream::UpdateAiming(HOBJECT hTarget)
{
	if ( m_flStreamTime < g_pLTServer->GetTime() )
	{
		// Don't calculate new stream time until finished firing animation.
		if( !GetAnimationContext()->IsLocked() )
		{
			CalculateStreamTime();
		}

		Aim();
	}
	else
	{
		// We're done waiting, fire if we're at a reasonable angle

		if ( m_bIgnoreFOV )
		{
			Fire();
		}
		else
		{
			LTVector vTargetPos;
			g_pLTServer->GetObjectPos(hTarget, &vTargetPos);

			LTVector vDir = vTargetPos - GetAI()->GetPosition();
			vDir.y = 0.0f;
			vDir.Normalize();

			if ( vDir.Dot(GetAI()->GetTorsoForward()) < 0.70f )
			{
				Aim();
			}
			else
			{
				Fire();
			}
		}
	}
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:47,代码来源:AIHumanStrategyShootStream.cpp

示例7: GetAI

LTBOOL CAIHelicopterStrategyShoot::Update()
{
	if ( !CAIHelicopterStrategy::Update() )
	{
        return LTFALSE;
	}

	if ( !m_hTarget )
	{
        return LTFALSE;
	}

	for ( int iWeapon = 0 ; iWeapon < GetAI()->GetNumWeapons() ; iWeapon++ )
	{
		CWeapon* pWeapon = GetAI()->GetWeapon(iWeapon);

		if ( m_aBursts[iWeapon].m_bFired && m_aBursts[iWeapon].m_bActive )
		{
			UpdateFiring(pWeapon, &m_aBursts[iWeapon]);

			m_aBursts[iWeapon].m_bFired = LTFALSE;
		}
		else
		{
			UpdateAiming(pWeapon, &m_aBursts[iWeapon]);
		}

		if ( 0 == pWeapon->GetAmmoInClip() )
		{
            pWeapon->ReloadClip(LTFALSE);
		}

		if ( 0 == pWeapon->GetParent()->GetAmmoCount(pWeapon->GetAmmoId()) )
		{
			pWeapon->GetParent()->AddAmmo(pWeapon->GetAmmoId(), 999999);
		}
	}

    return LTTRUE;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:40,代码来源:AIVehicleStrategy.cpp

示例8: GetAI

void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

    switch (ai->GetScenarioType())
    {
        case PlayerbotAI::SCENARIO_DUEL:
            ai->CastSpell(MOONFIRE);
            return;
        default:
            break;
    }

    uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();

    Player *m_bot = GetPlayerBot();
    Unit* pVictim = pTarget->getVictim();

    if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_HEAL) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
        SpellSequence = DruidHeal;
    else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
        SpellSequence = DruidCombat;
    else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_TANK)
        SpellSequence = DruidTank;
    else
        SpellSequence = DruidSpell;

    switch (SpellSequence)
    {
        case DruidTank: // Its now a tank druid!
            //ai->TellMaster("DruidTank");
            _DoNextPVECombatManeuverBear(pTarget);
            break;

        case DruidSpell:
            //ai->TellMaster("DruidSpell");
            _DoNextPVECombatManeuverSpellDPS(pTarget);
            break;

        case DruidHeal:
            //ai->TellMaster("DruidHeal");
            _DoNextPVECombatManeuverHeal(pTarget);
            break;

        case DruidCombat:
            //ai->TellMaster("DruidCombat");
            _DoNextPVECombatManeuverMeleeDPS(pTarget);
            break;
    }
} // end DoNextCombatManeuver
开发者ID:AngelX,项目名称:portalR2,代码行数:52,代码来源:PlayerbotDruidAI.cpp

示例9: GetAI

void PlayerbotWarriorAI::DoNonCombatActions()
{
    PlayerbotAI* ai = GetAI();
    Player* m_bot = GetPlayerBot();
    Player* m_master = ai->GetLeader();

    if (m_bot->getRole() == WarriorProtection && ai->Cast(DEFENSIVE_STANCE))
        return;
    else if (ai->Cast(BERSERKER_STANCE))
        return;
    else if (ai->Cast(BATTLE_STANCE))
        return;
}
开发者ID:Archives,项目名称:easy-mangos,代码行数:13,代码来源:PlayerbotWarriorAI.cpp

示例10: GetAI

bool PlayerbotMageAI::BuffPlayer(Player* target)
{
    PlayerbotAI * ai = GetAI();
    Pet * pet = target->GetPet();

    if (pet && pet->getPowerType() == POWER_MANA && ai->Buff(ARCANE_INTELLECT, pet))
        return true;

    if (ARCANE_INTELLECT)
        return ai->Buff(ARCANE_INTELLECT, target);
    else
        return false;
}
开发者ID:Archives,项目名称:portal,代码行数:13,代码来源:PlayerbotMageAI.cpp

示例11: GetPlayerBot

void PlayerbotWarriorAI::DoNonCombatActions()
{
    Player * m_bot = GetPlayerBot();
    if (!m_bot)
        return;

    // TODO (by Runsttren): check if shout aura bot has is casted by this bot, 
    // otherwise cast other useful shout
    // If the bot is protect talented, she/he needs stamina not attack power.
    // With stance change can the shout change to. 
    // Inserted line to battle shout m_bot->HasAura( COMMANDING_SHOUT, 0 )
    // Natsukawa
    if( ( (COMMANDING_SHOUT>0 && !m_bot->HasAura( COMMANDING_SHOUT, 0 )) ||
        (BATTLE_SHOUT>0 && !m_bot->HasAura( BATTLE_SHOUT, 0 )) ) && 
        GetAI()->GetRageAmount()<10 && BLOODRAGE>0 && !m_bot->HasAura( BLOODRAGE, 0 ) )
    {
        // we do have a useful shout, no rage coming but can cast bloodrage... do it
        GetAI()->CastSpell( BLOODRAGE, *m_bot );
    }
    else if( COMMANDING_SHOUT>0 && !m_bot->HasAura( COMMANDING_SHOUT, 0 ) )
    {
        // use commanding shout now
        GetAI()->CastSpell( COMMANDING_SHOUT, *m_bot );
    }
    else if( BATTLE_SHOUT>0 && !m_bot->HasAura( BATTLE_SHOUT, 0 ) && !m_bot->HasAura( COMMANDING_SHOUT, 0 ) )
    {
        // use battle shout
        GetAI()->CastSpell( BATTLE_SHOUT, *m_bot );
    }

    // hp check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    Item* pItem = GetAI()->FindFood();

    if (pItem != NULL && GetAI()->GetHealthPercent() < 30)
    {
        GetAI()->TellMaster("I could use some food.");
        GetAI()->UseItem(*pItem);
        GetAI()->SetIgnoreUpdateTime(30);
        return;
    }
} // end DoNonCombatActions
开发者ID:mbb1978,项目名称:mangos,代码行数:44,代码来源:PlayerbotWarriorAI.cpp

示例12: GetAI

void PlayerbotRogueAI::DoNonCombatActions()
{
    PlayerbotAI *ai = GetAI();
    Player *m_bot = GetPlayerBot();
    if (!m_bot || !ai || m_bot->isDead()) { return; }

    //If Casting or Eating/Drinking return
    if (m_bot->hasUnitState(UNIT_STAT_CASTING)) { return; }
    if (m_bot->getStandState() == UNIT_STAND_STATE_SIT) { return; }

    //Buff Up
    if (ChangeWeaponEnchants()) { return; }
} //end DoNonCombatActions
开发者ID:Mferrill,项目名称:BotCore,代码行数:13,代码来源:PlayerbotRogueAI.cpp

示例13: GetAI

void PlayerbotShamanAI::DoNonCombatActions()
{
    PlayerbotAI *ai = GetAI();
    Player *m_bot = GetPlayerBot();
    if (!m_bot || !ai || m_bot->isDead()) {
        return;
    }

    //If Casting or Eating/Drinking return
    if (m_bot->HasUnitState(UNIT_STATE_CASTING)) {
        return;
    }
    if (m_bot->getStandState() == UNIT_STAND_STATE_SIT) {
        return;
    }

    //buff and heal raid
    if (DoSupportRaid(m_bot)) {
        return;
    }

    //heal pets and bots
    Unit *target = DoSelectLowestHpFriendly(40, 1000);
    if (target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth())) {
        return;
    }

    //Buffs
    if (ChangeWeaponEnchants()) {
        return;
    }
    if (CastSpell(WATER_SHIELD,m_bot)) {
        return;
    }
    if (CastSpell(EARTH_SHIELD,m_bot)) {
        return;
    }

    //mana/hp check
    //Don't bother with eating, if low on hp, just let it heal themself
    if (m_bot->getRace() == (uint8) RACE_UNDEAD_PLAYER && ai->GetHealthPercent() < 75 && CastSpell(R_CANNIBALIZE,m_bot)) {
        return;
    }
    if (m_bot->GetHealth() < m_bot->GetMaxHealth() && CastSpell(LESSER_HEAL,m_bot)) {
        return;
    }
    if (ai->GetManaPercent() < 50) {
        ai->Feast();
    }

} //end DoNonCombatActions
开发者ID:Crash911,项目名称:RaptoredSkyFire,代码行数:51,代码来源:PlayerbotShamanAI.cpp

示例14: GetAI

void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

    switch (ai->GetScenarioType())
    {
    case PlayerbotAI::SCENARIO_DUEL:
        ai->CastSpell(MOONFIRE);
        return;
    }

    uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();

    Player *m_bot = GetPlayerBot();
    Unit* pVictim = pTarget->getVictim();

    if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_HEAL)
        SpellSequence = DruidHeal;
    else if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST && CAT_FORM > 0)
        SpellSequence = DruidCombat;
    // No check for Dire Bear here: you must have Bear form to learn Dire Bear form.
    else if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_TANK && BEAR_FORM > 0)
        SpellSequence = DruidTank;
    else
        SpellSequence = DruidSpell;

    switch (SpellSequence)
    {
    case DruidTank: // Its now a tank druid!
        //ai->TellMaster("DruidTank");
        _DoNextPVECombatManeuverBear(pTarget);
        break;

    case DruidSpell:
        //ai->TellMaster("DruidSpell");
        _DoNextPVECombatManeuverSpellDPS(pTarget);
        break;

    case DruidHeal:
        //ai->TellMaster("DruidHeal");
        _DoNextPVECombatManeuverHeal(pTarget);
        break;

    case DruidCombat:
        //ai->TellMaster("DruidCombat");
        _DoNextPVECombatManeuverMeleeDPS(pTarget);
        break;
    }
} // end DoNextCombatManeuver
开发者ID:BACKUPLIB,项目名称:Darkportalwow,代码行数:51,代码来源:PlayerbotDruidAI.cpp

示例15: UBER_ASSERT

//----------------------------------------------------------------------------
//              
//	ROUTINE:	CAIHumanStateCatch::Init()
//              
//	PURPOSE:	Handles initialization of the CAIHumanStateCatch class,
//				Retreive initialization information from the AI, and change
//				the AI state to reflect entry to this state
//              
//----------------------------------------------------------------------------
LTBOOL CAIHumanStateCatch::Init(CAIHuman* pAIHuman)
{
	LTBOOL bParentInitializationSuccess = CAIHumanState::Init(pAIHuman);
	UBER_ASSERT( bParentInitializationSuccess, "CAIHumanStateCatch::Init Failed parent class initialization"	);

	// Retrieve the max hold time from the bute file, failing if it is not
	// defined for this AI
	m_fMaxCatchDuration = pAIHuman->GetBrain()->GetAIData(kAIData_MaxCatchDuration);

	// Be sure that we retrieved a MaxCatch value..
	UBER_ASSERT( m_fMaxCatchDuration > 0.0000001, "SetupCatch: MaxCatchDuration not set" );

	// Set the incoming position to a position 48 units in front of the AI.
	m_vIncomingPosition =  GetAI()->GetPosition() + GetAI()->GetEyeForward() * 48;

	// Ensure that node tracking is disabled.
	m_pAIHuman->DisableNodeTracking();

	// Set the Catching AI to an alert state/combat type
	m_pAIHuman->SetAwareness( kAware_Alert );

	return LTTRUE;
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:32,代码来源:AIHumanStateCatch.cpp


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