From 5ef8d5ab92968162ba7fd1d8b8a7b3828883fc13 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 4 Oct 2022 05:56:19 +0300 Subject: [PATCH 28/28] AI: Correct which players one considers to be Tech Parasite of - Consider team members when pooled research off - Do not consider dead players See osdn #45588 Signed-off-by: Marko Lindqvist --- ai/default/daieffects.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/ai/default/daieffects.c b/ai/default/daieffects.c index 20b4a92644..15ac0291c9 100644 --- a/ai/default/daieffects.c +++ b/ai/default/daieffects.c @@ -256,31 +256,30 @@ adv_want dai_effect_value(struct player *pplayer, { int bulbs; int value; - + if (nplayers <= amount) { - break; + break; } bulbs = 0; - players_iterate(aplayer) { - int potential = (aplayer->server.bulbs_last_turn - + city_list_size(aplayer->cities) + 1); + players_iterate_alive(aplayer) { + if (aplayer != pplayer + && (!game.info.team_pooled_research + || !players_on_same_team(aplayer, pplayer))) { + bulbs += (aplayer->server.bulbs_last_turn + + city_list_size(aplayer->cities) + 1); + } + } players_iterate_alive_end; - if (players_on_same_team(aplayer, pplayer)) { - continue; - } - bulbs += potential; - } players_iterate_end; - /* For some number of turns we will be receiving bulbs for free * Bulbs should be amortized properly for each turn. * We use formula for the sum of geometric series: */ value = bulbs * (1.0 - pow(1.0 - (1.0 / MORT), turns)) * MORT; - - value = value * (100 - game.server.freecost) - * (nplayers - amount) / (nplayers * amount * 100); - + + value = value * (100 - game.server.freecost) + * (nplayers - amount) / (nplayers * amount * 100); + /* WAG */ value /= 3; -- 2.35.1