Example #1
0
    def on_use(self, user, target):
        target_items = [item_dict['kind']
                        for item_dict in inventory.get_inventory(target)]
        if target_items:
            to_steal = random.choice(target_items)
            inventory.consume_item(target, to_steal)
            inventory.add_to_inventory(user, to_steal)

            to_steal_title = g.f2pitems[to_steal]['title']
            item_title = self.item['title']
            subject = "you've been robbed!"
            msg = ('%s used %s to steal your %s' %
                   (user.name, item_title, to_steal_title))
            send_system_message(target, subject, msg)

            subject = "you stole an item"
            msg = ("you used %s to steal %s from %s" %
                   (item_title, to_steal_title, target.name))
            send_system_message(user, subject, msg)

            self.apply_damage_and_log(user, target, [target])
Example #2
0
    def on_use(self, user, target):
        target_items = [
            item_dict['kind'] for item_dict in inventory.get_inventory(target)
        ]
        if target_items:
            to_steal = random.choice(target_items)
            inventory.consume_item(target, to_steal)
            inventory.add_to_inventory(user, to_steal)

            to_steal_title = g.f2pitems[to_steal]['title']
            item_title = self.item['title']
            subject = "you've been robbed!"
            msg = ('%s used %s to steal your %s' %
                   (user.name, item_title, to_steal_title))
            send_system_message(target, subject, msg)

            subject = "you stole an item"
            msg = ("you used %s to steal %s from %s" %
                   (item_title, to_steal_title, target.name))
            send_system_message(user, subject, msg)

            self.apply_damage_and_log(user, target, [target])
Example #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)
Example #4
0
 def on_drop(self, user):
     inventory.add_to_inventory(user, self.item_name)
Example #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)
Example #6
0
 def on_drop(self, user):
     inventory.add_to_inventory(user, self.item_name)