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

Style, commend - requested

This commit is contained in:
Tomasz Zieliński 2022-09-10 06:38:46 +02:00 committed by Andrii Danylchenko
parent 22b4795f86
commit 40585a66c0
2 changed files with 8 additions and 5 deletions

View File

@ -299,7 +299,13 @@ float RewardEvaluator::getEnemyHeroStrategicalValue(const CGHeroInstance * enemy
vstd::amax(objectValue, getStrategicalValue(obj));
}
//AI should absolutely prioritize killing enemy heroes, even scouts
/*
1. If an enemy hero can attack nearby object, it's not useful to capture the object on our own.
Killing the hero is almost as important (0.9) as capturing the object itself.
2. The formula quickly approaches 1.0 as hero level increases,
but higher level always means higher value and the minimal value for level 1 hero is 0.5
*/
return std::min(1.0f, objectValue * 0.9f + (1.0f - (1.0f / (1 + enemy->level))));
}

View File

@ -5583,10 +5583,7 @@ bool CGameHandler::isAllowedExchange(ObjectInstanceID id1, ObjectInstanceID id2)
auto topArmy = dialog->exchangingArmies.at(0);
auto bottomArmy = dialog->exchangingArmies.at(1);
if (topArmy == o1 && bottomArmy == o2)
return true;
if (bottomArmy == o1 && topArmy == o2)
if (topArmy == o1 && bottomArmy == o2 || bottomArmy == o1 && topArmy == o2)
return true;
}
}