def check(self):
if self.thing.carrying is None:
raise PlayError('carrying nothing to consume')
- if self.thing.carrying.type_ not in {'Bottle', 'Cookie'}:
+ if self.thing.carrying.type_ not in {'Bottle', 'Cookie', 'Psychedelic'}:
raise PlayError('cannot consume this kind of thing')
if self.thing.carrying.type_ == 'Bottle' and\
not self.thing.carrying.full:
if self.thing.carrying.type_ == 'Bottle':
self.thing.carrying.full = False
self.thing.carrying.empty()
- self.thing.send_msg('RANDOM_COLORS')
self.thing.send_msg('CHAT "You are drunk now."')
self.thing.drunk = 10000
self.thing.invalidate('fov')
self.thing.game.record_change(self.thing.position, 'other')
+ elif self.thing.carrying.type_ == 'Psychedelic':
+ self.thing.tripping = 10000
+ self.thing.send_msg('CHAT "You start tripping."')
+ self.thing.send_msg('RANDOM_COLORS')
+ eaten = self.thing.uncarry()
+ self.thing.game.remove_thing(eaten)
elif self.thing.carrying.type_ == 'Cookie':
self.thing.send_msg('CHAT ' + quote('You eat a cookie and gain the ability to draw the following character: "%s"' % self.thing.carrying.thing_char))
self.thing.add_cookie_char(self.thing.carrying.thing_char)
+class Thing_Psychedelic(Thing):
+ symbol_hint = 'P'
+ portable = True
+
+
+
+class Thing_PsychedelicSpawner(ThingSpawner):
+ symbol_hint = 'P'
+ child_type = 'Psychedelic'
+
+
+
class Thing_Bottle(Thing):
symbol_hint = 'B'
portable = True
class ThingAnimate(Thing):
blocks_movement = True
drunk = 0
+ tripping = 0
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
return task
def proceed(self):
- self.drunk -= 1
- if self.drunk == 0:
- for c_id in self.game.sessions:
- if self.game.sessions[c_id]['thing_id'] == self.id_:
- # TODO: refactor with self.send_msg
- self.game.io.send('DEFAULT_COLORS', c_id)
- self.game.io.send('CHAT "You sober up."', c_id)
- self.invalidate('fov')
- break
- self.game.changed = True
if self.task is None:
self.task = self.get_next_task()
return
super().__init__(*args, **kwargs)
self.carrying = None
+ def proceed(self):
+ super().proceed()
+ self.drunk -= 1
+ if self.drunk == 0:
+ self.send_msg('CHAT "You sober up."')
+ self.invalidate('fov')
+ self.game.changed = True
+ self.tripping -= 1
+ if self.tripping == 0:
+ self.send_msg('DEFAULT_COLORS')
+ self.send_msg('CHAT "You sober up."')
+ self.game.changed = True
+ elif self.tripping > 0 and self.tripping % 250 == 0:
+ self.send_msg('RANDOM_COLORS')
+ self.game.changed = True
+
def send_msg(self, msg):
for c_id in self.game.sessions:
if self.game.sessions[c_id]['thing_id'] == self.id_:
Thing_Door, Thing_DoorSpawner, Thing_Bottle,
Thing_BottleSpawner, Thing_BottleDeposit,
Thing_MusicPlayer, Thing_Hat, Thing_HatRemixer,
- Thing_Cookie, Thing_CookieSpawner)
+ Thing_Cookie, Thing_CookieSpawner, Thing_Psychedelic,
+ Thing_PsychedelicSpawner)
from plomrogue.config import config
game = Game(config['savefile'])
game.register_thing_type(Thing_HatRemixer)
game.register_thing_type(Thing_Cookie)
game.register_thing_type(Thing_CookieSpawner)
+game.register_thing_type(Thing_Psychedelic)
+game.register_thing_type(Thing_PsychedelicSpawner)
game.read_savefile()
game.io.start_loop()
for port in config['servers']: