def shatter(self): broken = False while len([ key for key in self.bone_dict.keys() if self.bone_dict[key] ]) > int(self.max_wounds / (self.max_wounds - self.wounds + 1)): broken = random.choice( [key for key in self.bone_dict.keys() if self.bone_dict[key]]) self.bone_dict[broken] = False self.string(self.broken_dict[broken], format_dict={'actor': self.name}) if broken == 'arms': if self.bone_dict['head']: self.default_weapon = weapons.Teeth(self) self.weapon = weapons.Teeth(self) else: self.default_weapon = weapons.Fist(self) self.weapon = weapons.Fist(self) elif broken == 'head': self.melee_accuracy -= 3 if not self.bone_dict['arms']: self.default_weapon = weapons.Fist(self) self.weapon = weapons.Fist(self) broken = True if broken: return True # В ином случае self.string('skill_8', format_dict={'actor': self.name})
def __init__(self, name=None, controller=None, fight=None, unit_dict=None, complexity=None): complexity = 30 if complexity is None else complexity Skeleton.__init__(self, name, controller=controller, fight=fight, unit_dict=unit_dict) self.max_wounds = complexity self.wounds = complexity self.weapon = weapons.Claws(self) self.default_weapon = weapons.Teeth(self) self.blood_touch_action = self.create_action('blood_touch', self.blood_touch, 'button_1', order=5) self.chain_action = self.create_action('chain', self.chain, 'button_2', order=5) self.check_blood_action = self.create_action('check_blood', self.check_blood, 'button_3', order=20) self.summon_skeleton_action = self.create_action('summon_skeleton', self.summon_skeleton, 'button', order=11) self.chains = False if unit_dict is not None: self.equip_from_dict(unit_dict)
def __init__(self, name=None, controller=None, fight=None, unit_dict=None, complexity=None): Unit.__init__(self, name, controller, fight=fight, unit_dict=unit_dict) self.max_wounds = 15 self.wounds = 15 self.bone_dict = {'head': True, 'legs': True, 'arms': True} self.weapon = random.choice([weapons.Knife, weapons.Bow])(self) self.melee_accuracy = 0 self.range_accuracy = 0 self.evasion = 0 self.damage = 0 self.weapons = [] self.crawl_action = self.create_action('crawl', self.crawl, 'button_1', order=10) self.crawl_back_action = self.create_action('crawl-back', self.crawl_back, 'button_2', order=10) self.default_weapon = weapons.Teeth(self) self.crawling = False self.energy = 5 self.max_energy = 5 self.loot_chances['weapon'] = 50 self.recovery_energy = 5 self.toughness = 5 if unit_dict is not None: self.equip_from_dict(unit_dict)
def __init__(self, name=None, controller=None, fight=None, unit_dict=None, complexity=None): Unit.__init__(self, name, controller=controller, fight=fight, unit_dict=unit_dict) self.feared = False # Максимальные параметры if unit_dict is None: self.max_hp = 3 self.hp = self.max_hp self.max_energy = 5 self.recovery_energy = 5 self.toughness = 4 self.melee_accuracy = 0 self.range_accuracy = 0 self.evasion = 0 self.damage = 0 else: self.max_hp = unit_dict['max_hp'] self.hp = unit_dict['hp'] self.max_energy = unit_dict['max_energy'] self.recovery_energy = unit_dict['recovery_energy'] self.toughness = unit_dict['toughness'] self.melee_accuracy = unit_dict['melee_accuracy'] self.range_accuracy = unit_dict['range_accuracy'] self.evasion = unit_dict['evasion'] self.damage = unit_dict['damage'] # Снаряжение if unit_dict is None: self.weapon = weapons.Teeth(self) self.weapons = [] self.abilities = [ abilities.Cannibal(self), abilities.CorpseEater(self) ] self.items = [] self.armor = [] self.inventory = [] else: self.equip_from_dict(unit_dict) self.energy = int(self.max_energy / 2 + 1) self.crawl_action = self.create_action('worm-crawl-forward', self.crawl, 'button_1', order=10) self.crawl_back_action = self.create_action('worm-crawl-back', self.crawl_back, 'button_2', order=1)