From: Christian Heller Date: Mon, 14 Dec 2020 23:27:51 +0000 (+0100) Subject: If drunk, speak drunkenly. X-Git-Url: https://plomlompom.com/repos/new_day?a=commitdiff_plain;h=1ff4078be77dba8b4c4a5213490233a7642c2b6e;p=plomrogue2 If drunk, speak drunkenly. --- diff --git a/plomrogue/commands.py b/plomrogue/commands.py index 24e991c..50445e7 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -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'