home · contact · privacy
Spawn hats from BottleDeposit, add HatRemixer.
[plomrogue2] / plomrogue / things.py
index 2c12cf283e41cc5b788d37c35d1fabe23225ba17..32d7854732029bd0fc2ef2946dae9ecaebf006d7 100644 (file)
@@ -1,5 +1,6 @@
 from plomrogue.errors import GameError, PlayError
 from plomrogue.mapping import YX
+import random
 
 
 
@@ -170,9 +171,17 @@ class Thing_Hat(Thing):
 
 
 
-class Thing_HatSpawner(ThingSpawner):
-    child_type = 'Hat'
+class Thing_HatRemixer(Thing):
+    symbol_hint = 'H'
 
+    def accept(self, hat):
+        import string
+        new_design = ''
+        legal_chars = string.ascii_letters + string.digits + string.punctuation + ' '
+        for i in range(9):
+            new_design += random.choice(list(legal_chars))
+        hat.design = new_design
+        self.sound('HAT REMIXER', 'remixing a hat …')
 
 
 
@@ -289,12 +298,15 @@ class Thing_BottleDeposit(Thing):
     def proceed(self):
         if self.bottle_counter >= 3:
             self.bottle_counter = 0
-            t = self.game.thing_types['MusicPlayer'](self.game,
-                                                     position=self.position)
+            choice = random.choice(['MusicPlayer', 'Hat'])
+            t = self.game.thing_types[choice](self.game, position=self.position)
             self.game.things += [t]
-            self.sound('BOTTLE DEPOSITOR',
-                       'here is a gift as a reward for ecological consciousness –'
-                       'use "command thing" on it to learn more!')
+            msg = 'here is a gift as a reward for ecological consciousness –'
+            if choice == 'MusicPlayer':
+                msg += 'pick it up and then use "command thing" on it!'
+            elif choice == 'Hat':
+                msg += 'pick it up and then use "(un-)wear" on it!'
+            self.sound('BOTTLE DEPOSITOR', msg)
             self.game.changed = True
 
     def accept(self):