Пример #1
0
    def on_use(self, user, target):
        all_effects = effects.get_all_effects([target._fullname])
        target_effects = all_effects.get(target._fullname, [])
        target_afflictions = [e for e in target_effects
                              if not e.endswith("_hat")]

        if target_afflictions:
            to_heal = random.choice(target_afflictions)
            effects.remove_effect(target, to_heal)
            to_heal_title = g.f2pitems[to_heal]['title']
            item_title = self.item['title']
            msg = '%s used %s to heal of %s' % (user.name, item_title,
                                                to_heal_title)
        else:
            item_title = self.item['title']
            msg = ('%s used %s to heal you but you were '
                   'fully healthy. what a waste' % (user.name, item_title))
        subject = 'you have been healed!'

        if isinstance(target, Account):
            send_system_message(target, subject, msg)

        self.apply_damage_and_log(user, target, [target])
Пример #2
0
    def on_use(self, user, target):
        all_effects = effects.get_all_effects([target._fullname])
        target_effects = all_effects.get(target._fullname, [])
        target_afflictions = [
            e for e in target_effects if not e.endswith("_hat")
        ]

        if target_afflictions:
            to_heal = random.choice(target_afflictions)
            effects.remove_effect(target, to_heal)
            to_heal_title = g.f2pitems[to_heal]['title']
            item_title = self.item['title']
            msg = '%s used %s to heal of %s' % (user.name, item_title,
                                                to_heal_title)
        else:
            item_title = self.item['title']
            msg = ('%s used %s to heal you but you were '
                   'fully healthy. what a waste' % (user.name, item_title))
        subject = 'you have been healed!'

        if isinstance(target, Account):
            send_system_message(target, subject, msg)

        self.apply_damage_and_log(user, target, [target])
Пример #3
0
 def on_use(self, user, target):
     effects.remove_effect(user, self.item_name)
     inventory.add_to_inventory(target, self.item_name)
     super(Abstinence, self).on_use(user, target)
Пример #4
0
 def on_reply(self, user, target):
     effector = effects.get_effector(self.item_name, target._fullname)
     effects.remove_effect(target, self.item_name)
     self.apply_damage_and_log(effector, target, [user])
Пример #5
0
 def on_use(self, user, target):
     effects.remove_effect(user, self.item_name)
     inventory.add_to_inventory(target, self.item_name)
     super(Abstinence, self).on_use(user, target)
Пример #6
0
 def on_reply(self, user, target):
     effector = effects.get_effector(self.item_name, target._fullname)
     effects.remove_effect(target, self.item_name)
     self.apply_damage_and_log(effector, target, [user])