From aaaf96caed6cf06ba1d43add436ab7885bac956c Mon Sep 17 00:00:00 2001 From: Daniel Nagel Date: Mon, 16 Mar 2026 07:21:02 +0100 Subject: [PATCH] Immer noch mmr berechnung... --- match_calculations/calc_match.py | 95 +++++++++++++++---------------- match_calculations/calculation.py | 14 ++--- 2 files changed, 52 insertions(+), 57 deletions(-) diff --git a/match_calculations/calc_match.py b/match_calculations/calc_match.py index 06773e8..8195bdb 100644 --- a/match_calculations/calc_match.py +++ b/match_calculations/calc_match.py @@ -26,15 +26,24 @@ def calculate_match (match_id): sys_name = match_data['gamesystem_name'] sys_id = match_data['gamesystem_id'] + match_is_draw = False + # ========================================== # 1. IDENTIFIKATION (Bleibt gleich) # ========================================== + # Draw if -draw_diff <= (p1_score - p2_score) <= draw_diff: winner_id, looser_id = p1_id, p2_id + winner_score, looser_score = p1_score, p2_score + match_is_draw = True + # P1 Winner elif p1_score > p2_score: winner_id, looser_id = p1_id, p2_id + winner_score, looser_score = p1_score, p2_score + # P2 Winner else: winner_id, looser_id = p2_id, p1_id + winner_score, looser_score = p2_score, p1_score # ========================================== @@ -42,60 +51,50 @@ def calculate_match (match_id): # ========================================== # Wir speichern die Ergebnisse direkt in einem temporären Dictionary, # und nutzen die SPIELER-ID als Schlüsselwort! + elo_factor = calculation.calc_elo_factor(winner_id, looser_id, system_name) + base_change = calculation.calc_base_change(elo_factor, match_is_draw) + rust_factor = calculation.calc_rust_factor(winner_id, looser_id, gamesystem_id) -calc_results = { - "match_id" : match_id, - "sys_id" : sys_id, - "elo_factor" : calculation.calc_elo_factor(winner_id, looser_id, system_name), - "rust_factor" : calculation.calc_rust_factor(winner_id, looser_id, gamesystem_id), + #winner + w_base = base_change + w_khorne = calculation.wrath_of_khorne(winner_id) - winner_id: { - "base": calculation.calc_base_change(), - "khorne": calculation.wrath_of_khorne(winner_id), - "slaanesh": calculation.slaanesh_delight(), - "tzeentch": calculation.tzeentch_scemes(), - "total": winner_total - }, - looser_id: { - "base": looser_base, - "khorne": wrath_of_khorne(looser_id), - "slaanesh": slaanesh_delight(winner_score, looser_score, rules), - "total": looser_total + #looser + l_base = int(base_change*point_inflation) + l_khorne = calculation.wrath_of_khorne(looser_id) + + slaanesh = calculation.slaanesh_delight(), + tzeentch = calculation.tzeentch_scemes(winner_score, looser_score), + + + +# ========================================== +# 3. Daten Verpacken +# ========================================== + calc_results = { + "match_id" : match_id, + "elo_factor" : elo_factor, + "rust_factor" : rust_factor, + "point_inflation" : point_inflation, + + winner_id: { + "base": w_base, + "khorne": w_khorne, + "slaanesh": slaanesh, + "tzeentch": tzeentch, + "total": int((w_base + w_khorne + slaanesh + tzeentch)*rust_factor), + }, + looser_id: { + "base": l_base, + "khorne": l_khorne, + "slaanesh": -slaanesh, + "tzeentch": calculation.tzeentch_scemes(winner_score, looser_score), + "total": int((calc_results[looser_id]["base"] + calc_results[looser_id]["khorne"] - calc_results[looser_id]["slaanesh"] - calc_results[looser_id]["tzeentch"])*calc_results["rust_factor"]), + } } -} -meine_ergebnisse = { - # --- Identifikation --- - "match_id": match_id, - "gamesystem_id": sys_id, - - # --- Match-Globale Werte --- - "rust_factor": 1.0, # Dein errechneter Wert (als Kommazahl / Float) - "elo_factor": 40.0, # K-Faktor - "point_inflation": 0.7, # Deine 70% - - # --- Spieler 1 --- - "p1_id": p1_id, - "p1_score": p1_score, - "p1_base": p1_base_change, - "p1_khorne": khorne_p1, - "p1_slaanesh": slaanesh_points, - "p1_tzeentch": 0, - "p1_total": winner_final, # Die endgültige MMR Änderung! - - # --- Spieler 2 --- - "p2_id": p2_id, - "p2_score": p2_score, - "p2_base": p2_base_change, - "p2_khorne": khorne_p2, - "p2_slaanesh": slaanesh_points, - "p2_tzeentch": 0, - "p2_total": looser_final # Die endgültige MMR Änderung! -} - - def determine_draw_diff(sys_id): diff --git a/match_calculations/calculation.py b/match_calculations/calculation.py index 9752d97..2694157 100644 --- a/match_calculations/calculation.py +++ b/match_calculations/calculation.py @@ -5,7 +5,7 @@ from wood import logger # die meisten Spieler über 1000MMR sein. Sprich: Neueinsteiger, oder leute die weniger spielen sind eher im unteren Ende als in der Mitte. -def calc_base_change(elo_factor): +def calc_base_change(elo_factor, match_is_draw): if match_is_draw: # Bei einem Draw (0.5) gewinnt der Schwächere leicht Punkte, der Stärkere verliert leicht. base_change = (K_FACTOR * (0.5 - elo_factor)/2) @@ -64,11 +64,7 @@ def wrath_of_khorne(player_id): return 0 -def slaanesh_delight(winner_points, looser_points, rules): - print() - -def tzeentch_scemes(): - print("k") - -def nurgles_entropy(): - print("k") \ No newline at end of file +def slaanesh_delight(): + return 0 +def tzeentch_scemes(winner_score, looser_score): + return 0