Featured image of post 猫猫惊魂小游戏

猫猫惊魂小游戏

用C++写了个小游戏,在豆包和老爸的帮助下运行起来了,可以在线直接玩哦。。。

点击下面的链接可以直接玩:

猫猫惊魂

C++源代码如下:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
#include<bits/stdc++.h>
#include<windows.h>
#include<iomanip>   // 修复setw setfill缺失
#include<ctime>     // 修复time随机数
using namespace std;

// 全局变量
int endings[21] = {0};  // 索引1-20
int totalEndings = 0;
int cycleCount = 0;
int memoryFragments = 0;
bool hasKnife = false;
bool hasKey = false;
bool hasMirrorPiece = false;
bool metCat = false;
string playerName = "未知";
int deathCount = 0;
bool inGame = true;

// 函数声明
void showEnding(int num);
void checkProgress();
void saveMemory();
void showMemoryFragments();
void resetGame();

// 场景函数
void mainGameScene();
void whiteDoorScene();
void windowScene();
void wallScratchesScene();
void bloodStainScene();
void recallDeathScene();
void corridor1Scene();
void redDoorScene();
void mirrorRoomScene();
void mirrorTruthScene();
void blueDoorScene();
void blackDoorScene();
void hiddenDoorScene();
void truthRoomScene();
void finalRoomScene();
void developerRoomScene();
void catDialogueScene();
void catMeetingScene();

// =========== 主函数 ===========
int main(){
    srand((unsigned)time(NULL)); // 初始化随机数,每次游戏随机结果不同
    int choice;
    system("color 0F");

    // 开场字符画
    cout<<"███████╗██╗  ██╗███████╗███╗   ██╗"<<endl;
    cout<<"██╔════╝██║  ██║██╔════╝████╗  ██║"<<endl;
    cout<<"███████╗███████║█████╗  ██╔██╗ ██║"<<endl;
    cout<<"╚════██║██╔══██║██╔══╝  ██║╚██╗██║"<<endl;
    cout<<"███████║██║  ██║███████╗██║ ╚████║"<<endl;
    cout<<"╚══════╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═══╝"<<endl;
    Sleep(3000);

    cout<<"嗨嗨嗨,我又来做游戏了,今天我带来的是:"<<endl;
    Sleep(2000);

    // 闪屏效果
    for(int i=0;i<8;i++){
        system("cls");
        cout<<"███    ███ █████  ██████  ███    ███ █████  ██       ██████  ██   ██ ██████  ██   ██ ██ ██████  ███████ ██████"<<endl;
        cout<<"████  ██████   ████    ███████  ███ ██   ████       ██   ██ ██   ████    ██ ██  ██  ████    ██ ██     ██   ██"<<endl;
        cout<<"██ ████ ██████  ███    ████ ████ ██████  ████       ██████  ██   ████    ██ █████   ████    ██ █████  ██████ "<<endl;
        cout<<"██  ██  ████   ████    ████  ██  ████   ████       ██      ██   ████    ██ ██  ██  ████    ██ ██     ██   ██"<<endl;
        cout<<"██      ███ █████  ██████  ██      ██ █████ ███████ ██       █████  ██████  ██   ██ ██ ██████  ███████ ██   ██"<<endl;
        Sleep(80);
        system("cls");
        cout<<"猫 猫 惊 魂"<<endl;
        cout<<"M A O   M A O   T H R I L L E R"<<endl;
        Sleep(85);
        system("cls");
        cout<<"你 将 陷 入 无 尽 循 环"<<endl;
        Sleep(70);
        system("cls");
        cout<<"第 0 次 循 环 开 始"<<endl;
        Sleep(80);
    }

    cout<<"\n\n自然是MaoMAo_thriller(猫猫惊魂)"<<endl;
    system("pause") ;
    system("cls");

    // 游戏介绍
    cout<<"╔═══════════════════════════════════════╗"<<endl;
    cout<<"║             游 戏 介 绍               ║"<<endl;
    cout<<"╚═══════════════════════════════════════╝"<<endl;
    cout<<"\n1. 这是一个无尽的循环游戏,每次死亡都会重新开始"<<endl;
    cout<<"   但你会保留一些记忆碎片..."<<endl;
    Sleep(3000);
    cout<<"\n2. 包含20个结局:"<<endl;
    cout<<"   · 3个真结局(彻底逃脱循环)"<<endl;
    cout<<"   · 5个假结局(看似逃脱实则陷入更深循环)"<<endl;
    cout<<"   · 12个彩蛋结局(隐藏的秘密)"<<endl;
    Sleep(3000);
    cout<<"\n3. 你的每一次死亡都是有意义的"<<endl;
    cout<<"   仔细观察,寻找规律,打破循环!"<<endl;
    Sleep(3000);
    cout<<"\n\n输入你的名字:";
    cin>>playerName;

    cout<<"\n欢迎," << playerName << "。" << endl;
    cout<<"记住:死亡不是终点,而是新的开始。"<<endl;
    system("pause");

    // 游戏主循环
    while(inGame){
        cycleCount++;
        system("cls");

        if(cycleCount == 1){
            cout<<"【第" << cycleCount << "次循环开始】"<<endl;
            cout<<"你感到一阵眩晕..."<<endl;
        }
        else{
            cout<<"【第" << cycleCount << "次循环开始】"<<endl;
            cout<<"你又回到了这里...似曾相识的感觉。"<<endl;

            if(cycleCount >= 3){
                cout<<"你开始记得一些事情..."<<endl;
                if(memoryFragments > 0){
                    cout<<"记忆碎片:" << memoryFragments << "/7"<<endl;
                }
            }

            if(cycleCount >= 5){
                cout<<"墙壁上似乎有新的划痕..."<<endl;
                cout<<"'我已经来过这里" << cycleCount-1 << "次了'"<<endl;
            }

            if(cycleCount >= 10){
                cout<<"你能听到自己以前的回声..."<<endl;
                cout<<"'快逃...不要相信...猫...'"<<endl;
            }
        }

        cout<<"\n系统启动中..."<<endl;
        for(int i=0;i<3;i++){
            cout<<"█";
            Sleep(500);
        }
        cout<<"\n系统已启动"<<endl;
        system("pause");

        mainGameScene();
    }

    return 0;
}

// =========== 主房间场景 ===========
void mainGameScene(){
    int choice;
    while(true){
        system("cls");
        cout<<"【第" << cycleCount << "次循环】";
        cout<<"  记忆碎片:" << memoryFragments << "/7"<<endl;
        cout<<"  死亡次数:" << deathCount << endl;
        cout<<"══════════════════════════════"<<endl;

        if(cycleCount == 1){
            cout<<"你醒来发现自己在一个白色的房间里。"<<endl;
            cout<<"房间空荡荡的,只有一扇门和一扇窗。"<<endl;
        }else{
            cout<<"又是这个白色的房间..."<<endl;
            if(memoryFragments >= 1) cout<<"你记得上次的事情..."<<endl;
        }

        cout<<"\n房间里现在有:"<<endl;
        cout<<"1. 一扇白色的门"<<endl;
        cout<<"2. 一扇窗户"<<endl;
        if(cycleCount >= 3) cout<<"3. 墙上的划痕(查看)"<<endl;
        if(cycleCount >= 7) cout<<"4. 地上的血迹(检查)"<<endl;
        if(memoryFragments >= 2 && cycleCount >= 4) cout<<"5. 回忆上次的死亡(消耗1记忆碎片)"<<endl;

        cout<<"\n选择你的行动:";
        cin>>choice;
        if(choice == 1){whiteDoorScene();return;}
        else if(choice == 2){windowScene();return;}
        else if(choice == 3 && cycleCount >= 3){wallScratchesScene();return;}
        else if(choice == 4 && cycleCount >= 7){bloodStainScene();return;}
        else if(choice == 5 && memoryFragments >= 2 && cycleCount >= 4){
            memoryFragments--;
            recallDeathScene();
            return;
        }else{
            cout<<"无效选择!"<<endl;
            Sleep(1000);
        }
    }
}

// 白门密码场景
void whiteDoorScene(){
    system("cls");
    int password;
    if(cycleCount == 1){
        cout<<"白色门是锁着的。"<<endl;
        cout<<"需要密码才能打开。"<<endl;
        cout<<"提示:循环的次数"<<endl;
    }else{
        cout<<"白色门依然锁着。"<<endl;
        cout<<"你尝试过的密码:"<<endl;
        for(int i=1;i<cycleCount;i++) cout<<i << " ";
        cout<<endl;
    }
    cout<<"\n输入密码(数字):";
    cin>>password;
    if(password == cycleCount){
        cout<<"咔哒...门开了!"<<endl;
        Sleep(1000);
        corridor1Scene();
    }else if(password == 999 && cycleCount >= 10){
        cout<<"特殊密码!进入开发者通道..."<<endl;
        Sleep(1000);
        developerRoomScene();
    }else if(password == 0){
        cout<<"零?有趣的想法..."<<endl;
        Sleep(1000);
        showEnding(12);
        deathCount++;
    }else{
        cout<<"密码错误!"<<endl;
        Sleep(800);
        if(cycleCount >= 5){
            cout<<"你感到一阵剧痛..."<<endl;
            Sleep(1000);
            cout<<"门上的尖刺刺穿了你!"<<endl;
            cout<<"死亡次数:" << ++deathCount << endl;
            system("pause");
            if(rand() % 3 == 0 && memoryFragments < 7){
                memoryFragments++;
                cout<<"【获得1个记忆碎片!】"<<endl;
            }
        }
    }
}

// 窗户场景
void windowScene(){
    system("cls");
    int choice;
    if(!metCat){
        cout<<"窗外是一片浓雾。"<<endl;
        cout<<"你隐约看到一双发光的眼睛..."<<endl;
        if(cycleCount == 1){
            cout<<"那是一双猫的眼睛。"<<endl;
            cout<<"它在看着你..."<<endl;
            metCat = true;
        }else if(cycleCount >= 2){
            cout<<"又是那双眼睛..."<<endl;
            cout<<"你认识它吗?"<<endl;
        }
    }else{
        cout<<"那双猫眼还在那里。"<<endl;
        cout<<"它似乎在等待什么..."<<endl;
        if(memoryFragments >= 3){
            cout<<"你想起了一些关于猫的记忆..."<<endl;
            cout<<"猫是这里的守护者?还是囚徒?"<<endl;
        }
    }
    cout<<"\n1. 打开窗户\n2. 向猫挥手\n3. 离开窗户"<<endl;
    if(cycleCount >= 6) cout<<"4. 尝试和猫对话(需要记忆碎片≥3)"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    if(choice == 1){
        if(cycleCount < 3){
            cout<<"窗户打不开,好像从外面锁住了。"<<endl;
            Sleep(1000);
            windowScene();
        }else{
            cout<<"窗户突然打开了!"<<endl;
            Sleep(1000);
            cout<<"一只黑猫跳了进来..."<<endl;
            Sleep(1000);
            catMeetingScene();
        }
    }else if(choice == 2){
        cout<<"猫眨了眨眼,消失了。"<<endl;
        Sleep(1000);
    }else if(choice == 3){
        return;
    }else if(choice == 4 && cycleCount >= 6 && memoryFragments >= 3){
        memoryFragments -= 2;
        cout<<"你尝试和猫沟通..."<<endl;
        Sleep(1500);
        cout<<"猫说话了:'第" << cycleCount << "次了...你还想继续吗?'"<<endl;
        Sleep(2000);
        catDialogueScene();
    }else windowScene();
}

// 墙上划痕
void wallScratchesScene(){
    system("cls");
    int choice;
    cout<<"墙上的划痕记录了以前的循环:"<<endl;
    for(int i=1;i<cycleCount;i++){
        cout<<"第" << i << "次循环:";
        if(i % 3 == 0) cout<<"尝试开门失败"<<endl;
        else if(i % 3 == 1) cout<<"看到了猫"<<endl;
        else cout<<"死亡"<<endl;
    }
    if(cycleCount >= 8) cout<<"\n一条特别的划痕:\n'镜子里的不是倒影,是另一个你'"<<endl;
    if(cycleCount >= 15) cout<<"\n血红色的字:\n'STOP THE CYCLE - 停止循环的方法在第七次死亡时出现'"<<endl;
    cout<<"\n1. 添加新的划痕\n2. 返回\n选择:";
    cin>>choice;
    if(choice == 1){
        cout<<"你在墙上刻下:'第" << cycleCount << "次循环,我还活着'"<<endl;
        Sleep(1000);
        if(rand() % 4 == 0){
            memoryFragments++;
            cout<<"【刻下记忆,获得1个记忆碎片!】"<<endl;
        }
        wallScratchesScene();
    }else return;
}

// 血迹场景
void bloodStainScene(){
    system("cls");
    int choice;
    cout<<"地上有一滩暗红色的血迹。"<<endl;
    if(deathCount >= 3){
        cout<<"血迹开始蔓延..."<<endl;
        cout<<"你认出了这些血迹..."<<endl;
        cout<<"它们都是你的血。"<<endl;
    }
    if(deathCount >= 10) cout<<"血迹组成了无限符号图案"<<endl;
    cout<<"\n1. 触摸血迹\n2. 避开血迹\n选择:";
    cin>>choice;
    if(choice == 1){
        cout<<"你触摸了血迹..."<<endl;
        Sleep(1500);
        if(deathCount >= 5){
            cout<<"记忆涌入你的脑海!"<<endl;
            Sleep(1000);
            cout<<"你看到了自己死亡的瞬间..."<<endl;
            string deaths[] = {"被尖刺刺穿","从高处坠落","被猫...杀死?","在镜子里消失","被时间吞噬"};
            cout<<"死亡方式:" << deaths[rand()%5] << endl;
            memoryFragments += 2;
            cout<<"【获得2个记忆碎片!】"<<endl;
        }else cout<<"什么都没发生..."<<endl;
        system("pause");
    }else return;
}

// 回忆死亡
void recallDeathScene(){
    system("cls");
    cout<<"你集中精神,回忆上次的死亡..."<<endl;
    Sleep(2000);
    cout<<"记忆片段:你正在..."<<endl;
    int memoryType = rand() % 5;
    switch(memoryType){
        case 0: cout<<"尝试打开一扇红色的门...门后是无尽的黑暗..."<<endl;break;
        case 1: cout<<"和一只白猫对话...它告诉你一个秘密..."<<endl;break;
        case 2: cout<<"站在一面破碎的镜子前...镜子里的人不是你..."<<endl;break;
        case 3: cout<<"数着墙上的划痕...发现第7次循环是特殊的..."<<endl;break;
        case 4: cout<<"听到一个声音:'只有接受死亡,才能逃离死亡'"<<endl;break;
    }
    cout<<"\n这段记忆让你感到不安..."<<endl;
    system("pause");
}

// 走廊
void corridor1Scene(){
    system("cls");
    int choice;
    cout<<"你进入了一条长长的走廊。"<<endl;
    if(cycleCount >= 2) cout<<"你觉得这条走廊很熟悉..."<<endl;
    cout<<"走廊上有三扇门:"<<endl;
    cout<<"1. 红色的门(上面有猫的图案)"<<endl;
    cout<<"2. 蓝色的门(发出微弱的光)"<<endl;
    cout<<"3. 黑色的门(没有任何标记)"<<endl;
    cout<<"4. 返回白色房间"<<endl;
    if(cycleCount >= 4 && memoryFragments >= 4) cout<<"5. 发现隐藏的门(需要记忆碎片)"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    switch(choice){
        case 1: redDoorScene(); break;
        case 2: blueDoorScene(); break;
        case 3: blackDoorScene(); break;
        case 4: return;
        case 5:
            if(cycleCount >= 4 && memoryFragments >= 4){
                memoryFragments -= 2;
                hiddenDoorScene();
            }else corridor1Scene();
            break;
        default: corridor1Scene();
    }
}

// 红门猫谜题
void redDoorScene(){
    system("cls");
    int choice;
    cout<<"红色门上有一个猫的浮雕。"<<endl;
    cout<<"猫的眼睛似乎会动..."<<endl;
    if(metCat) cout<<"你认识这只猫..."<<endl;
    cout<<"\n门上刻着字:'回答我的问题,才能通过'"<<endl;
    cout<<"\n问题:循环的意义是什么?\n1.惩罚 2.救赎 3.学习 4.没有意义"<<endl;
    cout<<"\n你的回答(1-4):";
    cin>>choice;
    if(cycleCount < 3){
        cout<<"猫的眼睛变红了...'你还不明白...'"<<endl;
        cout<<"你被弹回了走廊"<<endl;
        system("pause");
        corridor1Scene();
        return;
    }
    if(choice == 2 && cycleCount >= 5){
        cout<<"猫的眼睛变绿了...门开了...'你开始理解了...'"<<endl;
        system("pause");
        mirrorRoomScene();
    }else if(choice == 4 && deathCount >= 7){
        cout<<"猫沉默了...'也许你是对的...'"<<endl;
        cout<<"门开了,但你进入了一个不同的房间"<<endl;
        system("pause");
        truthRoomScene();
    }else{
        cout<<"'错误...'"<<endl;
        Sleep(1000);
        if(cycleCount >= 7){
            cout<<"猫攻击了你!"<<endl;
            deathCount++;
            if(rand() % 2 == 0){
                memoryFragments++;
                cout<<"【在死亡边缘,你获得了1个记忆碎片】"<<endl;
            }
            system("pause");
        }else corridor1Scene();
    }
}

// 镜子房间
void mirrorRoomScene(){
    system("cls");
    int choice;
    cout<<"房间里全是镜子。无数个你看着无数个你..."<<endl;
    if(cycleCount >= 7) cout<<"镜子中的你开始做出不同的动作..."<<endl;
    cout<<"\n1. 照镜子\n2. 打碎一面镜子\n3. 数镜子里的倒影\n4. 离开房间"<<endl;
    if(memoryFragments >= 5) cout<<"5. 与镜中的自己对话(消耗5记忆碎片)"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    if(choice == 1){
        cout<<"你看着镜子中的自己..."<<endl;
        Sleep(1500);
        if(cycleCount >= 10){
            cout<<"镜中人眨了眨眼...'嗨,第" << cycleCount << "次见面的我'"<<endl;
            Sleep(2000);
            cout<<"'想听听真相吗?'"<<endl;
            system("pause");
            mirrorTruthScene();
        }else{
            cout<<"你看起来有些疲惫..."<<endl;
            system("pause");
            mirrorRoomScene();
        }
    }else if(choice == 2){
        cout<<"你打碎了一面镜子!"<<endl;
        Sleep(1000);
        cout<<"镜子碎片中,你看到了不同的景象..."<<endl;
        int randomEnd = rand() % 3;
        if(randomEnd == 0){
            showEnding(13);
            deathCount++;
        }else{
            memoryFragments++;
            cout<<"【获得1个记忆碎片】"<<endl;
            system("pause");
            mirrorRoomScene();
        }
    }else if(choice == 3){
        cout<<"你开始数倒影的数量...1...2...3..."<<endl;
        Sleep(500);
        cout<<"等等,怎么多了一个?一共有" << cycleCount + 1 << "个倒影!"<<endl;
        system("pause");
        mirrorRoomScene();
    }else if(choice == 4){
        corridor1Scene();
    }else if(choice == 5 && memoryFragments >= 5){
        memoryFragments = 0;
        cout<<"你消耗了所有记忆碎片与镜中人对话..."<<endl;
        Sleep(2000);
        mirrorTruthScene();
    }else mirrorRoomScene();
}

// 镜中真相
void mirrorTruthScene(){
    system("cls");
    int choice;
    cout<<"镜中的你走出了镜子..."<<endl;
    Sleep(2000);
    cout<<"他看起来和你一模一样,但眼神不同..."<<endl;
    Sleep(2000);
    cout<<"\n镜中人:'我是上一次循环的你。我们都在这里很久了...'"<<endl;
    Sleep(1500);
    if(cycleCount < 10){
        cout<<"镜中人:'你还需要经历更多才能理解...'回到镜子里"<<endl;
        system("pause");
        mirrorRoomScene();
        return;
    }
    cout<<"镜中人:'想结束这一切吗?'\n1.是的,结束它! 2.不,我还想知道更多 3.你是谁?"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    if(choice == 1){
        if(deathCount >= 10) showEnding(14);
        else{
            showEnding(15);
            deathCount++;
        }
    }else if(choice == 2){
        cout<<"镜中人:'那就继续探索吧...'"<<endl;
        system("pause");
        mirrorRoomScene();
    }else{
        cout<<"镜中人:'我就是你,你就是我。我们都是被困在时间里的灵魂。'"<<endl;
        system("pause");
        mirrorTruthScene();
    }
}

// 蓝门书房
void blueDoorScene(){
    system("cls");
    int choice;
    cout<<"蓝色门后面是一个书房。书架上摆满了书。"<<endl;
    cout<<"\n1.《时间循环理论》\n2.《猫的九种死亡》\n3.《镜子与倒影》\n4.返回走廊"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    switch(choice){
        case 1:
            cout<<"书中写道:'时间循环的关键在于接受。只有接受自己已经死亡的事实,才能获得新生。'"<<endl;
            if(cycleCount >= 8) cout<<"\n纸条:真正的出口在第7次死亡时出现"<<endl;
            system("pause"); blueDoorScene(); break;
        case 2:
            cout<<"猫是循环的守护者,也是最大的变数。"<<endl;
            if(metCat) cout<<"\n你想起了窗外的黑猫..."<<endl;
            system("pause"); blueDoorScene(); break;
        case 3:
            cout<<"镜子倒影是过去与未来的你。"<<endl;
            if(memoryFragments >= 3){
                memoryFragments++;
                cout<<"【获得1个记忆碎片】"<<endl;
            }
            system("pause"); blueDoorScene(); break;
        case 4: corridor1Scene(); break;
        default: blueDoorScene();
    }
}

// 黑门
void blackDoorScene(){
    system("cls");
    cout<<"黑色门是锁着的。门上有一个手印。"<<endl;
    cout<<"刻字:只有经历过7种死亡的人才能打开此门"<<endl;
    if(deathCount >= 7){
        cout<<"\n你符合条件!门开了..."<<endl;
        system("pause");
        finalRoomScene();
    }else{
        cout<<"\n已死亡:" << deathCount << " 还需:" << 7-deathCount << "次"<<endl;
        system("pause");
        corridor1Scene();
    }
}

// 隐藏钟表房
void hiddenDoorScene(){
    system("cls");
    int choice;
    cout<<"你发现了一扇隐藏的门!门后是钟表房,所有钟表秒针倒走。"<<endl;
    cout<<"大钟显示11:59,剩余" << 60 - (cycleCount % 60) << "秒"<<endl;
    cout<<"\n1.调整时间到12:00 2.让时间倒流更快 3.离开房间"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    if(choice == 1){
        if(cycleCount % 12 == 0){
            cout<<"时钟12点,全部钟表静止,时间停止!"<<endl;
            showEnding(16);
        }else{
            cout<<"时间无法调整,还不是时候..."<<endl;
            system("pause");
            hiddenDoorScene();
        }
    }else if(choice == 2){
        cout<<"时间倒流,记忆清零,循环重置!"<<endl;
        memoryFragments = 0;
        cycleCount = 1;
        deathCount = 0;
        system("pause");
        return;
    }else corridor1Scene();
}

// 真相房间
void truthRoomScene(){
    system("cls");
    int choice;
    cout<<"房间只有一把椅子,上面坐着第一次循环的你。"<<endl;
    Sleep(2000);
    cout<<"\n过去的你:你终于来了,这是循环起点也是终点。"<<endl;
    cout<<"\n1.我想结束循环 2.告诉我真相 3.杀死过去的自己"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    if(choice == 1){
        if(deathCount >=7 && memoryFragments >=7){
            showEnding(17);
        }else{
            cout<<"你还没准备好..."<<endl;
            system("pause");
            corridor1Scene();
        }
    }else if(choice == 2){
        cout<<"真相:你早就已经死亡,循环是你不愿接受死亡创造的牢笼。"<<endl;
        memoryFragments = 7;
        cout<<"【获得全部记忆碎片】"<<endl;
        system("pause");
        truthRoomScene();
    }else{
        cout<<"你杀死过去的自己,自身随之消散..."<<endl;
        showEnding(18);
        deathCount++;
    }
}

// 最终房间水晶球
void finalRoomScene(){
    system("cls");
    int choice;
    cout<<"最终房间,中央水晶球。"<<endl;
    cout<<"循环:"<<cycleCount<<" 死亡:"<<deathCount<<" 碎片:"<<memoryFragments<<"/7 遇猫:"<<(metCat?"是":"否")<<endl;
    cout<<"条件:7记忆碎片+7次死亡可获得自由"<<endl;
    cout<<"\n1.触摸水晶球 2.打碎水晶球 3.离开"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    if(choice == 1){
        if(memoryFragments >=7 && deathCount >=7) showEnding(19);
        else{
            cout<<"条件不足!"<<endl;
            system("pause");
            finalRoomScene();
        }
    }else if(choice == 2){
        cout<<"水晶球碎裂,房间崩塌!"<<endl;
        showEnding(20);
        deathCount++;
    }else corridor1Scene();
}

// 开发者房间
void developerRoomScene(){
    system("cls");
    int choice;
    cout<<"══════════════════════════════\n        开 发 者 房 间         \n══════════════════════════════"<<endl;
    cout<<"玩家:"<<playerName<<" 循环:"<<cycleCount<<" 死亡:"<<deathCount<<" 碎片:"<<memoryFragments<<"/7 结局:"<<totalEndings<<"/20"<<endl;
    cout<<"\n1.解锁全部结局 2.满记忆碎片 3.重置游戏 4.查看结局收集 5.返回游戏 6.直达真结局"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    switch(choice){
        case 1:
            for(int i=1;i<=20;i++) endings[i]=1;
            totalEndings=20;
            cout<<"全部结局解锁!"<<endl; break;
        case 2: memoryFragments=7; cout<<"碎片拉满!"<<endl; break;
        case 3: resetGame(); cout<<"游戏重置!"<<endl; break;
        case 4: checkProgress(); break;
        case 5: return;
        case 6:
            if(cycleCount >=10) showEnding(19);
            else cout<<"需要至少10次循环!"<<endl; break;
    }
    system("pause");
    developerRoomScene();
}

// 和猫对话
void catDialogueScene(){
    system("cls");
    int choice;
    cout<<"猫:我们又见面了"<<playerName<<",第"<<cycleCount<<"次对话。"<<endl;
    cout<<"\n1.我为什么在这里? 2.怎么离开? 3.你是谁? 4.结束对话";
    if(cycleCount>=10) cout<<" 5.特殊问题";
    cout<<"\n选择:";
    cin>>choice;
    switch(choice){
        case 1:
            if(cycleCount<8) cout<<"时候未到,再多经历一些。"<<endl;
            else cout<<"你被困是因为你不愿意放下执念。"<<endl;
            system("pause"); catDialogueScene(); break;
        case 2:
            cout<<"当你不再刻意寻找出口,出口自然出现。"<<endl;
            system("pause"); catDialogueScene(); break;
        case 3:
            if(cycleCount>=12) cout<<"我是第一个被困者,如今引导后来人。"<<endl;
            else cout<<"我只是一只猫。"<<endl;
            system("pause"); catDialogueScene(); break;
        case 4: return;
        case 5:
            if(cycleCount>=10){
                cout<<"你:这一切是真实的吗?\n猫:你当下感受到的就是你的真实。"<<endl;
                system("pause"); catDialogueScene();
            }else catDialogueScene(); break;
        default: catDialogueScene();
    }
}

// 初次遇见黑猫
void catMeetingScene(){
    system("cls");
    int choice;
    cout<<"黑猫跳到你面前,绿色漩涡般的眼睛。"<<endl;
    cout<<"猫:欢迎"<<playerName<<",我是这里的引导者与看守者。"<<endl;
    cout<<"\n1.你是谁? 2.这是哪里? 3.攻击猫 4.逃跑"<<endl;
    cout<<"\n选择:";
    cin>>choice;
    switch(choice){
        case 1:
            cout<<"我曾经和你一样被困,现在以猫的形态帮助他人。"<<endl;
            system("pause"); break;
        case 2:
            cout<<"这里是时间循环牢笼,极少人能逃离。"<<endl;
            system("pause"); break;
        case 3:
            cout<<"攻击无效,猫轻松躲开。暴力无法解脱。"<<endl;
            deathCount++; system("pause"); break;
        case 4: return;
    }
}

// 结局展示
void showEnding(int num){
    system("cls");
    if(endings[num] == 0){
        endings[num] = 1;
        totalEndings++;
    }
    cout<<"══════════════════════════════\n          结 局 #" << setw(2) << setfill('0') << num << "           \n══════════════════════════════"<<endl;
    string titles[21] = {
        "",
        "永恒的开始", "猫的玩物", "黑暗吞噬者", "无尽杀戮者",
        "深渊坠落者", "破碎的自我", "虚假的安宁", "拒绝现实者",
        "时间囚徒", "短暂的自由", "幕后真相", "零的思考",
        "破碎的真相", "循环终结者", "虚假的自由", "自我毁灭者",
        "时间停止者", "自我和解", "真正的自由", "破坏者"
    };
    string descriptions[21] = {
        "",
        "你因错误密码永远困在门外,循环才刚刚开始。",
        "你成为猫的玩物,永远徘徊窗边。",
        "攻击禁忌存在,被黑暗彻底吞噬。",
        "暴力滋生无尽杀戮,循环永恒。",
        "错误的寻路方式坠入更深深渊。",
        "逃避真相,自我永远残缺。",
        "表面安宁,实则坠入更深循环。",
        "拒绝接纳死亡,循环永不停止。",
        "篡改时间只会重置循环,沦为时间囚徒。",
        "短暂解脱只是新一轮循环的序幕。",
        "窥见制作秘密,但循环并未结束。",
        "参悟零的本质,零亦是循环一环。",
        "碎镜窥见局部真相,未得完整出路。",
        "打破循环却遗忘一切,重新轮回。",
        "看似自由,实则从未逃离牢笼。",
        "抹杀过去只会滋生更多悲剧。",
        "时间静止,你永远困在这一刻。",
        "与过往自我和解,挣脱循环枷锁。",
        "接纳死亡真相,获得真正自由。",
        "毁灭无法解放,只会带来混沌。"
    };
    if(num >=1 && num <=20){
        cout<<"\n" << titles[num] << "\n\n" << descriptions[num] << endl;
    }
    cout<<"\n══════════════════════════════\n循环:"<<cycleCount<<" 死亡:"<<deathCount<<" 碎片:"<<memoryFragments<<"/7 解锁结局:"<<totalEndings<<"/20\n══════════════════════════════"<<endl;
    cout<<"\n";
    system("pause");
    inGame = true;
}

// 结局收集进度
void checkProgress(){
    system("cls");
    cout<<"══════════════════════════════\n        结 局 收 集          \n══════════════════════════════"<<endl;
    for(int i=1;i<=20;i++){
        if(i % 5 == 1) cout<<endl;
        cout<<"结局" << setw(2) << setfill('0') << i << ": ";
        if(endings[i]) cout<<"已解锁 ";
        else cout<<"未解锁 ";
    }
    cout<<"\n\n收集进度:" << totalEndings << "/20"<<endl;
    if(totalEndings >= 15) cout<<"\n【成就:资深循环者】"<<endl;
    if(totalEndings >= 20) cout<<"\n【成就:循环大师】全部结局解锁,但循环真的结束了吗?"<<endl;
    cout<<"\n";
    system("pause");
}

// 重置游戏
void resetGame(){
    cycleCount = 0;
    memoryFragments = 0;
    deathCount = 0;
    metCat = false;
    hasKnife = false;
    hasKey = false;
    hasMirrorPiece = false;
    totalEndings = 0;
    for(int i=0;i<21;i++) endings[i]=0;
}

// 补充缺失声明函数(空实现,消除未定义报错)
void saveMemory(){}
void showMemoryFragments(){}
Buray 使用 HUGO 构建