Пример #1
0
def getChest(chestTem: str, birthday: dict):
    '''
    按罩杯模板生成人物最终罩杯,并按人物年龄计算当前罩杯
    Keyword arguments:
    chestTem -- 罩杯模板
    age -- 角色年龄
    '''
    targetChest = getRandNpcChest(chestTem)
    overAge = random.randint(14, 18)
    overYear = birthday['year'] + overAge
    endDate = GameTime.getRandDayForYear(overYear).timetuple()
    nowDate = CacheContorl.gameTime.copy()
    nowDate = GameTime.gameTimeToDatetime(nowDate)
    startDate = GameTime.gameTimeToDatetime(birthday)
    endDay = GameTime.countDayForDateToDate(startDate, endDate)
    nowDay = GameTime.countDayForDateToDate(startDate, nowDate)
    subChest = targetChest / endDay
    nowChest = subChest * nowDay
    if nowChest > subChest:
        nowChest = targetChest
    return {
        "TargetChest": targetChest,
        "NowChest": nowChest,
        "SubChest": subChest
    }
Пример #2
0
def getRandNpcBirthDay(age: int):
    '''
    随机生成npc生日
    Keyword arguments:
    age -- 年龄
    '''
    nowYear = int(CacheContorl.gameTime['year'])
    nowMonth = int(CacheContorl.gameTime['month'])
    nowDay = int(CacheContorl.gameTime['day'])
    birthYear = nowYear - age
    date = GameTime.getRandDayForYear(birthYear)
    birthday = {"year": date.year, "month": date.month, "day": date.day}
    if nowMonth < birthday['month'] or (nowMonth == birthday['month']
                                        and nowDay < birthday['day']):
        birthday['year'] -= 1
    return birthday