diff --git a/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp b/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp index e88ab5928..4a2b3fc83 100644 --- a/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp +++ b/AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp @@ -307,6 +307,8 @@ Goals::TGoalVec GatherArmyBehavior::upgradeArmy(const CGTownInstance * upgrader) path.heroArmy, upgrader->getUpperArmy())); + armyToGetOrBuy.upgradeValue -= path.heroArmy->getArmyStrength(); + armyToGetOrBuy.addArmyToBuy( ai->nullkiller->armyManager->toSlotInfo( ai->nullkiller->armyManager->getArmyAvailableToBuy( diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.cpp b/AI/Nullkiller/Engine/PriorityEvaluator.cpp index 135f1451a..11efc0ec1 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.cpp +++ b/AI/Nullkiller/Engine/PriorityEvaluator.cpp @@ -1014,6 +1014,8 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task) + (evaluationContext.armyReward > 0 ? 1 : 0) + (evaluationContext.skillReward > 0 ? 1 : 0) + (evaluationContext.strategicalValue > 0 ? 1 : 0); + + auto goldRewardPerTurn = evaluationContext.goldReward / std::log2f(evaluationContext.movementCost * 10); double result = 0; @@ -1023,7 +1025,7 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task) heroRoleVariable->setValue(evaluationContext.heroRole); mainTurnDistanceVariable->setValue(evaluationContext.movementCostByRole[HeroRole::MAIN]); scoutTurnDistanceVariable->setValue(evaluationContext.movementCostByRole[HeroRole::SCOUT]); - goldRewardVariable->setValue(evaluationContext.goldReward); + goldRewardVariable->setValue(goldRewardPerTurn); armyRewardVariable->setValue(evaluationContext.armyReward); armyGrowthVariable->setValue(evaluationContext.armyGrowth); skillRewardVariable->setValue(evaluationContext.skillReward); diff --git a/config/ai/object-priorities.txt b/config/ai/object-priorities.txt index 13ec86617..acef84421 100644 --- a/config/ai/object-priorities.txt +++ b/config/ai/object-priorities.txt @@ -23,11 +23,11 @@ InputVariable: goldReward enabled: true range: 0.000 5000.000 lock-range: true - term: LOW Triangle 10.000 500.000 2000.000 - term: MEDIUM Triangle 500.000 2000.000 5000.000 - term: HIGH Ramp 2000.000 5000.000 - term: NONE Ramp 100.000 0.000 - term: LOWEST Triangle 0.000 100.000 500.000 + term: LOWEST Triangle 0.000 100.000 200.000 + term: SMALL Triangle 100.000 200.000 400.000 + term: MEDIUM Triangle 200.000 400.000 1000.000 + term: BIG Triangle 400.000 1000.000 5000.000 + term: HUGE Ramp 1000.000 5000.000 InputVariable: armyReward enabled: true range: 0.000 10000.000 @@ -97,7 +97,7 @@ InputVariable: goldPreasure range: 0.000 1.000 lock-range: false term: LOW Ramp 0.300 0.000 - term: HIGH Discrete 0.100 0.000 0.250 0.100 0.300 0.200 0.400 0.700 1.000 1.000 + term: HIGH Discrete 0.100 0.000 0.250 0.200 0.300 0.300 0.400 0.700 1.000 1.000 InputVariable: goldCost description: Action cost in gold enabled: true @@ -214,4 +214,23 @@ RuleBlock: armyReward rule: if heroRole is MAIN and armyReward is MEDIUM and mainTurnDistance is MEDIUM and fear is not HIGH then Value is BITHIGH rule: if heroRole is MAIN and armyReward is MEDIUM and mainTurnDistance is LONG and fear is not HIGH then Value is MEDIUM rule: if heroRole is MAIN and armyReward is LOW and mainTurnDistance is LOW and fear is not HIGH then Value is MEDIUM - rule: if heroRole is MAIN and armyReward is LOW and mainTurnDistance is MEDIUM and fear is not HIGH then Value is SMALL \ No newline at end of file + rule: if heroRole is MAIN and armyReward is LOW and mainTurnDistance is MEDIUM and fear is not HIGH then Value is SMALL +RuleBlock: gold + enabled: true + conjunction: AlgebraicProduct + 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 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 \ No newline at end of file