mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-21 17:17:06 +02:00
NKAI: take into account 7lvl creature cost when we consider what resources we need
This commit is contained in:
parent
e227fa1691
commit
e9e5948d61
@ -100,10 +100,17 @@ int32_t convertToGold(const TResources & res)
|
||||
+ 125 * (res[EGameResID::GEMS] + res[EGameResID::CRYSTAL] + res[EGameResID::MERCURY] + res[EGameResID::SULFUR]);
|
||||
}
|
||||
|
||||
TResources withoutGold(TResources other)
|
||||
{
|
||||
other[GameResID::GOLD] = 0;
|
||||
|
||||
return other;
|
||||
}
|
||||
|
||||
TResources BuildAnalyzer::getResourcesRequiredNow() const
|
||||
{
|
||||
auto resourcesAvailable = ai->getFreeResources();
|
||||
auto result = requiredResources - resourcesAvailable;
|
||||
auto result = withoutGold(armyCost) + requiredResources - resourcesAvailable;
|
||||
|
||||
result.positive();
|
||||
|
||||
@ -113,7 +120,7 @@ TResources BuildAnalyzer::getResourcesRequiredNow() const
|
||||
TResources BuildAnalyzer::getTotalResourcesRequired() const
|
||||
{
|
||||
auto resourcesAvailable = ai->getFreeResources();
|
||||
auto result = totalDevelopmentCost - resourcesAvailable;
|
||||
auto result = totalDevelopmentCost + withoutGold(armyCost) - resourcesAvailable;
|
||||
|
||||
result.positive();
|
||||
|
||||
@ -341,6 +348,7 @@ void TownDevelopmentInfo::addExistingDwelling(const BuildingInfo & existingDwell
|
||||
void TownDevelopmentInfo::addBuildingToBuild(const BuildingInfo & nextToBuild)
|
||||
{
|
||||
townDevelopmentCost += nextToBuild.buildCostWithPrerequisites;
|
||||
townDevelopmentCost += withoutGold(nextToBuild.armyCost);
|
||||
|
||||
if(nextToBuild.canBuild)
|
||||
{
|
||||
|
@ -15,9 +15,9 @@ InputVariable: scoutTurnDistance
|
||||
range: 0.000 10.000
|
||||
lock-range: true
|
||||
term: LOWEST Ramp 0.250 0.000
|
||||
term: LOW Discrete 0.000 1.000 0.500 0.800 1.000 0.000
|
||||
term: MEDIUM Discrete 0.000 0.000 0.500 0.200 1.000 1.000 2.500 0.300 4.000 0.000
|
||||
term: LONG Discrete 1.000 0.000 1.500 0.200 3.000 0.800 10.000 1.000
|
||||
term: LOW Discrete 0.000 1.000 1.000 0.800 2.500 0.000
|
||||
term: MEDIUM Discrete 0.000 0.000 1.000 0.200 2.500 1.000 3.500 0.300 5.000 0.000
|
||||
term: LONG Discrete 2.500 0.000 3.500 0.200 5.000 0.800 10.000 1.000
|
||||
InputVariable: goldReward
|
||||
description: estimated amount of gold received
|
||||
enabled: true
|
||||
|
Loading…
Reference in New Issue
Block a user