Fix retreat injured CA taking allied villages #6792
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is a comment in the retreat injured CA code that taking ally side villages should be disallowed, with potential exceptions, but apparently I forgot to do that after porting this CA to the default AI. For 1.16, it is too late to do anything other than disallowing this. That part should be done though, in order to make it consistent with previous behavior (and with player expectations). That's the first commit in this PR, which should be backported.
The other two commits, for master only, add a new AI aspect
allow_ally_villages
which, when set, let's injured units take ally villages, but they will do so with lower priority than using own or enemy villages. I decided against letting only "very injured" units do so in favor of a more clear-cut behavior, and also because there is already an aspect that affects how injured a unit has to be before it retreats. Adding yet another sliding-scale parameter on top of that would be too confusing, in my opinion.