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 393 forks source link

2.6: When opening battle calc on own territory on own turn, your country is selected as both attacker and defender. #12688

Open asvitkine opened 3 months ago

asvitkine commented 3 months ago

2.6: When opening battle calc on own territory on own turn, your country is selected as both attacker and defender.

See discussion here: https://forums.triplea-game.org/topic/2999/2-6-release-getting-close-need-volunteers-to-help-beta-test-2-6/190?page=10

Although one could argue this "could" be helpful if you want to simulate an attack with the units of that territory, that functionality already exists via "swap sides" button.

Where it's not helpful, is when the units can debuff opposing units, so the stats shown (I guess just "power"?) are not accurate. In 2.5, it would default to an arbitrary hostile player.

Cernelius commented 3 months ago

I found this weird too, and I agree that clicking the "Swap Sides" button is generally faster.

Was this (having such units on both attack and defence instead of only defence like in 2.5) an intended change?

Cernelius commented 3 months ago

In 2.5, it would default to an arbitrary hostile player.

I would rather leave it empty unless something better than a "first in some list" way of determining it is devised.

asvitkine commented 3 months ago

I found this weird too, and I agree that clicking the "Swap Sides" button is generally faster.

Was this (having such units on both attack and defence instead of only defence like in 2.5) an intended change?

I don't think it was intended, I think that case wasn't considered and was a side effect of the overall changes to this logic.

DanVanAtta commented 3 months ago

I don't think it was intended, I think that case wasn't considered and was a side effect of the overall changes to this logic.

Agree. I think an invariant is that the same side should never be chosen as both defender and attacker (unless somehow there is a map with exactly one faction, which is hard to imagine).

Adding recent comments from me on forum. Overall I think the algorithm should be roughly as follows (to my knowledge, this is pretty close to how it works now, these scenarios assume no battle calc window is open):

"ctrl+a" -> units owned by the current player from the given territory are selected as attackers. If no units are owned by the current player, then whomever owns the most units in the territory is chosen as the attacker. If the territory is empty, then the attacker is selected to be the territory owner (which could be "the neutral" player).

"ctrl+d" -> similar to 'ctrl+a' but operates with defense & ignores the current player (current player should be selected as the attacker)

"ctrl+b" -> same as "ctrl+a"

frigoref commented 2 months ago

@DanVanAtta Isn't this issue about not being able to identify the pair Attacker x Defender and what should happen when this pair is not been able to clearly be determined? From the posts above I still don't understand what the expected behavior of the game is supposed to be in this case.

DanVanAtta commented 2 months ago

@frigoref - this is the issue:

2.6: When opening battle calc on own territory on own turn, your country is selected as both attacker and defender.

That should never be the case. Current player should always be the attacker. The logic for choosing the defender is somewhat involved, but if there are no defenders present - then whomever is at war and has the next turn is probably the best choice for defender. For example, in WaW, ctrl+b clicking a german territory while it is Germany's turn should default to "russia" as the defender.

frigoref commented 2 months ago

@Cernelius, @asvitkine, @DanVanAtta Should be solved with PR 12816 - battleCalculator #1 (fix issue 12688 battle calc attacker/defender determination) Could someone confirm and close this issue if all is fixed as expected?