[freeciv-ai] Re: (PR#14529) AI keeps building already present in a city.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14529 >
Per I. Mathisen wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=14529 >
> On Wed, 2 Nov 2005, Mateusz Stefek wrote:
>>Look what Romans do in Eridu. It switches production to Barracks which
>>are already present in the city.
> This looks like an effects bug. The military advisor thinks it does not
> have barracks, and wishes to build one before it builds military units.
> Jason was the last one to touch this code, I think, with the land defense
> 2: Tiberius's Eridu(7,9) [s11 d8344 u94 g28] overriding Destroyer(691)
> with Destroyer(1574) [attack=3600,value=20,move_time=1,vuln=225,bcost=60]
> 2: Tiberius's Eridu(7,9) [s11 d8344 u94 g28] ksw: Eridu has chosen
> attacker, Destroyer, want=1574
> 2: Tiberius's Eridu(7,9) [s11 d8344 u94 g28] military advisor choice:
> Barracks II (want 1574)
> See adjust_ai_unit_choice() in ai/advmilitary.c; I no longer understand
> what goes on in this code.
This is probably the same as the bug causing city walls not to be
displayed. I really don't know what to do about it.
However it's an AI bug too because this code should be able to handle
multiple barracks. We might have one barracks but want to build a
second one (in a ruleset which has barracks1 and barracks2) before
building a larger unit.
Barracks1: +1 veterancy, costs 30 shields
Barracks2: +1 veterancy, costs 30 shields
The first barracks increases military effectiveness by 50%. So if we're
building more than 60 shields worth of units it's worth it. The second
barracks increases effectiveness by only 25%. So if we're building more
than 120 shields worth of units it's worth it. This is the kind of
logic the code should follow (though actually a +50% bonus to offense
and defense might be worth more than +50% shields).