fix ignored campaign NP tie-break when closing war
This commit is contained in:
parent
b1bde76319
commit
72f80563f1
16 changed files with 314 additions and 219 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from typing import List, Dict, Tuple, TYPE_CHECKING
|
||||
from typing import List, Dict, TYPE_CHECKING
|
||||
|
||||
from PyQt6.QtWidgets import QDialog
|
||||
from PyQt6.QtWidgets import QMessageBox
|
||||
|
|
@ -105,9 +105,8 @@ class RoundController:
|
|||
if battle.is_draw():
|
||||
p1_icon = Icons.get(IconName.DRAW)
|
||||
p2_icon = Icons.get(IconName.DRAW)
|
||||
if TieResolver.was_tie_broken_by_tokens(
|
||||
war, ContextType.BATTLE, battle.sector_id
|
||||
):
|
||||
context = TieContext(ContextType.BATTLE, battle.sector_id)
|
||||
if TieResolver.was_tie_broken_by_tokens(war, context):
|
||||
effective_winner = ResultChecker.get_effective_winner_id(
|
||||
war, ContextType.BATTLE, battle.sector_id, None
|
||||
)
|
||||
|
|
@ -179,7 +178,7 @@ class RoundController:
|
|||
|
||||
def resolve_ties(
|
||||
self, war: War, contexts: List[TieContext]
|
||||
) -> Dict[Tuple[ContextType, str, int | None], Dict[str, bool]]:
|
||||
) -> Dict[tuple[str, str, int | None], Dict[str, bool]]:
|
||||
bids_map = {}
|
||||
for ctx in contexts:
|
||||
players = [
|
||||
|
|
@ -198,13 +197,9 @@ class RoundController:
|
|||
context_id=ctx.context_id,
|
||||
)
|
||||
if not dialog.exec():
|
||||
TieResolver.cancel_tie_break(
|
||||
war, ContextType.BATTLE, ctx.context_id, ctx.score_value
|
||||
)
|
||||
TieResolver.cancel_tie_break(war, ctx)
|
||||
raise ForbiddenOperation("Tie resolution cancelled")
|
||||
bids_map[(ctx.context_type, ctx.context_id, ctx.score_value)] = (
|
||||
dialog.get_bids()
|
||||
)
|
||||
bids_map[ctx.key()] = dialog.get_bids()
|
||||
return bids_map
|
||||
|
||||
# Choice methods
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue