home · contact · privacy
If drunk, speak drunkenly.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 14 Dec 2020 23:27:51 +0000 (00:27 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 14 Dec 2020 23:27:51 +0000 (00:27 +0100)
plomrogue/commands.py

index 24e991c8f89e4c2b2605f9c29aef4d170fd36dd1..50445e7f9c62f557b098d7e4781723679c11c74d 100644 (file)
@@ -32,6 +32,14 @@ def cmd_ALL(game, msg, connection_id):
     speaker = game.get_player(connection_id)
     if not speaker:
         raise GameError('need to be logged in for this')
+    if speaker.drunk > 0:
+        import random
+        drunken_msg = ''
+        for c in msg:
+            if random.random() > 0.85:
+                c = random.choice(['l', 'll', 'n', 'nhg', 'w', 'wl', 'bw'])
+            drunken_msg += c
+        msg = drunken_msg
     speaker.sound(speaker.name, msg)
 cmd_ALL.argtypes = 'string'