Ejemplo n.º 1
0
def get_rand_npc_body_fat_tem(age_judge: str, bmi_tem: str) -> str:
    """
    按年龄段体脂率分布比例随机生成体脂率模板
    Keyword arguments:
    age_judge -- 年龄段
    bmi_tem -- bmi模板
    """
    now_body_fat_data = body_fat_weight_data[age_judge][bmi_tem]
    return value_handle.get_random_for_weight(now_body_fat_data)
Ejemplo n.º 2
0
def get_rand_npc_age_tem(age_judge: str) -> int:
    """
    按年龄断随机生成npc年龄
    Keyword arguments:
    age_judge -- 年龄段
    """
    now_age_weight_data = age_tem_weight_data[age_judge]
    now_age_tem = value_handle.get_random_for_weight(now_age_weight_data)
    return now_age_tem
Ejemplo n.º 3
0
def get_rand_npc_fat_tem(age_judge: str) -> str:
    """
    按人群年龄段体重分布比例随机生成体重模板
    Keyword arguments:
    agejudge -- 年龄段
    """
    now_fat_weight_data = fat_weight_data[age_judge]
    now_fat_tem = value_handle.get_random_for_weight(now_fat_weight_data)
    return now_fat_tem
Ejemplo n.º 4
0
def get_rand_npc_body_fat_tem(age_judge: str, bmi_tem: str) -> str:
    """
    按职业和体重随机生成体脂率模板
    Keyword arguments:
    age_judge -- 职业(student:学生,teacher:老师)
    bmi_tem -- bmi模板
    """
    now_body_fat_data = game_config.config_occupation_bodyfat_region_data[age_judge][bmi_tem]
    return value_handle.get_random_for_weight(now_body_fat_data)
Ejemplo n.º 5
0
def get_rand_npc_age_tem(age_judge: str) -> int:
    """
    按职业断随机生成npc年龄段id
    Keyword arguments:
    age_judge -- 职业(student:学生,teacher:老师)
    Return arguments:
    int -- 年龄段id
    """
    now_age_weight_data = game_config.config_occupation_age_region_data[age_judge]
    now_age_tem = value_handle.get_random_for_weight(now_age_weight_data)
    return now_age_tem
Ejemplo n.º 6
0
def get_rand_npc_fat_tem(age_judge: str) -> int:
    """
    按人群年龄段体重分布比例随机生成重模板
    Keyword arguments:
    age_judge -- 职业(student:学生,teacher:老师)
    Return arguments:
    int -- 体重模板id
    """
    now_fat_weight_data = game_config.config_occupation_bmi_region_data[age_judge]
    now_fat_tem = value_handle.get_random_for_weight(now_fat_weight_data)
    return now_fat_tem
Ejemplo n.º 7
0
def get_rand_npc_sex_experience_tem(age: int, sex: str) -> str:
    """
    按年龄范围随机获取性经验模板
    Keyword arguments:
    age -- 年龄
    sex -- 性别
    """
    age_judge_sex_experience_tem_data = text_loading.get_text_data(
        constant.FilePath.ATTR_TEMPLATE_PATH, "AgeJudgeSexExperienceTem")
    if sex == "Asexual":
        sex = "Woman"
    if sex == "Futa":
        sex = "Man"
    now_tem_data = age_judge_sex_experience_tem_data[sex]
    age_region_list = [int(i) for i in now_tem_data.keys()]
    age_region = str(value_handle.get_old_value_for_list(age, age_region_list))
    age_regionData = now_tem_data[age_region]
    return value_handle.get_random_for_weight(age_regionData)
Ejemplo n.º 8
0
def get_rand_npc_sex_experience_tem(age: int, sex: int) -> int:
    """
    按年龄范围随机获取性经验模板
    Keyword arguments:
    age -- 年龄
    sex -- 性别
    Return arguments:
    int -- 性经验模板id
    """
    age_judge_sex_experience_tem_data = game_config.config_age_judge_sex_experience_tem_data
    if sex == 3:
        sex = 1
    if sex == 2:
        sex = 0
    now_tem_data = age_judge_sex_experience_tem_data[sex]
    age_region_list = [int(i) for i in now_tem_data.keys()]
    age_region = value_handle.get_old_value_for_list(age, age_region_list)
    age_region_data = now_tem_data[age_region]
    return value_handle.get_random_for_weight(age_region_data)
Ejemplo n.º 9
0
def cook(food_data: Dict[str, Food], recipe_id: int, cook_level: int, maker: str) -> Food:
    """
    按食谱烹饪食物
    Keyword arguments:
    food_data -- 食材数据
    recipe_id -- 菜谱id
    cook_level -- 烹饪技能等级
    maker -- 制作者
    Return arguments:
    Food -- 食物对象
    """
    recipe = cache.recipe_data[recipe_id]
    cook_judge = True
    feel_data = {}
    quality_data = game_config.config_food_quality_weight_data[cook_level]
    now_quality = int(value_handle.get_random_for_weight(quality_data))
    now_weight = 0
    for food in recipe.base:
        if food not in food_data:
            cook_judge = False
            break
        now_food = food_data[food]
        rand_weight = random.randint(75, 125)
        if now_food.weight < rand_weight:
            cook_judge = False
            break
        for feel in now_food.feel:
            feel_data.setdefault(feel, 0)
            feel_data[feel] += now_food.feel[feel] / now_food.weight * rand_weight
        now_food.weight -= rand_weight
        now_weight += rand_weight
    if not cook_judge:
        return create_food(65, now_quality, now_weight, [])
    for food in recipe.ingredients:
        if food not in food_data:
            cook_judge = False
            break
        now_food = food_data[food]
        rand_weight = random.randint(25, 75)
        if now_food.weight < rand_weight:
            cook_judge = False
            break
        for feel in now_food.feel:
            feel_data.setdefault(feel, 0)
            feel_data[feel] += now_food.feel[feel] / now_food.weight * rand_weight
        now_food.weight -= rand_weight
        now_weight += rand_weight
    if not cook_judge:
        return create_food(65, now_quality, now_weight, [])
    for food in recipe.seasoning:
        if food not in food_data:
            cook_judge = False
            break
        now_food = food_data[food]
        rand_weight = random.randint(3, 7)
        if now_food.weight < rand_weight:
            cook_judge = False
            break
        for feel in now_food.feel:
            feel_data.setdefault(feel, 0)
            now_feel_num = now_food.feel[feel] / now_food.weight * rand_weight
            feel_data[feel] += now_feel_num
            now_food.feel[feel] -= now_feel_num
        now_food.weight -= rand_weight
        now_weight += rand_weight
    if not cook_judge:
        return create_food(65, now_quality, now_weight, [])
    return create_food("", now_quality, now_weight, feel_data, maker, recipe_id)
Ejemplo n.º 10
0
def get_rand_npc_chest_tem() -> str:
    """
    随机获取npc罩杯模板
    """
    return value_handle.get_random_for_weight(chest_tem_weight_data)
Ejemplo n.º 11
0
def cook(food_data: Dict[str, Food], recipe_id: int, cook_level: str,
         maker: str) -> Food:
    """
    按食谱烹饪食物
    Keyword arguments:
    food_data -- 食材数据
    recipe_id -- 菜谱id
    cook_level -- 烹饪技能等级
    maker -- 制作者
    Return arguments:
    Food -- 食物对象
    """
    recipe = cache_contorl.recipe_data[recipe_id]
    cook_judge = True
    feel_data = {}
    quality_data = text_loading.get_text_data(
        constant.FilePath.ATTR_TEMPLATE_PATH,
        "FoodQualityWeight")[str(cook_level)]
    now_quality = int(value_handle.get_random_for_weight(quality_data))
    now_weight = 0
    for food in recipe.base:
        if food not in food_data:
            cook_judge = False
            break
        now_food = food_data[food]
        rand_weight = random.randint(75, 125)
        if now_food.weight < rand_weight:
            cook_judge = False
            break
        for feel in now_food.feel:
            feel_data.setdefault(feel, 0)
            feel_data[feel] += (now_food.feel[feel] / now_food.weight *
                                rand_weight)
        now_food.weight -= rand_weight
        now_weight += rand_weight
    if not cook_judge:
        return create_food("KitchenWaste", now_quality, now_weight, [])
    for food in recipe.ingredients:
        if food not in food_data:
            cook_judge = False
            break
        now_food = food_data[food]
        rand_weight = random.randint(25, 75)
        if now_food.weight < rand_weight:
            cook_judge = False
            break
        for feel in now_food.feel:
            feel_data.setdefault(feel, 0)
            feel_data[feel] += (now_food.feel[feel] / now_food.weight *
                                rand_weight)
        now_food.weight -= rand_weight
        now_weight += rand_weight
    if not cook_judge:
        return create_food("KitchenWaste", now_quality, now_weight, [])
    for food in recipe.seasoning:
        if food not in food_data:
            cook_judge = False
            break
        now_food = food_data[food]
        rand_weight = random.randint(3, 7)
        if now_food.weight < rand_weight:
            cook_judge = False
            break
        for feel in now_food.feel:
            feel_data.setdefault(feel, 0)
            now_feel_num = now_food.feel[feel] / now_food.weight * rand_weight
            feel_data[feel] += now_feel_num
            now_food.feel[feel] -= now_feel_num
        now_food.weight -= rand_weight
        now_weight += rand_weight
    if not cook_judge:
        return create_food("KitchenWaste", now_quality, now_weight, [])
    return create_food("", now_quality, now_weight, feel_data, maker,
                       recipe_id)