463 lines
22 KiB
Python
463 lines
22 KiB
Python
|
|
# -*- coding: utf-8 -*-
|
|||
|
|
import random
|
|||
|
|
import models.i18n as i18n
|
|||
|
|
|
|||
|
|
class ChatEngine:
|
|||
|
|
"""Verwaltet über 220 kontextsensitive Chat-Reaktionen (DE/EN) ohne >U+FFFF Tkinter-Bugs."""
|
|||
|
|
|
|||
|
|
REACTIONS = {
|
|||
|
|
"DE": {
|
|||
|
|
# --- Wenn JEMAND ANDERES 0 Punkte streicht (mit @{0}) ---
|
|||
|
|
"other_zero": [
|
|||
|
|
"@{0} Autsch, das tut weh! ☠",
|
|||
|
|
"@{0} Nullrunde! (T_T)",
|
|||
|
|
"@{0} Das war wohl nichts... ✖",
|
|||
|
|
"@{0} Die Würfel sind heute gnadenlos zu dir! ⚡",
|
|||
|
|
"@{0} Ein Opfer für die Würfelgötter! ✞",
|
|||
|
|
"@{0} Direkt in den Abgrund gestrichen. ▼",
|
|||
|
|
"@{0} Mehr Glück in der nächsten Runde! ☘",
|
|||
|
|
"@{0} RIP an diese Kategorie. ✞",
|
|||
|
|
"@{0} Manchmal muss man Federn lassen. ¯\\_(ツ)_/¯",
|
|||
|
|
"@{0} Das gibt mir ordentlich Vorsprung! >:)",
|
|||
|
|
"@{0} Komplett verhext! ✦",
|
|||
|
|
"@{0} Schmerzhaft anzusehen... >_<",
|
|||
|
|
"@{0} Da wollten die Würfel einfach nicht. ⚀✖",
|
|||
|
|
"@{0} Uff, eiskalt abserviert! ❄",
|
|||
|
|
"@{0} Wenigstens hast du es hinter dir! ^^"
|
|||
|
|
],
|
|||
|
|
# --- Wenn der Bot SELBST 0 Punkte streicht (OHNE @, nur Symbole/Emotes) ---
|
|||
|
|
"self_zero": [
|
|||
|
|
"(╯°□°)╯︵ ┻━┻", "☠ ✞ ☠", "(T_T) ✖", ">_< ⚡", "⚀ ✖ ☠",
|
|||
|
|
"¯\\_(ツ)_/¯ ✖", "(✖╭╮✖)", "⚡ ☠ ⚡", "(-_-;) ...", "(>_<)",
|
|||
|
|
"grrr... ☠", "Verfluchte Würfel! ☠", "Nicht mein Ernst... (T_T)",
|
|||
|
|
"Uff... ✞", "Das gibt Rache! ⚔"
|
|||
|
|
],
|
|||
|
|
# --- Kleine Straße in Runde 1-4 (mit @{0}) ---
|
|||
|
|
"other_early_ss": [
|
|||
|
|
"@{0} Oha, eine Kleine Straße gleich am Anfang! O_O",
|
|||
|
|
"@{0} Direkt zum Start eine Kleine Straße, stark! ⚡",
|
|||
|
|
"@{0} Früh übt sich, wer Straßen baut! ⚀⚁⚂⚃",
|
|||
|
|
"@{0} Schon so früh 30 Punkte gesichert, nicht schlecht! ★",
|
|||
|
|
"@{0} Blitzstart mit der Kleinen Straße! ⚡",
|
|||
|
|
"@{0} Kaum angefangen und schon steht die Straße! ✦",
|
|||
|
|
"@{0} Solider Auftakt mit 30 Punkten! ✔",
|
|||
|
|
"@{0} Das ging aber schnell mit der Kleinen Straße! >>"
|
|||
|
|
],
|
|||
|
|
# --- Kleine Straße allgemein (mit @{0}) ---
|
|||
|
|
"other_ss": [
|
|||
|
|
"@{0} Saubere Kleine Straße! ⚀⚁⚂⚃",
|
|||
|
|
"@{0} 30 Punkte nimmt man immer gern mit! ✔",
|
|||
|
|
"@{0} Schön der Reihe nach aufgestellt! ✦",
|
|||
|
|
"@{0} Kleine Straße sitzt! ✔",
|
|||
|
|
"@{0} Solide 30 Punkte aufs Konto! ★",
|
|||
|
|
"@{0} Gut gerettet mit der Kleinen Straße! o7",
|
|||
|
|
"@{0} Vier in einer Reihe, sauber gespielt! ♦",
|
|||
|
|
"@{0} Die 30 Punkte hast du dir verdient! ✦"
|
|||
|
|
],
|
|||
|
|
# --- Große Straße (mit @{0}) ---
|
|||
|
|
"other_ls": [
|
|||
|
|
"@{0} Große Straße?! Nicht schlecht! ★",
|
|||
|
|
"@{0} 40 Punkte am Stück, starkes Ding! ⚡",
|
|||
|
|
"@{0} Wie am Schnürchen gezogen! ⚀⚁⚂⚃⚄",
|
|||
|
|
"@{0} Eine Bilderbuch-Straße! ✦",
|
|||
|
|
"@{0} 1-2-3-4-5 oder 2-3-4-5-6... egal, 40 Punkte! ♛",
|
|||
|
|
"@{0} Große Straße sitzt perfekt! ✔",
|
|||
|
|
"@{0} Da haben alle fünf Würfel perfekt mitgespielt! ✦",
|
|||
|
|
"@{0} Respekt für die Große Straße! o7",
|
|||
|
|
"@{0} 40 Punkte auf einen Schlag, langsam wirst du gefährlich! O_O",
|
|||
|
|
"@{0} Makellose Reihe! ⚡"
|
|||
|
|
],
|
|||
|
|
# --- Full House (mit @{0}) ---
|
|||
|
|
"other_fh": [
|
|||
|
|
"@{0} Sauberes Full House! ⌂",
|
|||
|
|
"@{0} Volles Haus und 25 sichere Punkte! ★",
|
|||
|
|
"@{0} Drei plus Zwei – perfekt kombiniert! ⚂⚂⚂⚁⚁",
|
|||
|
|
"@{0} Da steht die Hütte! ⌂✦",
|
|||
|
|
"@{0} 25 Punkte für das Full House, stark! ✔",
|
|||
|
|
"@{0} Schönes Full House eingetütet! :D",
|
|||
|
|
"@{0} Volles Haus, keine Wünsche offen! ✦",
|
|||
|
|
"@{0} Klassisches Full House, sauber! ♦"
|
|||
|
|
],
|
|||
|
|
# --- Viererpasch (mit @{0}) ---
|
|||
|
|
"other_4k": [
|
|||
|
|
"@{0} Vier Gleiche und richtig gute Punkte! ⚡",
|
|||
|
|
"@{0} Fast ein Yahtzee! Starker Viererpasch! ⚄⚄⚄⚄",
|
|||
|
|
"@{0} Vier auf einen Streich, Respekt! ⚔",
|
|||
|
|
"@{0} Das scheppert ordentlich im Viererpasch! ⚡",
|
|||
|
|
"@{0} Nur einer hat zum Yahtzee gefehlt! Trotzdem top Punkte! O_O",
|
|||
|
|
"@{0} Mächtiger Viererpasch! ★",
|
|||
|
|
"@{0} Vierlinge! Das bringt ordentlich Zähler! ▲",
|
|||
|
|
"@{0} Stark gewürfelt beim Viererpasch! o7"
|
|||
|
|
],
|
|||
|
|
# --- Yahtzee / +100 Bonus Yahtzee (mit @{0}) ---
|
|||
|
|
"other_yahtzee": [
|
|||
|
|
"@{0} WAHNSINN! Ein Yahtzee! ♛✦",
|
|||
|
|
"@{0} Fünf Gleiche?! Hast du gezinkte Würfel?! ⚅⚅⚅⚅⚅",
|
|||
|
|
"@{0} Unglaublich, das volle Yahtzee! ♛",
|
|||
|
|
"@{0} Verneigt euch vor diesem Wurf! o7 ♛",
|
|||
|
|
"@{0} 50 Punkte direkt aus der Dunkelheit! 🦇♛",
|
|||
|
|
"@{0} Ein echtes Meisterstück! ♦✦",
|
|||
|
|
"@{0} Jackpot! Besser geht es nicht! ★⚡",
|
|||
|
|
"@{0} Das nennt man wohl pures Würfelglück! ☘♛",
|
|||
|
|
"@{0} Legendärer Wurf! ⚡♛",
|
|||
|
|
"@{0} Jetzt wird es richtig schwer, dich noch einzuholen! O_O"
|
|||
|
|
],
|
|||
|
|
# --- Gute Punkte allgemein / Oberer Teil >= 3 Gleiche (mit @{0}) ---
|
|||
|
|
"other_good": [
|
|||
|
|
"@{0} Das war gar nicht schlecht! ✔",
|
|||
|
|
"@{0} Starker Zug, Respekt! o7",
|
|||
|
|
"@{0} Ordentliche Ausbeute! ★",
|
|||
|
|
"@{0} Du sammelst ganz schön fleißig Punkte! O_O",
|
|||
|
|
"@{0} Wichtige Punkte für den Bonus! ▲",
|
|||
|
|
"@{0} Sehr sauber eingetragen! ✔",
|
|||
|
|
"@{0} Nicht übel, gar nicht übel! :)",
|
|||
|
|
"@{0} Das bringt dich gut nach vorne! >>",
|
|||
|
|
"@{0} Gute Entscheidung bei diesem Wurf! ✦",
|
|||
|
|
"@{0} Starke Runde von dir! ★",
|
|||
|
|
"@{0} Solches Würfelglück hätte ich auch gern! ;)",
|
|||
|
|
"@{0} Präzise abgeliefert! ♦"
|
|||
|
|
],
|
|||
|
|
# --- Kleine / normale Punkte (mit @{0}) ---
|
|||
|
|
"other_small": [
|
|||
|
|
"@{0} Kleinvieh macht auch Mist! ⚀⚁",
|
|||
|
|
"@{0} Punkte sind Punkte. :)",
|
|||
|
|
"@{0} Besser als eine Nullrunde! ✔",
|
|||
|
|
"@{0} Sicher gespielt, kann man machen. 👌",
|
|||
|
|
"@{0} Mühsam ernährt sich das Eichhörnchen! ^^",
|
|||
|
|
"@{0} Solider Lückenfüller! ✔",
|
|||
|
|
"@{0} Nicht die Welt, aber immerhin auf dem Konto. ▲",
|
|||
|
|
"@{0} Schadensbegrenzung erfolgreich! ⚔",
|
|||
|
|
"@{0} Schritt für Schritt! >>",
|
|||
|
|
"@{0} Ganz vernünftig gelöst. :)"
|
|||
|
|
],
|
|||
|
|
# --- Bot feiert SICH SELBST bei starken Würfen (OHNE @) ---
|
|||
|
|
"self_taunt": [
|
|||
|
|
"Schlag das erst mal! B)",
|
|||
|
|
"Da staunt ihr, was? ⚡",
|
|||
|
|
"So wird das gemacht! ♛",
|
|||
|
|
"Zu einfach für mich! ✦",
|
|||
|
|
"Nehmt euch ein Beispiel daran! ;)",
|
|||
|
|
"Präzision wie ein Uhrwerk! ⚡",
|
|||
|
|
"Die Würfel gehorchen mir! ♛",
|
|||
|
|
"Wer will mich heute noch stoppen? >>",
|
|||
|
|
"Ein Meisterwerk aus dem Handgelenk! ★",
|
|||
|
|
"Schreibt euch das hinter die Ohren! >:)",
|
|||
|
|
"Genau nach Plan! ✦",
|
|||
|
|
"Der Sieg rückt immer näher! ♛",
|
|||
|
|
"Da bleibt euch die Spucke weg! >:D",
|
|||
|
|
"Maximaler Ertrag, null Mühe! ♦",
|
|||
|
|
"Heute läuft es einfach bei mir! ⚡⚅"
|
|||
|
|
],
|
|||
|
|
# --- Bot trägt für SICH SELBST normale Punkte ein (OHNE @) ---
|
|||
|
|
"self_normal": [
|
|||
|
|
"Punkte sind Punkte! B)",
|
|||
|
|
"Nehm ich so mit! ✔",
|
|||
|
|
"Ganz solide für zwischendurch. :)",
|
|||
|
|
"Immer schön weitersammeln! ▲",
|
|||
|
|
"Pflichtaufgabe erfüllt. ✔",
|
|||
|
|
"Passt schon so! ^^",
|
|||
|
|
"Kleiner Schritt Richtung Sieg! >>",
|
|||
|
|
"Besser als nichts! ⚔",
|
|||
|
|
"Sicher ist sicher. ✔",
|
|||
|
|
"Das fügt sich gut ins Bild. ♦"
|
|||
|
|
],
|
|||
|
|
|
|||
|
|
# --- Spielende: Mensch hat gewonnen ---
|
|||
|
|
"end_human_won": [
|
|||
|
|
"@{0} Gut gemacht, verdienter Sieg! ♛✦",
|
|||
|
|
"@{0} Stark gespielt, Glückwunsch zum Sieg! o7",
|
|||
|
|
"@{0} Heute warst du nicht zu schlagen. GG! ★",
|
|||
|
|
"@{0} Respekt, sauber abgeliefert! ⚔♛",
|
|||
|
|
"@{0} Nächstes Mal holen wir uns den Sieg zurück! >:)"
|
|||
|
|
],
|
|||
|
|
# --- Spielende: Mensch hat verloren (Aufmunterung) ---
|
|||
|
|
"end_human_lost": [
|
|||
|
|
"@{0} Gut gespielt! Viel Glück fürs nächste Mal! ☘",
|
|||
|
|
"@{0} Kopf hoch, beim nächsten Mal fallen die Würfel für dich! ⚀⚅",
|
|||
|
|
"@{0} Stark gekämpft, nächstes Mal klappt es! o7",
|
|||
|
|
"@{0} Knappes Ding! Viel Erfolg in der nächsten Runde! ★",
|
|||
|
|
"@{0} GG! Beim nächsten Ritual drehst du den Spieß um! ✦"
|
|||
|
|
],
|
|||
|
|
# --- Spielende: Sieger-Bot feiert sich selbst (ohne @) ---
|
|||
|
|
"end_bot_winner": [
|
|||
|
|
"Dieser Sieg gehört mir! GG an alle! ♛✦",
|
|||
|
|
"Niemand schlägt den Meister der Würfel! B) ♛",
|
|||
|
|
"Ein würdiges Spiel! Danke für die Runde! ⚔★",
|
|||
|
|
"Die Krone bleibt heute bei mir! ♛"
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
"EN": {
|
|||
|
|
# --- Someone else scores 0 (with @{0}) ---
|
|||
|
|
"other_zero": [
|
|||
|
|
"@{0} Ouch, that hurts! ☠",
|
|||
|
|
"@{0} Zero points! (T_T)",
|
|||
|
|
"@{0} That didn't go as planned... ✖",
|
|||
|
|
"@{0} The dice are merciless today! ⚡",
|
|||
|
|
"@{0} A sacrifice to the dice gods! ✞",
|
|||
|
|
"@{0} Straight into the abyss. ▼",
|
|||
|
|
"@{0} Better luck next round! ☘",
|
|||
|
|
"@{0} RIP to that category. ✞",
|
|||
|
|
"@{0} Sometimes you have to take the hit. ¯\\_(ツ)_/¯",
|
|||
|
|
"@{0} That gives me a nice lead! >:)",
|
|||
|
|
"@{0} Totally cursed! ✦",
|
|||
|
|
"@{0} Painful to watch... >_<",
|
|||
|
|
"@{0} The dice just said no. ⚀✖",
|
|||
|
|
"@{0} Cold-blooded scratch! ❄",
|
|||
|
|
"@{0} At least you got that one out of the way! ^^"
|
|||
|
|
],
|
|||
|
|
# --- Bot scores 0 itself (NO @) ---
|
|||
|
|
"self_zero": [
|
|||
|
|
"(╯°□°)╯︵ ┻━┻", "☠ ✞ ☠", "(T_T) ✖", ">_< ⚡", "⚀ ✖ ☠",
|
|||
|
|
"¯\\_(ツ)_/¯ ✖", "(✖╭╮✖)", "⚡ ☠ ⚡", "(-_-;) ...", "(>_<)",
|
|||
|
|
"grrr... ☠", "Cursed dice! ☠", "Are you kidding me... (T_T)",
|
|||
|
|
"Ugh... ✞", "I will have my revenge! ⚔"
|
|||
|
|
],
|
|||
|
|
# --- Early Small Straight (with @{0}) ---
|
|||
|
|
"other_early_ss": [
|
|||
|
|
"@{0} Whoa, a Small Straight right at the start! O_O",
|
|||
|
|
"@{0} Starting off hot with a Small Straight! ⚡",
|
|||
|
|
"@{0} Building straights early on, nice! ⚀⚁⚂⚃",
|
|||
|
|
"@{0} 30 points locked in already, not bad! ★",
|
|||
|
|
"@{0} Lightning start with that Small Straight! ⚡",
|
|||
|
|
"@{0} Barely started and already rolling straights! ✦",
|
|||
|
|
"@{0} Solid opening with 30 points! ✔",
|
|||
|
|
"@{0} That was fast for a Small Straight! >>"
|
|||
|
|
],
|
|||
|
|
# --- Small Straight general (with @{0}) ---
|
|||
|
|
"other_ss": [
|
|||
|
|
"@{0} Clean Small Straight! ⚀⚁⚂⚃",
|
|||
|
|
"@{0} 30 points are always welcome! ✔",
|
|||
|
|
"@{0} Nicely lined up! ✦",
|
|||
|
|
"@{0} Small Straight locked in! ✔",
|
|||
|
|
"@{0} Solid 30 points in the bank! ★",
|
|||
|
|
"@{0} Good save with that Small Straight! o7",
|
|||
|
|
"@{0} Four in a row, well played! ♦",
|
|||
|
|
"@{0} Well-deserved 30 points! ✦"
|
|||
|
|
],
|
|||
|
|
# --- Large Straight (with @{0}) ---
|
|||
|
|
"other_ls": [
|
|||
|
|
"@{0} Large Straight?! Impressive! ★",
|
|||
|
|
"@{0} 40 points in one go, huge play! ⚡",
|
|||
|
|
"@{0} Lined up like clockwork! ⚀⚁⚂⚃⚄",
|
|||
|
|
"@{0} A textbook Large Straight! ✦",
|
|||
|
|
"@{0} Five in a row for a clean 40 points! ♛",
|
|||
|
|
"@{0} Large Straight nailed to perfection! ✔",
|
|||
|
|
"@{0} All five dice cooperated beautifully! ✦",
|
|||
|
|
"@{0} Respect for that Large Straight! o7",
|
|||
|
|
"@{0} 40 points at once, you're getting dangerous! O_O",
|
|||
|
|
"@{0} Flawless sequence! ⚡"
|
|||
|
|
],
|
|||
|
|
# --- Full House (with @{0}) ---
|
|||
|
|
"other_fh": [
|
|||
|
|
"@{0} Clean Full House! ⌂",
|
|||
|
|
"@{0} Full House and 25 safe points! ★",
|
|||
|
|
"@{0} Three plus two – perfectly combined! ⚂⚂⚂⚁⚁",
|
|||
|
|
"@{0} The house is packed! ⌂✦",
|
|||
|
|
"@{0} 25 points for the Full House, strong! ✔",
|
|||
|
|
"@{0} Nice Full House in the bag! :D",
|
|||
|
|
"@{0} Full House, nothing left to wish for! ✦",
|
|||
|
|
"@{0} Classic Full House, well done! ♦"
|
|||
|
|
],
|
|||
|
|
# --- Four of a Kind (with @{0}) ---
|
|||
|
|
"other_4k": [
|
|||
|
|
"@{0} Four of a kind and great points! ⚡",
|
|||
|
|
"@{0} Almost a Yahtzee! Strong Four of a Kind! ⚄⚄⚄⚄",
|
|||
|
|
"@{0} Four at once, respect! ⚔",
|
|||
|
|
"@{0} Big points on that Four of a Kind! ⚡",
|
|||
|
|
"@{0} Just one shy of a Yahtzee! Still awesome points! O_O",
|
|||
|
|
"@{0} Mighty Four of a Kind! ★",
|
|||
|
|
"@{0} Quads! That racks up the score! ▲",
|
|||
|
|
"@{0} Great roll on that Four of a Kind! o7"
|
|||
|
|
],
|
|||
|
|
# --- Yahtzee (with @{0}) ---
|
|||
|
|
"other_yahtzee": [
|
|||
|
|
"@{0} INSANE! A Yahtzee! ♛✦",
|
|||
|
|
"@{0} Five of a kind?! Are those loaded dice?! ⚅⚅⚅⚅⚅",
|
|||
|
|
"@{0} Unbelievable, a full Yahtzee! ♛",
|
|||
|
|
"@{0} Bow down to that roll! o7 ♛",
|
|||
|
|
"@{0} 50 points straight from the shadows! ♛",
|
|||
|
|
"@{0} An absolute masterpiece! ♦✦",
|
|||
|
|
"@{0} Jackpot! It doesn't get better than that! ★⚡",
|
|||
|
|
"@{0} Pure dice magic right there! ☘♛",
|
|||
|
|
"@{0} Legendary roll! ⚡♛",
|
|||
|
|
"@{0} Catching up to you just got a lot harder! O_O"
|
|||
|
|
],
|
|||
|
|
# --- Good points general (with @{0}) ---
|
|||
|
|
"other_good": [
|
|||
|
|
"@{0} That wasn't bad at all! ✔",
|
|||
|
|
"@{0} Solid move, respect! o7",
|
|||
|
|
"@{0} Decent haul right there! ★",
|
|||
|
|
"@{0} You're stacking up points fast! O_O",
|
|||
|
|
"@{0} Crucial points toward the bonus! ▲",
|
|||
|
|
"@{0} Very cleanly scored! ✔",
|
|||
|
|
"@{0} Not bad, not bad at all! :)",
|
|||
|
|
"@{0} That pushes you right ahead! >>",
|
|||
|
|
"@{0} Smart choice on that roll! ✦",
|
|||
|
|
"@{0} Strong turn from you! ★",
|
|||
|
|
"@{0} Wish I had that kind of dice luck! ;)",
|
|||
|
|
"@{0} Delivered with precision! ♦"
|
|||
|
|
],
|
|||
|
|
# --- Small / normal points (with @{0}) ---
|
|||
|
|
"other_small": [
|
|||
|
|
"@{0} Every point counts! ⚀⚁",
|
|||
|
|
"@{0} Points are points. :)",
|
|||
|
|
"@{0} Better than a zero! ✔",
|
|||
|
|
"@{0} Played it safe, fair enough. :)",
|
|||
|
|
"@{0} Little by little fills the scorecard! ^^",
|
|||
|
|
"@{0} Solid filler score! ✔",
|
|||
|
|
"@{0} Not huge, but it's on the board. ▲",
|
|||
|
|
"@{0} Damage control successful! ⚔",
|
|||
|
|
"@{0} Step by step! >>",
|
|||
|
|
"@{0} Sensible choice. :)"
|
|||
|
|
],
|
|||
|
|
# --- Bot taunts for ITSELF on strong rolls (NO @) ---
|
|||
|
|
"self_taunt": [
|
|||
|
|
"Beat that! B)",
|
|||
|
|
"Amazed, aren't you? ⚡",
|
|||
|
|
"That's how it's done! ♛",
|
|||
|
|
"Too easy for me! ✦",
|
|||
|
|
"Take notes, everyone! ;)",
|
|||
|
|
"Precision like clockwork! ⚡",
|
|||
|
|
"The dice obey my command! ♛",
|
|||
|
|
"Who's gonna stop me today? >>",
|
|||
|
|
"A masterpiece of a roll! ★",
|
|||
|
|
"Remember that move! >:)",
|
|||
|
|
"All according to plan! ✦",
|
|||
|
|
"Victory is getting closer! ♛",
|
|||
|
|
"Left you speechless, huh? >:D",
|
|||
|
|
"Maximum points, zero effort! ♦",
|
|||
|
|
"I'm on fire today! ⚡⚅"
|
|||
|
|
],
|
|||
|
|
# --- Bot scores normal points for ITSELF (NO @) ---
|
|||
|
|
"self_normal": [
|
|||
|
|
"Points are points! B)",
|
|||
|
|
"I'll take it! ✔",
|
|||
|
|
"Solid enough for now. :)",
|
|||
|
|
"Keep stacking them up! ▲",
|
|||
|
|
"Job done. ✔",
|
|||
|
|
"Works for me! ^^",
|
|||
|
|
"One small step toward victory! >>",
|
|||
|
|
"Better than nothing! ⚔",
|
|||
|
|
"Better safe than sorry. ✔",
|
|||
|
|
"Fits right into the plan. ♦"
|
|||
|
|
],
|
|||
|
|
# --- Game Over: Human won ---
|
|||
|
|
"end_human_won": [
|
|||
|
|
"@{0} Well done, well-deserved victory! ♛✦",
|
|||
|
|
"@{0} Great game, congrats on the win! o7",
|
|||
|
|
"@{0} You were unbeatable today. GG! ★",
|
|||
|
|
"@{0} Respect, cleanly played! ⚔♛",
|
|||
|
|
"@{0} Next time we'll take the crown back! >:)"
|
|||
|
|
],
|
|||
|
|
# --- Game Over: Human lost ---
|
|||
|
|
"end_human_lost": [
|
|||
|
|
"@{0} Well played! Better luck next time! ☘",
|
|||
|
|
"@{0} Heads up, the dice will roll your way next game! ⚀⚅",
|
|||
|
|
"@{0} Good fight, you'll get 'em next time! o7",
|
|||
|
|
"@{0} Close game! Best of luck in the next match! ★",
|
|||
|
|
"@{0} GG! Next ritual is yours! ✦"
|
|||
|
|
],
|
|||
|
|
# --- Game Over: Winning bot celebrates (no @) ---
|
|||
|
|
"end_bot_winner": [
|
|||
|
|
"Victory is mine! GG everyone! ♛✦",
|
|||
|
|
"Nobody beats the master of dice! B) ♛",
|
|||
|
|
"A worthy match! Thanks for playing! ⚔★",
|
|||
|
|
"The crown stays with me today! ♛"
|
|||
|
|
]
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@staticmethod
|
|||
|
|
def sanitize_for_tk(text):
|
|||
|
|
"""Entfernt oder ersetzt Zeichen über U+FFFF, die in Linux-Tkinter Darstellungsfehler verursachen."""
|
|||
|
|
return "".join(ch if ord(ch) <= 0xFFFF else "✦" for ch in str(text))
|
|||
|
|
|
|||
|
|
@classmethod
|
|||
|
|
def generate_reaction(cls, actor, all_players, cat_key, pts, turn_num, has_joker=False):
|
|||
|
|
bots = [p for p in all_players if p.is_bot]
|
|||
|
|
if not bots:
|
|||
|
|
return None
|
|||
|
|
|
|||
|
|
lang = i18n.CURRENT_LANG if i18n.CURRENT_LANG in cls.REACTIONS else "DE"
|
|||
|
|
pool = cls.REACTIONS[lang]
|
|||
|
|
target_name = actor.name
|
|||
|
|
|
|||
|
|
if not actor.is_bot:
|
|||
|
|
sender = random.choice(bots).name
|
|||
|
|
bucket = cls._pick_other_bucket(cat_key, pts, turn_num, has_joker)
|
|||
|
|
template = random.choice(pool[bucket])
|
|||
|
|
return sender, cls.sanitize_for_tk(template.format(target_name)), False
|
|||
|
|
|
|||
|
|
other_bots = [b for b in bots if b != actor]
|
|||
|
|
|
|||
|
|
if pts == 0:
|
|||
|
|
if not other_bots or random.random() < 0.75:
|
|||
|
|
return actor.name, cls.sanitize_for_tk(random.choice(pool["self_zero"])), False
|
|||
|
|
else:
|
|||
|
|
commenter = random.choice(other_bots).name
|
|||
|
|
return commenter, cls.sanitize_for_tk(random.choice(pool["other_zero"]).format(target_name)), False
|
|||
|
|
|
|||
|
|
is_big_play = (
|
|||
|
|
has_joker
|
|||
|
|
or (cat_key in ["FH", "SS", "LS", "Y"] and pts > 0)
|
|||
|
|
or (cat_key in ["1", "2", "3", "4", "5", "6"] and pts >= int(cat_key) * 3)
|
|||
|
|
or pts >= 20
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
if is_big_play:
|
|||
|
|
if not other_bots or random.random() < 0.70:
|
|||
|
|
return actor.name, cls.sanitize_for_tk(random.choice(pool["self_taunt"])), True
|
|||
|
|
else:
|
|||
|
|
commenter = random.choice(other_bots).name
|
|||
|
|
bucket = cls._pick_other_bucket(cat_key, pts, turn_num, has_joker)
|
|||
|
|
return commenter, cls.sanitize_for_tk(random.choice(pool[bucket]).format(target_name)), False
|
|||
|
|
else:
|
|||
|
|
if not other_bots or random.random() < 0.65:
|
|||
|
|
return actor.name, cls.sanitize_for_tk(random.choice(pool["self_normal"])), False
|
|||
|
|
else:
|
|||
|
|
commenter = random.choice(other_bots).name
|
|||
|
|
return commenter, cls.sanitize_for_tk(random.choice(pool["other_small"]).format(target_name)), False
|
|||
|
|
|
|||
|
|
@staticmethod
|
|||
|
|
def _pick_other_bucket(cat_key, pts, turn_num, has_joker):
|
|||
|
|
if pts == 0:
|
|||
|
|
return "other_zero"
|
|||
|
|
if (cat_key == "Y" and pts == 50) or has_joker:
|
|||
|
|
return "other_yahtzee"
|
|||
|
|
if cat_key == "LS" and pts == 40:
|
|||
|
|
return "other_ls"
|
|||
|
|
if cat_key == "SS" and pts == 30:
|
|||
|
|
return "other_early_ss" if turn_num <= 4 else "other_ss"
|
|||
|
|
if cat_key == "FH" and pts == 25:
|
|||
|
|
return "other_fh"
|
|||
|
|
if cat_key == "4K" and pts >= 15:
|
|||
|
|
return "other_4k"
|
|||
|
|
if (cat_key in ["1", "2", "3", "4", "5", "6"] and pts >= int(cat_key) * 3) or pts >= 18:
|
|||
|
|
return "other_good"
|
|||
|
|
return "other_small"
|
|||
|
|
|
|||
|
|
@classmethod
|
|||
|
|
def generate_endgame_reactions(cls, human_player, all_players, winner_player):
|
|||
|
|
"""Erzeugt am Spielende für jeden Bot eine Abschluss-Nachricht (Gratulation oder Viel Glück)."""
|
|||
|
|
bots = [p for p in all_players if p.is_bot]
|
|||
|
|
if not bots:
|
|||
|
|
return []
|
|||
|
|
|
|||
|
|
lang = i18n.CURRENT_LANG if i18n.CURRENT_LANG in cls.REACTIONS else "DE"
|
|||
|
|
pool = cls.REACTIONS[lang]
|
|||
|
|
human_won = (winner_player == human_player)
|
|||
|
|
messages = []
|
|||
|
|
|
|||
|
|
for bot in bots:
|
|||
|
|
if human_won:
|
|||
|
|
txt = random.choice(pool["end_human_won"]).format(human_player.name)
|
|||
|
|
messages.append((bot.name, cls.sanitize_for_tk(txt), False))
|
|||
|
|
else:
|
|||
|
|
if bot == winner_player:
|
|||
|
|
txt = random.choice(pool["end_bot_winner"])
|
|||
|
|
messages.append((bot.name, cls.sanitize_for_tk(txt), True))
|
|||
|
|
else:
|
|||
|
|
txt = random.choice(pool["end_human_lost"]).format(human_player.name)
|
|||
|
|
messages.append((bot.name, cls.sanitize_for_tk(txt), False))
|
|||
|
|
return messages
|