예제 #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 execute(self):
     smoke = self.room.items.find("smoke") or self.room.items.find(
         "fading smoke")
     if smoke is not None:
         say.insayne(
             "The smoke whirls for a moment on the altar as though set "
             "there for an offering. "
             "The idol's ruby eyes seem to blaze as the smoke makes "
             "languorous curls beneath its nose. With a sound like the "
             "clatter of gravel and like the snuffling of many beasts, the "
             "idol draws the smoke into its nostrils. Its mouth shudders "
             "and falls open, smashing the altar beneath to shards. ")
         say.insayne("All beings present are pelted with debris.")
         for character in self.room.characters:
             character.health.heal_or_harm(
                 -1, cause="pelting with stone fragments")
         say.insayne(
             "In the idol's lax jaws can be seen a passage, like a pulsing "
             "throat, winding downward. From the throat you hear a voice "
             "like wet cloth dragged over stone: ")
         say.insayne("'You have practiced the first mortification")
         say.insayne("and shown you lack attachment to your health.", False)
         say.insayne("Through me you will find the way to the second.",
                     False)
         say.insayne("Through me you will see your flesh as loathsome.'",
                     False)
         say.insayne("These things will come to pass in their own time.",
                     False)
         say.insayne("They may not now. The stars are not aligned.'", False)
         say.insayne(
             "Soon, this idol will lead you to horrors and blasphemies. "
             "For now, you must roam without succor and without end in this "
             "cathedral. Perhaps enjoy a cigarette with the enviably cool "
             "gentleman.")
         self.room.description = (
             "An idol with ruby eyes and a soot-stained maw yawns at you. "
             "Its throat, of an almost irritated red color, is large enough "
             "for you to pass through. The idol's mandible lies atop a pile "
             "of rubble. Fragments of stone are "
             "punctuated with the remains of an ivory frieze. One "
             "piece of ivory appears to depict the idol itself, its mouth "
             "cavernous, the red gold of its eyes showing contentment.")
         G.set_flag("IDOL_MOUTH_OPEN")
         self.room.items.remove(smoke)
         self.kill()
예제 #5
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)
예제 #6
0
def enqueue_text(text, where="post"):
    """Convenience function to add text events to global queue."""
    _G.add_event(_EphemeralTextEvent(text), where)
예제 #7
0
 def on_enter(self):
     super().on_enter()
     self._event = _BoilerHeatEvent()
     G.add_event(self._event, "post")
예제 #8
0
 def on_enter(self):
     super().on_enter()
     if not self._entered:
         G.add_event(_IntestineRoomEvent(), "post")
         self._entered = True
예제 #9
0
 def on_enter(self):
     super().on_enter()
     self._event = _AcidDropEvent()
     G.add_event(self._event, "post")
예제 #10
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")