def config_instance(self, instance): if instance.type == 'weapon': instance.damage_low = nudge(nudge(int(instance.level / 4 + 2))) instance.damage_high = nudge(nudge(int(3 * instance.level / 4 + 6))) elif instance.type == 'armor': defense = nudge(int(instance.level / 4 + 2)) if instance.slot == 'torso': defense *= 3 elif instance.slot in ['head', 'legs', 'cloak']: defense *= 2 instance.defense = defense
def config_instance(self, mobile): mobile.level = nudge(mobile.level if mobile.level else 1) mobile.defense = scale32(mobile.level, 100, -100) mobile.max_health = mobile.level * 8 + randint(mobile.level * mobile.level / 4, mobile.level * mobile.level) mobile.health = mobile.max_health mobile.weapon = None return super(MobileTemplateMerc, self).config_instance(mobile)