2013-10-18 23:17:25 +03:00
|
|
|
#include "StdInc.h"
|
|
|
|
#include "Goals.h"
|
|
|
|
#include "VCAI.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Goals.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern boost::thread_specific_ptr<CCallback> cb;
|
|
|
|
extern boost::thread_specific_ptr<VCAI> ai;
|
|
|
|
|
|
|
|
using namespace vstd;
|
2013-10-19 08:52:30 +03:00
|
|
|
using namespace Goals;
|
2013-10-18 23:17:25 +03:00
|
|
|
|
2013-11-23 21:16:25 +03:00
|
|
|
TSubgoal Goals::sptr(const AbstractGoal & tmp)
|
|
|
|
{
|
|
|
|
shared_ptr<AbstractGoal> ptr;
|
|
|
|
ptr.reset(tmp.clone());
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
std::string Goals::AbstractGoal::name() const //TODO: virtualize
|
2013-10-18 23:17:25 +03:00
|
|
|
{
|
|
|
|
switch (goalType)
|
|
|
|
{
|
|
|
|
case INVALID:
|
|
|
|
return "INVALID";
|
|
|
|
case WIN:
|
|
|
|
return "WIN";
|
|
|
|
case DO_NOT_LOSE:
|
|
|
|
return "DO NOT LOOSE";
|
|
|
|
case CONQUER:
|
|
|
|
return "CONQUER";
|
|
|
|
case BUILD:
|
|
|
|
return "BUILD";
|
|
|
|
case EXPLORE:
|
|
|
|
return "EXPLORE";
|
|
|
|
case GATHER_ARMY:
|
|
|
|
return "GATHER ARMY";
|
|
|
|
case BOOST_HERO:
|
|
|
|
return "BOOST_HERO (unsupported)";
|
|
|
|
case RECRUIT_HERO:
|
|
|
|
return "RECRUIT HERO";
|
|
|
|
case BUILD_STRUCTURE:
|
|
|
|
return "BUILD STRUCTURE";
|
|
|
|
case COLLECT_RES:
|
|
|
|
return "COLLECT RESOURCE";
|
|
|
|
case GATHER_TROOPS:
|
|
|
|
return "GATHER TROOPS";
|
|
|
|
case GET_OBJ:
|
|
|
|
return "GET OBJECT " + boost::lexical_cast<std::string>(objid);
|
|
|
|
case FIND_OBJ:
|
|
|
|
return "FIND OBJECT " + boost::lexical_cast<std::string>(objid);
|
|
|
|
case VISIT_HERO:
|
|
|
|
return "VISIT HERO " + boost::lexical_cast<std::string>(objid);
|
|
|
|
case GET_ART_TYPE:
|
|
|
|
return "GET ARTIFACT OF TYPE " + VLC->arth->artifacts[aid]->Name();
|
|
|
|
case ISSUE_COMMAND:
|
|
|
|
return "ISSUE COMMAND (unsupported)";
|
|
|
|
case VISIT_TILE:
|
|
|
|
return "VISIT TILE " + tile();
|
|
|
|
case CLEAR_WAY_TO:
|
|
|
|
return "CLEAR WAY TO " + tile();
|
|
|
|
case DIG_AT_TILE:
|
|
|
|
return "DIG AT TILE " + tile();
|
|
|
|
default:
|
|
|
|
return boost::lexical_cast<std::string>(goalType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-23 21:16:25 +03:00
|
|
|
//TSubgoal AbstractGoal::whatToDoToAchieve()
|
|
|
|
//{
|
|
|
|
// logAi->debugStream() << boost::format("Decomposing goal of type %s") % name();
|
|
|
|
// return sptr (Goals::Explore());
|
|
|
|
//}
|
2013-10-18 23:17:25 +03:00
|
|
|
|
|
|
|
TSubgoal Win::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
const VictoryCondition &vc = cb->getMapHeader()->victoryCondition;
|
|
|
|
EVictoryConditionType::EVictoryConditionType cond = vc.condition;
|
|
|
|
|
|
|
|
if(!vc.appliesToAI)
|
|
|
|
{
|
|
|
|
//TODO deduce victory from human loss condition
|
|
|
|
cond = EVictoryConditionType::WINSTANDARD;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(cond)
|
|
|
|
{
|
|
|
|
case EVictoryConditionType::ARTIFACT:
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GetArtOfType(vc.objectId));
|
2013-10-18 23:17:25 +03:00
|
|
|
case EVictoryConditionType::BEATHERO:
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GetObj(vc.obj->id.getNum()));
|
2013-10-18 23:17:25 +03:00
|
|
|
case EVictoryConditionType::BEATMONSTER:
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GetObj(vc.obj->id.getNum()));
|
2013-10-18 23:17:25 +03:00
|
|
|
case EVictoryConditionType::BUILDCITY:
|
|
|
|
//TODO build castle/capitol
|
|
|
|
break;
|
|
|
|
case EVictoryConditionType::BUILDGRAIL:
|
|
|
|
{
|
|
|
|
if(auto h = ai->getHeroWithGrail())
|
|
|
|
{
|
|
|
|
//hero is in a town that can host Grail
|
|
|
|
if(h->visitedTown && !vstd::contains(h->visitedTown->forbiddenBuildings, BuildingID::GRAIL))
|
|
|
|
{
|
|
|
|
const CGTownInstance *t = h->visitedTown;
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::BuildThis(BuildingID::GRAIL, t));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
auto towns = cb->getTownsInfo();
|
|
|
|
towns.erase(boost::remove_if(towns,
|
|
|
|
[](const CGTownInstance *t) -> bool
|
|
|
|
{
|
|
|
|
return vstd::contains(t->forbiddenBuildings, BuildingID::GRAIL);
|
|
|
|
}),
|
|
|
|
towns.end());
|
|
|
|
boost::sort(towns, isCloser);
|
|
|
|
if(towns.size())
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(towns.front()->visitablePos()).sethero(h));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
double ratio = 0;
|
|
|
|
int3 grailPos = cb->getGrailPos(ratio);
|
|
|
|
if(ratio > 0.99)
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::DigAtTile(grailPos));
|
2013-10-18 23:17:25 +03:00
|
|
|
} //TODO: use FIND_OBJ
|
|
|
|
else if(const CGObjectInstance * obj = ai->getUnvisitedObj(objWithID<Obj::OBELISK>)) //there are unvisited Obelisks
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GetObj(obj->id.getNum()));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
else
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore());
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EVictoryConditionType::CAPTURECITY:
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GetObj(vc.obj->id.getNum()));
|
2013-10-18 23:17:25 +03:00
|
|
|
case EVictoryConditionType::GATHERRESOURCE:
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::CollectRes(static_cast<Res::ERes>(vc.objectId), vc.count));
|
2013-10-18 23:17:25 +03:00
|
|
|
//TODO mines? piles? marketplace?
|
|
|
|
//save?
|
|
|
|
break;
|
|
|
|
case EVictoryConditionType::GATHERTROOP:
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GatherTroops(vc.objectId, vc.count));
|
2013-10-18 23:17:25 +03:00
|
|
|
break;
|
|
|
|
case EVictoryConditionType::TAKEDWELLINGS:
|
|
|
|
break;
|
|
|
|
case EVictoryConditionType::TAKEMINES:
|
|
|
|
break;
|
|
|
|
case EVictoryConditionType::TRANSPORTITEM:
|
|
|
|
break;
|
|
|
|
case EVictoryConditionType::WINSTANDARD:
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Conquer());
|
2013-10-18 23:17:25 +03:00
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Invalid());
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal FindObj::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
const CGObjectInstance * o = nullptr;
|
|
|
|
if (resID > -1) //specified
|
|
|
|
{
|
|
|
|
for(const CGObjectInstance *obj : ai->visitableObjs)
|
|
|
|
{
|
|
|
|
if(obj->ID == objid && obj->subID == resID)
|
|
|
|
{
|
|
|
|
o = obj;
|
|
|
|
break; //TODO: consider multiple objects and choose best
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for(const CGObjectInstance *obj : ai->visitableObjs)
|
|
|
|
{
|
|
|
|
if(obj->ID == objid)
|
|
|
|
{
|
|
|
|
o = obj;
|
|
|
|
break; //TODO: consider multiple objects and choose best
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (o && isReachable(o))
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GetObj(o->id.getNum()));
|
2013-10-18 23:17:25 +03:00
|
|
|
else
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore());
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
2013-11-24 11:21:51 +03:00
|
|
|
std::string GetObj::completeMessage() const
|
|
|
|
{
|
|
|
|
return "hero " + hero.get()->name + " captured Object ID = " + boost::lexical_cast<std::string>(objid);
|
|
|
|
}
|
|
|
|
|
2013-10-18 23:17:25 +03:00
|
|
|
TSubgoal GetObj::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
const CGObjectInstance * obj = cb->getObj(ObjectInstanceID(objid));
|
|
|
|
if(!obj)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore());
|
2013-10-18 23:17:25 +03:00
|
|
|
int3 pos = obj->visitablePos();
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(pos));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
2013-11-24 11:21:51 +03:00
|
|
|
std::string VisitHero::completeMessage() const
|
|
|
|
{
|
|
|
|
return "hero " + hero.get()->name + " visited hero " + boost::lexical_cast<std::string>(objid);
|
|
|
|
}
|
|
|
|
|
2013-10-18 23:17:25 +03:00
|
|
|
TSubgoal VisitHero::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
const CGObjectInstance * obj = cb->getObj(ObjectInstanceID(objid));
|
|
|
|
if(!obj)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore());
|
2013-10-18 23:17:25 +03:00
|
|
|
int3 pos = obj->visitablePos();
|
|
|
|
|
|
|
|
if (hero && ai->isAccessibleForHero(pos, hero, true) && isSafeToVisit(hero, pos)) //enemy heroes can get reinforcements
|
2013-11-15 20:30:16 +03:00
|
|
|
{
|
2013-11-24 11:21:51 +03:00
|
|
|
assert (hero->pos != pos); //don't try to visit yourself
|
2013-11-15 20:30:16 +03:00
|
|
|
settile(pos).setisElementar(true);
|
|
|
|
return sptr (*this);
|
|
|
|
}
|
|
|
|
return sptr (Goals::Invalid());
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal GetArtOfType::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
TSubgoal alternativeWay = CGoal::lookForArtSmart(aid); //TODO: use
|
2013-11-10 00:29:46 +03:00
|
|
|
if(alternativeWay->invalid())
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::FindObj(Obj::ARTIFACT, aid));
|
|
|
|
return sptr (Goals::Invalid());
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal ClearWayTo::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
assert(tile.x >= 0); //set tile
|
|
|
|
if(!cb->isVisible(tile))
|
|
|
|
{
|
|
|
|
logAi->errorStream() << "Clear way should be used with visible tiles!";
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore());
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
HeroPtr h = hero ? hero : ai->primaryHero();
|
|
|
|
if(!h)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::RecruitHero());
|
2013-10-18 23:17:25 +03:00
|
|
|
|
|
|
|
cb->setSelection(*h);
|
|
|
|
|
|
|
|
SectorMap sm;
|
|
|
|
bool dropToFile = false;
|
|
|
|
if(dropToFile) //for debug purposes
|
|
|
|
sm.write("test.txt");
|
|
|
|
|
|
|
|
int3 tileToHit = sm.firstTileToGet(h, tile);
|
|
|
|
//if(isSafeToVisit(h, tileToHit))
|
|
|
|
if(isBlockedBorderGate(tileToHit))
|
|
|
|
{ //FIXME: this way we'll not visit gate and activate quest :?
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::FindObj (Obj::KEYMASTER, cb->getTile(tileToHit)->visitableObjects.back()->subID));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//FIXME: this code shouldn't be necessary
|
|
|
|
if(tileToHit == tile)
|
|
|
|
{
|
|
|
|
logAi->errorStream() << boost::format("Very strange, tile to hit is %s and tile is also %s, while hero %s is at %s\n")
|
|
|
|
% tileToHit % tile % h->name % h->visitablePos();
|
|
|
|
throw cannotFulfillGoalException("Retrieving first tile to hit failed (probably)!");
|
|
|
|
}
|
|
|
|
|
|
|
|
auto topObj = backOrNull(cb->getVisitableObjs(tileToHit));
|
|
|
|
if(topObj && topObj->ID == Obj::HERO && cb->getPlayerRelations(h->tempOwner, topObj->tempOwner) != PlayerRelations::ENEMIES)
|
|
|
|
{
|
|
|
|
std::string problem = boost::str(boost::format("%s stands in the way of %s.\n") % topObj->getHoverText() % h->getHoverText());
|
|
|
|
throw cannotFulfillGoalException(problem);
|
|
|
|
}
|
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(tileToHit).sethero(h));
|
2013-11-10 00:29:46 +03:00
|
|
|
//FIXME:: attempts to visit completely unreachable tile with hero results in stall
|
2013-10-18 23:17:25 +03:00
|
|
|
|
|
|
|
//TODO czy istnieje lepsza droga?
|
|
|
|
|
|
|
|
throw cannotFulfillGoalException("Cannot reach given tile!"); //how and when could this be used?
|
|
|
|
}
|
|
|
|
|
2013-11-24 11:21:51 +03:00
|
|
|
std::string Explore::completeMessage() const
|
|
|
|
{
|
|
|
|
return "Hero " + hero.get()->name + " completed exploration";
|
|
|
|
};
|
|
|
|
|
2013-10-18 23:17:25 +03:00
|
|
|
TSubgoal Explore::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
auto objs = ai->visitableObjs; //try to use buildings that uncover map
|
|
|
|
erase_if(objs, [&](const CGObjectInstance *obj) -> bool
|
|
|
|
{
|
|
|
|
if (vstd::contains(ai->alreadyVisited, obj))
|
|
|
|
return true;
|
|
|
|
switch (obj->ID.num)
|
|
|
|
{
|
|
|
|
case Obj::REDWOOD_OBSERVATORY:
|
|
|
|
case Obj::PILLAR_OF_FIRE:
|
|
|
|
case Obj::CARTOGRAPHER:
|
|
|
|
case Obj::SUBTERRANEAN_GATE: //TODO: check ai->knownSubterraneanGates
|
|
|
|
//case Obj::MONOLITH1:
|
|
|
|
//case obj::MONOLITH2:
|
|
|
|
//case obj::MONOLITH3:
|
|
|
|
//case Obj::WHIRLPOOL:
|
|
|
|
return false; //do not erase
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (objs.size())
|
|
|
|
{
|
|
|
|
if (hero.get(true))
|
|
|
|
{
|
|
|
|
for (auto obj : objs)
|
|
|
|
{
|
|
|
|
auto pos = obj->visitablePos();
|
|
|
|
//FIXME: this confition fails if everything but guarded subterranen gate was explored. in this case we should gather army for hero
|
|
|
|
if (isSafeToVisit(hero, pos) && ai->isAccessibleForHero(pos, hero))
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(pos).sethero(hero));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (auto obj : objs)
|
|
|
|
{
|
|
|
|
auto pos = obj->visitablePos();
|
|
|
|
if (ai->isAccessible (pos)) //TODO: check safety?
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(pos).sethero(hero));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hero)
|
|
|
|
{
|
|
|
|
int3 t = whereToExplore(hero);
|
|
|
|
if (t.z == -1) //no safe tile to explore - we need to break!
|
|
|
|
{
|
|
|
|
erase_if (objs, [&](const CGObjectInstance *obj) -> bool
|
|
|
|
{
|
|
|
|
switch (obj->ID.num)
|
|
|
|
{
|
|
|
|
case Obj::CARTOGRAPHER:
|
|
|
|
case Obj::SUBTERRANEAN_GATE:
|
|
|
|
//case Obj::MONOLITH1:
|
|
|
|
//case obj::MONOLITH2:
|
|
|
|
//case obj::MONOLITH3:
|
|
|
|
//case Obj::WHIRLPOOL:
|
|
|
|
return false; //do not erase
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (objs.size())
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(objs.front()->visitablePos()).sethero(hero).setisAbstract(true));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
throw cannotFulfillGoalException("Cannot explore - no possible ways found!");
|
|
|
|
}
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(t).sethero(hero));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
auto hs = cb->getHeroesInfo();
|
|
|
|
int howManyHeroes = hs.size();
|
|
|
|
|
|
|
|
erase(hs, [](const CGHeroInstance *h)
|
|
|
|
{
|
|
|
|
return contains(ai->lockedHeroes, h);
|
|
|
|
});
|
|
|
|
if(hs.empty()) //all heroes are busy. buy new one
|
|
|
|
{
|
|
|
|
if (howManyHeroes < 3 && ai->findTownWithTavern()) //we may want to recruit second hero. TODO: make it smart finally
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::RecruitHero());
|
2013-10-18 23:17:25 +03:00
|
|
|
else //find mobile hero with weakest army
|
|
|
|
{
|
|
|
|
hs = cb->getHeroesInfo();
|
|
|
|
erase_if(hs, [](const CGHeroInstance *h)
|
|
|
|
{
|
|
|
|
return !h->movement; //only hero with movement are of interest for us
|
|
|
|
});
|
|
|
|
if (hs.empty())
|
|
|
|
{
|
|
|
|
if (howManyHeroes < GameConstants::MAX_HEROES_PER_PLAYER)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::RecruitHero());
|
2013-10-18 23:17:25 +03:00
|
|
|
else
|
|
|
|
throw cannotFulfillGoalException("No heroes with remaining MPs for exploring!\n");
|
|
|
|
}
|
|
|
|
boost::sort(hs, compareMovement); //closer to what?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const CGHeroInstance *h = hs.front();
|
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (sethero(h).setisAbstract(true));
|
2013-10-18 23:17:25 +03:00
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
return iAmElementar(); //FIXME: how can this be called?
|
2013-10-18 23:17:25 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
TSubgoal RecruitHero::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
const CGTownInstance *t = ai->findTownWithTavern();
|
|
|
|
if(!t)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::BuildThis(BuildingID::TAVERN));
|
2013-10-18 23:17:25 +03:00
|
|
|
|
|
|
|
if(cb->getResourceAmount(Res::GOLD) < HERO_GOLD_COST)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::CollectRes(Res::GOLD, HERO_GOLD_COST));
|
2013-10-18 23:17:25 +03:00
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
return iAmElementar();
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
2013-11-24 11:21:51 +03:00
|
|
|
std::string VisitTile::completeMessage() const
|
|
|
|
{
|
|
|
|
return "Hero " + hero.get()->name + " visited tile " + tile();
|
|
|
|
}
|
|
|
|
|
2013-10-18 23:17:25 +03:00
|
|
|
TSubgoal VisitTile::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
if(!cb->isVisible(tile))
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore());
|
2013-10-18 23:17:25 +03:00
|
|
|
|
|
|
|
if(hero && !ai->isAccessibleForHero(tile, hero))
|
|
|
|
hero = nullptr;
|
|
|
|
|
|
|
|
if(!hero)
|
|
|
|
{
|
|
|
|
if(cb->getHeroesInfo().empty())
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::RecruitHero());
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
for(const CGHeroInstance *h : cb->getHeroesInfo())
|
|
|
|
{
|
|
|
|
if(ai->isAccessibleForHero(tile, h))
|
|
|
|
{
|
|
|
|
hero = h;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(hero)
|
|
|
|
{
|
|
|
|
if(isSafeToVisit(hero, tile))
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (setisElementar(true));
|
2013-10-18 23:17:25 +03:00
|
|
|
else
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GatherArmy(evaluateDanger(tile, *hero) * SAFE_ATTACK_CONSTANT).sethero(hero));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else //inaccessible for all heroes
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::ClearWayTo(tile));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal DigAtTile::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
const CGObjectInstance *firstObj = frontOrNull(cb->getVisitableObjs(tile));
|
|
|
|
if(firstObj && firstObj->ID == Obj::HERO && firstObj->tempOwner == ai->playerID) //we have hero at dest
|
|
|
|
{
|
|
|
|
const CGHeroInstance *h = dynamic_cast<const CGHeroInstance *>(firstObj);
|
2013-11-15 20:30:16 +03:00
|
|
|
sethero(h).setisElementar(true);
|
|
|
|
return sptr (*this);
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(tile));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal BuildThis::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
//TODO check res
|
|
|
|
//look for town
|
|
|
|
//prerequisites?
|
2013-11-15 20:30:16 +03:00
|
|
|
return iAmElementar();
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal CollectRes::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
std::vector<const IMarket*> markets;
|
|
|
|
|
|
|
|
std::vector<const CGObjectInstance*> visObjs;
|
|
|
|
ai->retreiveVisitableObjs(visObjs, true);
|
|
|
|
for(const CGObjectInstance *obj : visObjs)
|
|
|
|
{
|
|
|
|
if(const IMarket *m = IMarket::castFrom(obj, false))
|
|
|
|
{
|
|
|
|
if(obj->ID == Obj::TOWN && obj->tempOwner == ai->playerID && m->allowsTrade(EMarketMode::RESOURCE_RESOURCE))
|
|
|
|
markets.push_back(m);
|
|
|
|
else if(obj->ID == Obj::TRADING_POST) //TODO a moze po prostu test na pozwalanie handlu?
|
|
|
|
markets.push_back(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
boost::sort(markets, [](const IMarket *m1, const IMarket *m2) -> bool
|
|
|
|
{
|
|
|
|
return m1->getMarketEfficiency() < m2->getMarketEfficiency();
|
|
|
|
});
|
|
|
|
|
|
|
|
markets.erase(boost::remove_if(markets, [](const IMarket *market) -> bool
|
|
|
|
{
|
|
|
|
return !(market->o->ID == Obj::TOWN && market->o->tempOwner == ai->playerID)
|
|
|
|
&& !ai->isAccessible(market->o->visitablePos());
|
|
|
|
}),markets.end());
|
|
|
|
|
|
|
|
if(!markets.size())
|
|
|
|
{
|
|
|
|
for(const CGTownInstance *t : cb->getTownsInfo())
|
|
|
|
{
|
|
|
|
if(cb->canBuildStructure(t, BuildingID::MARKETPLACE) == EBuildingState::ALLOWED)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::BuildThis(BuildingID::MARKETPLACE, t));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const IMarket *m = markets.back();
|
|
|
|
//attempt trade at back (best prices)
|
|
|
|
int howManyCanWeBuy = 0;
|
|
|
|
for(Res::ERes i = Res::WOOD; i <= Res::GOLD; vstd::advance(i, 1))
|
|
|
|
{
|
|
|
|
if(i == resID) continue;
|
|
|
|
int toGive = -1, toReceive = -1;
|
|
|
|
m->getOffer(i, resID, toGive, toReceive, EMarketMode::RESOURCE_RESOURCE);
|
|
|
|
assert(toGive > 0 && toReceive > 0);
|
|
|
|
howManyCanWeBuy += toReceive * (cb->getResourceAmount(i) / toGive);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(howManyCanWeBuy + cb->getResourceAmount(static_cast<Res::ERes>(resID)) >= value)
|
|
|
|
{
|
|
|
|
auto backObj = backOrNull(cb->getVisitableObjs(m->o->visitablePos())); //it'll be a hero if we have one there; otherwise marketplace
|
|
|
|
assert(backObj);
|
2013-11-15 20:30:16 +03:00
|
|
|
if (backObj->tempOwner != ai->playerID)
|
|
|
|
{
|
|
|
|
return sptr (Goals::GetObj(m->o->id.getNum()));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return sptr (Goals::GetObj(m->o->id.getNum()).setisElementar(true));
|
|
|
|
}
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Invalid()); //FIXME: unused?
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal GatherTroops::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
std::vector<const CGDwelling *> dwellings;
|
|
|
|
for(const CGTownInstance *t : cb->getTownsInfo())
|
|
|
|
{
|
|
|
|
auto creature = VLC->creh->creatures[objid];
|
|
|
|
if (t->subID == creature->faction) //TODO: how to force AI to build unupgraded creatures? :O
|
|
|
|
{
|
|
|
|
auto creatures = vstd::tryAt(t->town->creatures, creature->level - 1);
|
|
|
|
if(!creatures)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
int upgradeNumber = vstd::find_pos(*creatures, creature->idNumber);
|
|
|
|
if(upgradeNumber < 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
BuildingID bid(BuildingID::DWELL_FIRST + creature->level - 1 + upgradeNumber * GameConstants::CREATURES_PER_TOWN);
|
|
|
|
if (t->hasBuilt(bid)) //this assumes only creatures with dwellings are assigned to faction
|
|
|
|
{
|
|
|
|
dwellings.push_back(t);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::BuildThis(bid, t));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (auto obj : ai->visitableObjs)
|
|
|
|
{
|
|
|
|
if (obj->ID != Obj::CREATURE_GENERATOR1) //TODO: what with other creature generators?
|
|
|
|
continue;
|
|
|
|
|
|
|
|
auto d = dynamic_cast<const CGDwelling *>(obj);
|
|
|
|
for (auto creature : d->creatures)
|
|
|
|
{
|
|
|
|
if (creature.first) //there are more than 0 creatures avaliabe
|
|
|
|
{
|
|
|
|
for (auto type : creature.second)
|
|
|
|
{
|
|
|
|
if (type == objid && ai->freeResources().canAfford(VLC->creh->creatures[type]->cost))
|
|
|
|
dwellings.push_back(d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dwellings.size())
|
|
|
|
{
|
|
|
|
boost::sort(dwellings, isCloser);
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GetObj(dwellings.front()->id.getNum()));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
else
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore());
|
2013-10-18 23:17:25 +03:00
|
|
|
//TODO: exchange troops between heroes
|
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal Conquer::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
auto hs = cb->getHeroesInfo();
|
|
|
|
int howManyHeroes = hs.size();
|
|
|
|
|
|
|
|
erase(hs, [](const CGHeroInstance *h)
|
|
|
|
{
|
|
|
|
return contains(ai->lockedHeroes, h);
|
|
|
|
});
|
|
|
|
if(hs.empty()) //all heroes are busy. buy new one
|
|
|
|
{
|
|
|
|
if (howManyHeroes < 3 && ai->findTownWithTavern()) //we may want to recruit second hero. TODO: make it smart finally
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::RecruitHero());
|
2013-10-18 23:17:25 +03:00
|
|
|
else //find mobile hero with weakest army
|
|
|
|
{
|
|
|
|
hs = cb->getHeroesInfo();
|
|
|
|
erase_if(hs, [](const CGHeroInstance *h)
|
|
|
|
{
|
|
|
|
return !h->movement; //only hero with movement are of interest for us
|
|
|
|
});
|
|
|
|
if (hs.empty())
|
|
|
|
{
|
|
|
|
if (howManyHeroes < GameConstants::MAX_HEROES_PER_PLAYER)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::RecruitHero());
|
2013-10-18 23:17:25 +03:00
|
|
|
else
|
|
|
|
throw cannotFulfillGoalException("No heroes with remaining MPs for exploring!\n");
|
|
|
|
}
|
|
|
|
boost::sort(hs, compareHeroStrength);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const CGHeroInstance *h = hs.back();
|
|
|
|
cb->setSelection(h);
|
|
|
|
std::vector<const CGObjectInstance *> objs; //here we'll gather enemy towns and heroes
|
|
|
|
ai->retreiveVisitableObjs(objs);
|
|
|
|
erase_if(objs, [&](const CGObjectInstance *obj)
|
|
|
|
{
|
|
|
|
return (obj->ID != Obj::TOWN && obj->ID != Obj::HERO) //not town/hero
|
|
|
|
|| cb->getPlayerRelations(ai->playerID, obj->tempOwner) != PlayerRelations::ENEMIES;
|
|
|
|
});
|
|
|
|
|
|
|
|
if (objs.empty()) //experiment - try to conquer dwellings and mines, it should pay off
|
|
|
|
{
|
|
|
|
ai->retreiveVisitableObjs(objs);
|
|
|
|
erase_if(objs, [&](const CGObjectInstance *obj)
|
|
|
|
{
|
|
|
|
return (obj->ID != Obj::CREATURE_GENERATOR1 && obj->ID != Obj::MINE) //not dwelling or mine
|
|
|
|
|| cb->getPlayerRelations(ai->playerID, obj->tempOwner) != PlayerRelations::ENEMIES;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if(objs.empty())
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore()); //we need to find an enemy
|
2013-10-18 23:17:25 +03:00
|
|
|
|
|
|
|
erase_if(objs, [&](const CGObjectInstance *obj)
|
|
|
|
{
|
|
|
|
return !isSafeToVisit(h, obj->visitablePos()) || vstd::contains (ai->reservedObjs, obj); //no need to capture same object twice
|
|
|
|
});
|
|
|
|
|
|
|
|
if(objs.empty())
|
2013-11-15 20:30:16 +03:00
|
|
|
return iAmElementar();
|
2013-10-18 23:17:25 +03:00
|
|
|
|
|
|
|
boost::sort(objs, isCloser);
|
|
|
|
for(const CGObjectInstance *obj : objs)
|
|
|
|
{
|
|
|
|
if (ai->isAccessibleForHero(obj->visitablePos(), h))
|
|
|
|
{
|
|
|
|
ai->reserveObject(h, obj); //no one else will capture same object until we fail
|
|
|
|
|
|
|
|
if (obj->ID == Obj::HERO)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitHero(obj->id.getNum()).sethero(h).setisAbstract(true));
|
2013-11-10 00:29:46 +03:00
|
|
|
//track enemy hero
|
2013-10-18 23:17:25 +03:00
|
|
|
else
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(obj->visitablePos()).sethero(h));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore()); //enemy is inaccessible
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal Build::whatToDoToAchieve()
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return iAmElementar();
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
TSubgoal Invalid::whatToDoToAchieve()
|
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return iAmElementar();
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
2013-11-24 11:21:51 +03:00
|
|
|
std::string GatherArmy::completeMessage() const
|
|
|
|
{
|
|
|
|
return "Hero " + hero.get()->name + " gathered army of value " + boost::lexical_cast<std::string>(value);
|
|
|
|
};
|
|
|
|
|
2013-10-18 23:17:25 +03:00
|
|
|
TSubgoal GatherArmy::whatToDoToAchieve()
|
|
|
|
{
|
|
|
|
//TODO: find hero if none set
|
|
|
|
assert(hero);
|
|
|
|
|
|
|
|
cb->setSelection(*hero);
|
|
|
|
auto compareReinforcements = [this](const CGTownInstance *lhs, const CGTownInstance *rhs) -> bool
|
|
|
|
{
|
|
|
|
return howManyReinforcementsCanGet(hero, lhs) < howManyReinforcementsCanGet(hero, rhs);
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<const CGTownInstance *> townsReachable;
|
|
|
|
for(const CGTownInstance *t : cb->getTownsInfo())
|
|
|
|
{
|
|
|
|
if(!t->visitingHero && howManyReinforcementsCanGet(hero,t))
|
|
|
|
{
|
|
|
|
if(isReachable(t) && !vstd::contains (ai->townVisitsThisWeek[hero], t))
|
|
|
|
townsReachable.push_back(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(townsReachable.size()) //try towns first
|
|
|
|
{
|
|
|
|
boost::sort(townsReachable, compareReinforcements);
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(townsReachable.back()->visitablePos()).sethero(hero));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (hero == ai->primaryHero()) //we can get army from other heroes
|
|
|
|
{
|
|
|
|
auto otherHeroes = cb->getHeroesInfo();
|
|
|
|
auto heroDummy = hero;
|
|
|
|
erase_if(otherHeroes, [heroDummy](const CGHeroInstance * h)
|
|
|
|
{
|
|
|
|
return (h == heroDummy.h || !ai->isAccessibleForHero(heroDummy->visitablePos(), h, true) || !ai->canGetArmy(heroDummy.h, h));
|
|
|
|
});
|
|
|
|
if (otherHeroes.size())
|
|
|
|
{
|
|
|
|
boost::sort(otherHeroes, compareArmyStrength); //TODO: check if hero has at least one stack more powerful than ours? not likely to fail
|
|
|
|
int primaryPath, secondaryPath;
|
|
|
|
auto h = otherHeroes.back();
|
|
|
|
cb->setSelection(hero.h);
|
|
|
|
primaryPath = cb->getPathInfo(h->visitablePos())->turns;
|
|
|
|
cb->setSelection(h);
|
|
|
|
secondaryPath = cb->getPathInfo(hero->visitablePos())->turns;
|
|
|
|
|
|
|
|
if (primaryPath < secondaryPath)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitHero(h->id.getNum()).setisAbstract(true).sethero(hero));
|
2013-11-10 00:29:46 +03:00
|
|
|
//go to the other hero if we are faster
|
2013-10-18 23:17:25 +03:00
|
|
|
else
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitHero(h->id.getNum()).setisAbstract(true).sethero(h));
|
|
|
|
//let the other hero come to us
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<const CGObjectInstance *> objs; //here we'll gather all dwellings
|
|
|
|
ai->retreiveVisitableObjs(objs, true);
|
|
|
|
erase_if(objs, [&](const CGObjectInstance *obj)
|
|
|
|
{
|
|
|
|
if(obj->ID != Obj::CREATURE_GENERATOR1)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
auto relationToOwner = cb->getPlayerRelations(obj->getOwner(), ai->playerID);
|
|
|
|
if(relationToOwner == PlayerRelations::ALLIES)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
//Use flagged dwellings only when there are available creatures that we can afford
|
|
|
|
if(relationToOwner == PlayerRelations::SAME_PLAYER)
|
|
|
|
{
|
|
|
|
auto dwelling = dynamic_cast<const CGDwelling*>(obj);
|
|
|
|
for(auto & creLevel : dwelling->creatures)
|
|
|
|
{
|
|
|
|
if(creLevel.first)
|
|
|
|
{
|
|
|
|
for(auto & creatureID : creLevel.second)
|
|
|
|
{
|
|
|
|
auto creature = VLC->creh->creatures[creatureID];
|
|
|
|
if(ai->freeResources().canAfford(creature->cost))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
if(objs.empty()) //no possible objects, we did eveyrthing already
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore(hero));
|
2013-10-18 23:17:25 +03:00
|
|
|
//TODO: check if we can recruit any creatures there, evaluate army
|
|
|
|
else
|
|
|
|
{
|
|
|
|
boost::sort(objs, isCloser);
|
|
|
|
HeroPtr h = nullptr;
|
|
|
|
for(const CGObjectInstance *obj : objs)
|
|
|
|
{ //find safe dwelling
|
|
|
|
auto pos = obj->visitablePos();
|
|
|
|
if (shouldVisit (hero, obj)) //creatures fit in army
|
|
|
|
h = hero;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for(auto ourHero : cb->getHeroesInfo()) //make use of multiple heroes
|
|
|
|
{
|
|
|
|
if (shouldVisit(ourHero, obj))
|
|
|
|
h = ourHero;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (h && isSafeToVisit(h, pos) && ai->isAccessibleForHero(pos, h))
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::VisitTile(pos).sethero(h));
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore(hero)); //find dwelling. use current hero to prevent him from doing nothing.
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
2013-11-23 21:16:25 +03:00
|
|
|
//TSubgoal AbstractGoal::whatToDoToAchieve()
|
|
|
|
//{
|
|
|
|
// logAi->debugStream() << boost::format("Decomposing goal of type %s") % name();
|
|
|
|
// return sptr (Goals::Explore());
|
|
|
|
//}
|
2013-10-18 23:17:25 +03:00
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
TSubgoal AbstractGoal::goVisitOrLookFor(const CGObjectInstance *obj)
|
2013-10-18 23:17:25 +03:00
|
|
|
{
|
|
|
|
if(obj)
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::GetObj(obj->id.getNum()));
|
2013-10-18 23:17:25 +03:00
|
|
|
else
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Explore());
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
TSubgoal AbstractGoal::lookForArtSmart(int aid)
|
2013-10-18 23:17:25 +03:00
|
|
|
{
|
2013-11-15 20:30:16 +03:00
|
|
|
return sptr (Goals::Invalid());
|
2013-10-18 23:17:25 +03:00
|
|
|
}
|
|
|
|
|
2013-11-15 20:30:16 +03:00
|
|
|
bool AbstractGoal::invalid() const
|
2013-10-18 23:17:25 +03:00
|
|
|
{
|
|
|
|
return goalType == INVALID;
|
2013-10-20 16:51:05 +03:00
|
|
|
}
|
2013-11-23 21:16:25 +03:00
|
|
|
|
|
|
|
void AbstractGoal::accept (VCAI * ai)
|
|
|
|
{
|
|
|
|
ai->tryRealize(*this);
|
|
|
|
};
|