def HitAnyKey():
    import sys, platform
    sys.stdout.write('\a')
    sys.stdout.flush()
    if platform.system().lower() == 'windows':
        print("Press any key to exit...")
        import msvcrt
        msvcrt.getch()
    return
def main():
    import os
    script_path = os.path.join('..', 'game', 'script.rpy')
    with open(script_path, 'r', encoding='utf-8') as file:
        lines = file.readlines()
    modified = False
    for i, line in enumerate(lines):
        if ('$ inc_patch' in line or '$inc_patch' in line) and 'False' in line:
            lines[i] = line.replace('False', 'True')
            modified = True
            break
        elif ('$ inc_patch' in line or '$inc_patch' in line) and 'True' in line:
            print('The incest patch was already applied.')
            return
    if modified:
        with open(script_path, 'w', encoding='utf-8') as file:
            file.writelines(lines)
        print('The incest patch was successfully applied.')
    else:
        print('The incest patch line was not found.')
    return
if __name__ == "__main__":
    main()
    HitAnyKey()