def create_art(nation, creator): category = creator.choice(ART_CATEGORIES[creator.periods[-1].role]) style = '' sub_category = '' material = '' if category == 'drawing': style = creator.choice(ART_STYLES[category]) sub_category = creator.choice(ART_SUBCATEGORIES[category]) gen_forms = creator.choice(ART_SUBJECTS[sub_category]) else: gen_forms = creator.choice(ART_SUBJECTS[category]) gen = Form(gen_forms, custom_weights=creator.periods[-1].custom_weights) subject, content = gen.generate(nation=nation, creator=creator) if subject is not None: creator.periods[-1].custom_weights = gen.custom_weights material_gen = None if style in ART_MATERIALS: material_gen = Form( ART_MATERIALS[style], custom_weights=creator.periods[-1].custom_weights) elif category in ART_MATERIALS: material_gen = Form( ART_MATERIALS[category], custom_weights=creator.periods[-1].custom_weights) name = utility.titlecase(nation.language.translateTo(subject)) if material_gen is not None: material = material_gen.generate(nation=nation, creator=creator)[0] creator.periods[-1].custom_weights = material_gen.custom_weights return Art(nation, creator, name, subject, category, style, sub_category, content, material, None, gen) else: return None
def create_art(nation, creator): category = creator.choice(ART_CATEGORIES[creator.periods[-1].role]) style = '' sub_category = '' material = '' if category == 'drawing': style = creator.choice(ART_STYLES[category]) sub_category = creator.choice(ART_SUBCATEGORIES[category]) gen_forms = creator.choice(ART_SUBJECTS[sub_category]) else: gen_forms = creator.choice(ART_SUBJECTS[category]) gen = Form(gen_forms, custom_weights=creator.periods[-1].custom_weights) subject, content = gen.generate(nation=nation, creator=creator) if subject is not None: creator.periods[-1].custom_weights = gen.custom_weights material_gen = None if style in ART_MATERIALS: material_gen = Form(ART_MATERIALS[style], custom_weights=creator.periods[-1].custom_weights) elif category in ART_MATERIALS: material_gen = Form(ART_MATERIALS[category], custom_weights=creator.periods[-1].custom_weights) name = utility.titlecase(nation.language.translateTo(subject)) if material_gen is not None: material = material_gen.generate(nation=nation, creator=creator)[0] creator.periods[-1].custom_weights = material_gen.custom_weights return Art(nation, creator, name, subject, category, style, sub_category, content, material, None, gen) else: return None