1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Nullkiller: hero chain stabilisation

This commit is contained in:
Andrii Danylchenko 2021-05-15 21:26:24 +03:00 committed by Andrii Danylchenko
parent dd046e60be
commit ff57a52001
2 changed files with 3 additions and 12 deletions

View File

@ -43,8 +43,7 @@ Goals::TGoalVec CaptureObjectsBehavior::getTasks() {
vstd::erase_if(waysToVisitObj, [objToVisit](Goals::TSubgoal goal) -> bool
{
return !goal->hero.validAndSet()
|| !shouldVisit(goal->hero, objToVisit)
|| goal->evaluationContext.danger * 1.5 > goal->hero->getTotalStrength();
|| !shouldVisit(goal->hero, objToVisit);
});
if(waysToVisitObj.empty())

View File

@ -302,17 +302,9 @@ float PriorityEvaluator::evaluate(Goals::TSubgoal task)
const CGObjectInstance * target = cb->getObj((ObjectInstanceID)objId, false);
auto estimateLoss = [](double strength, double danger) -> double
{
auto ratio = danger / strength;
return ratio * ratio * ratio * strength;
};
auto hero = heroPtr.get();
auto armyTotal = hero->getTotalStrength();
auto armyLoss = estimateLoss(armyTotal, task->evaluationContext.danger);
double armyLossPersentage = armyLoss / (double)armyTotal;
auto armyTotal = task->evaluationContext.heroStrength;
double armyLossPersentage = task->evaluationContext.armyLoss / (double)armyTotal;
int32_t goldReward = getGoldReward(target, hero);
uint64_t armyReward = getArmyReward(target, hero);
double result = 0;