Exemplo n.º 1
0
    def get_action(self, consumer):
        if self.tier == 1:
            self.engine.message_log.add_message(
                f"For a brief moment, you sense everything on this level.",
                color.status_effect_applied,
            )
            for y in range(len(self.engine.game_map.visible[0])):
                for x in range(len(self.engine.game_map.visible)):
                    self.engine.game_map.visible[x, y] = True
            for y in range(len(self.engine.game_map.explored[0])):
                for x in range(len(self.engine.game_map.explored)):
                    self.engine.game_map.explored[x, y] = True
        elif self.tier == 2:
            self.engine.message_log.add_message(
                f"Your mind is filled with geometric informations.",
                color.status_effect_applied,
            )
            for y in range(len(self.engine.game_map.explored[0])):
                for x in range(len(self.engine.game_map.explored)):
                    self.engine.game_map.explored[x, y] = True

        self.engine.message_log.add_message(
            "Press ESC to stop viewing the map.",
            color.white,
        )
        self.engine.event_handler = MagicMappingLookHandler(
            self.engine,
            callback=lambda trash_value: actions.ReadItem(
                consumer, self.parent),
        )
        return None
Exemplo n.º 2
0
 def get_action(self, consumer: Actor) -> Optional[actions.Action]:
     self.engine.message_log.add_message("Select a target location.",
                                         color.needs_target)
     self.engine.event_handler = SingleRangedAttackHandler(
         self.engine,
         callback=lambda xy: actions.ReadItem(consumer, self.parent, xy),
     )
     return None
Exemplo n.º 3
0
 def get_action(self, consumer):
     self.engine.message_log.add_message("Select a direction.",
                                         color.needs_target)
     self.engine.event_handler = RayRangedInputHandler(
         self.engine,
         actor=consumer,
         max_range=self.max_range,
         callback=lambda xy: actions.ReadItem(consumer, self.parent, xy),
     )
     return None
Exemplo n.º 4
0
 def get_action(self, consumer: Actor) -> Optional[actions.Action]:
     self.engine.message_log.add_message("Choose an item to enchant.",
                                         color.needs_target)
     self.engine.event_handler = InventoryChooseItemAndCallbackHandler(
         self.engine,
         inventory_component=consumer.inventory,
         show_only=
         None,  # If item_type filter is needed, you should override this entire function.
         callback=lambda selected_item: actions.ReadItem(
             consumer, self.parent, (0, 0), selected_item),
     )
     return None
Exemplo n.º 5
0
 def get_action(self, consumer: Actor) -> Optional[actions.Action]:
     self.engine.message_log.add_message("Choose an item to identify.",
                                         color.needs_target)
     self.engine.event_handler = InventoryChooseItemAndCallbackHandler(
         self.engine,
         inventory_component=consumer.inventory,
         show_only_status=(
             "unidentified-all", "semi-identified-all"
         ),  # NOTE: WARNING - If yoou pass only one parameter, additional comma is needed inside tuple to prevent passing the data in string form
         callback=lambda selected_item: actions.ReadItem(
             consumer, self.parent, (0, 0), selected_item),
     )
     return None
Exemplo n.º 6
0
 def get_action(self, consumer: Actor) -> Optional[actions.Action]:
     self.engine.message_log.add_message("Choose an item to remove curse.",
                                         color.needs_target)
     self.engine.event_handler = InventoryChooseItemAndCallbackHandler(
         self.engine,
         inventory_component=consumer.inventory,
         show_only_status=(
             "unidentified-all",
             "semi-identified-all",
             "full-identified-cursed",
         ),
         callback=lambda selected_item: actions.ReadItem(
             consumer, self.parent, (0, 0), selected_item),
     )
     return None
Exemplo n.º 7
0
 def get_action(self, consumer: Actor) -> Optional[actions.Action]:
     self.engine.message_log.add_message("Choose an item to enchant.",
                                         color.needs_target)
     self.engine.event_handler = InventoryChooseItemAndCallbackHandler(
         self.engine,
         inventory_component=consumer.inventory,
         show_only_types=(
             InventoryOrder.MELEE_WEAPON,
             InventoryOrder.THROWING_WEAPON,
             InventoryOrder.ARMOR,
             InventoryOrder.AMULET,
             InventoryOrder.RING,
             InventoryOrder.WAND,
         ),  # Only display enchantable items.
         callback=lambda selected_item: actions.ReadItem(
             consumer, self.parent, (0, 0), selected_item),
     )
     return None
Exemplo n.º 8
0
 def get_action(self, consumer: Actor) -> Optional[actions.Action]:
     """Try to return the action for this item."""
     return actions.ReadItem(consumer, self.parent)