mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
NKAI: loosen gold presure on build system.
This commit is contained in:
@@ -166,7 +166,7 @@ void BuildAnalyzer::update()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
goldPreasure = ai->getLockedResources()[EGameResID::GOLD] / 10000.0f
|
goldPreasure = ai->getLockedResources()[EGameResID::GOLD] / 5000.0f
|
||||||
+ (float)armyCost[EGameResID::GOLD] / (1 + ai->getFreeGold() + (float)dailyIncome[EGameResID::GOLD] * 7.0f);
|
+ (float)armyCost[EGameResID::GOLD] / (1 + ai->getFreeGold() + (float)dailyIncome[EGameResID::GOLD] * 7.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -236,7 +236,7 @@ const CGHeroInstance * HeroManager::findWeakHeroToDismiss(uint64_t armyLimit) co
|
|||||||
|
|
||||||
for(auto existingHero : myHeroes)
|
for(auto existingHero : myHeroes)
|
||||||
{
|
{
|
||||||
if(ai->isHeroLocked(existingHero)
|
if(ai->isHeroLocked(existingHero) && ai->getHeroLockedReason(existingHero) == HeroLockedReason::DEFENCE
|
||||||
|| existingHero->getArmyStrength() >armyLimit
|
|| existingHero->getArmyStrength() >armyLimit
|
||||||
|| getHeroRole(existingHero) == HeroRole::MAIN
|
|| getHeroRole(existingHero) == HeroRole::MAIN
|
||||||
|| existingHero->movementPointsRemaining()
|
|| existingHero->movementPointsRemaining()
|
||||||
|
@@ -360,7 +360,7 @@ Goals::TGoalVec GatherArmyBehavior::upgradeArmy(const CGTownInstance * upgrader)
|
|||||||
|
|
||||||
auto armyValue = (float)upgrade.upgradeValue / path.getHeroStrength();
|
auto armyValue = (float)upgrade.upgradeValue / path.getHeroStrength();
|
||||||
|
|
||||||
if((armyValue < 0.1f && upgrade.upgradeValue < 20000) || upgrade.upgradeValue < 300) // avoid small upgrades
|
if((armyValue < 0.25f && upgrade.upgradeValue < 40000) || upgrade.upgradeValue < 2000) // avoid small upgrades
|
||||||
{
|
{
|
||||||
#if NKAI_TRACE_LEVEL >= 2
|
#if NKAI_TRACE_LEVEL >= 2
|
||||||
logAi->trace("Ignore path. Army value is too small (%f)", armyValue);
|
logAi->trace("Ignore path. Army value is too small (%f)", armyValue);
|
||||||
|
@@ -134,6 +134,9 @@ void Nullkiller::updateAiState(int pass, bool fast)
|
|||||||
activeHero = nullptr;
|
activeHero = nullptr;
|
||||||
setTargetObject(-1);
|
setTargetObject(-1);
|
||||||
|
|
||||||
|
decomposer->reset();
|
||||||
|
buildAnalyzer->update();
|
||||||
|
|
||||||
if(!fast)
|
if(!fast)
|
||||||
{
|
{
|
||||||
memory->removeInvisibleObjects(cb.get());
|
memory->removeInvisibleObjects(cb.get());
|
||||||
@@ -179,8 +182,6 @@ void Nullkiller::updateAiState(int pass, bool fast)
|
|||||||
}
|
}
|
||||||
|
|
||||||
armyManager->update();
|
armyManager->update();
|
||||||
buildAnalyzer->update();
|
|
||||||
decomposer->reset();
|
|
||||||
|
|
||||||
logAi->debug("AI state updated in %ld", timeElapsed(start));
|
logAi->debug("AI state updated in %ld", timeElapsed(start));
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
namespace NKAI
|
namespace NKAI
|
||||||
{
|
{
|
||||||
|
|
||||||
const float MAX_GOLD_PEASURE = 0.3f;
|
const float MAX_GOLD_PEASURE = 0.6f;
|
||||||
const float MIN_PRIORITY = 0.01f;
|
const float MIN_PRIORITY = 0.01f;
|
||||||
const float SMALL_SCAN_MIN_PRIORITY = 0.4f;
|
const float SMALL_SCAN_MIN_PRIORITY = 0.4f;
|
||||||
|
|
||||||
|
@@ -420,10 +420,10 @@ float RewardEvaluator::getTotalResourceRequirementStrength(int resType) const
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
float ratio = dailyIncome[resType] == 0
|
float ratio = dailyIncome[resType] == 0
|
||||||
? (float)requiredResources[resType] / 50.0f
|
? (float)requiredResources[resType] / 10.0f
|
||||||
: (float)requiredResources[resType] / dailyIncome[resType] / 50.0f;
|
: (float)requiredResources[resType] / dailyIncome[resType] / 20.0f;
|
||||||
|
|
||||||
return std::min(ratio, 1.0f);
|
return std::min(ratio, 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t RewardEvaluator::townArmyGrowth(const CGTownInstance * town) const
|
uint64_t RewardEvaluator::townArmyGrowth(const CGTownInstance * town) const
|
||||||
@@ -954,7 +954,9 @@ public:
|
|||||||
|
|
||||||
if(bi.notEnoughRes && bi.prerequisitesCount == 1)
|
if(bi.notEnoughRes && bi.prerequisitesCount == 1)
|
||||||
{
|
{
|
||||||
evaluationContext.strategicalValue /= 2;
|
evaluationContext.strategicalValue /= 3;
|
||||||
|
evaluationContext.movementCostByRole[evaluationContext.heroRole] += 5;
|
||||||
|
evaluationContext.turn += 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -879,8 +879,12 @@ void AINodeStorage::setHeroes(std::map<const CGHeroInstance *, HeroRole> heroes)
|
|||||||
for(auto & hero : heroes)
|
for(auto & hero : heroes)
|
||||||
{
|
{
|
||||||
// do not allow our own heroes in garrison to act on map
|
// do not allow our own heroes in garrison to act on map
|
||||||
if(hero.first->getOwner() == ai->playerID && hero.first->inTownGarrison && ai->isHeroLocked(hero.first))
|
if(hero.first->getOwner() == ai->playerID
|
||||||
|
&& hero.first->inTownGarrison
|
||||||
|
&& (ai->isHeroLocked(hero.first) || ai->heroManager->heroCapReached()))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t mask = FirstActorMask << actors.size();
|
uint64_t mask = FirstActorMask << actors.size();
|
||||||
auto actor = std::make_shared<HeroActor>(hero.first, hero.second, mask, ai);
|
auto actor = std::make_shared<HeroActor>(hero.first, hero.second, mask, ai);
|
||||||
|
Reference in New Issue
Block a user