本文整理汇总了C++中Heroes::GetScoute方法的典型用法代码示例。如果您正苦于以下问题:C++ Heroes::GetScoute方法的具体用法?C++ Heroes::GetScoute怎么用?C++ Heroes::GetScoute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Heroes
的用法示例。
在下文中一共展示了Heroes::GetScoute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AIHeroesAddedRescueTask
void AIHeroesAddedRescueTask(Heroes & hero)
{
AIHero & ai_hero = AIHeroes::Get(hero);
Queue & task = ai_hero.sheduled_visit;
DEBUG(DBG_AI, DBG_TRACE, hero.GetName());
u32 scoute = hero.GetScoute();
switch(Settings::Get().GameDifficulty())
{
case Difficulty::NORMAL: scoute += 2; break;
case Difficulty::HARD: scoute += 3; break;
case Difficulty::EXPERT: scoute += 4; break;
case Difficulty::IMPOSSIBLE:scoute += 6; break;
default: break;
}
// find unchartered territory
s32 index = FindUncharteredTerritory(hero, scoute);
const Maps::Tiles & tile = world.GetTiles(hero.GetIndex());
if(index < 0)
{
// check teleports
if(MP2::OBJ_STONELIGHTS == tile.GetObject(false) ||
MP2::OBJ_WHIRLPOOL == tile.GetObject(false))
{
AI::HeroesAction(hero, hero.GetIndex());
}
else
{
// random
index = GetRandomHeroesPosition(hero, scoute);
}
}
if(0 <= index) task.push_back(index);
}
示例2: HeroesGetTask
//.........这里部分代码省略.........
if(hero.GetIndex() == ai_hero.primary_target)
{
ai_hero.primary_target = -1;
hero.GetPath().Reset();
DEBUG(DBG_AI, DBG_TRACE, hero.GetName() << ", reset path");
}
else
{
DEBUG(DBG_AI, DBG_TRACE, hero.GetName() << ", primary target: " <<
ai_hero.primary_target << ", " << MP2::StringObject(world.GetTiles(ai_hero.primary_target).GetObject()));
const Castle* castle = NULL;
if(NULL != (castle = world.GetCastle(Maps::GetPoint(ai_hero.primary_target))) &&
NULL != castle->GetHeroes().Guest() && castle->isFriends(hero.GetColor()))
{
hero.SetModes(AI::HEROES_WAITING);
DEBUG(DBG_AI, DBG_TRACE, hero.GetName() << ", castle busy..");
}
// make path
if(ai_hero.primary_target != hero.GetPath().GetDestinationIndex() &&
!hero.GetPath().Calculate(ai_hero.primary_target))
{
DEBUG(DBG_AI, DBG_TRACE, hero.GetName() << ", path unknown, primary target reset");
ai_hero.primary_target = -1;
}
}
if(hero.GetPath().isValid()) return true;
}
// scan heroes and castle
const Maps::Indexes & enemies = Maps::ScanAroundObjects(hero.GetIndex(), hero.GetScoute(), objs3);
for(MapsIndexes::const_iterator
it = enemies.begin(); it != enemies.end(); ++it)
if(AIHeroesPriorityObject(hero, *it) &&
hero.GetPath().Calculate(*it))
{
DEBUG(DBG_AI, DBG_TRACE, hero.GetName() << ", set primary target: " <<
MP2::StringObject(world.GetTiles(*it).GetObject()) << "(" << *it << ")");
ai_hero.primary_target = *it;
return true;
}
// check destination
if(hero.GetPath().isValid())
{
if(! AI::HeroesValidObject(hero, hero.GetPath().GetDestinationIndex()))
hero.GetPath().Reset();
else
if(hero.GetPath().size() < 5)
{
DEBUG(DBG_AI, DBG_TRACE, hero.GetName() << ", continue short");
ai_hero.fix_loop++;
return true;
}
}
// scan 2x2 pickup objects
Maps::Indexes pickups = Maps::ScanAroundObjects(hero.GetIndex(), 2, objs1);
// scan 3x3 capture objects
const Maps::Indexes & captures = Maps::ScanAroundObjects(hero.GetIndex(), 3, objs2);
if(captures.size()) pickups.insert(pickups.end(), captures.begin(), captures.end());