From d9c8cd31293b19fb1361a0260d68d97edc3dd08e Mon Sep 17 00:00:00 2001 From: Pithlit Date: Tue, 20 Aug 2024 18:11:01 +0200 Subject: [PATCH] eecs: add difficulty --- deploy/campaign/eecs/campaign.py | 38 +++++++++++++++++++---------- deploy/campaign/eecs/models/crew.py | 2 ++ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/deploy/campaign/eecs/campaign.py b/deploy/campaign/eecs/campaign.py index b7d10b97e..5c28d70d9 100644 --- a/deploy/campaign/eecs/campaign.py +++ b/deploy/campaign/eecs/campaign.py @@ -44,19 +44,23 @@ def scenario_event(scenario: models.scenario.Scenario, crew: models.crew.Crew, e # update score and get progress progress = None rep_factor = SCENARIO_REPUTATION_FACTOR.get(s, 1.0) + difficulty = 1 + if "current" in crew.score: + difficulty = crew.score["current"].get("difficulty",1) if event_topic == "score": details = json.loads(details) if "progress" in details: progress = details["progress"] - details["reputation"] = progress * rep_factor + difficulty = details.get("difficulty",difficulty) + details["reputation"] = progress * rep_factor * difficulty crew.updateScore(s, details) + elif event_topic == "victory": + progress = 100 elif event_topic == "progress": assert isinstance(details, dict) progress = details["progress"] - crew.updateScore(s, {"progress": progress, "reputation": progress*rep_factor}) - elif event_topic == "victory": - progress = 100 - crew.updateScore(s, {"progress": progress, "reputation": progress*rep_factor}) + if event_topic in ["victory", "progress"]: + crew.updateScore(s, {"progress": progress, "reputation": progress * rep_factor * difficulty}) # for all scenarios if event_topic == "started": @@ -68,26 +72,34 @@ def scenario_event(scenario: models.scenario.Scenario, crew: models.crew.Crew, e # scenario specific if s == "20_training1": if progress is not None and progress >= 75: - crew.unlockScenarios(["00_basic", "21_training2"]) + crew.unlockScenario("00_basic", settings={"Time": ["30Min"], "Enemies": ["Normal"]}) + crew.unlockScenario("21_training2") crew.setBriefing("""Glückwunsch, {crew_name}. Euch stehen weitere Missionen zur Auswahl: -In 'Basic Battle' +In 'Skirmish' könnt ihr euer Können gegen angreifende Gegner testen. +In 'Frigates Testing Ground' könnt ihr andere (spezialisierte) Schiffe ausprobieren. -Ihr könnt euch nun euren Punklestand bei der gerade abgeschlossenen Missionen ansehen. +Ihr könnt euch nun euren Punktestand bei der gerade abgeschlossenen Missionen ansehen. """) if s == "21_training2": if event_topic == "unlockShip": ship = details["ship"] if not crew.hasShip(ship): crew.unlockShip(ship) - crew.setBriefing("""Glückwunsch, {crew_name}. -Die in dieser Mission von euch verwendeten Schiffstypen stehen euch nun auch in den kampfbasierten Missionen zur Verfügung. + crew.setBriefing("""Willkommen zurück, {crew_name}. +Die in dieser Mission von euch verwendeten Schiffstypen stehen euch nun auch im 'Skirmish'-Szenario zur Verfügung. """) if s == "00_basic": - if progress is not None and progress >= 75: - crew.unlockScenario("03_waves") - crew.setBriefing("""Glückwunsch, {crew_name}. + if progress is not None and progress > 0: +# crew.unlockScenario("03_waves") + crew.unlockScenario("00_basic", settings={"Enemies": ["Easy", "Normal", "Hard", "Extreme"]}) + crew.setBriefing("""Willkommen zurück, {crew_name}. + +Die aktuelle Mission 'Skirmish' kann auf verschiedenen Schwierigkeitsgraden wiederholt werden. +Je höher der Schwierigkeitsgrad ist, desto höher wird eurer Reputations-Bonus ausfallen. + +Der Reputations-Bonus ergibt sich aus dem Schwierigkeitsgrad und dem erreichten Missionsfortschritt. """) diff --git a/deploy/campaign/eecs/models/crew.py b/deploy/campaign/eecs/models/crew.py index 1bae0ea87..bdac0dce7 100644 --- a/deploy/campaign/eecs/models/crew.py +++ b/deploy/campaign/eecs/models/crew.py @@ -159,6 +159,8 @@ def getRecentScore(self): ret["best_artifacts"] = str(int(ss["artifacts"])) ret["fleet_artifacts"] = str(int(hi["artifacts"][0])) ret["fleet_artifacts_name"] = "" if len(hi["artifacts"][1]) != 1 else " (" + str(list(hi["artifacts"][1])[0]) + ")" + if "difficulty" in current: + ret["current_difficulty"] = str(int(current["difficulty"])) if "reputation" in current: ret["reputation"] = str(int(ss["reputation"])) return ret