예제 #1
0
 def create(cls, room):
     event = _FadingSmokeEvent()
     room.add_event(event)
     _G.add_event(event, "post")
     return cls(
         "smoke",
         description="plumes of smoke",
         idle_description="Thick wreaths of acrid smoke hang in the air.")
예제 #2
0
 def on_enter(self):
     super().on_enter()
     if self._event is None:
         self._event = _AltarEvent()
         # TODO: Use add_event here and elsewhere;
         # omit _maybe_append_event from Room.add_event.
         self._event.room = self
         G.add_event(self._event, "post")
     adventurelib.set_context("altar")
예제 #3
0
 def execute(self):
     self._counter += 1
     if self.room is not G.player.current_room:
         return
     if self._counter % self._TURNS_TO_CHIME == 0:
         say.insayne(
             "Suddenly, the bells begin to chime in simultaneity, if not "
             "exactly unison. From the chaos can be discerned a discordant "
             "melody. It is a blasphemous all-bells rendition of Hanson's "
             "'MMMBop.' As the final incomprehensible peal subsides, you "
             "realize the song is stuck in your head, threatening the "
             "sinews of your very sanity.")
         G.player.insanity.modify(15)
         G.add_event(_SongInHeadEvent(), "pre")
예제 #4
0
    def _restart(unused_actor):
        # Creates the player character and ensures game will restart upon death.
        _G.player = actor.create_actor(
            health=10,
            psyche=10,
            strength=10,
            stamina=10,
            will=10,
            wisdom=10,
            insanity=0,
            name="player",
        )
        _G.player.log_stats = True
        _G.player.upon_death(_restart)

        # Removes all events from global queue.
        _G.clear_queues()

        # Resets just_died flag.
        _G.add_event(_ResetDiedFlag(), "pre")

        # Creates a small dungeon.
        level = floor.Floor.generate("cathedral",
                                     number_rooms=config["num_rooms"])

        # Places a monster in a random room.
        level.random_room().add_character(npcs.fish_man())

        # Places an NPC in a random room.
        level.random_room().add_character(npcs.mad_librarian())

        # Places a cool NPC in a random room.
        level.random_room().add_character(npcs.smokes_man())

        # Places the player.
        level.random_room().add_character(_G.player)

        # Starts it up.
        _get_random_start()
        adventurelib.set_context("start_game")
        adventurelib.set_context(None)
        with _poll_events(poll_before=True, poll_after=True):
            commands.enter_room(_G.player.current_room)
예제 #5
0
def enqueue_text(text, where="post"):
    """Convenience function to add text events to global queue."""
    _G.add_event(_EphemeralTextEvent(text), where)
예제 #6
0
 def on_enter(self):
     super().on_enter()
     self._event = _BoilerHeatEvent()
     G.add_event(self._event, "post")
예제 #7
0
 def on_enter(self):
     super().on_enter()
     if not self._entered:
         G.add_event(_IntestineRoomEvent(), "post")
         self._entered = True
예제 #8
0
 def on_enter(self):
     super().on_enter()
     self._event = _AcidDropEvent()
     G.add_event(self._event, "post")
예제 #9
0
 def on_enter(self):
     super().on_enter()
     if self._event is None:
         self._event = _BelfryEvent()
         self._event.room = self
         G.add_event(self._event, "post")