From 6855f87d02c0b8f98a9fb781ea851446a78dcfdb Mon Sep 17 00:00:00 2001 From: Daniel Nagel Date: Fri, 20 Mar 2026 10:17:29 +0000 Subject: [PATCH] =?UTF-8?q?Tzeench=20Regel=20eingebunden.=20Point=20Inflat?= =?UTF-8?q?ion=20auf=200.8=20ge=C3=A4ndert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e-user-21d6fdd4-43d2-4625-8dc2-9282b6aa433f.json | 2 +- match_calculations/calc_match.py | 13 ++++++------- match_calculations/calculation.py | 12 ++++++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.nicegui/storage-user-21d6fdd4-43d2-4625-8dc2-9282b6aa433f.json b/.nicegui/storage-user-21d6fdd4-43d2-4625-8dc2-9282b6aa433f.json index cf2e059..768c8da 100644 --- a/.nicegui/storage-user-21d6fdd4-43d2-4625-8dc2-9282b6aa433f.json +++ b/.nicegui/storage-user-21d6fdd4-43d2-4625-8dc2-9282b6aa433f.json @@ -1 +1 @@ -{"authenticated":true,"discord_id":"277898241750859776","discord_name":"mrteels","db_id":2,"display_name":"DN","discord_avatar_url":"https://cdn.discordapp.com/avatars/277898241750859776/7c3446bb51fafd72b1b4c21124b4994f.png"} \ No newline at end of file +{"authenticated":true,"discord_id":"277898241750859776","discord_name":"mrteels","db_id":2,"display_name":"Verwirrter Klebschnüffler","discord_avatar_url":"https://cdn.discordapp.com/avatars/277898241750859776/7c3446bb51fafd72b1b4c21124b4994f.png"} \ No newline at end of file diff --git a/match_calculations/calc_match.py b/match_calculations/calc_match.py index a6c7511..58db5dc 100644 --- a/match_calculations/calc_match.py +++ b/match_calculations/calc_match.py @@ -5,8 +5,8 @@ import os from wood import logger -point_inflation = 0.7 # => entspricht % -K_FACTOR = 30 # Die "Border" (Maximalpunkte) die ein Sieg gibt. +point_inflation = 0,8 # => entspricht % +K_FACTOR = 40 # Die "Border" (Maximalpunkte) die ein Sieg gibt. # Mach die DB abfrage für die Relevanten Daten. Von hier aus werden die "Aufgaben" und Daten dann an die kleineren Berechnungs Funktionen verteilt. def calculate_match (match_id): @@ -62,8 +62,8 @@ def calculate_match (match_id): l_base = int(base_change*point_inflation) l_khorne = int(calculation.wrath_of_khorne(looser_id, system_id)) - slaanesh = int(calculation.slaanesh_delight()) - tzeentch = int(calculation.tzeentch_scemes(system_id, winner_score, looser_score)) + slaanesh = calculation.slaanesh_delight() + tzeentch = calculation.tzeentch_schemes(system_id, winner_score, looser_score) # ========================================== # 3. Daten Verpacken @@ -93,9 +93,8 @@ def calculate_match (match_id): } } - logger.log("MATCH CALC", f"Match{match_id} berechnet.") - logger.log("MATCH CALC", f"Winner {data_api.get_player_name(winner_id)}: Base {w_base} + Khorne {w_khorne} + Slaanesh {slaanesh} + Tzeentch {tzeentch}") - logger.log("MATCH CALC", f"Looser {data_api.get_player_name(looser_id)}: Base {l_base} + Khorne {l_khorne} - Slaanesh {slaanesh} - Tzeentch {tzeentch}") + logger.log(f"calc_match ID:{match_id}", f"Winner {data_api.get_player_name(winner_id)}: Base {w_base} + Khorne({w_khorne}) + Slaanesh({slaanesh}) + Tzeentch({tzeentch}) = {calc_results[winner_id]["total"]}") + logger.log(f"calc_match ID:{match_id}", f"Looser {data_api.get_player_name(looser_id)}: -Base({l_base}) + Khorne({l_khorne}) - Slaanesh({slaanesh}) - Tzeentch({tzeentch}) = {calc_results[looser_id]["total"]}") data_api.save_calculated_match(calc_results) diff --git a/match_calculations/calculation.py b/match_calculations/calculation.py index 4444bb3..f2c85b4 100644 --- a/match_calculations/calculation.py +++ b/match_calculations/calculation.py @@ -67,11 +67,15 @@ def wrath_of_khorne(player_id, system_id): def slaanesh_delight(): return 0 -def tzeentch_scemes(system_id, winner_score, looser_score): + +def tzeentch_schemes(system_id, winner_score, looser_score): sys_data = data_api.get_gamesystem_data(system_id) - min_score = sys_data["min_score"] max_score = sys_data["max_score"] - bonus = int(((max_score*(winner_score-looser_score)))/(max_score*1.1)) #Multiplikatiionsfaktor für die Berechnung. + diff_normalized = (winner_score - looser_score) / max_score # 0.0 – 1.0 + threshold = 0.1 # Bonus startet erst ab 10% Vorsprung - return 0 + bonus = int(max(0, diff_normalized - threshold) * 10) # Ergibt 0–9 + bonus = min(bonus, 9) # Sicherheits-Cap + + return bonus