Closed ChrisNeedham24 closed 1 year ago
Acceptance Criteria:
For further context, the current way that AI players deploy units is to move them to the quad below the settlement, regardless of whether there are other units there. This is clearly not ideal, and potentially extends to other problems where AI players have multiple of their own units stacked.
The changes for this will be made in movemaker.py, and can broadly follow the same sort of logic as exists for AI units moving to attack other units, on lines 394-403.
I'm actually not sure if this is an issue. The two cases where this happens are when a settler or a regular unit is deployed due to certain conditions. I believe that in any case, these units will immediately move anyway, so you'll never end up with a situation where you can't see your own unit. With respect to situations where AI units might be stacked, this will never happen either, because once deployed, each unit will move away to quads that nothing is occupying.
This also solves somewhat of a problem where if units encircle a settlement, in theory nothing can be deployed.
I'll mark this as unsure
for now, and come back to it later. If I can't reproduce then, I'll close this issue.
So further investigation has confirmed that these units will always move post-deployment. However, it turns out that AI settler units or attacking/healer units that have elected not to attack/heal, when moving randomly, don't actually check that there's nothing there before moving to the new location. So, I suspect that's what caused the original bug - an AI unit that had a random roll of the dice that turned out to be no movement in any direction, leaving them where they originally deployed - directly under their settlement and on top of a player unit.
This issue will be slightly altered to reflect these new findings.
Currently the AI players always deploy their units in the same location (one quad below their settlement), even if other players already have a unit there. Logically can follow the first/second/third resort logic already in movemaker.py.