Example #1
0
    def __init__(self, event):
        """
        Default constructor
        """
        super().__init__(event)

        self.location = e_target(event).location
        self.text = 'poisoned'
        self.colour = 'green'
        self.offset = (0, 16)
Example #2
0
    def __init__(self, event):
        """
        Default constructor
        """
        super().__init__(event)

        self.location = e_target(event).location
        self.damage = -e_damage(event)[0]
        self.colour = 'white'
        self.offset = (0, 0)
Example #3
0
    def __init__(self, event):
        """
        Default constructor
        """
        super().__init__(event)

        self.location = e_target(event).location
        self.text = 'poisoned'
        self.colour = 'green'
        self.offset = (0, 16)
Example #4
0
    def __init__(self, event):
        """
        Default constructor
        """
        super().__init__(event)

        self.location = e_target(event).location
        self.text = 'healing'
        self.colour = 'blue'
        self.offset = (0, 16)
Example #5
0
    def __init__(self, event):
        """
        Default constructor
        """
        super().__init__(event)

        self.location = e_target(event).location
        self.text = 'healing'
        self.colour = 'blue'
        self.offset = (0, 16)
Example #6
0
    def receive_update(self, event):
        """
        Receive update from entity
        """
        if e_event_type(event) in ('heal started', 'poisoned', 'heal ended',
                                   'poison ended', 'damage started',
                                   'damage ended'):
            for i in range(self.layout().count()):
                self.layout().itemAt(i).widget().close()

            character = e_target(event)
            for effect in character.get_effects():
                new_icon = QLabel()
                new_icon.setPixmap(self.surface_manager.get_icon(effect.icon))
                self.layout().insertWidget(self.layout().count() - 1, new_icon)
Example #7
0
def impl(context, character_name):
    character = get_character(context, character_name)

    old_hit_points = get_history_value(character, "hit_points")
    new_hit_points = character.hit_points
    total_damage_suffered = old_hit_points - new_hit_points

    attack_hit_events = (x for x in context.observer.events if e_event_type(x) == "attack hit")
    matching_events = [x for x in attack_hit_events if e_target(x).name == character_name]
    hit_event = matching_events[0]
    attacker = e_attacker(hit_event)

    total_damage_from_weapon = sum([x[0] for x in attacker.inventory.weapon.weapon_data.damage])

    assert total_damage_suffered > total_damage_from_weapon
Example #8
0
    def receive_update(self, event):
        """
        Receive update from entity
        """
        if e_event_type(event) in ('heal started', 'poisoned',
                                   'heal ended', 'poison ended',
                                   'damage started', 'damage ended'):
            for i in range(self.layout().count()):
                self.layout().itemAt(i).widget().close()

            character = e_target(event)
            for effect in character.get_effects():
                new_icon = QLabel()
                new_icon.setPixmap(self.surface_manager.get_icon(effect.icon))
                self.layout().insertWidget(self.layout().count() - 1,
                                       new_icon)
Example #9
0
def impl(context, character_name):
    character = get_character(context, character_name)

    old_hit_points = get_history_value(character, 'hit_points')
    new_hit_points = character.hit_points
    total_damage_suffered = old_hit_points - new_hit_points

    attack_hit_events = (x for x in context.observer.events
                         if e_event_type(x) == 'attack hit')
    matching_events = [
        x for x in attack_hit_events if e_target(x).name == character_name
    ]
    hit_event = matching_events[0]
    attacker = e_attacker(hit_event)

    total_damage_from_weapon = sum(
        [x[0] for x in attacker.inventory.weapon.weapon_data.damage])

    assert (total_damage_suffered > total_damage_from_weapon)