@Cernel said in Question on MustFightBattle#checkForUnitsThatCanRollLeft and "Transport Casualties Restricted" property:
@Trevan So why the first post still says "At the end of a round when a defender either has no more units or only infrastructure units"? Didn't you say that is actually in between of the defensive fire step and the retreat step? You said there is nothing related to this issue anywhere after the retreat step (thus nothing "at the end of a round"), right? Just asking to be sure the first post is wrong and being corrected by following ones.
When I said "end of round" in the first post, I was talking about after the shooting. I should have been more clear. I didn't think it really mattered.
Also, didn't you say that you misread the code, and the first auto-kill is about defenceless and the second about infrastructures? In this case, of course, the first one would be v3 rules only and the second one would be generic.
No, the first auto-kill and the second auto-kill affect the same types of units. It is just that the second auto-kill only occurs if all of the units are infrastructure units. That makes me think it hardly ever happens because I'm not sure any current maps have those types of units.
Also, can you confirm that when you said things like this:
Another question. In this auto-kill location after the standard attack, it will only remove undefended transports IF "Transport Casualties Restricted" is true. But it will always remove units with no rolls. But the auto-kill location before the standard attack, it will only kill undefended transports AND units with no rolls IF "Transport Casualties Restricted". Any ideas why the two locations treat units with no rolls differently? Should they be treated the same? And if so, which way should it be treated?
The "units with no rolls" are actually units with attack and defence values equal to 0 (which I would say is a wrong check, as only one of the other should matter, dependind whether the unit is offending or defending) and with no support attachments, regardless of their offensive or defensive rolls values? If so, can everyone please stop confusingly saying "no rolls" or "units that can't roll anymore" to refer to this, as that literally comprises units that have 0 rolls (and possibly positive attack or defence or both) and units that cannot target any remaining units, which I understand it is not what it is being checked (right?)?
"units with no rolls" are units that have either attack or defense of 0 depending on whether they are attacking or defending. That's in the code snippet above.
The reason why I was using "no rolls" is because that is how the code describes them. I'm going to start calling them "useless" units or "unprotected" units since they are units that have no attack or defense (depending on the situation) or they have no support capability.
There are two types of auto-destruction: 1) unescorted transports 2) units with no rolls. #1 is always controlled by "Transport Casualties Restricted". #2 is only controlled by "Transport Casualties Restricted" before the standard fire step. After the standard fire step, it doesn't care about that property.
How is the situation after the fire steps ever even happening since you said:
I'm looking at the second place where the auto-kill is happening. And I think I misread the code. I think the auto-kill rarely ever happens there. It first checks that
CollectionUtils.getMatches(defendingUnits, Matches.unitIsNotInfrastructure()).size() == 0. So, it will only do the auto kill IF there are only infrastructure units available. And only those infrastructure units will be auto-killed.
And, obviously, when only infrastructures remain for one or both sides, the battle is over regardless of anything else. So how is not everything else useless for the second check.
That is what I'm trying to understand. In the second case, it checks if only infrastructure is around. Then it will auto-kill any of the undefended transports if "transport casualties restricted" is true. And it will auto-kill any of the unprotected units regardless of the "transport casualties restricted". But in the first case, it only auto-killed the unprotected units if "transport casualties restricted". So, why is the difference? And it is looking like the second case might be pointless unless you can have an infrastructure unit that is also a "unprotected unit" that needs to be auto-killed.
Furthermore, and here we go back to what I suggested that, before thinking about fine tuning these codes, one should rather fix the known problems related to them, you say:
The auto destruction also never happens after the retreat steps. It is either before the standard attack or after the standard attack but before the retreat step.
Which is contrary to what experienced as reported at this issue:
TripleA should not offer the attacker's option to retreat, if after a round of combat only a defending AAA-gun is left. In the attached savegames (1.9/1.10) the remaining infantry is incorrectly offered a retreat option when facing only a "defending" AAA gun.
That is saying the problem is actually the behavioural absence of auto-destruction "after the standard attack but before the retreat step".
No, that bug report is not contrary to what I'm saying. The aaGun is not an infrastructure unit. So the auto-kill that occurs before the retreat doesn't see it. The user is given the retreat option and then the round starts over and the unit is auto-killed before the attack step.