From 278d612ec288fb927ff29c719571c4ecc14e2c94 Mon Sep 17 00:00:00 2001 From: Logan Davidson Date: Mon, 12 Feb 2024 19:12:19 +0000 Subject: [PATCH] Add Leader attribute data --- backend/rorapp/admin/__init__.py | 2 +- backend/rorapp/functions/game_starter.py | 12 +++++++----- backend/rorapp/presets/leader.json | 22 ++++++++++++++++++++++ backend/rorapp/presets/situation.json | 16 ---------------- 4 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 backend/rorapp/presets/leader.json diff --git a/backend/rorapp/admin/__init__.py b/backend/rorapp/admin/__init__.py index cae36548..9d89aeed 100644 --- a/backend/rorapp/admin/__init__.py +++ b/backend/rorapp/admin/__init__.py @@ -13,4 +13,4 @@ from .title import TitleAdmin # noqa: F401 from .turn import TurnAdmin # noqa: F401 from .waitlist_entry import WaitlistEntryAdmin # noqa: F401 -from .war import WarAdmin # noqa: F401 \ No newline at end of file +from .war import WarAdmin # noqa: F401 diff --git a/backend/rorapp/functions/game_starter.py b/backend/rorapp/functions/game_starter.py index f89fb5d7..390336bc 100644 --- a/backend/rorapp/functions/game_starter.py +++ b/backend/rorapp/functions/game_starter.py @@ -292,11 +292,6 @@ def create_situations_and_secrets( secret.save() secrets.append(secret) situations = list(secret_situations) - situations += [ - Situation(name=name, type=data["type"], secret=False, game=game, index=0) - for name, data in situations_dict.items() - if data["type"] == "leader" - ] wars_json_path = os.path.join(settings.BASE_DIR, "rorapp", "presets", "war.json") with open(wars_json_path, "r") as file: wars_dict = json.load(file) @@ -305,6 +300,13 @@ def create_situations_and_secrets( for title in wars_dict.keys() if title != "Punic 1" ] + leaders_json_path = os.path.join(settings.BASE_DIR, "rorapp", "presets", "leader.json") + with open(leaders_json_path, "r") as file: + leaders_dict = json.load(file) + situations += [ + Situation(name=name, type="leader", secret=False, game=game, index=0) + for name in leaders_dict.keys() + ] situations += [ Situation(name=name, type="senator", secret=False, game=game, index=0) for name in unassigned_senator_names diff --git a/backend/rorapp/presets/leader.json b/backend/rorapp/presets/leader.json new file mode 100644 index 00000000..1fd93827 --- /dev/null +++ b/backend/rorapp/presets/leader.json @@ -0,0 +1,22 @@ +{ + "Hamilcar": { + "strength": 3, + "disaster_number": 8, + "standoff_number": 12 + }, + "Hannibal": { + "strength": 7, + "disaster_number": 9, + "standoff_number": 16 + }, + "Antiochus III": { + "strength": 5, + "disaster_number": 14, + "standoff_number": 17 + }, + "Philip V": { + "strength": 6, + "disaster_number": 15, + "standoff_number": 14 + } +} diff --git a/backend/rorapp/presets/situation.json b/backend/rorapp/presets/situation.json index 4addf60f..512947b8 100644 --- a/backend/rorapp/presets/situation.json +++ b/backend/rorapp/presets/situation.json @@ -1,20 +1,4 @@ { - "Hamilcar": { - "scenario": 1, - "type": "leader" - }, - "Hannibal": { - "scenario": 1, - "type": "leader" - }, - "Antiochus III": { - "scenario": 1, - "type": "leader" - }, - "Philip V": { - "scenario": 1, - "type": "leader" - }, "Tribune": { "scenario": 1, "type": "intrigue",