Beispiel #1
0
    def trigger(self, **kwargs):
        source_entity = kwargs[action.SOURCE_ENTITY]
        target_entity = kwargs[action.TARGET_ENTITY]
        message_arguments = {}
        if source_entity and source_entity.has("description"):
            message_arguments["source_entity"] = source_entity.description.long_name
        if target_entity and target_entity.has("description"):
            message_arguments["target_entity"] = target_entity.description.long_name

        msg.send_visual_message(self.message % message_arguments, source_entity.position.value)
Beispiel #2
0
 def print_player_error(self, **kwargs):
     """
     Prints a message to the user explaining what went wrong.
     """
     source_entity = kwargs[action.SOURCE_ENTITY]
     item = self._get_item_on_floor(source_entity)
     if (not item is None and
             not self.parent.inventory.has_room_for_item(item)):
         message = "Could not pick up: " + item.description.name + \
                   ", the inventory is full."
         msg.send_visual_message(message, source_entity.position.value)
Beispiel #3
0
    def value(self, new_value):
        if (self._value != MonsterActorState.HUNTING and
                    MonsterActorState.HUNTING == new_value):
            found_gfx = GraphicChar(None, colors.BLUE, "!")
            (self.parent.char_printer.
             append_graphic_char_temporary_frames([found_gfx]))
            msg.send_visual_message(self.parent.entity_messages.notice, self.parent.position.value)
            if self.parent.has("sleeping"):
                self.parent.effect_queue.add(RemoveChildEffect(self.parent, "sleeping", time_to_live=1))

        self._value = new_value
 def print_player_error(self, **kwargs):
     """
     Prints a message to the user explaining what went wrong.
     """
     source_entity = kwargs[action.SOURCE_ENTITY]
     item = self._get_item_on_floor(source_entity)
     if (not item is None
             and not self.parent.inventory.has_room_for_item(item)):
         message = "Could not pick up: " + item.description.name + \
                   ", the inventory is full."
         msg.send_visual_message(message, source_entity.position.value)
    def trigger(self, **kwargs):
        source_entity = kwargs[action.SOURCE_ENTITY]
        target_entity = kwargs[action.TARGET_ENTITY]
        message_arguments = {}
        if source_entity and source_entity.has("description"):
            message_arguments[
                "source_entity"] = source_entity.description.long_name
        if target_entity and target_entity.has("description"):
            message_arguments[
                "target_entity"] = target_entity.description.long_name

        msg.send_visual_message(self.message % message_arguments,
                                source_entity.position.value)
Beispiel #6
0
 def act(self, **kwargs):
     """
     Performs the pickup action.
     """
     source_entity = kwargs[action.SOURCE_ENTITY]
     item = self._get_item_on_floor(source_entity)
     if item is None:
         raise Exception("Could not find item on floor.", source_entity, item)
     pickup_succeded = self.parent.inventory.try_add(item)
     if pickup_succeded:
         item.remove_component_of_type("player_auto_pick_up")
         msg.send_visual_message(messenger.PICK_UP_MESSAGE % {"item": item.description.name},
                                 source_entity.position.value)
         self.parent.actor.newly_spent_energy += gametime.single_turn
         _item_flash_animation(source_entity, item)
 def act(self, **kwargs):
     """
     Performs the pickup action.
     """
     source_entity = kwargs[action.SOURCE_ENTITY]
     item = self._get_item_on_floor(source_entity)
     if item is None:
         raise Exception("Could not find item on floor.", source_entity,
                         item)
     pickup_succeded = self.parent.inventory.try_add(item)
     if pickup_succeded:
         item.remove_component_of_type("player_auto_pick_up")
         msg.send_visual_message(
             messenger.PICK_UP_MESSAGE % {"item": item.description.name},
             source_entity.position.value)
         self.parent.actor.newly_spent_energy += gametime.single_turn
         _item_flash_animation(source_entity, item)
Beispiel #8
0
 def on_tick(self, time):
     if self.parent.health.is_dead():
         msg.send_visual_message(self.parent.entity_messages.death, self.parent.position.value)