triplea-game / triplea

TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.
https://triplea-game.org/
GNU General Public License v3.0
1.34k stars 392 forks source link

Retreat ignores "unitsNotAllowed" #4107

Open alkexr opened 5 years ago

alkexr commented 5 years ago

Engine version

11665 pre-release Most likely affects all engine versions

Bug description

Retreat ignores "unitsNotAllowed" of the territory effect

How to trigger the bug?

Use e.g. Battle for Arda. Attack a territory from 2 directions:

retreattomountain.zip (here only rangers should be able to enter mountains)

Instead of this, what should have happened?

Not sure. General solution would require retreat to multiple territories OR disallowing retreat when no territory is suitable for all retreating units.

Cernelius commented 5 years ago

This is a same problem also for movement stack limits.

ron-murhammer commented 5 years ago

Yeah, generally retreat locations are missing some verification for some of the more advanced properties. I think it should probably work that you can only retreat to 1 location and only if all units should be allowed to move there.

Cernelius commented 5 years ago

Just for at least supporting the matter at hand, that is most likely the right solution. However, solving this issue would be highly complementary with adding some option for a more refined way to handle retreat, that, then, a mapmaker would just assure to be using when having such options in its map. Once you have the ability to specify units for stack limits / canals / territory effects, the ability to retreat all to 1 single of the territories you came from ends up being really to simplistic and limited. Simple example: you have units that cannot go in territory effect A and units that cannot go in territory effect B; they come from territories having such effects, thus nobody can possibly retreat until all the other ones are dead.

ron-murhammer commented 5 years ago

True though the only simple solution to that is to have an option where units retreat to where they came from.

simon33-2 commented 5 years ago

I think the only reason why retreat is only to a single territory is because it's too hard to keep track of origins in a board game such as Axis and Allies. I'd suggest that you only be asked which units are retreating when you actually retreat, not when you actually allocate casualties just for the annoyance factor of the latter.

Cernelius commented 5 years ago

@ron-murhammer That may be a simple solution, but, as @simon33-2 points out, the challenge would be for same units types, coming from different territories, that you would either have to decide which ones are getting killed each combat round or you would need having it randomized (and in this case that should be sorted at the moment you retreat, not each combat round, or you would still need to display it to the user, as that may be important for casualties choices).

We should really open a feature request in forum about this, as this would be a separate feature (either a property or a unit option), but I think the best solution would be to generally allow for units to end combat in the same territory (just like air does), and getting 1 remaining movement for that (no matter how much they used in combat movement), and, in non combat move or at the end of the combat phase, being able to move them (of 1), but only for going to territories whence any of the units that were in there (no matter if any of those surviving) came from. So, I guess, probably better at the end of the combat phase, to not make confusion with non combat movements, since all connections but the ones from which any combat movements were made would need to be temporary made unusable. Practically, exactly like if they were all air units using all movement but 1 to get to the target, but with the additional limit of being limited to use a connection that was used during combat movement by any not-air units (excluding those moved with air transports). Then another property to destroy all your units in hostile territories, after that, to force you to actually retreat all (this could be used also for limited combat rounds, if wanted, to change it into a victory or death timed thing).

simon33-2 commented 5 years ago

But I already suggested a different option to the randomised idea (which I hate).

Interesting idea to have the unretreatable units just move on NCM.

simon33-2 commented 5 years ago

Another possible idea would be to just have the unretreatable units continue to fight, like they do when you have an amphibious assault. What do you think of that idea?

stale[bot] commented 5 years ago

The TripleA team regrets this issue was not solved sooner. To keep focus on latest issues and the most pressing tasks, this issue has been automatically marked as stale because it has not had recent activity. If the issue may be closed, please do so. If there are remaining items, we encourage for those items to be resubmitted as new, independent, concise tasks. The strategy is divide and conquer. Thank you for your contributions.