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.3k stars 387 forks source link

BattleDelegate#setupTerritoriesAbandonedToTheEnemy:671 - java.lang.IllegalStateException #12351

Open tripleabuilderbot opened 5 months ago

tripleabuilderbot commented 5 months ago

Map

crazygs_ww1

Log Message

Should not be possible to have a normal battle in: Macedonia and have abandoned or only bombing there too.

TripleA Version

2.6.14602

Java Version

11.0.19

Operating System

Windows 10

Stack Trace

Exception: java.lang.IllegalStateException Should not be possible to have a normal battle in: Macedonia and have abandoned or only bombing there too.
java.lang.Exception
    at games.strategy.triplea.delegate.battle.BattleDelegate.setupTerritoriesAbandonedToTheEnemy(BattleDelegate.java:671)
    at games.strategy.triplea.delegate.battle.BattleDelegate.doInitialize(BattleDelegate.java:206)
    at games.strategy.triplea.delegate.battle.BattleDelegate.start(BattleDelegate.java:87)
    at games.strategy.engine.framework.ServerGame.startStep(ServerGame.java:575)
    at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:443)
    at games.strategy.engine.framework.ServerGame.runNextStep(ServerGame.java:345)
    at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:312)
    at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInternal(LocalLauncher.java:92)
    at games.strategy.engine.framework.startup.launcher.LocalLauncher.lambda$launch$0(LocalLauncher.java:60)
    at java.base/java.lang.Thread.run(Thread.java:829)
asvitkine commented 5 months ago

This is using "2023-December-05` - 2.6.14602 Pre-release", which is not so old. I'm not sure we had any fixes for something like this since, so this probably still exists.

But I'm not sure what the repro steps are...

WCSumpton commented 2 months ago

@asvitkine

This error happens because land combat rounds have been set to something other then -1. At the end of the combat rounds the defender only has air units left, and the attacker has ground forces. The territory becomes contested. The next player has to be the defender otherwise the air unit might be removed during a subsequent players turn. 2024-5-11-CrazyG's-Giant-World-War-1-v0.2.tsvg.zip In the attached save a United Kingdom Infantry as attacked for Austria 01 to Austria 02 and the lone Austria-Hungary Airship. The battle has ended in a stalemate, and it is now Austria-Hungary's turn. Select "Done" for combat move, and ok because nothing has moved. Because Austria 02 is the only battle, it will try to select it and the ensuing error message will show.

Hope this helps.

Cheers...

asvitkine commented 2 months ago

@WCSumpton

Thanks for the explanation. I assume the expected behavior would be for a combat to still happen there, with airship attacking the ground unit? (and if the active player doesn't want that to happen, they should actually abandon and move out the air ship?)

WCSumpton commented 2 months ago

Thanks for the explanation. I assume the expected behavior would be for a combat to still happen there, with airship attacking the ground unit? (and if the active player doesn't want that to happen, they should actually abandon and move out the air ship?)

That would be my thought. This "error" still occurs even when the airship is replaced with a recon-plane. Also, if Austria-Hungary only moves air unit into the territory, the "error" will occur. If Austria-Hungary moves a ground unit into territory Austria 02, then the battle will happen normally. If Austria-Hungary wins the battle, the airship is allowed to remain in territory Austria 02 and other air unit are allowed to land there during the non-combat move.

Cheers...

Cernelius commented 2 months ago

For your information, these rules (limited combat rounds) were made with the intent of replicating the game mechanics of a well known WW1 board-game. However, that project was never ultimated.

In the aforementioned board-game, you were never allowed to have air units anywhere unless the same power owning the air unit also owned at least one land unit in the territory (Yes, you also need 1 land unit in the territory to land your air unit in that territory.), and actually at least one of the land units needed to be an infantry, so you practically needed at least one infantry in every territory in which you had one or more air units (allied units do not count).

To be clear, I'm not saying that these rules should be hard-coded as part of what at this situation (but rather that they should be added to the program under an other property or some-such): I'm just wondering whether this problem may derive by something related to the fact that, in the rules-set which was intended to be supported when the limited combat rounds properties were added, it would just never happen to have air units fighting alone against land units or whatever.

As a side note, in that board-game there are no airships: all air units are fighters.

If @panther2 can check what I said, that would be good.