diff --git a/AI/Nullkiller/AIGateway.cpp b/AI/Nullkiller/AIGateway.cpp index 1ce6b6fd4..ed23f4bc0 100644 --- a/AI/Nullkiller/AIGateway.cpp +++ b/AI/Nullkiller/AIGateway.cpp @@ -682,7 +682,7 @@ void AIGateway::showBlockingDialog(const std::string & text, const std::vectorheroManager->getHeroRole(hero) != HeroRole::MAIN - || nullkiller->buildAnalyzer->isGoldPreasureHigh())) + || nullkiller->buildAnalyzer->isGoldPressureHigh())) { sel = 1; } diff --git a/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp b/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp index 74e5a3d70..a50ccc255 100644 --- a/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp +++ b/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp @@ -120,9 +120,9 @@ TResources BuildAnalyzer::getTotalResourcesRequired() const return result; } -bool BuildAnalyzer::isGoldPreasureHigh() const +bool BuildAnalyzer::isGoldPressureHigh() const { - return goldPreasure > ai->settings->getMaxGoldPreasure(); + return goldPressure > ai->settings->getMaxGoldPressure(); } void BuildAnalyzer::update() @@ -167,15 +167,15 @@ void BuildAnalyzer::update() if(ai->cb->getDate(Date::DAY) == 1) { - goldPreasure = 1; + goldPressure = 1; } else { - goldPreasure = ai->getLockedResources()[EGameResID::GOLD] / 5000.0f + goldPressure = ai->getLockedResources()[EGameResID::GOLD] / 5000.0f + (float)armyCost[EGameResID::GOLD] / (1 + 2 * ai->getFreeGold() + (float)dailyIncome[EGameResID::GOLD] * 7.0f); } - logAi->trace("Gold preasure: %f", goldPreasure); + logAi->trace("Gold pressure: %f", goldPressure); } void BuildAnalyzer::reset() diff --git a/AI/Nullkiller/Analyzers/BuildAnalyzer.h b/AI/Nullkiller/Analyzers/BuildAnalyzer.h index 754225070..019d3245f 100644 --- a/AI/Nullkiller/Analyzers/BuildAnalyzer.h +++ b/AI/Nullkiller/Analyzers/BuildAnalyzer.h @@ -84,7 +84,7 @@ private: std::vector developmentInfos; TResources armyCost; TResources dailyIncome; - float goldPreasure; + float goldPressure; Nullkiller * ai; public: @@ -95,8 +95,8 @@ public: TResources getTotalResourcesRequired() const; const std::vector & getDevelopmentInfo() const { return developmentInfos; } TResources getDailyIncome() const { return dailyIncome; } - float getGoldPreasure() const { return goldPreasure; } - bool isGoldPreasureHigh() const; + float getGoldPressure() const { return goldPressure; } + bool isGoldPressureHigh() const; bool hasAnyBuilding(int32_t alignment, BuildingID bid) const; private: diff --git a/AI/Nullkiller/Behaviors/BuildingBehavior.cpp b/AI/Nullkiller/Behaviors/BuildingBehavior.cpp index d0596f838..2cdc2ead3 100644 --- a/AI/Nullkiller/Behaviors/BuildingBehavior.cpp +++ b/AI/Nullkiller/Behaviors/BuildingBehavior.cpp @@ -47,13 +47,13 @@ Goals::TGoalVec BuildingBehavior::decompose(const Nullkiller * ai) const totalDevelopmentCost.toString()); auto & developmentInfos = ai->buildAnalyzer->getDevelopmentInfo(); - auto isGoldPreasureLow = !ai->buildAnalyzer->isGoldPreasureHigh(); + auto isGoldPressureLow = !ai->buildAnalyzer->isGoldPressureHigh(); for(auto & developmentInfo : developmentInfos) { for(auto & buildingInfo : developmentInfo.toBuild) { - if(isGoldPreasureLow || buildingInfo.dailyIncome[EGameResID::GOLD] > 0) + if(isGoldPressureLow || buildingInfo.dailyIncome[EGameResID::GOLD] > 0) { if(buildingInfo.notEnoughRes) { diff --git a/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp b/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp index c36109167..d53adc023 100644 --- a/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp +++ b/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp @@ -46,7 +46,7 @@ Goals::TGoalVec BuyArmyBehavior::decompose(const Nullkiller * ai) const for(const CGHeroInstance * targetHero : heroes) { - if(ai->buildAnalyzer->isGoldPreasureHigh() && !town->hasBuilt(BuildingID::CITY_HALL)) + if(ai->buildAnalyzer->isGoldPressureHigh() && !town->hasBuilt(BuildingID::CITY_HALL)) { continue; } diff --git a/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp b/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp index 689ee3cf7..f8d36cb1b 100644 --- a/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp +++ b/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp @@ -344,7 +344,7 @@ Goals::TGoalVec GatherArmyBehavior::upgradeArmy(const Nullkiller * ai, const CGT if(scoutReinforcement >= armyToGetOrBuy.upgradeValue && ai->getFreeGold() >20000 - && !ai->buildAnalyzer->isGoldPreasureHigh()) + && !ai->buildAnalyzer->isGoldPressureHigh()) { Composition recruitHero; diff --git a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp index fb9a7a754..f086b62cd 100644 --- a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp +++ b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp @@ -85,7 +85,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose(const Nullkiller * ai) const continue; if(ai->cb->getHeroesInfo().size() < ai->cb->getTownsInfo().size() + 1 - || (ai->getFreeResources()[EGameResID::GOLD] > 10000 && !ai->buildAnalyzer->isGoldPreasureHigh())) + || (ai->getFreeResources()[EGameResID::GOLD] > 10000 && !ai->buildAnalyzer->isGoldPressureHigh())) { tasks.push_back(Goals::sptr(Goals::RecruitHero(town).setpriority(3))); } diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.cpp b/AI/Nullkiller/Engine/PriorityEvaluator.cpp index 2c87d4a1c..c01582eec 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.cpp +++ b/AI/Nullkiller/Engine/PriorityEvaluator.cpp @@ -85,7 +85,7 @@ void PriorityEvaluator::initVisitTile() rewardTypeVariable = engine->getInputVariable("rewardType"); closestHeroRatioVariable = engine->getInputVariable("closestHeroRatio"); strategicalValueVariable = engine->getInputVariable("strategicalValue"); - goldPreasureVariable = engine->getInputVariable("goldPreasure"); + goldPressureVariable = engine->getInputVariable("goldPressure"); goldCostVariable = engine->getInputVariable("goldCost"); fearVariable = engine->getInputVariable("fear"); value = engine->getOutputVariable("Value"); @@ -1017,9 +1017,9 @@ public: if(evaluationContext.goldReward) { - auto goldPreasure = evaluationContext.evaluator.ai->buildAnalyzer->getGoldPreasure(); + auto goldPressure = evaluationContext.evaluator.ai->buildAnalyzer->getGoldPressure(); - evaluationContext.addNonCriticalStrategicalValue(evaluationContext.goldReward * goldPreasure / 3500.0f / bi.prerequisitesCount); + evaluationContext.addNonCriticalStrategicalValue(evaluationContext.goldReward * goldPressure / 3500.0f / bi.prerequisitesCount); } if(bi.notEnoughRes && bi.prerequisitesCount == 1) @@ -1111,7 +1111,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task) rewardTypeVariable->setValue(rewardType); closestHeroRatioVariable->setValue(evaluationContext.closestWayRatio); strategicalValueVariable->setValue(evaluationContext.strategicalValue); - goldPreasureVariable->setValue(ai->buildAnalyzer->getGoldPreasure()); + goldPressureVariable->setValue(ai->buildAnalyzer->getGoldPressure()); goldCostVariable->setValue(evaluationContext.goldCost / ((float)ai->getFreeResources()[EGameResID::GOLD] + (float)ai->buildAnalyzer->getDailyIncome()[EGameResID::GOLD] + 1.0f)); turnVariable->setValue(evaluationContext.turn); fearVariable->setValue(evaluationContext.enemyHeroDangerRatio); diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.h b/AI/Nullkiller/Engine/PriorityEvaluator.h index beccbef62..02dbb2fad 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.h +++ b/AI/Nullkiller/Engine/PriorityEvaluator.h @@ -109,7 +109,7 @@ private: fl::InputVariable * strategicalValueVariable; fl::InputVariable * rewardTypeVariable; fl::InputVariable * closestHeroRatioVariable; - fl::InputVariable * goldPreasureVariable; + fl::InputVariable * goldPressureVariable; fl::InputVariable * goldCostVariable; fl::InputVariable * fearVariable; fl::OutputVariable * value; diff --git a/AI/Nullkiller/Engine/Settings.cpp b/AI/Nullkiller/Engine/Settings.cpp index f0465e764..136b053ad 100644 --- a/AI/Nullkiller/Engine/Settings.cpp +++ b/AI/Nullkiller/Engine/Settings.cpp @@ -26,7 +26,7 @@ namespace NKAI : maxRoamingHeroes(8), mainHeroTurnDistanceLimit(10), scoutHeroTurnDistanceLimit(5), - maxGoldPreasure(0.3f), + maxGoldPressure(0.3f), maxpass(30), allowObjectGraph(false) { @@ -71,9 +71,9 @@ namespace NKAI maxpass = node.Struct()["maxpass"].Integer(); } - if(node.Struct()["maxGoldPreasure"].isNumber()) + if(node.Struct()["maxGoldPressure"].isNumber()) { - maxGoldPreasure = node.Struct()["maxGoldPreasure"].Float(); + maxGoldPressure = node.Struct()["maxGoldPressure"].Float(); } if(!node.Struct()["allowObjectGraph"].isNull()) diff --git a/AI/Nullkiller/Engine/Settings.h b/AI/Nullkiller/Engine/Settings.h index c4b9510ec..881dc436f 100644 --- a/AI/Nullkiller/Engine/Settings.h +++ b/AI/Nullkiller/Engine/Settings.h @@ -25,14 +25,14 @@ namespace NKAI int mainHeroTurnDistanceLimit; int scoutHeroTurnDistanceLimit; int maxpass; - float maxGoldPreasure; + float maxGoldPressure; bool allowObjectGraph; public: Settings(); int getMaxPass() const { return maxpass; } - float getMaxGoldPreasure() const { return maxGoldPreasure; } + float getMaxGoldPressure() const { return maxGoldPressure; } int getMaxRoamingHeroes() const { return maxRoamingHeroes; } int getMainHeroTurnDistanceLimit() const { return mainHeroTurnDistanceLimit; } int getScoutHeroTurnDistanceLimit() const { return scoutHeroTurnDistanceLimit; } diff --git a/config/ai/nkai/nkai-settings.json b/config/ai/nkai/nkai-settings.json index a77362420..3dedd8f22 100644 --- a/config/ai/nkai/nkai-settings.json +++ b/config/ai/nkai/nkai-settings.json @@ -3,5 +3,5 @@ "maxpass" : 30, "mainHeroTurnDistanceLimit" : 10, "scoutHeroTurnDistanceLimit" : 5, - "maxGoldPreasure" : 0.3 + "maxGoldPressure" : 0.3 } \ No newline at end of file diff --git a/config/ai/nkai/object-priorities.txt b/config/ai/nkai/object-priorities.txt index 1989bc3c7..44c8ef954 100644 --- a/config/ai/nkai/object-priorities.txt +++ b/config/ai/nkai/object-priorities.txt @@ -91,7 +91,7 @@ InputVariable: strategicalValue term: MEDIUM Triangle 0.250 1.000 2.000 term: HIGH Triangle 1.000 2.000 3.000 term: CRITICAL Ramp 2.000 3.000 -InputVariable: goldPreasure +InputVariable: goldPressure description: Ratio between weekly army cost and gold income enabled: true range: 0.000 1.000 @@ -238,19 +238,19 @@ RuleBlock: gold disjunction: AlgebraicSum implication: AlgebraicProduct activation: General - rule: if goldReward is HUGE and goldPreasure is HIGH and heroRole is SCOUT and danger is NONE then Value is HIGHEST - rule: if goldReward is HUGE and goldPreasure is HIGH and heroRole is SCOUT and danger is not NONE and armyLoss is LOW then Value is BITHIGH + rule: if goldReward is HUGE and goldPressure is HIGH and heroRole is SCOUT and danger is NONE then Value is HIGHEST + rule: if goldReward is HUGE and goldPressure is HIGH and heroRole is SCOUT and danger is not NONE and armyLoss is LOW then Value is BITHIGH rule: if goldReward is HUGE and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is HIGHEST - rule: if goldReward is HUGE and goldPreasure is HIGH and heroRole is MAIN and danger is NONE then Value is HIGH - rule: if goldReward is BIG and goldPreasure is HIGH and heroRole is SCOUT and danger is NONE then Value is HIGH - rule: if goldReward is BIG and goldPreasure is HIGH and heroRole is SCOUT and danger is not NONE then Value is MEDIUM - rule: if goldReward is BIG and goldPreasure is HIGH and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is HIGH - rule: if goldReward is BIG and goldPreasure is HIGH and heroRole is MAIN and danger is NONE then Value is MEDIUM - rule: if goldReward is MEDIUM and goldPreasure is HIGH and heroRole is SCOUT and danger is NONE then Value is BITHIGH - rule: if goldReward is MEDIUM and goldPreasure is HIGH and heroRole is SCOUT and danger is not NONE then Value is SMALL - rule: if goldReward is MEDIUM and goldPreasure is HIGH and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is BITHIGH - rule: if goldReward is SMALL and goldPreasure is HIGH and heroRole is SCOUT and danger is NONE then Value is MEDIUM - rule: if goldReward is SMALL and goldPreasure is HIGH and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is SMALL + rule: if goldReward is HUGE and goldPressure is HIGH and heroRole is MAIN and danger is NONE then Value is HIGH + rule: if goldReward is BIG and goldPressure is HIGH and heroRole is SCOUT and danger is NONE then Value is HIGH + rule: if goldReward is BIG and goldPressure is HIGH and heroRole is SCOUT and danger is not NONE then Value is MEDIUM + rule: if goldReward is BIG and goldPressure is HIGH and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is HIGH + rule: if goldReward is BIG and goldPressure is HIGH and heroRole is MAIN and danger is NONE then Value is MEDIUM + rule: if goldReward is MEDIUM and goldPressure is HIGH and heroRole is SCOUT and danger is NONE then Value is BITHIGH + rule: if goldReward is MEDIUM and goldPressure is HIGH and heroRole is SCOUT and danger is not NONE then Value is SMALL + rule: if goldReward is MEDIUM and goldPressure is HIGH and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is BITHIGH + rule: if goldReward is SMALL and goldPressure is HIGH and heroRole is SCOUT and danger is NONE then Value is MEDIUM + rule: if goldReward is SMALL and goldPressure is HIGH and heroRole is MAIN and danger is not NONE and armyLoss is LOW then Value is SMALL rule: if goldReward is LOWEST then Value is SMALL with 0.1 rule: if goldReward is SMALL then Value is SMALL with 0.2 rule: if goldReward is MEDIUM then Value is SMALL with 0.5