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 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403
| #include<stdio.h> #include<windows.h> #include<string.h> int map1[20][20]={{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, {1,2,1,1,1,4,1,1,1,3,3,3,3,3,3,3,3,3,3,1}, {1,3,1,1,1,3,1,1,1,3,1,1,1,1,1,1,1,1,3,1}, {1,3,1,1,1,3,3,3,1,3,1,1,4,1,1,1,1,1,3,1}, {1,3,3,3,3,3,1,3,1,3,1,1,3,3,3,3,1,1,3,1}, {1,1,1,1,1,1,1,3,1,3,1,1,50,1,1,3,1,1,3,1}, {1,1,1,1,4,1,1,3,1,3,1,1,4,1,1,3,1,1,3,1}, {1,1,1,1,3,1,1,3,1,3,1,1,1,1,1,3,1,1,3,1}, {1,1,1,1,3,1,1,5,1,3,1,1,1,1,1,3,1,1,3,1}, {1,1,1,1,3,1,1,3,1,3,1,3,3,3,3,3,1,1,3,1}, {1,1,1,1,3,1,1,3,1,3,1,3,1,1,1,1,1,1,3,1}, {1,3,3,3,3,3,3,3,1,3,1,3,3,3,3,3,3,3,3,1}, {1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1}, {1,3,1,1,1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,1}, {1,3,1,1,1,1,1,1,1,1,3,1,1,3,1,1,1,1,1,1}, {1,3,3,3,1,1,1,1,1,1,3,1,1,9,3,3,3,1,1,1}, {1,1,8,1,1,1,1,3,3,3,3,1,1,1,1,1,3,1,1,1}, {1,1,3,1,1,1,1,3,1,1,1,1,1,1,1,1,3,3,3,1}, {1,1,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,3,6}, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},}; int map2[20][20]={{1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,1,3,7,3,1,1,1,3,1,1}, {1,1,3,1,1,1,3,3,3,1,1,3,3,3,1,1,1,3,1,1}, {1,1,3,1,1,1,1,17,1,1,1,1,16,1,1,1,1,3,1,1}, {1,1,3,1,1,1,3,3,3,1,1,3,3,3,1,1,1,3,1,1}, {1,1,3,1,1,1,3,23,3,1,1,3,24,3,13,13,13,3,1,1}, {1,1,2,1,1,1,3,3,3,1,1,3,3,3,1,1,1,3,1,1}, {1,1,32,1,1,1,1,1,1,1,1,1,1,1,1,1,1,41,1,1}, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},}; int map6[20][20]={{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, {1,1,100,1,13,13,13,13,13,13,13,13,13,13,13,13,13,13,1,1}, {1,1,13,1,1,1,1,13,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,1,1,1,13,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,1,1,1,13,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,1,1,1,13,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,1,1,1,1,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,1,1,1,13,13,13,13,13,13,1,1,1,1,13,1,1}, {1,1,13,1,1,1,1,13,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,1,1,1,13,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,13,13,13,13,13,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,1,1,1,1,13,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,1,13,13,13,13,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,13,13,13,1,13,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,1,1,1,13,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,13,1,1,13,1,1,1,1,13,1,1,1,1,13,1,1}, {1,1,13,1,13,13,13,13,1,1,1,1,13,1,1,1,1,2,1,1}, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,42,1,1}, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},};
struct hero{ char name[20]; int z_x; int z_y; int jade; int is_over; int hp; int carry; int defend; int fortune; int actor; int backpack; int shop; int floor; int money; }; struct monster{ char m1_name[20]; int m1_hp; int m1_carry; int m1_defend; char m1_lose[20]; int m1Lose; char m2_name[20]; int m2_hp; int m2_carry; int m2_defend; char m2_lose[20]; int m2Lose; char m3_name[20]; int m3_hp; int m3_carry; int m3_defend; char m3_lose[20]; int m3Lose; char m4_name[20]; int m4_hp; int m4_carry; int m4_defend; char m4_lose[20]; int m4Lose; char m5_name[20]; int m5_hp; int m5_carry; int m5_defend; char m5_lose[20]; int m5Lose; } ; struct contain{ struct hero person; struct monster ms; };
struct contain move(struct contain zd,int a[20][20]); struct contain moveDown(struct contain zd,int a[20][20]); struct contain moveUp(struct contain zd,int a[20][20]); struct contain moveRight(struct contain zd,int a[20][20]); struct contain moveLeft(struct contain zd,int a[20][20]); struct contain information(struct contain zd,int a[20][20]); struct contain monsterBP(struct contain zd,int a[20][20]); struct contain login(struct contain zd); struct contain account(struct contain zd); struct contain ShowMap(struct contain zd,int a[20][20]); struct contain fightM1(struct contain zd); struct contain fightM2(struct contain zd); struct contain fightM3(struct contain zd); struct contain fightM4(struct contain zd); struct contain fightM5(struct contain zd); struct contain addCarry(struct contain zd); struct contain addDefend(struct contain zd); struct contain addCarry10(struct contain zd); struct contain addDefend10(struct contain zd); struct contain addHp(struct contain zd); struct contain SHOP(struct contain zd); struct contain openshop(struct contain zd);
struct contain ShowMap(struct contain zd,int a[20][20]){ system("cls"); zd=account(zd); system("color 75"); int i=0,j=0; for(i=0;i<20;i++){ for(j=0;j<20;j++){ if(a[i][j]==1) printf("■"); else if(a[i][j]==2) printf("♀"); else if(a[i][j]==3) printf(" "); else if(a[i][j]==4) printf("¢"); else if(a[i][j]==5||a[i][j]==8||a[i][j]==9||a[i][j]==50) printf("卍"); else if(a[i][j]==6) printf("♂"); else if(a[i][j]==7) printf("%c%c",3,3); else if(a[i][j]==10)printf("智"); else if(a[i][j]==11)printf("上"); else if(a[i][j]==12)printf("下"); else if(a[i][j]==21)printf("上"); else if(a[i][j]==22)printf("下"); else if(a[i][j]==31)printf("上"); else if(a[i][j]==32)printf("下"); else if(a[i][j]==41)printf("上"); else if(a[i][j]==42)printf("下"); else if(a[i][j]==13)printf("■"); else if(a[i][j]==14)printf("○"); else if(a[i][j]==15)printf("◎"); else if(a[i][j]==16)printf("☆"); else if(a[i][j]==17)printf("¤"); else if(a[i][j]==18)printf("ㄨ"); else if(a[i][j]==19)printf("◇"); else if(a[i][j]==23)printf("剑"); else if(a[i][j]==24)printf("盾"); else if(a[i][j]==25)printf("商"); else if(a[i][j]==100)printf("№"); }printf("\n"); } if(zd.person.floor>=1)printf("\t 魔塔第%d层\n",zd.person.floor); return zd; } struct contain account(struct contain zd){ int x=0,y=0,z=0; z=zd.person.carry-zd.ms.m1_defend; if(z!=0) x=zd.ms.m1_hp/z; y=(x-1)*(zd.ms.m1_carry-zd.person.defend); if(zd.person.carry<=zd.ms.m1_defend||zd.person.hp<=y){ strcpy(zd.ms.m1_lose,"?????"); }else{ if(zd.ms.m1_carry<=zd.person.defend){ strcpy(zd.ms.m1_lose,"0"); zd.ms.m1Lose=0; }else { zd.ms.m1Lose=y; itoa(zd.ms.m1Lose,zd.ms.m1_lose,10); } } z=zd.person.carry-zd.ms.m2_defend; if(z!=0) x=zd.ms.m2_hp/z; y=(x-1)*(zd.ms.m2_carry-zd.person.defend); if(zd.person.carry<=zd.ms.m2_defend||zd.person.hp<=y){ strcpy(zd.ms.m2_lose,"?????"); }else{ if(zd.ms.m2_carry<=zd.person.defend){ strcpy(zd.ms.m2_lose,"0"); zd.ms.m2Lose=0; }else { zd.ms.m2Lose=y; itoa(zd.ms.m2Lose,zd.ms.m2_lose,10); } } z=zd.person.carry-zd.ms.m3_defend; if(z!=0) x=zd.ms.m3_hp/z; y=(x-1)*(zd.ms.m3_carry-zd.person.defend); if(zd.person.carry<=zd.ms.m3_defend||zd.person.hp<=y){ strcpy(zd.ms.m3_lose,"?????"); }else{ if(zd.ms.m3_carry<=zd.person.defend){ strcpy(zd.ms.m3_lose,"0"); zd.ms.m3Lose=0; }else { zd.ms.m3Lose=y; itoa(zd.ms.m3Lose,zd.ms.m3_lose,10); } } z=zd.person.carry-zd.ms.m4_defend; if(z!=0) x=zd.ms.m4_hp/z; y=(x-1)*(zd.ms.m4_carry-zd.person.defend); if(zd.person.carry<=zd.ms.m4_defend||zd.person.hp<=y){ strcpy(zd.ms.m4_lose,"?????"); }else{ if(zd.ms.m4_carry<=zd.person.defend){ strcpy(zd.ms.m4_lose,"0"); zd.ms.m4Lose=0; }else { zd.ms.m4Lose=y; itoa(zd.ms.m4Lose,zd.ms.m4_lose,10); } } z=zd.person.carry-zd.ms.m5_defend; if(z!=0) x=zd.ms.m5_hp/z; y=(x-1)*(zd.ms.m5_carry-zd.person.defend); if(zd.person.carry<=zd.ms.m5_defend||zd.person.hp<=y){ strcpy(zd.ms.m5_lose,"?????"); }else{ if(zd.ms.m5_carry<=zd.person.defend){ strcpy(zd.ms.m5_lose,"0"); zd.ms.m5Lose=0; }else { zd.ms.m5Lose=y; itoa(zd.ms.m5Lose,zd.ms.m5_lose,10); } } return zd; } int main(void){ struct hero person={"公主",1,1,0,0,400,6,8,0,0,0,0,0,2}; struct monster ms={ "小史莱姆怪",100,20,0,"???",1000000, "大史莱姆怪",100,50,0,"???",1000000, "邪恶巫师",200,70,10,"???",1000000, "双剑武士",300,100,25,"???",1000000, "大法师",500,200,60,"???",1000000}; struct contain zd; zd.ms=ms; zd.person=person; load(); post(); background(); scene(); mention(); jiazai(); ShowMap(zd,map1); zd=move(zd,map1); theme(); zd=login(zd); ShowMap(zd,map2); zd=move(zd,map2); gameover(); getch(); } int mention(void){ printf("\n\n\t\t\t游戏小提示:\n"); printf("\t\t\t游戏前请将输入法切换为英文输入\n"); printf("\t\t\t向上:w\n"); printf("\t\t\t向下:s\n"); printf("\t\t\t向左:a\n"); printf("\t\t\t向右:d\n"); printf("\n\t\t\t按任意键继续...\n"); getch(); system("cls"); } int scene(void){ printf("\n\n\n\n\t\tloading"); int x=0; for(x=0;x<7;x++){ Sleep(100); printf("."); } system("cls"); printf("\n\n\n\n \t\t王子小鑫的独白:\n");Sleep(1000);printf("\t\t\t很");Sleep(200);printf("久");Sleep(200); printf("以");Sleep(200);printf("前");Sleep(500);printf("我");Sleep(200);printf("不");Sleep(200); printf("相\n");Sleep(1000);printf("\t\t\t信");Sleep(500);printf("爱");Sleep(100);printf("情");Sleep(100); printf("直");Sleep(100);printf("到");Sleep(100);printf("有");Sleep(100);printf("一\n");Sleep(1000); printf("\t\t\t天");Sleep(100);printf("遇见了你\n");Sleep(1000);printf("\t\t\t我");Sleep(100);printf("深");Sleep(700); printf("情");Sleep(100);printf("的");Sleep(100);printf("爱");Sleep(100);printf("着");Sleep(100); printf("你");Sleep(100);printf("啊\n");Sleep(1000);printf("\t\t\t可");Sleep(100);printf("你");Sleep(100); printf("突然\n");Sleep(1000);printf("\t\t\t消失");Sleep(100);printf("在");Sleep(100);printf("我的");Sleep(100); printf("世");Sleep(100);printf("界\n");Sleep(500);printf("\n\t\t\t按任意键继续...\n"); getch(); system("cls"); } int postOne(int count){ printf("\n\n\n"); switch(count){ case 4:printf("\t\t***************************************\n"); case 3:printf("\t\t* ♀ *\n"); case 2:printf("\t\t* 爱的征途 *\n"); case 1:printf("\t\t* ♂ *\n"); default:printf("\t\t***************************************\n"); } } int postTwo(int count){ printf("\n\n\n"); switch(count){ case 4:printf("\t\t***************************************\n"); case 3:printf("\t\t* ## *\n"); case 2:printf("\t\t* 演员:王子小鑫和公主某某 *\n"); case 1:printf("\t\t* *\n"); default:printf("\t\t***************************************\n"); } } int postThree(int count){ printf("\n\n\n"); switch(count){ case 4:printf("\t\t***************************************\n"); case 3:printf("\t\t* 导演 № *\n"); case 2:printf("\t\t* 金笔连少 № *\n"); case 1:printf("\t\t* № ^-^ *\n"); default:printf("\t\t***************************************\n"); } } int post(){ int count=0,num=1; Sleep(1000); for(;num!=4;){ for(;count!=5;){ switch(num){ case 1:postOne(count); break; case 2:postTwo(count); break; case 3:postThree(count); break; } Sleep(400); system("cls"); count++; } count--; for(;count!=-1;){ switch(num){ case 1:postOne(count); break; case 2:postTwo(count); break; case 3:postThree(count); break; } Sleep(200); system("cls"); count--; } system("cls"); Sleep(1000); count=0; num++; } } int background(){ char test[1000]="\n \n \n \n \t\t\t血 腥 的 风 放 肆 嘲 笑 \n \t\t\t漫 天 的 黄 叶 \n \t\t\t这 古 堡 的 路 \n \t\t\t已 横 尸 遍 野 \n \t\t\t听 说 \n \t\t\t你 落 入 封 闭 的 地 牢 \n \t\t\t发 不 出 求 救 的 讯 号 \n \t\t\t我 折 返 这 古 堡 \n \t\t\t提 着 刀 \n \t\t\t杀 红 了 眼 \n \t\t\t不 依 不 饶 \n"; char *p ; p = strtok(test," "); while(p){ printf("%s",p); p = strtok(NULL," "); Sleep(100); } printf("\n\t\t\t按任意键继续\n"); getch(); system("cls"); } int jiazai(){ int i=0; for(i=0;i<1;i++){ system("cls"); printf("\n\t\t\t请稍等,正在加载中...\n");Sleep(15);system("cls"); printf("\t\t\t请\n"); printf("\t\t\t 稍等,正在加载中...\n");Sleep(50);system("cls"); printf("\t\t\t 稍\n"); printf("\t\t\t请 等,正在加载中...\n");Sleep(50);system("cls"); printf("\t\t\t 等\n"); printf("\t\t\t请稍 ,正在加载中...\n");Sleep(50);system("cls"); printf("\t\t\t ,\n"); printf("\t\t\t请稍等 正在加载中...\n");Sleep(50);system("cls"); printf("\t\t\t 正\n"); printf("\t\t\t请稍等, 在加载中...\n");Sleep(50);system("cls"); printf("\t\t\t 在\n"); printf("\t\t\t请稍等,正 加载中...\n");Sleep(50);system("cls"); printf("\t\t\t 加\n"); printf("\t\t\t请稍等,正在 载中...\n");Sleep(50);system("cls"); printf("\t\t\t 载\n"); printf("\t\t\t请稍等,正在加 中...\n");Sleep(50);system("cls"); printf("\t\t\t 中\n"); printf("\t\t\t请稍等,正在加载 ...\n");Sleep(50);system("cls"); printf("\t\t\t .\n"); printf("\t\t\t请稍等,正在加载中 ..\n");Sleep(50);system("cls"); printf("\t\t\t .\n"); printf("\t\t\t请稍等,正在加载中. .\n");Sleep(50);system("cls"); printf("\t\t\t .\n"); printf("\t\t\t请稍等,正在加载中.. \n");Sleep(50);system("cls"); printf("\n\t\t\t请稍等,正在加载中...\n");Sleep(200); system("cls"); } } int last(){ printf("\n\n\n\n\t\t\t王");Sleep(300);printf("子");Sleep(300);printf("看");Sleep(300);printf("见");Sleep(500); printf("来");Sleep(200);printf("找");Sleep(200);printf("自");Sleep(200);printf("己");Sleep(200); printf("的");Sleep(200);printf("公");Sleep(200);printf("主\n");Sleep(2000); printf("\t\t\t非");Sleep(300);printf("常");Sleep(300);printf("的");Sleep(600);printf("高兴");Sleep(300); printf("王子");Sleep(300);printf("小鑫");Sleep(300);printf("将公主");Sleep(300);printf("拥入怀中\n");Sleep(1000); printf("\t\t王子:\n"); Sleep(2000); printf("\t\t\t我");Sleep(200);printf("以为");Sleep(200); printf("在也");Sleep(200);printf("见不到");Sleep(200);printf("你了!");Sleep(3000);printf("\n\t\t\t两");Sleep(400); printf("人");Sleep(400);printf("紧");Sleep(400);printf("紧");Sleep(400);printf("相");Sleep(400); printf("拥\n");Sleep(5000);printf("\t\t公主:\n");Sleep(2000);printf("\t\t\t距离");Sleep(1000); printf("终究");Sleep(300);printf("没");Sleep(700);printf("能阻挡");Sleep(200);printf("我们");Sleep(200); printf("的爱\n");Sleep(2000); printf("\t\t\t我不想");Sleep(700);printf("失去");Sleep(200);printf("你,");Sleep(200);printf("可是");Sleep(200); printf("我。。。。\n");Sleep(2000);printf("\t\t\t我的");Sleep(200);printf("王子殿下");Sleep(200);printf("我");Sleep(200); printf("爱");Sleep(200);printf("你\n");Sleep(2000); printf("\n\t\t\t公");Sleep(700);printf("主");Sleep(200);printf("转");Sleep(200);printf("身");Sleep(200); printf("\n");Sleep(2000);printf("\t\t\t黑");Sleep(200);printf("白");Sleep(200);printf("分");Sleep(200); printf("明");Sleep(200);printf("的");Sleep(200);printf("眼");Sleep(200);printf("眸");Sleep(700); printf("泛");Sleep(200);printf("着");Sleep(200);printf("红");Sleep(200);printf("宝");Sleep(200); printf("石");Sleep(200);printf("一");Sleep(200);printf("样");Sleep(200); printf("的");Sleep(700);printf("光");Sleep(200);printf("泽\n");Sleep(2000); printf("\n\t\t\t她");Sleep(700);printf("又一次");Sleep(300);printf("消失");Sleep(200); printf("不见\n");Sleep(2000); printf("\t\t王");Sleep(700);printf("子");Sleep(300);printf("痛");Sleep(200);printf("哭:\n");Sleep(5000); printf("\t\t\t我一定");Sleep(1000);printf("把你");Sleep(1000);printf("找");Sleep(1000);printf("回来!!\n"); printf("\n\n\t\t\t按任意键继续\n"); getch(); } int load(void){ int i=0,j=0,count=0; system("color 73"); for(i=0;i<=50;i++){ printf("\n\n\n\n\t\t\t\t Installing%d%%\n",count); for(j=0;j<=count/2;j++){ printf("_"); } if(count!=100){ count=count+2; Sleep(10); system("cls"); }else { printf("\n"); Sleep(500); system("cls"); return 0; } } } int actionOne(){ Sleep(1000); system("color 75"); Sleep(1000); system("color 71"); Sleep(1000); system("color 72"); Sleep(1000); system("color 74"); Sleep(1000); system("color 70"); system("cls"); } int monsterOne(){ system("cls"); printf("\n\n"); printf("\t\t\t\t可爱的蘑菇甜甜\n\n"); printf("\t\t\t '''''' \n"); printf("\t\t\t '''''''''''' \n"); printf("\t\t\t '''''''''''''''§ \n"); printf("\t\t\t '''''''''''''''''''' \n"); printf("\t\t\t '''''''''''''''''''''''' \n"); printf("\t\t\t ''''''''灬灬灬灬灬 ''''''' \n"); printf("\t\t\t '''''''〞≯ ≮ 〃''''''' \n"); printf("\t\t\t ''''''〞 ミ 〃'''''' \n"); printf("\t\t\t 〃〃 ︺ 〃〃 \n"); printf("\t\t\t '''''''''''' \n"); printf("\t\t\t '''''''''''' \n"); printf("\t\t\t '''''''''''' \n"); printf("\t\t\t '''''''''''' \n"); printf("\t\t\t '''''''''''' \n"); printf("\t\t\t '''''''''' \n"); } int monsterTwo(){ system("cls"); printf("\n\n"); printf("\t\t\t 可恶的巫婆\n\n"); printf("\t\t\t @@@\n"); printf("\t\t\t # #\n"); printf("\t\t\t / \\ \n"); printf("\t\t\t / @-.\\\n"); printf("\t\t\t /_ )\\\\ _\\\n"); printf("\t\t\t /\\/\\/ | \\/\\/\\\n"); printf("\t\t\t\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\n"); printf("\t\t\t /~~~~~\\\n"); printf("\t\t\t | ^ ^ |\n"); printf("\t\t\t | . |\n"); printf("\t\t\t | (\\_/) |\n"); printf("\t\t\t / .-. \\___/ .-. \\\n"); printf("\t\t\t @/` /.-. .-.\\ `\\@\n"); printf("\t\t\t @` \\ / `@\n"); printf("\n"); printf("\n"); } int monsterThree(){ system("cls"); printf("\n\n"); printf("\t\t\t 奇厨师佳倩\n\n"); printf("\t\t 〃〃〃 \n"); printf("\t\t ≈≈≈≈№ \n"); printf("\t\t ≈≈≈≈ㄨ ξζ \n"); printf("\t\t ≈≈灬灬灬灬灬ξξ \n"); printf("\t\t √∫∫∫ ζξξ \n"); printf("\t\t ∫∫∫∫ E E ζξξ \n"); printf("\t\t ∫∫∫∫~ ミζξξ \n"); printf("\t\t ∫∫∫∫ - ζξξ \n"); printf("\t\t ∫∫∫∫ ㄨ \n"); printf("\n\n\n\n"); } struct contain move(struct contain zd,int a[20][20]){ for(;;){ char position=getch(); switch(position){ case 'w':zd=moveUp(zd,a); system("cls"); zd=ShowMap(zd,a); break; case 'a':zd=moveLeft(zd,a); system("cls"); zd=ShowMap(zd,a); break; case 's':zd=moveDown(zd,a); system("cls"); zd=ShowMap(zd,a); break; case 'd':zd=moveRight(zd,a); if(zd.person.is_over==0){ system("cls"); zd=ShowMap(zd,a); } break; case 'c': if(zd.person.actor==1){ zd=information(zd,a); system("cls"); zd=ShowMap(zd,a); } break; case 'p': if(zd.person.shop==1){ zd=SHOP(zd); system("cls"); zd=ShowMap(zd,a); } break; case 'b': if(zd.person.backpack==1){ zd=monsterBP(zd,a); system("cls"); zd=ShowMap(zd,a); } break; } if(zd.person.is_over==1){ return zd; } } return zd; } struct contain moveUp(struct contain zd,int a[20][20]){ if(a[zd.person.z_x-1][zd.person.z_y]==3||a[zd.person.z_x-1][zd.person.z_y]==13){ a[zd.person.z_x][zd.person.z_y]=3; a[zd.person.z_x-1][zd.person.z_y]=2; zd.person.z_x=zd.person.z_x-1; }else if(a[zd.person.z_x-1][zd.person.z_y]==4){ a[zd.person.z_x-1][zd.person.z_y]=3; system("cls"); zd.person.jade++; printf("\n\n\t\t收集到%d个镇魂之玉\n\t\t集齐4个镇魂之玉才可以救王子",zd.person.jade); if(zd.person.jade==4){ getch(); system("cls"); printf("\n\n\t\t你已集齐4颗镇魂之玉\n\t\t快去救你的王子吧\n"); } getch(); }else if(a[zd.person.z_x-1][zd.person.z_y]==10){ system("cls"); printf("\n\n\t\t\t智者:\n\t\t\t 恭喜你获得怪物图谱一本,\n\t\t\t 游戏中按b键可随时查看怪物信息\n"); zd.person.backpack=1; a[zd.person.z_x-1][zd.person.z_y]=3; getch(); }else if(a[zd.person.z_x-1][zd.person.z_y]==14){ if(zd.person.hp>zd.ms.m1Lose){ a[zd.person.z_x-1][zd.person.z_y]=3; zd=fightM1(zd); }else { faild(zd); } }else if(a[zd.person.z_x-1][zd.person.z_y]==15){ if(zd.person.hp>zd.ms.m2Lose){ a[zd.person.z_x-1][zd.person.z_y]=3; zd=fightM2(zd); }else { faild(zd); } } else if(a[zd.person.z_x-1][zd.person.z_y]==16){ if(zd.person.hp>zd.ms.m3Lose){ a[zd.person.z_x-1][zd.person.z_y]=3; zd=fightM3(zd); }else { faild(zd); } } else if(a[zd.person.z_x-1][zd.person.z_y]==17){ if(zd.person.hp>zd.ms.m4Lose){ a[zd.person.z_x-1][zd.person.z_y]=3; zd=fightM4(zd); }else { faild(zd); } } else if(a[zd.person.z_x-1][zd.person.z_y]==100){ if(zd.person.hp>zd.ms.m5Lose){ a[zd.person.z_x-1][zd.person.z_y]=3; zd=fightM5(zd); zd.person.is_over=1; return zd; }else { faild(zd); } } else if(a[zd.person.z_x-1][zd.person.z_y]==18){ zd=addCarry(zd); a[zd.person.z_x-1][zd.person.z_y]=3; } else if(a[zd.person.z_x-1][zd.person.z_y]==19){ zd=addDefend(zd); a[zd.person.z_x-1][zd.person.z_y]=3; } else if(a[zd.person.z_x-1][zd.person.z_y]==23){ zd=addCarry10(zd); a[zd.person.z_x-1][zd.person.z_y]=3; } else if(a[zd.person.z_x-1][zd.person.z_y]==24){ zd=addDefend10(zd); a[zd.person.z_x-1][zd.person.z_y]=3; }else if(a[zd.person.z_x-1][zd.person.z_y]==7){ zd=addHp(zd); a[zd.person.z_x-1][zd.person.z_y]=3; } return zd; } struct contain moveDown(struct contain zd,int a[20][20]){ if(a[zd.person.z_x+1][zd.person.z_y]==3||a[zd.person.z_x+1][zd.person.z_y]==13){ a[zd.person.z_x][zd.person.z_y]=3; a[zd.person.z_x+1][zd.person.z_y]=2; zd.person.z_x=zd.person.z_x+1; } else if(a[zd.person.z_x+1][zd.person.z_y]==12){ zd.person.floor=1; ShowMap(zd,map2); zd.person.z_x=1; zd.person.z_y=1; zd=move(zd,map2); } else if(a[zd.person.z_x+1][zd.person.z_y]==21){ zd.person.floor=3; ShowMap(zd,map4); zd.person.z_x=17; zd.person.z_y=9; zd=move(zd,map4); } else if(a[zd.person.z_x+1][zd.person.z_y]==22){ zd.person.floor=2; ShowMap(zd,map3); zd.person.z_x=17; zd.person.z_y=17; zd=move(zd,map3); } else if(a[zd.person.z_x+1][zd.person.z_y]==31){ zd.person.floor=4; ShowMap(zd,map5); zd.person.z_x=17; zd.person.z_y=2; zd=move(zd,map5); } else if(a[zd.person.z_x+1][zd.person.z_y]==32){ zd.person.floor=3; ShowMap(zd,map4); zd.person.z_x=17; zd.person.z_y=2; zd=move(zd,map4); } else if(a[zd.person.z_x+1][zd.person.z_y]==41){ zd.person.floor=5; ShowMap(zd,map6); zd.person.z_x=17; zd.person.z_y=17; zd=move(zd,map6); } else if(a[zd.person.z_x+1][zd.person.z_y]==42){ zd.person.floor=4; ShowMap(zd,map5); zd.person.z_x=17; zd.person.z_y=17; zd=move(zd,map5); } else if(a[zd.person.z_x+1][zd.person.z_y]==5) { jiazai(); monsterOne(); sceneFirst(); a[zd.person.z_x+1][zd.person.z_y]=3; }else if(a[zd.person.z_x+1][zd.person.z_y]==50) { jiazai(); monsterOne(); sceneFirstII(); a[zd.person.z_x+1][zd.person.z_y]=3; }else if(a[zd.person.z_x+1][zd.person.z_y]==8) { jiazai(); monsterTwo(); sceneSecond(); a[zd.person.z_x+1][zd.person.z_y]=3; }else if(a[zd.person.z_x+1][zd.person.z_y]==9) { jiazai(); monsterThree(); sceneThird(); a[zd.person.z_x+1][zd.person.z_y]=3; }else if(a[zd.person.z_x+1][zd.person.z_y]==14){ if(zd.person.hp>zd.ms.m1Lose){ a[zd.person.z_x+1][zd.person.z_y]=3; zd=fightM1(zd); }else { faild(zd); } }else if(a[zd.person.z_x+1][zd.person.z_y]==15){ if(zd.person.hp>zd.ms.m2Lose){ a[zd.person.z_x+1][zd.person.z_y]=3; zd=fightM2(zd); }else { faild(zd); } } else if(a[zd.person.z_x+1][zd.person.z_y]==16){ if(zd.person.hp>zd.ms.m3Lose){ a[zd.person.z_x+1][zd.person.z_y]=3; zd=fightM3(zd); }else { faild(zd); } } else if(a[zd.person.z_x+1][zd.person.z_y]==17){ if(zd.person.hp>zd.ms.m4Lose){ a[zd.person.z_x+1][zd.person.z_y]=3; zd=fightM4(zd); }else { faild(zd); } } else if(a[zd.person.z_x+1][zd.person.z_y]==18){ zd=addCarry(zd); a[zd.person.z_x+1][zd.person.z_y]=3; } else if(a[zd.person.z_x+1][zd.person.z_y]==19){ zd=addDefend(zd); a[zd.person.z_x+1][zd.person.z_y]=3; } else if(a[zd.person.z_x+1][zd.person.z_y]==23){ zd=addCarry10(zd); a[zd.person.z_x+1][zd.person.z_y]=3; } else if(a[zd.person.z_x+1][zd.person.z_y]==24){ zd=addDefend10(zd); a[zd.person.z_x+1][zd.person.z_y]=3; }else if(a[zd.person.z_x+1][zd.person.z_y]==7){ zd=addHp(zd); a[zd.person.z_x+1][zd.person.z_y]=3; }else if(a[zd.person.z_x+1][zd.person.z_y]==4){ a[zd.person.z_x+1][zd.person.z_y]=3; system("cls"); zd.person.jade++; printf("\n\n\t\t收集到%d个镇魂之玉\n\t\t集齐4个镇魂之玉才可以救王子",zd.person.jade); if(zd.person.jade==4){ getch(); system("cls"); printf("\n\n\t\t你已集齐4颗镇魂之玉\n\t\t快去救你的王子吧\n"); } getch(); } return zd; } struct contain moveLeft(struct contain zd,int a[20][20]){ if(a[zd.person.z_x][zd.person.z_y-1]==3||a[zd.person.z_x][zd.person.z_y-1]==13){ a[zd.person.z_x][zd.person.z_y]=3; a[zd.person.z_x][zd.person.z_y-1]=2; zd.person.z_y=zd.person.z_y-1; }else if(a[zd.person.z_x][zd.person.z_y-1]==11){ zd.person.floor=2; ShowMap(zd,map3); zd.person.z_x=17; zd.person.z_y=2; zd=move(zd,map3); }else if(a[zd.person.z_x][zd.person.z_y-1]==14){ if(zd.person.hp>zd.ms.m1Lose){ a[zd.person.z_x][zd.person.z_y-1]=3; zd=fightM1(zd); }else { faild(zd); } }else if(a[zd.person.z_x][zd.person.z_y-1]==15){ if(zd.person.hp>zd.ms.m2Lose){ a[zd.person.z_x][zd.person.z_y-1]=3; zd=fightM2(zd); }else { faild(zd); } } else if(a[zd.person.z_x][zd.person.z_y-1]==16){ if(zd.person.hp>zd.ms.m3Lose){ a[zd.person.z_x][zd.person.z_y-1]=3; zd=fightM3(zd); }else { faild(zd); } } else if(a[zd.person.z_x][zd.person.z_y-1]==17){ if(zd.person.hp>zd.ms.m4Lose){ a[zd.person.z_x][zd.person.z_y-1]=3; zd=fightM4(zd); }else { faild(zd); } } else if(a[zd.person.z_x][zd.person.z_y-1]==18){ zd=addCarry(zd); a[zd.person.z_x][zd.person.z_y-1]=3; } else if(a[zd.person.z_x][zd.person.z_y-1]==19){ zd=addDefend(zd); a[zd.person.z_x][zd.person.z_y-1]=3; } else if(a[zd.person.z_x][zd.person.z_y-1]==23){ zd=addCarry10(zd); a[zd.person.z_x][zd.person.z_y-1]=3; } else if(a[zd.person.z_x][zd.person.z_y-1]==24){ zd=addDefend10(zd); a[zd.person.z_x][zd.person.z_y-1]=3; }else if(a[zd.person.z_x][zd.person.z_y-1]==7){ zd=addHp(zd); a[zd.person.z_x][zd.person.z_y-1]=3; }else if(a[zd.person.z_x][zd.person.z_y-1]==25){ zd=openshop(zd); a[zd.person.z_x][zd.person.z_y-1]=3; } return zd; } struct contain moveRight(struct contain zd,int a[20][20]){ if(a[zd.person.z_x][zd.person.z_y+1]==3||a[zd.person.z_x][zd.person.z_y+1]==13){ a[zd.person.z_x][zd.person.z_y]=3; a[zd.person.z_x][zd.person.z_y+1]=2; zd.person.z_y=zd.person.z_y+1; }else if(a[zd.person.z_x][zd.person.z_y+1]==6&&zd.person.jade==4){ system("cls"); last(); gameBegin(); zd.person.is_over=1; zd.person.z_x=18; zd.person.z_y=10; return zd; }else if(a[zd.person.z_x][zd.person.z_y+1]==14){ if(zd.person.hp>zd.ms.m1Lose){ a[zd.person.z_x][zd.person.z_y+1]=3; zd=fightM1(zd); }else { faild(zd); } }else if(a[zd.person.z_x][zd.person.z_y+1]==15){ if(zd.person.hp>zd.ms.m2Lose){ a[zd.person.z_x][zd.person.z_y+1]=3; zd=fightM2(zd); }else { faild(zd); } } else if(a[zd.person.z_x][zd.person.z_y+1]==16){ if(zd.person.hp>zd.ms.m3Lose){ a[zd.person.z_x][zd.person.z_y+1]=3; zd=fightM3(zd); }else { faild(zd); } } else if(a[zd.person.z_x][zd.person.z_y+1]==17){ if(zd.person.hp>zd.ms.m4Lose){ a[zd.person.z_x][zd.person.z_y+1]=3; zd=fightM4(zd); }else { faild(zd); } } else if(a[zd.person.z_x][zd.person.z_y+1]==18){ zd=addCarry(zd); a[zd.person.z_x][zd.person.z_y+1]=3; } else if(a[zd.person.z_x][zd.person.z_y+1]==19){ zd=addDefend(zd); a[zd.person.z_x][zd.person.z_y+1]=3; } else if(a[zd.person.z_x][zd.person.z_y+1]==23){ zd=addCarry10(zd); a[zd.person.z_x][zd.person.z_y+1]=3; } else if(a[zd.person.z_x][zd.person.z_y+1]==24){ zd=addDefend10(zd); a[zd.person.z_x][zd.person.z_y+1]=3; }else if(a[zd.person.z_x][zd.person.z_y+1]==7){ zd=addHp(zd); a[zd.person.z_x][zd.person.z_y+1]=3; } return zd; } struct contain information(struct contain zd,int a[20][20]){ system("cls"); printf("\n\n\t\t\t 人物属性\n"); printf("\t\t\t昵称 :%s\n",zd.person.name); printf("\t\t\t生命值:%d\n",zd.person.hp); printf("\t\t\t攻击 :%d\n",zd.person.carry); printf("\t\t\t防御 :%d\n",zd.person.defend); printf("\t\t\t金币 :%d\n",zd.person.fortune); printf("\n\t\t\t按任意键返回\n"); getch(); return zd; } struct contain monsterBP(struct contain zd,int a[20][20]){ system("cls"); printf("\n\t\t\t\t <怪物图谱>\n\n"); printf("\t○:%-10s 血量:%4d 攻击:%-4d 防御:%-4d 损血:%s\n\n",zd.ms.m1_name,zd.ms.m1_hp,zd.ms.m1_carry,zd.ms.m1_defend,zd.ms.m1_lose); printf("\t◎:%-10s 血量:%4d 攻击:%-4d 防御:%-4d 损血:%s\n\n",zd.ms.m2_name,zd.ms.m2_hp,zd.ms.m2_carry,zd.ms.m2_defend,zd.ms.m2_lose); printf("\t☆:%-10s 血量:%4d 攻击:%-4d 防御:%-4d 损血:%s\n\n",zd.ms.m3_name,zd.ms.m3_hp,zd.ms.m3_carry,zd.ms.m3_defend,zd.ms.m3_lose); printf("\t¤:%-10s 血量:%4d 攻击:%-4d 防御:%-4d 损血:%s\n\n",zd.ms.m4_name,zd.ms.m4_hp,zd.ms.m4_carry,zd.ms.m4_defend,zd.ms.m4_lose); printf("\t№:%-10s 血量:%4d 攻击:%-4d 防御:%-4d 损血:%s\n\n",zd.ms.m5_name,zd.ms.m5_hp,zd.ms.m5_carry,zd.ms.m5_defend,zd.ms.m5_lose); getch(); return zd; } struct contain SHOP(struct contain zd){ for(;;){ system("cls"); printf("\n\t\t\t\t <魔法商店>\n\n"); printf("\t\t\t亲爱的%s,花%d金币你可以购买\n\n",zd.person.name,zd.person.money); printf("\t\t\t\tj 、2点攻击力\n\n"); printf("\t\t\t\tk 、2点防御力\n\n"); printf("\t\t\t\tl 、离开\n\n"); printf("\t\t\t您当前金币余额为:%d\n\n\t\t\t请输入你选择的项目代号(如 j ):\n\n",zd.person.fortune); char num1=getchar(); char num=getchar(); switch(num){ case 'j':if(zd.person.fortune>=zd.person.money){ system("cls"); zd.person.fortune=zd.person.fortune-zd.person.money; zd.person.carry=zd.person.carry+2; zd.person.money=zd.person.money*2; printf("\n\n\t\t\t您的攻击力提升了2点\n\n"); printf("\t\t\t当前攻击力为:%d\n\n",zd.person.carry); printf("\t\t\t您还剩下金币:%d\n\n",zd.person.fortune); printf("\t\t\t按任意键返回\n"); getch(); return zd; }else { system("cls"); printf("\n\n\t\t\t很抱歉,您没有足够的金币\n\n"); printf("\t\t\t按任意键返回\n"); getch(); return zd; }break; case 'k':if(zd.person.fortune>=zd.person.money){ system("cls"); zd.person.fortune=zd.person.fortune-zd.person.money; zd.person.defend=zd.person.defend+2; zd.person.money=zd.person.money*2; printf("\n\n\t\t\t您的防御力提升了2点\n\n"); printf("\t\t\t当前防御力为:%d\n\n",zd.person.defend); printf("\t\t\t您还剩下金币:%d\n\n",zd.person.fortune); printf("\t\t\t按任意键返回\n"); getch(); return zd; }else { system("cls"); printf("\n\n\t\t\t很抱歉,您没有足够的金币\n\n"); printf("\t\t\t按任意键返回\n"); getch(); return zd; }break; case 'l': return zd; break; default:system("cls"); printf("\n\n\t\t\t输入错误!!!\n\n"); printf("\t\t\t按任意键返回\n"); getch(); return zd; } } return zd; } int sceneFirst(void){ getch(); system("cls"); printf("\t\t===============================\n"); printf("\t\t\t路遇野生蘑菇一枚\n"); printf("\t\t===============================\n\n");getch(); printf("\t\t公主(嗨森):\n\t\t\t好可爱啊!\n");getch(); printf("\t\t蘑菇甜甜(微笑):\n\t\t\t带我回家吧,我会陪你度过很多美好时光.\n");getch(); printf("\t\t公主(皱眉):\n\t\t\t对不起哦,我已经有陪我度过美好时光的人了,我要去找他\n");getch(); printf("\t\t蘑菇甜甜(难过):\n\t\t\t那你只有把我杀了才可以过去\n");getch(); printf("\t\t公主带着浅浅笑意,缓缓起身\n");getch(); printf("\t\t轻轻合上刀剑,徐徐前行\n");getch(); system("cls"); return 0; } int sceneFirstII(void){ getch(); system("cls"); printf("\t\t===============================\n"); printf("\t\t\t路遇野生蘑菇一枚\n"); printf("\t\t===============================\n\n");getch(); printf("\t\t蘑菇甜甜(平静):\n\t\t\t如果再给你一次机会,你会选我吗?\n");getch(); printf("\t\t公主(冷漠):\n\t\t\t不会\n");getch(); printf("\t\t蘑菇甜甜(难过):\n\t\t\t去拿下一个镇魂之玉吧,早点救到王子。\n");getch(); system("cls"); return 0; } int sceneSecond(void){ getch(); system("cls"); printf("\t\t===============================\n"); printf("\t\t\t遭遇到可恶的巫婆\n"); printf("\t\t===============================\n\n");getch(); printf("\t\t巫婆(笑盈盈):\n\t\t\t年轻的公主哟,我有一件奇幻连衣裙,穿上它,\n");getch(); printf("\t\t你将成为举世瞩目的人,倾国倾城\n"); printf("\t\t公主(警觉):\n\t\t\t交换条件是什么?\n");getch(); printf("\t\t巫婆(笑盈盈):\n\t\t\t你只需要原路返回,王子的身体供我享乐\n");getch(); printf("\t\t公主(大怒):\n\t\t\t淫邪的巫婆,我要杀了你\n");getch(); printf("\t\t巫婆(阴险地笑):\n\t\t\t那就没办法了,出手吧!\n");getch(); printf("\t\t公主轻笑,再一次展示了杀手素养。\n");getch(); system("cls"); return 0; } int sceneThird(void){ getch(); system("cls"); printf("\t\t===============================\n"); printf("\t\t\t 遇到西国奇厨师\n"); printf("\t\t===============================\n\n");getch(); printf("\t\t某某(冷漠):\n\t\t\t能走到这儿,我想你已经很清楚,\n");getch(); printf("\t\t要通过去古堡的路,必须...除掉我们这群暧昧党\n"); printf("\t\t公主拔剑:\n\t\t\t来吧\n");getch(); printf("\t\t空气中弥漫着各种情仇的味道\n");getch(); printf("\t\t公主举剑,直刺向某某心脏\n");getch(); printf("\t\t20cm,某某没有动静\n");getch(); printf("\t\t10cm,某某没有动静\n");getch(); printf("\t\t鲜血殷红了某某白色的衣服\n");getch(); printf("\t\t某某:\n\t\t\t你过去吧\n");getch(); printf("\t\t公主愣住两秒,用力抽出满是鲜血的剑\n");getch(); printf("\t\t公主前行,她一句话,又停住脚步\n");getch(); printf("\t\t某某:\n\t\t\t我和你有相似的过往\n");getch(); system("cls"); return 0; } int gameBegin(void){ system("cls"); system("color 07"); char test[1000]="\n\n\n\t\t\t你 以 为 我 们 的 游 戏 已 经 结 束 了 ?那 只 是 背 景 介 绍, \n\t\t\t 游 戏 才 刚 刚 开 始\n"; char *p ; p = strtok(test," "); while(p){ printf("%s",p); p = strtok(NULL," "); Sleep(100); } printf("\n\t\t\t按任意键继续...\n"); getch(); system("cls"); } int theme(){ int j=1; switch(j){ case 1:one();printf("\t\t■======公主救王子======■\n");two(); case 2:one();printf("\t\t■======公主救王 ======■\n");two(); case 3:one();printf("\t\t■======公主救 ======■\n");two(); case 4:one();printf("\t\t■======公主 ======■\n");two(); case 5:one();printf("\t\t■======公 ======■\n");two(); case 6:one();printf("\t\t■====== ======■\n");two(); case 7:one();printf("\t\t■======王 ======■\n");two(); case 8:one();printf("\t\t■======王子 ======■\n");two(); case 9:one();printf("\t\t■======王子救 ======■\n");two(); case 10:one();printf("\t\t■======王子救公 ======■\n");two(); case 11:one();printf("\t\t■======王子救公主======■\n");two(); } printf("\n\n\t\t■■■■■■■■■■■■■\n"); printf("\t\t■======================■\n"); printf("\t\t■====== 爱的征途 ======■\n"); printf("\t\t■======================■\n"); printf("\t\t■■■■■■■■■■■■■\n"); printf("\n\n\t\t\t按任意键继续...\n"); getch(); } int one(){ printf("\n\n\t\t■■■■■■■■■■■■■\n"); printf("\t\t■======================■\n"); } int two(){ printf("\t\t■======================■\n"); printf("\t\t■■■■■■■■■■■■■\n"); Sleep(150); system("cls"); } struct contain login(struct contain zd){ int i=0; for(i=0;i<3;i++){ printf("\n\n\n\t\t\t你是王子,请输入你的角色名:\n"); Sleep(5); system("color f2"); system("cls"); printf("\n\n\n\t\t\t 你是王子,请输入你的角色名:\n"); Sleep(5); system("color f4"); system("cls"); } system("color f0"); printf("\n\n\n\t\t\t你是王子,请输入你的角色名:\n\t\t\t\t"); scanf("%s",&zd.person.name); system("cls"); printf("\n\n\t\t\t 人物属性\n"); printf("\t\t\t昵称 :%s\n",zd.person.name); printf("\t\t\t生命值:%d\n",zd.person.hp); printf("\t\t\t攻击 :%d\n",zd.person.carry); printf("\t\t\t防御 :%d\n",zd.person.defend); printf("\t\t\t金币 :%d\n",zd.person.fortune); printf("\n\t\t游戏过程中可按‘c’键查看人物属性\n"); getch(); zd.person.is_over=0; zd.person.actor=1; zd.person.floor=1; return zd; } int faild(struct contain zd){ system("cls"); printf("\n\n\t\t亲爱的%s,你还打不过它!\n",zd.person.name); printf("\n\t\t按任意键返回\n"); getch(); return 0; } struct contain fightM1(struct contain zd){ zd.person.hp=zd.person.hp-zd.ms.m1Lose; zd.person.fortune=zd.person.fortune+10; system("cls"); printf("\n\n\t\t您损失了%d点血,打败了%s\n",zd.ms.m1Lose,zd.ms.m1_name); printf("\t\t获得金币:10\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain fightM2(struct contain zd){ zd.person.hp=zd.person.hp-zd.ms.m2Lose; zd.person.fortune=zd.person.fortune+20; system("cls"); printf("\n\n\t\t您损失了%d点血,打败了%s\n",zd.ms.m2Lose,zd.ms.m2_name); printf("\t\t获得金币:20\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain fightM3(struct contain zd){ zd.person.hp=zd.person.hp-zd.ms.m3Lose; zd.person.fortune=zd.person.fortune+50; system("cls"); printf("\n\n\t\t您损失了%d点血,打败了%s\n",zd.ms.m3Lose,zd.ms.m3_name); printf("\t\t获得金币:50\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain fightM4(struct contain zd){ zd.person.hp=zd.person.hp-zd.ms.m4Lose; zd.person.fortune=zd.person.fortune+100; system("cls"); printf("\n\n\t\t您损失了%d点血,打败了%s\n",zd.ms.m4Lose,zd.ms.m4_name); printf("\t\t获得金币:100\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain fightM5(struct contain zd){ zd.person.hp=zd.person.hp-zd.ms.m5Lose; zd.person.fortune=zd.person.fortune+1000; system("cls"); printf("\n\n\t\t您损失了%d点血,打败了%s\n",zd.ms.m5Lose,zd.ms.m5_name); printf("\t\t获得金币:1000\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain addCarry(struct contain zd){ zd.person.carry=zd.person.carry+2; system("cls"); printf("\n\n\t\t您的攻击力提升了2点\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain addDefend(struct contain zd){ zd.person.defend=zd.person.defend+2; system("cls"); printf("\n\n\t\t您的防御力提升了2点\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain addCarry10(struct contain zd){ zd.person.carry=zd.person.carry+10; system("cls"); printf("\n\n\t\t您的攻击力提升了10点\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain addDefend10(struct contain zd){ zd.person.defend=zd.person.defend+10; system("cls"); printf("\n\n\t\t您的防御力提升了10点\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain addHp(struct contain zd){ zd.person.hp=zd.person.hp+200; system("cls"); printf("\n\n\t\t您的血量提升了200点\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } struct contain openshop(struct contain zd){ zd.person.shop=1; system("cls"); printf("\n\n\t\t您已经激活商店\n\n"); printf("\t\t在游戏进程中按'p'键可随时购买商品\n"); printf("\n\t\t按任意键返回\n"); getch(); return zd; } int gameover(){ system("cls"); printf("\n\n\t\t王子:我拿一生去信仰,赌注为我相信的爱情。梦琪,我们永远都不要分开了好吗?\n"); printf("\n\t\t按任意键继续\n"); getch(); system("cls"); printf("\n\n\t\t谢谢您的试玩\n"); getch(); }
|