跳到正文

科技·工程

『转载zhhhh』花世界·第十部:花世界广播电台

Luna_From_Starry约 39 分钟
原文
文章信息与版本

文章信息

发布
2026年3月21日
收录
2026年3月22日
更新
2026年11月13日
篇幅
约 39 分钟

版本

  1. v2当前
  2. v1
C++
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<time.h>
#include<fstream>
#include<mmsystem.h>
#pragma comment(lib, "winmm.lib")
using namespace std;

// ==================== 全局变量 ====================
string player_name = "玩家";

// 入口验证
bool has_code = false;
vector<string> valid_codes = {
    "FULL_GARDEN",
    "HUNDRED_YEARS",
    "FLOWER_MEMORIES",
    "FLOWER_LANGUAGE"
};

// 电台状态
struct RadioStation {
    int frequency;          // 频率 88.0 - 108.0 (乘以10存储, 880-1080)
    string name;            // 电台名称
    string description;     // 描述
    string schedule[7];     // 一周节目单
    bool discovered;        // 是否已发现
    bool has_secret;        // 是否有秘密
    string secret_message;  // 秘密信息
};

vector<RadioStation> stations;
int current_frequency = 1000;  // 默认100.0
bool radio_on = false;
string current_program = "";

// 线索系统
struct Clue {
    string name;
    string content;
    string source_frequency;
    bool found;
};

vector<Clue> clues;
int clues_found = 0;

// 时间系统
int day = 1;
int hour = 0;  // 0-23
string weekdays[7] = {"周一", "周二", "周三", "周四", "周五", "周六", "周日"};
int weekday = 0;  // 0=周一

// 游戏状态
bool game_over = false;
string ending_type = "";

// 神秘存在
bool ancient_being_contacted = false;
int ancient_being_trust = 0;

// ==================== 函数声明 ====================
void setColor(int color);
void resetColor();
void slowPrint(string s, int speed = 30);
void Print(string s);
void PrintWarning(string s);
void PrintInfo(string s);
void PrintSuccess(string s);
void PrintError(string s);
void PrintRadio(string s);
void clearInput();
void showStatus();

bool checkSecretCode();
void initRadioStations();
void initClues();
void prologue();

void radio_interface();
void scan_frequencies();
void tune_frequency(int change);
void listen_radio();
void record_clue(string message, int freq);
void analyze_clues();

void special_broadcast(int hour, int weekday);
void midnight_message();
void contact_ancient_being();

void ending_freedom();
void ending_truth();
void ending_silence();
void ending_awakening();

// ==================== 工具函数 ====================

void setColor(int color) {
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole, color);
}

void resetColor() {
    setColor(7);
}

void slowPrint(string s, int speed) {
    for(int i = 0; i < s.size(); i++) {
        cout << s[i];
        Sleep(speed);
    }
}

void Print(string s) {
    cout << s;
}

void PrintWarning(string s) {
    setColor(14);
    cout << "[警告] " << s;
    resetColor();
}

void PrintInfo(string s) {
    setColor(11);
    cout << "[信息] " << s;
    resetColor();
}

void PrintSuccess(string s) {
    setColor(10);
    cout << "[成功] " << s;
    resetColor();
}

void PrintError(string s) {
    setColor(12);
    cout << "[错误] " << s;
    resetColor();
}

void PrintRadio(string s) {
    setColor(13);
    cout << "?? " << s;
    resetColor();
}

void clearInput() {
    while(kbhit()) getch();
}

void showStatus() {
    cout << "\n=== 状态 ===\n";
    cout << "第 " << day << " 天 " << weekdays[weekday] << " " << hour << ":00\n";
    cout << "当前频率: " << (current_frequency/10) << "." << (current_frequency%10) << " MHz\n";
    if(radio_on) {
        cout << "电台: " << current_program << "\n";
    }
    cout << "已发现线索: " << clues_found << "/" << clues.size() << "\n\n";
}

// ==================== 入口验证 ====================

bool checkSecretCode() {
    system("cls");
    setColor(13);
    cout << "╔══════════════════════════════════════╗\n";
    cout << "║   花世界·第十部:花世界广播电台      ║\n";
    cout << "╚══════════════════════════════════════╝\n\n";
    resetColor();

    string input;
    cin >> input;

    for(string code : valid_codes) {
        if(input == code) {
            system("cls");
            PrintSuccess("验证通过...\n");
            PrintSuccess("欢迎来到花世界广播电台\n");
            Sleep(1500);
            return true;
        }
    }

    exit(0);
    return false;
}

// ==================== 初始化 ====================

void initRadioStations() {
    // 普通电台
    RadioStation s1;
    s1.frequency = 889;  // 88.9
    s1.name = "花都音乐台";
    s1.description = "24小时播放流行音乐";
    s1.schedule[0] = "音乐早班车";
    s1.schedule[1] = "午后旋律";
    s1.schedule[2] = "音乐晚高峰";
    s1.schedule[3] = "周末音乐会";
    s1.schedule[4] = "经典回放";
    s1.schedule[5] = "听众点歌";
    s1.schedule[6] = "排行榜";
    s1.discovered = false;
    s1.has_secret = false;
    stations.push_back(s1);

    RadioStation s2;
    s2.frequency = 1017;  // 101.7
    s2.name = "花世界新闻台";
    s2.description = "整点新闻,实时资讯";
    s2.schedule[0] = "早间新闻";
    s2.schedule[1] = "午间报道";
    s2.schedule[2] = "晚间播报";
    s2.schedule[3] = "一周要闻回顾";
    s2.schedule[4] = "天气资讯";
    s2.schedule[5] = "交通路况";
    s2.schedule[6] = "深夜故事";
    s2.discovered = false;
    s2.has_secret = false;
    stations.push_back(s2);

    RadioStation s3;
    s3.frequency = 943;  // 94.3
    s3.name = "花语故事台";
    s3.description = "讲故事的电台";
    s3.schedule[0] = "童话故事";
    s3.schedule[1] = "民间传说";
    s3.schedule[2] = "历史故事";
    s3.schedule[3] = "恐怖故事";
    s3.schedule[4] = "爱情故事";
    s3.schedule[5] = "冒险故事";
    s3.schedule[6] = "听众投稿";
    s3.discovered = false;
    s3.has_secret = true;
    s3.secret_message = "在每周三深夜12点,会播放一个特殊的故事...";
    stations.push_back(s3);

    // 神秘电台(需要特殊条件才能收到)
    RadioStation s4;
    s4.frequency = 666;  // 66.6 (不在正常范围)
    s4.name = "???";
    s4.description = "只有午夜才能收到的神秘信号";
    s4.schedule[0] = "???";
    s4.schedule[1] = "???";
    s4.schedule[2] = "???";
    s4.schedule[3] = "???";
    s4.schedule[4] = "???";
    s4.schedule[5] = "???";
    s4.schedule[6] = "???";
    s4.discovered = false;
    s4.has_secret = true;
    s4.secret_message = "救救我...我被困在花世界深处...";
    stations.push_back(s4);
}

void initClues() {
    Clue c1;
    c1.name = "第一个线索";
    c1.content = "午夜时分,66.6 MHz会有特殊信号";
    c1.source_frequency = "943";
    c1.found = false;
    clues.push_back(c1);

    Clue c2;
    c2.name = "第二个线索";
    c2.content = "被困的存在需要三个关键词才能找到他:光、声、时间";
    c2.source_frequency = "666";
    c2.found = false;
    clues.push_back(c2);

    Clue c3;
    c3.name = "第三个线索";
    c3.content = "周三午夜的故事里,藏着第一个关键词";
    c3.source_frequency = "943";
    c3.found = false;
    clues.push_back(c3);

    Clue c4;
    c4.name = "第四个线索";
    c4.content = "周五深夜的新闻里,藏着第二个关键词";
    c4.source_frequency = "1017";
    c4.found = false;
    clues.push_back(c4);

    Clue c5;
    c5.name = "第五个线索";
    c5.content = "周日的音乐里,藏着第三个关键词";
    c5.source_frequency = "889";
    c5.found = false;
    clues.push_back(c5);
}

void prologue() {
    system("cls");
    setColor(13);
    cout << "\n\n";
    cout << "    ╔════════════════════════════════╗\n";
    cout << "    ║    花世界广播电台              ║\n";
    cout << "    ║    声音背后的秘密              ║\n";
    cout << "    ╚════════════════════════════════╝\n\n";
    resetColor();

    Sleep(1500);

    Print("第九部里,你在庭院里种满了花。\n");
    Print("每一朵花都幸福地生活着。\n");
    Print("xiaobb和花们也终于过上了平静的日子。\n");
    getchar();

    Print("\n但有一天晚上,你听到了奇怪的声音。\n");
    Print("是从收音机里传出来的。\n");
    Print("收音机明明是关着的。\n");
    getchar();

    setColor(13);
    Print("?? “救救我...”\n");
    Print("?? “我被困在花世界深处...”\n");
    Print("?? “只有你能听到我...”\n");
    resetColor();
    getchar();

    Print("\n你叫醒了xiaobb和花们。\n");
    Print("xiaobb:“是收音机?但它没开啊。”\n");
    Print("小阳:“我也听到了!”\n");
    Print("露露:“有人在求救。”\n");
    getchar();

    Print("\n你决定调查这个神秘的电台信号。\n");
    Print("花世界广播电台,正式开播。\n");
    getchar();
}

// ==================== 电台系统 ====================

void radio_interface() {
    while(!game_over) {
        system("cls");
        showStatus();

        Print("\n【收音机】\n");
        Print("1. 调频 (向上/向下)\n");
        Print("2. 扫描频率\n");
        Print("3. 收听当前频率\n");
        Print("4. 记录线索\n");
        Print("5. 分析线索\n");
        Print("6. 等待一小时\n");
        Print("7. 退出收音机\n");

        char choice = getch();

        if(choice == '1') {
            Print("\n向上调频按 U,向下调频按 D\n");
            char dir = getch();
            if(dir == 'U' || dir == 'u') {
                tune_frequency(1);
            }
            else if(dir == 'D' || dir == 'd') {
                tune_frequency(-1);
            }
        }
        else if(choice == '2') {
            scan_frequencies();
        }
        else if(choice == '3') {
            listen_radio();
        }
        else if(choice == '4') {
            string msg, freq;
            cout << "输入发现的线索内容: ";
            cin.ignore();
            getline(cin, msg);
            cout << "输入来源频率: ";
            cin >> freq;
            record_clue(msg, stoi(freq));
        }
        else if(choice == '5') {
            analyze_clues();
        }
        else if(choice == '6') {
            hour++;
            if(hour >= 24) {
                hour = 0;
                weekday = (weekday + 1) % 7;
                day++;
            }
            PrintInfo("时间流逝... 现在是 " + weekdays[weekday] + " " + to_string(hour) + ":00\n");
            special_broadcast(hour, weekday);
            getchar();
        }
        else if(choice == '7') {
            return;
        }
    }
}

void tune_frequency(int change) {
    current_frequency += change;
    if(current_frequency < 880) current_frequency = 880;
    if(current_frequency > 1080) current_frequency = 1080;

    PrintInfo("频率调到: " + to_string(current_frequency/10) + "." + to_string(current_frequency%10) + " MHz\n");

    // 检查是否有电台
    radio_on = false;
    for(auto &s : stations) {
        if(s.frequency == current_frequency) {
            radio_on = true;
            s.discovered = true;
            current_program = s.name;
            PrintSuccess("?? 收到信号: " + s.name + "\n");

            // 特殊频率提示
            if(s.frequency == 666 && hour == 0) {
                PrintWarning("这个频率...只在午夜出现...\n");
            }
            break;
        }
    }

    if(!radio_on) {
        current_program = "沙沙的杂音";
        Print("?? " + current_program + "\n");
    }

    getchar();
}

void scan_frequencies() {
    PrintInfo("扫描中...\n");
    Sleep(2000);

    int found = 0;
    for(auto &s : stations) {
        if(!s.discovered && s.frequency != 666) {
            PrintSuccess("发现新频率: " + to_string(s.frequency/10) + "." + to_string(s.frequency%10) + " MHz - " + s.name + "\n");
            s.discovered = true;
            found++;
        }
    }

    if(found == 0) {
        Print("没有发现新频率。\n");
    }
    getchar();
}

void listen_radio() {
    if(!radio_on) {
        Print("?? " + current_program + "\n");
        getchar();
        return;
    }

    // 找到当前电台
    RadioStation* current = nullptr;
    for(auto &s : stations) {
        if(s.frequency == current_frequency) {
            current = &s;
            break;
        }
    }

    if(!current) {
        Print("?? 信号不稳定...\n");
        getchar();
        return;
    }

    // 播放节目
    PrintRadio("正在收听: " + current->name + "\n");

    // 不同时间有不同的节目
    string program;
    if(current->frequency == 666) {
        // 神秘电台
        if(hour == 0) {
            program = "......救救我......我被困了......";
            if(!ancient_being_contacted) {
                contact_ancient_being();
            }
        }
        else {
            program = "......沙沙......杂音......";
        }
    }
    else {
        program = current->schedule[weekday];
        if(hour < 6) program = "深夜节目 - " + program;
        else if(hour < 12) program = "上午节目 - " + program;
        else if(hour < 18) program = "下午节目 - " + program;
        else program = "晚间节目 - " + program;
    }

    PrintRadio(program + "\n");

    // 特殊时间特殊内容
    if(current->frequency == 943 && weekday == 2 && hour == 0) {  // 周三午夜
        PrintWarning("故事里说:'光'是找到我的第一个关键词...\n");
    }
    else if(current->frequency == 1017 && weekday == 4 && hour == 23) {  // 周五深夜
        PrintWarning("新闻里提到:'声'波可以穿透一切...\n");
    }
    else if(current->frequency == 889 && weekday == 6 && hour == 12) {  // 周日中午
        PrintWarning("歌词里唱着:'时间'会证明一切...\n");
    }

    getchar();
}

void record_clue(string message, int freq) {
    Clue new_clue;
    new_clue.name = "线索" + to_string(clues.size() + 1);
    new_clue.content = message;
    new_clue.source_frequency = to_string(freq);
    new_clue.found = true;

    clues.push_back(new_clue);
    clues_found++;

    PrintSuccess("线索已记录!\n");
    getchar();
}

void analyze_clues() {
    if(clues.empty()) {
        Print("还没有任何线索。\n");
        getchar();
        return;
    }

    cout << "\n已收集的线索:\n";
    for(int i = 0; i < clues.size(); i++) {
        cout << i+1 << ". " << clues[i].name << ": " << clues[i].content;
        cout << " (来自 " << clues[i].source_frequency << " MHz)\n";
    }

    // 检查是否集齐三个关键词
    int keywords = 0;
    for(auto &c : clues) {
        if(c.content.find("光") != string::npos) keywords++;
        if(c.content.find("声") != string::npos) keywords++;
        if(c.content.find("时间") != string::npos) keywords++;
    }

    if(keywords >= 3 && ancient_being_contacted) {
        PrintSuccess("\n你集齐了三个关键词!\n");
        PrintSuccess("你知道该怎么做了:在午夜用这三个关键词呼唤他...\n");
    }

    getchar();
}

// ==================== 特殊事件 ====================

void special_broadcast(int hour, int weekday) {
    // 整点新闻
    if(hour == 0) {
        PrintInfo("午夜12点,整点报时...\n");
        if(current_frequency == 666) {
            midnight_message();
        }
    }
    else if(hour == 12) {
        PrintInfo("中午12点,整点新闻...\n");
    }
    else if(hour == 18) {
        PrintInfo("晚上6点,晚间新闻...\n");
    }
}

void midnight_message() {
    setColor(13);
    cout << "\n?? “你终于来了...”\n";
    cout << "?? “我是花世界的第一个居民”\n";
    cout << "?? “我被困在这里无数年了”\n";
    cout << "?? “只有集齐三个关键词,才能找到我”\n";
    cout << "?? “光、声、时间...”\n";
    cout << "?? “它们藏在不同的电台、不同的时间里”\n";
    cout << "?? “找到它们,然后...”\n";
    cout << "?? “在午夜呼唤我”\n";
    resetColor();

    ancient_being_contacted = true;
}

void contact_ancient_being() {
    if(!ancient_being_contacted) {
        midnight_message();
        return;
    }

    // 检查是否有三个关键词
    int keywords = 0;
    for(auto &c : clues) {
        if(c.content.find("光") != string::npos) keywords++;
        if(c.content.find("声") != string::npos) keywords++;
        if(c.content.find("时间") != string::npos) keywords++;
    }

    if(keywords >= 3) {
        system("cls");
        setColor(13);
        cout << "\n\n";
        cout << "    ╔════════════════════════════════╗\n";
        cout << "    ║    你找到了古老的存在          ║\n";
        cout << "    ╚════════════════════════════════╝\n\n";
        resetColor();

        Sleep(1500);

        Print("你对着收音机,说出了三个关键词:\n");
        Print("“光...声...时间...”\n");
        getchar();

        Print("\n收音机发出耀眼的光芒。\n");
        Print("一个身影从光芒中走出。\n");
        getchar();

        setColor(13);
        Print("古老存在:“谢谢你...玩家”\n");
        Print("“我被困在这里,是为了守护一个秘密”\n");
        Print("“关于花世界真正的起源”\n");
        resetColor();
        getchar();

        // 最终选择
        Print("\n古老存在说:\n");
        Print("“你可以选择:”\n");
        Print("1. 让我重获自由(我会离开花世界)\n");
        Print("2. 让我继续守护秘密(我会留下)\n");
        Print("3. 把秘密公之于众(所有人都知道真相)\n");
        Print("4. 让秘密永远消失(你成为新守护者)\n");

        char choice = getch();

        if(choice == '1') {
            ending_freedom();
        }
        else if(choice == '2') {
            ending_silence();
        }
        else if(choice == '3') {
            ending_truth();
        }
        else {
            ending_awakening();
        }
    }
}

// ==================== 结局 ====================

void ending_freedom() {
    system("cls");
    setColor(10);
    cout << "\n\n";
    cout << "    ╔════════════════════════════════╗\n";
    cout << "    ║        结局:自由              ║\n";
    cout << "    ╚════════════════════════════════╝\n\n";
    resetColor();

    Sleep(1500);

    Print("古老存在重获自由,化作光芒消散。\n");
    Print("临走前,他留下了最后一句话:\n");
    Print("“谢谢你,玩家。花世界会永远记得你。”\n");
    getchar();

    Print("\n从那以后,收音机里再也没有奇怪的声音。\n");
    Print("只剩下普通的音乐、新闻和故事。\n");
    Print("但你知道,你曾经帮助过一个古老的存在。\n");
    getchar();

    Print("\n【结局:自由】\n");
    Print("隐藏代码:RADIO_FREEDOM\n");
    getchar();

    game_over = true;
    ending_type = "freedom";
}

void ending_silence() {
    system("cls");
    setColor(8);
    cout << "\n\n";
    cout << "    ╔════════════════════════════════╗\n";
    cout << "    ║        结局:沉默              ║\n";
    cout << "    ╚════════════════════════════════╝\n\n";
    resetColor();

    Sleep(1500);

    Print("古老存在选择继续守护秘密。\n");
    Print("他消失在黑暗中,收音机恢复平静。\n");
    Print("但你知道,他还在那里,在某个频率里。\n");
    getchar();

    Print("\n偶尔,在午夜时分,你还能听到他的声音:\n");
    Print("“谢谢你...记得我...”\n");
    getchar();

    Print("\n【结局:沉默】\n");
    Print("隐藏代码:RADIO_SILENCE\n");
    getchar();

    game_over = true;
    ending_type = "silence";
}

void ending_truth() {
    system("cls");
    setColor(14);
    cout << "\n\n";
    cout << "    ╔════════════════════════════════╗\n";
    cout << "    ║        结局:真相              ║\n";
    cout << "    ╚════════════════════════════════╝\n\n";
    resetColor();

    Sleep(1500);

    Print("你把秘密公之于众。\n");
    Print("所有花都知道了花世界的起源。\n");
    Print("古老存在终于可以解脱。\n");
    getchar();

    Print("\n广播电台开始24小时播放真相。\n");
    Print("花们听着,有的哭,有的笑。\n");
    Print("但她们都说:“谢谢你告诉我们。”\n");
    getchar();

    Print("\n【结局:真相】\n");
    Print("隐藏代码:RADIO_TRUTH\n");
    getchar();

    game_over = true;
    ending_type = "truth";
}

void ending_awakening() {
    system("cls");
    setColor(13);
    cout << "\n\n";
    cout << "    ╔════════════════════════════════╗\n";
    cout << "    ║        真结局:觉醒            ║\n";
    cout << "    ╚════════════════════════════════╝\n\n";
    resetColor();

    Sleep(1500);

    Print("你选择让秘密永远消失。\n");
    Print("古老存在看着你,笑了:\n");
    Print("“你愿意成为新的守护者吗?”\n");
    getchar();

    Print("\n你点头。\n");
    Print("古老存在化作光点,融入你体内。\n");
    Print("你感觉到了前所未有的力量。\n");
    Print("你成为了花世界的新守护者。\n");
    getchar();

    Print("\n从此以后,你也能听到那些微弱的声音。\n");
    Print("你帮助迷失的花找到回家的路。\n");
    Print("你守护着花世界的每一个秘密。\n");
    getchar();

    Print("\nxiaobb走过来,拍拍你的肩:\n");
    Print("“我就知道,你是特别的。”\n");
    Print("小阳她们围过来,笑着说:\n");
    Print("“我们的守护者。”\n");
    getchar();

    Print("\n【真结局:觉醒】\n");
    Print("隐藏代码:RADIO_AWAKENING\n");
    getchar();

    game_over = true;
    ending_type = "awakening";
}

// ==================== 主函数 ====================

int main() {
    srand(time(0));
    SetConsoleTitle("花世界·第十部:花世界广播电台");

    // 入口验证
    if(!checkSecretCode()) {
        return 0;
    }

    // 初始化
    initRadioStations();
    initClues();

    // 开场剧情
    prologue();

    // 游戏主循环
    while(!game_over) {
        radio_interface();
    }

    // 结局总结
    system("cls");
    setColor(8);
    cout << "\n感谢你玩完花世界·第十部\n";
    cout << "创造者:xiaobb & 花们\n";

    if(ending_type == "freedom") {
        cout << "\n你达成了结局:自由\n";
        cout << "隐藏代码:RADIO_FREEDOM\n";
    }
    else if(ending_type == "silence") {
        cout << "\n你达成了结局:沉默\n";
        cout << "隐藏代码:RADIO_SILENCE\n";
    }
    else if(ending_type == "truth") {
        cout << "\n你达成了结局:真相\n";
        cout << "隐藏代码:RADIO_TRUTH\n";
    }
    else if(ending_type == "awakening") {
        cout << "\n你达成了真结局:觉醒\n";
        cout << "隐藏代码:RADIO_AWAKENING\n";
    }

    cout << "\n每一个声音,都有一个故事。\n";
    cout << "每一个频率,都有一个秘密。\n";
    cout << "\n按任意键退出...";
    resetColor();
    getch();

    return 0;
}
原文