mirror of
https://github.com/vcmi/vcmi.git
synced 2026-05-22 09:55:17 +02:00
BattleAI: optional simulation depth
This commit is contained in:
@@ -655,11 +655,14 @@ BattleScore BattleExchangeEvaluator::calculateExchange(
|
||||
});
|
||||
|
||||
bool canUseAp = true;
|
||||
const int totalTurnsCount = 10;
|
||||
|
||||
std::set<uint32_t> blockedShooters;
|
||||
|
||||
for(int exchangeTurn = 0; exchangeTurn < totalTurnsCount; exchangeTurn++)
|
||||
int totalTurnsCount = simulationTurnsCount >= turn + turnOrder.size()
|
||||
? simulationTurnsCount
|
||||
: turn + turnOrder.size();
|
||||
|
||||
for(int exchangeTurn = 0; exchangeTurn < simulationTurnsCount; exchangeTurn++)
|
||||
{
|
||||
bool isMovingTurm = exchangeTurn < turn;
|
||||
int queueTurn = exchangeTurn >= exchangeUnits.units.size()
|
||||
@@ -826,6 +829,14 @@ BattleScore BattleExchangeEvaluator::calculateExchange(
|
||||
|
||||
auto score = v.getScore();
|
||||
|
||||
if(simulationTurnsCount < totalTurnsCount)
|
||||
{
|
||||
float scalingRatio = simulationTurnsCount / static_cast<float>(totalTurnsCount);
|
||||
|
||||
score.enemyDamageReduce *= scalingRatio;
|
||||
score.ourDamageReduce *= scalingRatio;
|
||||
}
|
||||
|
||||
if(turn > 0)
|
||||
{
|
||||
auto turnMultiplier = 1 - std::min(0.2, 0.05 * turn);
|
||||
|
||||
Reference in New Issue
Block a user