home · contact · privacy
Calibrate pee need messaging less aggressively.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 15 Dec 2020 03:56:44 +0000 (04:56 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 15 Dec 2020 03:56:44 +0000 (04:56 +0100)
plomrogue/things.py

index 666a14d6f2301dc9e901d67ceeef4874f87eeb17..a677f5015c6e08f15a7ed3e1a7bfb6708c98b548 100644 (file)
@@ -564,6 +564,7 @@ class Thing_Player(ThingAnimate):
     drunk = 0
     tripping = 0
     need_for_toilet = 0
+    last_pee_need_test = datetime.datetime.now()
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
@@ -576,15 +577,18 @@ class Thing_Player(ThingAnimate):
         if self.tripping >= 0:
             self.tripping -= 1
         if self.need_for_toilet > 0:
-            self.need_for_toilet *= 1.01
+            self.need_for_toilet *= 1.0001
             terrain = self.game.maps[self.position[0]][self.position[1]]
             if terrain in self.game.terrains:
                 terrain_type = self.game.terrains[terrain]
                 if 'toilet' in terrain_type.tags:
                     self.send_msg('CHAT "You use the toilet. What a relief!"')
                     self.need_for_toilet = 0
-            if 10000 * random.random() < self.need_for_toilet / 100000:
+            if self.last_pee_need_test + datetime.timedelta(seconds=1) <\
+               datetime.datetime.now() and\
+               10000 * random.random() < self.need_for_toilet / 100000:
                 self.send_msg('CHAT "You need to use a toilet."')
+                self.last_pee_need_test = datetime.datetime.now()
         if self.drunk == 0:
             self.send_msg('CHAT "You sober up."')
             self.invalidate('fov')