detect campaign tie

This commit is contained in:
Maxime Réaux 2026-02-20 11:01:25 +01:00
parent 7c9c941864
commit 60d8e6ca15
9 changed files with 203 additions and 116 deletions

View file

@ -371,6 +371,14 @@ class War:
# Round methods
# TODO replace multiloops by internal has_* method
def get_round(self, round_id: str) -> Round:
for camp in self.campaigns:
for rnd in camp.rounds:
if rnd.id == round_id:
return rnd
raise KeyError("Round not found")
def add_round(self, campaign_id: str) -> Round:
camp = self.get_campaign(campaign_id)
return camp.add_round()
@ -420,7 +428,7 @@ class War:
for bat in rnd.battles.values():
if bat.sector_id == battle_id:
return bat
raise KeyError("Round not found")
raise KeyError("Battle not found")
def create_battle(self, round_id: str, sector_id: str) -> Battle:
camp = self.get_campaign_by_round(round_id)