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


C++ PlayerbotAI::SetMovementOrder方法代码示例

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


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

示例1: DoNextCombatManeuver

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

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

    // ------- Non Duel combat ----------

    ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob <----changed

    Player *m_bot = GetPlayerBot();
    Group *m_group = m_bot->GetGroup();

    // Heal myself
    if (ai->GetHealthPercent() < 30 && ai->GetManaPercent() >= 32)
    {
        ai->CastSpell(HEALING_WAVE);
    }
    else if (ai->GetHealthPercent() < 50 && ai->GetManaPercent() >= 19)
    {
        ai->CastSpell(LESSER_HEALING_WAVE);
    }
    else if (ai->GetHealthPercent() < 70)
        HealTarget (*m_bot, ai->GetHealthPercent());

    // Heal master
    uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
    if (GetMaster()->isAlive())
    {
        if (masterHP < 30 && ai->GetManaPercent() >= 32)
                ai->CastSpell(HEALING_WAVE, *(GetMaster()));
        else if (masterHP < 70)
            HealTarget (*GetMaster(), masterHP);
    }

    // Heal group
    if( m_group )
    {
        Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots();
        for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
        {
            Player *m_groupMember = sObjectMgr.GetPlayer( itr->guid );
            if( !m_groupMember || !m_groupMember->isAlive() )
                continue;

            uint32 memberHP = m_groupMember->GetHealth()*100 / m_groupMember->GetMaxHealth();
            if( memberHP < 30 )
                HealTarget( *m_groupMember, memberHP );
        }
    }

    // Damage Spells
    ai->SetInFront( pTarget );

    switch (SpellSequence)
    {
        case SPELL_ENHANCEMENT:
			if (STRENGTH_OF_EARTH_TOTEM > 0 && LastSpellEnhancement == 1 && (!m_bot->HasAura(STRENGTH_OF_EARTH_TOTEM, 0)) && ai->GetManaPercent() >= 13)
            {
                ai->CastSpell(STRENGTH_OF_EARTH_TOTEM);
                SpellSequence = SPELL_RESTORATION;
                LastSpellEnhancement = LastSpellEnhancement +1;
                break;
            }
            else if (STONESKIN_TOTEM > 0 && LastSpellEnhancement == 5 && (!m_bot->HasAura(STONESKIN_TOTEM, 0)) && (!m_bot->HasAura(STRENGTH_OF_EARTH_TOTEM, 0)) && ai->GetManaPercent() >= 13)
            {
                ai->CastSpell(STONESKIN_TOTEM);
                SpellSequence = SPELL_RESTORATION;
                LastSpellEnhancement = LastSpellEnhancement +1;
                break;
            }
            else if (FOCUSED > 0 && LastSpellEnhancement == 2)
            {
                ai->CastSpell(FOCUSED, *pTarget);
                SpellSequence = SPELL_RESTORATION;
                LastSpellEnhancement = LastSpellEnhancement +1;
                break;
            }
            else if (FROST_RESISTANCE_TOTEM > 0 && LastSpellEnhancement == 10 && (!m_bot->HasAura(FROST_RESISTANCE_TOTEM, 0)) && (!m_bot->HasAura(TOTEM_OF_WRATH, 0)) && (!m_bot->HasAura(FLAMETONGUE_TOTEM, 0)) && ai->GetManaPercent() >= 10)
            {
                ai->CastSpell(FROST_RESISTANCE_TOTEM);
                SpellSequence = SPELL_RESTORATION;
                LastSpellEnhancement = LastSpellEnhancement +1;
                break;
            }
            else if (FLAMETONGUE_TOTEM > 0 && LastSpellEnhancement == 15 && (!m_bot->HasAura(FLAMETONGUE_TOTEM, 0)) && (!m_bot->HasAura(TOTEM_OF_WRATH, 0)) && (!m_bot->HasAura(FROST_RESISTANCE_TOTEM, 0)) && ai->GetManaPercent() >= 14)
            {
                ai->CastSpell(FLAMETONGUE_TOTEM);
                SpellSequence = SPELL_RESTORATION;
                LastSpellEnhancement = LastSpellEnhancement +1;
                break;
            }
            else if (FIRE_RESISTANCE_TOTEM > 0 && LastSpellEnhancement == 20 && (!m_bot->HasAura(FIRE_RESISTANCE_TOTEM, 0)) && (!m_bot->HasAura(HEALING_STREAM_TOTEM, 0)) && (!m_bot->HasAura(MANA_SPRING_TOTEM, 0)) && ai->GetManaPercent() >= 10)
//.........这里部分代码省略.........
开发者ID:Chrissuit33,项目名称:mangos,代码行数:101,代码来源:PlayerbotShamanAI.cpp

示例2: DoNextCombatManeuver

void PlayerbotPriestAI::DoNextCombatManeuver(Unit *pTarget)
{
    Unit* pVictim = pTarget->getVictim();
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

    switch (ai->GetScenarioType())
    {
        case PlayerbotAI::SCENARIO_DUEL:
            (ai->HasAura(SCREAM,*pTarget) && ai->GetHealthPercent() < 60 && ai->CastSpell(HEAL)) ||
                ai->CastSpell(PAIN) ||
                (ai->GetHealthPercent() < 80 && ai->CastSpell(RENEW)) ||
                (ai->GetPlayerBot()->GetDistance(pTarget) <= 5 && ai->CastSpell(SCREAM)) ||
                ai->CastSpell(MIND_BLAST) ||
                (ai->GetHealthPercent() < 20 && ai->CastSpell(GREAT_HEAL)) ||
                ai->CastSpell(SMITE);
            return;
    }

    // ------- Non Duel combat ----------

    ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob

    Player *m_bot = GetPlayerBot();
    Group *m_group = m_bot->GetGroup();

    // Heal myself
    if (ai->GetHealthPercent() < 15 && FADE > 0 && !m_bot->HasAura(FADE, EFFECT_INDEX_0))
    {
        ai->TellMaster("I'm casting fade.");
        ai->CastSpell(FADE, *m_bot);
    }
    else if (ai->GetHealthPercent() < 25 && PWS > 0 && !m_bot->HasAura(PWS, EFFECT_INDEX_0))
    {
        ai->TellMaster("I'm casting pws on myself.");
        ai->CastSpell(PWS);
    }
    else if (ai->GetHealthPercent() < 35 && DESPERATE_PRAYER > 0)
    {
        ai->TellMaster("I'm casting desperate prayer.");
        ai->CastSpell(DESPERATE_PRAYER, *m_bot);
    }
    else if (ai->GetHealthPercent() < 80)
        HealTarget (*m_bot, ai->GetHealthPercent());

    // Heal master
    uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
    if (GetMaster()->isAlive())
    {
        if (masterHP < 25 && PWS > 0 && !GetMaster()->HasAura(PWS, EFFECT_INDEX_0))
                ai->CastSpell(PWS, *(GetMaster()));
        else if (masterHP < 80)
            HealTarget (*GetMaster(), masterHP);
    }

    // Heal group
    if( m_group )
    {
        Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots();
        for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
        {
            Player *m_groupMember = sObjectMgr.GetPlayer( itr->guid );
            if( !m_groupMember || !m_groupMember->isAlive() )
                continue;

            uint32 memberHP = m_groupMember->GetHealth()*100 / m_groupMember->GetMaxHealth();
            if( memberHP < 25 )
                HealTarget( *m_groupMember, memberHP );
        }
    }

    // Damage Spells
    ai->SetInFront( pTarget );
	float dist = m_bot->GetDistance( pTarget );

    switch (SpellSequence)
    {
        case SPELL_HOLY:
            if (SMITE > 0 && LastSpellHoly <1 && !pTarget->HasAura(SMITE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 17)
            {
                ai->CastSpell(SMITE, *pTarget);
                SpellSequence = SPELL_SHADOWMAGIC;
                LastSpellHoly = LastSpellHoly +1;
                break;
            }
            else if (MANA_BURN > 0 && LastSpellHoly <2 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 14)
            {
                //ai->TellMaster("I'm casting mana burn.");
                ai->CastSpell(MANA_BURN, *pTarget);
                ai->SetIgnoreUpdateTime(3);
                SpellSequence = SPELL_SHADOWMAGIC;
                LastSpellHoly = LastSpellHoly +1;
                break;
            }
            else if (HOLY_NOVA > 0 && LastSpellHoly <3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 22)
            {
                //ai->TellMaster("I'm casting holy nova.");
                ai->CastSpell(HOLY_NOVA);
                SpellSequence = SPELL_SHADOWMAGIC;
//.........这里部分代码省略.........
开发者ID:kbt0y5,项目名称:mangos,代码行数:101,代码来源:PlayerbotPriestAI.cpp

示例3: DoNextCombatManeuver

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

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

    // ------- Non Duel combat ----------

	ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob

    // Damage Spells (primitive example)
    ai->SetInFront( pTarget );
    Player *m_bot = GetPlayerBot();
	Unit* pVictim = pTarget->getVictim();

    switch (SpellSequence)
    {
        case SPELL_FROST:
            if (ICY_VEINS > 0 && !m_bot->HasAura(ICY_VEINS, 0) && LastSpellFrost < 1 && ai->GetManaPercent() >= 3)
            {
                ai->CastSpell(ICY_VEINS, *m_bot);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
            else if (FROSTBOLT > 0 && LastSpellFrost < 2 && !pTarget->HasAura(FROSTBOLT, 0) && ai->GetManaPercent() >= 16)
            {
                ai->CastSpell(FROSTBOLT, *pTarget);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
			else if (FROST_WARD > 0 && LastSpellFrost < 3 && !m_bot->HasAura(FROST_WARD, 0) && ai->GetManaPercent() >= 19)
            {
                ai->CastSpell(FROST_WARD, *m_bot);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
            else if (FROST_NOVA > 0 && LastSpellFrost < 4 && !pTarget->HasAura(FROST_NOVA, 0) && ai->GetManaPercent() >= 10)
            {
                ai->CastSpell(FROST_NOVA, *pTarget);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
			else if (ICE_LANCE > 0 && LastSpellFrost < 5 && ai->GetManaPercent() >= 7)
            {
                ai->CastSpell(ICE_LANCE, *pTarget);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
            else if (BLIZZARD > 0 && LastSpellFrost < 6 && ai->GetAttackerCount()>=5 && ai->GetManaPercent() >= 89)
            {
                ai->CastSpell(BLIZZARD, *pTarget);
				ai->SetIgnoreUpdateTime(8);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
            else if (CONE_OF_COLD > 0 && LastSpellFrost < 7 && !pTarget->HasAura(CONE_OF_COLD, 0) && ai->GetManaPercent() >= 35)
            {
                ai->CastSpell(CONE_OF_COLD, *pTarget);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
			else if (DEEP_FREEZE > 0 && LastSpellFrost < 8 && ai->GetManaPercent() >= 9)
            {
                ai->CastSpell(DEEP_FREEZE, *pTarget);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
            else if (ICE_BARRIER > 0 && LastSpellFrost < 9 && ai->GetHealthPercent() < 70 && ai->GetManaPercent() >= 30)
            {
                ai->CastSpell(ICE_BARRIER, *m_bot);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
            else if (SUMMON_WATER_ELEMENTAL > 0 && LastSpellFrost < 10 && ai->GetManaPercent() >= 16)
            {
                ai->CastSpell(SUMMON_WATER_ELEMENTAL);
                SpellSequence = SPELL_FIRE;
                LastSpellFrost = LastSpellFrost +1;
                break;
            }
			else if (ICE_BLOCK > 0 && LastSpellFrost < 11 && !m_bot->HasAura(ICE_BLOCK, 0) && ai->GetHealthPercent() < 25)
            {
                ai->CastSpell(ICE_BLOCK, *m_bot);
//.........这里部分代码省略.........
开发者ID:mbb1978,项目名称:mangos,代码行数:101,代码来源:PlayerbotMageAI.cpp


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