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:
parent
dd046e60be
commit
ff57a52001
@ -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())
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user