Example #1
0
 def combine (self, item):
     instance = item.get_instance ()
     
     # -- is item the required agent?
     if instance.Name == self.Agent or instance.is_a (self.Agent):
         return item_storage.get (self.Result)
     
     return None
Example #2
0
 def combine (self, item):
     instance = item.get_instance ()
     
     # -- projectiles can be poisoned
     if instance.is_a ("Poison") and not self.is_a ("poisoned"):
     
         # -- create a (new) immutable item from projectile and poison
         name = self.Name + " of " + instance.Name
         
         # -- see whether this combination already exists
         result = rpg.item_storage.get (name)
         
         # -- otherwise create it
         if result == None:
             result = rpg.item (0)
             result.create_instance ("items.projectile", "projectile")
             result.set_max_stack (self.this.max_stack ())
             result.thisown = 0
             
             pyres = result.get_instance ()
             for category in self.Categories:
                 pyres.add_category (category)
             pyres.add_category ("poisoned")
             pyres.Name = name
             pyres.Value = self.Value + instance.Value / instance.MaxCharge
             
             # -- add it to item storage
             rpg.item_storage.add (result)
             
         # -- remove poison charge
         instance.Charge = instance.Charge - 1
         
         # -- destroy if no charges left
         if instance.Charge == 0: instance.destroy ()
         
         return result
     
     # -- combination failed
     return None