mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
- Tweaks for GatherArmy
- Tweaks for exploration - Increased default priority of BuyArmy, SIGNIFICANT improvement!
This commit is contained in:
parent
a9ef8fe32f
commit
d07a77f34b
@ -1522,7 +1522,7 @@ TGoalVec GatherArmy::getAllPossibleSubgoals()
|
|||||||
return true;
|
return true;
|
||||||
else if(!ai->isAccessibleForHero(heroDummy->visitablePos(), h, true))
|
else if(!ai->isAccessibleForHero(heroDummy->visitablePos(), h, true))
|
||||||
return true;
|
return true;
|
||||||
else if(!ai->canGetArmy(heroDummy.h, h))
|
else if(!ai->canGetArmy(heroDummy.h, h)) //TODO: return actual aiValue
|
||||||
return true;
|
return true;
|
||||||
else if(ai->getGoal(h)->goalType == Goals::GATHER_ARMY)
|
else if(ai->getGoal(h)->goalType == Goals::GATHER_ARMY)
|
||||||
return true;
|
return true;
|
||||||
@ -1558,7 +1558,7 @@ TGoalVec GatherArmy::getAllPossibleSubgoals()
|
|||||||
{
|
{
|
||||||
auto creature = VLC->creh->creatures[creatureID];
|
auto creature = VLC->creh->creatures[creatureID];
|
||||||
if(ah->freeResources().canAfford(creature->cost))
|
if(ah->freeResources().canAfford(creature->cost))
|
||||||
objs.push_back(obj);
|
objs.push_back(obj); //TODO: reserve resources?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1594,10 +1594,10 @@ TGoalVec GatherArmy::getAllPossibleSubgoals()
|
|||||||
|
|
||||||
if(ret.empty())
|
if(ret.empty())
|
||||||
{
|
{
|
||||||
if(hero == ai->primaryHero() || value >= 1.1f) // FIXME: check PR388
|
if(hero == ai->primaryHero())
|
||||||
ret.push_back(sptr(Goals::Explore()));
|
ret.push_back(sptr(Goals::Explore()));
|
||||||
else //workaround to break loop - seemingly there are no ways to explore left
|
else
|
||||||
throw goalFulfilledException(sptr(Goals::GatherArmy(0).sethero(hero)));
|
throw cannotFulfillGoalException("No ways to gather army");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -331,7 +331,7 @@ public:
|
|||||||
{
|
{
|
||||||
town = Town; //where to buy this army
|
town = Town; //where to buy this army
|
||||||
value = val; //expressed in AI unit strength
|
value = val; //expressed in AI unit strength
|
||||||
priority = 2;//TODO: evaluate?
|
priority = 3;//TODO: evaluate?
|
||||||
}
|
}
|
||||||
bool operator==(AbstractGoal & g) override;
|
bool operator==(AbstractGoal & g) override;
|
||||||
bool fulfillsMe(TSubgoal goal) override;
|
bool fulfillsMe(TSubgoal goal) override;
|
||||||
|
@ -2583,12 +2583,12 @@ int3 VCAI::explorationNewPoint(HeroPtr h)
|
|||||||
|
|
||||||
if(ourValue > bestValue) //avoid costly checks of tiles that don't reveal much
|
if(ourValue > bestValue) //avoid costly checks of tiles that don't reveal much
|
||||||
{
|
{
|
||||||
|
auto obj = cb->getTopObj(tile);
|
||||||
|
if (obj)
|
||||||
|
if (obj->blockVisit && !isObjectRemovable(obj)) //we can't stand on that object
|
||||||
|
continue;
|
||||||
if(isSafeToVisit(h, tile))
|
if(isSafeToVisit(h, tile))
|
||||||
{
|
{
|
||||||
auto obj = cb->getTopObj(tile);
|
|
||||||
if (obj)
|
|
||||||
if(obj->blockVisit && !isObjectRemovable(obj)) //we can't stand on that object
|
|
||||||
continue;
|
|
||||||
bestTile = tile;
|
bestTile = tile;
|
||||||
bestValue = ourValue;
|
bestValue = ourValue;
|
||||||
}
|
}
|
||||||
@ -2632,14 +2632,14 @@ int3 VCAI::explorationDesperate(HeroPtr h)
|
|||||||
auto t = sm->firstTileToGet(h, tile);
|
auto t = sm->firstTileToGet(h, tile);
|
||||||
if(t.valid())
|
if(t.valid())
|
||||||
{
|
{
|
||||||
|
auto obj = cb->getTopObj(t);
|
||||||
|
if (obj)
|
||||||
|
if (obj->blockVisit && !isObjectRemovable(obj)) //we can't stand on object or remove it
|
||||||
|
continue;
|
||||||
|
|
||||||
ui64 ourDanger = evaluateDanger(t, h.h);
|
ui64 ourDanger = evaluateDanger(t, h.h);
|
||||||
if(ourDanger < lowestDanger)
|
if(ourDanger < lowestDanger)
|
||||||
{
|
{
|
||||||
auto obj = cb->getTopObj(t);
|
|
||||||
if (obj)
|
|
||||||
if (obj->blockVisit && !isObjectRemovable(obj)) //we can't stand on objct or remove it
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(!ourDanger) //at least one safe place found
|
if(!ourDanger) //at least one safe place found
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user