Advertisement
Melron

Lavyrinth

Aug 17th, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.78 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #define N 22
  5. #define M 79
  6. #define TRUE 1
  7.  
  8.  
  9. int firstStage();
  10. int secStage();
  11. int thirdStage();
  12. int fight();
  13. void start();
  14. void settings();
  15. void HowTo();
  16. void finish();
  17.  
  18. char map[N][M];
  19. int auto_manual;
  20. int X = 3; // character coordinates
  21. int Y = 1; // character coordinates
  22. int t=1; // menu move
  23. int s=1; //settings move
  24. char player = 2;
  25. char boss = '#';
  26. int PlayerHp=10000;
  27. int BossHp=10000;
  28.  
  29. //int mode = 0;
  30.  
  31.  
  32. int main()
  33. {
  34.  
  35.  
  36. start();
  37. firstStage();
  38. secStage();
  39. thirdStage();
  40.  
  41. }
  42. int firstStage()
  43. {
  44.  
  45. char player = 2;
  46. int i,j;
  47. int stage=0;
  48. do
  49. {
  50. system("cls");
  51.  
  52. for (i=0;i<N;i++)
  53. {
  54. for (j=0;j<M;j++)
  55. {
  56. map[i][j]=0;
  57. }
  58. }
  59.  
  60. map[0][0]=201;
  61. map[0][M-1]=187;
  62. map[N-1][0]=200;
  63. map[N-1][M-1]=188;
  64.  
  65. map[1][1]='S';
  66. map[1][2]='T';
  67. map[1][3]='A';
  68. map[1][4]='G';
  69. map[1][5]='E';
  70. map[1][7]='1';
  71.  
  72. map[8][20]='#';
  73. map[4][4]='#';
  74. map[4][13]='#';
  75. map[15][24]='#';
  76. map[13][30]='#';
  77. map[7][44]='#';
  78. map[4][4]='#';
  79. map[4][63]='#';
  80. map[7][74]='#';
  81. map[20][66]='#';
  82.  
  83.  
  84. for (i=1;i<M-1;i++)
  85. map[0][i]=205;
  86. for (i=1;i<N-1;i++)
  87. map[i][0]=186;
  88. map[3][0]=0;
  89. for (i=1;i<M-1;i++)
  90. map[N-1][i]=205;
  91. for (i=1;i<N-1;i++)
  92.  
  93. map[i][M-1]=186;
  94.  
  95.  
  96.  
  97. map[2][0]=204;
  98. map[2][9]=188;
  99. map[1][9]=186;
  100. map[0][9]=203;
  101. for (i=1;i<9;i++)
  102. map[2][i]=205;
  103.  
  104. for (i=20;i<57;i++)
  105. {
  106. map[9][i] = 178;
  107. map[10][i] = 178;
  108. }
  109.  
  110. for (t=35;t<41;t++)
  111. for (i=11;i<21;i++)
  112. {
  113. map[i][t] = 178;
  114. }
  115.  
  116. for (i=20;i<57;i++)
  117. map[6][i]=178;
  118.  
  119. for (t=1;t<7;t++)
  120. for (i=20;i<57;i++)
  121. map[t][i]=178;
  122.  
  123. for (t=5;t<13;t++)
  124. for (i=9;i<19;i++)
  125. map[i][t]=178;
  126.  
  127. for (t=64;t<72;t++)
  128. for (i=9;i<19;i++)
  129. map[i][t]=178;
  130.  
  131. map[21][76]= 176;
  132. map[21][75]= 176;
  133. map[X][Y]=player;
  134.  
  135. for (i=0;i<N;i++)
  136. {
  137. for (j=0;j<M;j++)
  138. {
  139.  
  140. printf("%c",map[i][j]);
  141.  
  142. }
  143. printf("\n");
  144. }
  145.  
  146. //printf("\nX=%d Y=%d",X,Y);
  147. char move = getch();
  148. switch (move)
  149. {
  150. case 'S':
  151. case 's':
  152.  
  153. {
  154. if (map[X+1][Y]=='#')
  155. {
  156. fight();
  157. break;
  158. }
  159.  
  160. if (map[X+1][Y]==(char)176)
  161. {
  162. stage=1;
  163. break;
  164. }
  165.  
  166. else if (map[X+1][Y]!=(char)178 && map[X+1][Y]!=(char)205)
  167. {
  168. X++;
  169. break;
  170. }
  171. else
  172. break;
  173.  
  174. }
  175. case 'W':
  176. case 'w':
  177.  
  178. {
  179. if (map[X-1][Y]=='#')
  180. {
  181. fight();
  182. break;
  183. }
  184.  
  185. else if (map[X-1][Y]!=(char)178 && map[X-1][Y]!=(char)205 && map[X-1][Y]!=(char)188)
  186. {
  187. X--;
  188. break;
  189. }
  190. break;
  191. }
  192. case 'A':
  193. case 'a':
  194. {
  195.  
  196.  
  197. if (X==3 && Y-1 == 0)
  198. {
  199. break;
  200. }
  201.  
  202. if (map[X][Y-1]=='#')
  203. {
  204. fight();
  205. break;
  206. }
  207. else if (map[X][Y-1]!=(char)178 && map[X][Y-1]!=(char)186 && map[X][Y-1]!=(char)188)
  208. {
  209. Y--;
  210. break;
  211. }
  212. break;
  213. }
  214. case 'D':
  215. case 'd':
  216. {
  217. if (map[X][Y+1]=='#')
  218. {
  219. fight();
  220. break;
  221. }
  222. else if (map[X][Y+1]!=(char)178 && map[X][Y+1]!=(char)186 && map[X][Y+1]!=(char)188)
  223. Y++;
  224. break;
  225. }
  226. break;
  227.  
  228. }
  229. }while(stage==0);
  230. return 0;
  231. }
  232. int secStage()
  233. {
  234. char player = 2;
  235. int i,j;
  236. int stage=0;
  237.  
  238. BossHp=13000;
  239. X=20;
  240. Y=75;
  241. do
  242. {
  243. system("cls");
  244.  
  245. for (i=0;i<N;i++)
  246. {
  247. for (j=0;j<M;j++)
  248. {
  249. map[i][j]=0;
  250. }
  251. }
  252.  
  253. map[0][0]=201;
  254. map[0][M-1]=187;
  255. map[N-1][0]=200;
  256. map[N-1][M-1]=188;
  257.  
  258. map[1][1]='S';
  259. map[1][2]='T';
  260. map[1][3]='A';
  261. map[1][4]='G';
  262. map[1][5]='E';
  263. map[1][7]='2';
  264. map[8][20]='#';
  265. map[19][70]='#';
  266. map[13][61]='#';
  267. map[3][60]='#';
  268. map[16][37]='#';
  269. map[9][47]='#';
  270. map[15][31]='#';
  271. map[9][27]='#';
  272. map[16][18]='#';
  273. map[13][5]='#';
  274. map[4][7]='#';
  275.  
  276. for (i=1;i<M-1;i++)
  277. map[0][i]=205;
  278. for (i=1;i<N-1;i++)
  279. map[i][0]=186;
  280. for (i=1;i<M-1;i++)
  281. map[N-1][i]=205;
  282.  
  283. for (i=1;i<N-1;i++)
  284. map[i][M-1]=186;
  285.  
  286.  
  287. map[2][0]=204;
  288. map[2][9]=188;
  289. map[1][9]=186;
  290. map[0][9]=203;
  291. for (i=1;i<9;i++)
  292. map[2][i]=205;
  293.  
  294.  
  295. for (i=4;i<15;i++)
  296. {
  297. map[i][10]=178;
  298. map[i][11]=178;
  299. map[i][12]=178;
  300.  
  301. }
  302.  
  303. for (t=8;t<11;t++)
  304. for (i=10;i<18;i++)
  305. {
  306. map[t][i]=178;
  307. }
  308.  
  309. for (t=22;t<57;t++)
  310. for (i=3;i<5;i++)
  311. map[i][t]=178;
  312.  
  313. for (i=4;i<9;i++)
  314. for (t=36;t<41;t++)
  315. map[i][t]=178;
  316.  
  317. for (i=4;i<15;i++)
  318. {
  319. map[i][68]=178;
  320. map[i][69]=178;
  321. map[i][70]=178;
  322. }
  323.  
  324.  
  325. for (i=8;i<11;i++)
  326. for (t=63;t<68;t++)
  327. map[i][t]=178;
  328.  
  329.  
  330. for (i=13;i<20;i++)
  331. {
  332. map[i][22]=178;
  333. map[i][23]=178;
  334. }
  335.  
  336. for (i=13;i<20;i++)
  337. {
  338. map[i][54]=178;
  339. map[i][55]=178;
  340. }
  341.  
  342. for (i=22;i<56;i++)
  343. {
  344. map[19][i]=178;
  345. map[18][i]=178;
  346. }
  347.  
  348. for (i=22;i<31;i++)
  349. map[12][i]=178;
  350.  
  351. for (i=46;i<56;i++)
  352. map[12][i]=178;
  353.  
  354.  
  355. map[21][75]= 0;
  356. map[0][10]=176;
  357. map[0][11]=176;
  358.  
  359. map[X][Y]=player;
  360. for (i=0;i<N;i++)
  361. {
  362. for (j=0;j<M;j++)
  363. {
  364.  
  365. printf("%c",map[i][j]);
  366.  
  367. }
  368. printf("\n");
  369. }
  370.  
  371. char move = getch();
  372.  
  373. switch (move)
  374. {
  375. case 'S':
  376. case 's':
  377.  
  378. {
  379. if (X+1 == 21 && Y == 75 )
  380. {
  381. break;
  382. }
  383. if (map[X+1][Y]=='#')
  384. {
  385. fight();
  386. break;
  387. }
  388. if (map[X+1][Y]!= (char)205 && map [X+1][Y]!=(char)178)
  389.  
  390. {
  391. X++;
  392. break;
  393. }
  394.  
  395.  
  396. break;
  397.  
  398. }
  399.  
  400. case 'W':
  401. case 'w':
  402.  
  403. {
  404. if (map[X-1][Y] == (char) 176)
  405. {
  406. stage = 1;
  407. break;
  408. }
  409. if (map[X-1][Y] == '#')
  410. {
  411. fight();
  412. break;
  413. }
  414. if (map[X-1][Y]!= (char)205 && map [X-1][Y]!=(char)178 && map[X-1][Y]!=(char)188)
  415.  
  416. {
  417. X--;
  418. break;
  419. }
  420.  
  421. break;
  422.  
  423. }
  424. case 'A':
  425. case 'a':
  426.  
  427. {
  428. if (map[X][Y-1] == '#')
  429. {
  430. fight();
  431. break;
  432. }
  433. if (map[X][Y-1]!= (char)205 && map [X][Y-1]!=(char)178 && map[X][Y-1]!=(char)188 && map[X][Y-1]!=(char)186)
  434. {
  435. Y--;
  436. break;
  437. }
  438. break;
  439. }
  440. case 'D':
  441. case 'd':
  442.  
  443. {
  444.  
  445. if (map[X][Y+1] == '#')
  446. {
  447. fight();
  448. break;
  449. }
  450. if (map[X][Y+1]!= (char)205 && map [X][Y+1]!=(char)178 && map[X][Y+1]!=(char)186)
  451. {
  452. Y++;
  453. break;
  454. }
  455. break;
  456. }
  457. }
  458. }while(stage==0);
  459. return 0;
  460. }
  461.  
  462. int thirdStage()
  463. {
  464. char player = 2;
  465. int i,j;
  466. int stage=0;
  467. BossHp=15000;
  468. X=1;
  469. Y=11;
  470. do
  471. {
  472. system("cls");
  473.  
  474. for (i=0;i<N;i++)
  475. {
  476. for (j=0;j<M;j++)
  477. {
  478. map[i][j]=0;
  479. }
  480. }
  481.  
  482. map[0][0]=201;
  483. map[0][M-1]=187;
  484. map[N-1][0]=200;
  485. map[N-1][M-1]=188;
  486.  
  487. map[1][1]='S';
  488. map[1][2]='T';
  489. map[1][3]='A';
  490. map[1][4]='G';
  491. map[1][5]='E';
  492. map[1][7]='3';
  493.  
  494. map[8][20]='#';
  495. map[2][17]='#';
  496. map[1][33]='#';
  497. map[3][66]='#';
  498. map[3][72]='#';
  499. map[8][20]='#';
  500. map[11][75]='#';
  501. map[11][62]='#';
  502. map[7][59]='#';
  503. map[12][47]='#';
  504. map[8][20]='#';
  505. map[15][40]='#';
  506. map[12][34]='#';
  507. map[9][29]='#';
  508. map[5][18]='#';
  509. map[4][16]='#';
  510. map[10][13]='#';
  511. map[10][3]='#';
  512. map[19][4]='#';
  513. map[20][26]='#';
  514. map[18][13]='#';
  515. map[19][46]='#';
  516. map[8][20]='#';
  517. map[20][60]='#';
  518. map[18][70]='#';
  519. map[18][75]='#';
  520. for (i=1;i<M-1;i++)
  521. map[0][i]=205;
  522. for (i=1;i<N-1;i++)
  523. map[i][0]=186;
  524. for (i=1;i<M-1;i++)
  525. map[N-1][i]=205;
  526.  
  527. for (i=1;i<N-1;i++)
  528. map[i][M-1]=186;
  529.  
  530.  
  531. map[2][0]=204;
  532. map[2][9]=188;
  533. map[1][9]=186;
  534. map[0][9]=203;
  535.  
  536. for (i=1;i<9;i++)
  537. map[2][i]=205;
  538.  
  539. for (i=2;i<14;i++)
  540. map[6][i]=178;
  541.  
  542. map[5][13]=178;
  543.  
  544. for (t=5;t<11;t++)
  545. for (i=9;i<13;i++)
  546. map[i][t]=178;
  547.  
  548.  
  549. for (t=68;t<74;t++)
  550. for (i=9;i<13;i++)
  551. map[i][t]=178;
  552.  
  553.  
  554. for (i=13;i<66;i++)
  555. map[4][i]=178;
  556.  
  557. map[5][65]=178;
  558.  
  559. for (i=65;i<77;i++)
  560. map[6][i]=178;
  561.  
  562. for (i=2;i<14;i++)
  563. map[15][i]=178;
  564. map[16][13]=178;
  565. map[17][13]=178;
  566.  
  567. for (i=13;i<66;i++)
  568. map[17][i]=178;
  569. map[16][65]=178;
  570. map[15][65]=178;
  571.  
  572. for (i=65;i<77;i++)
  573. map[15][i]=178;
  574.  
  575. map[13][23]=178;
  576. map[12][22]=178;
  577. map[11][21]=178;
  578. map[10][20]=178;
  579. map[9][21]=178;
  580. map[8][22]=178;
  581. map[7][23]=178;
  582.  
  583. map[8][24]=178;
  584. map[9][25]=178;
  585. map[10][26]=178;
  586. map[11][25]=178;
  587. map[12][24]=178;
  588. map[13][23]=178;
  589.  
  590.  
  591. map[10][21]='F';
  592. map[10][22]='I';
  593. map[10][23]='N';
  594. map[10][24]='A';
  595. map[10][25]='L';
  596.  
  597.  
  598. map[13][38]=178;
  599. map[12][37]=178;
  600. map[11][36]=178;
  601. map[10][35]=178;
  602. map[9][36]=178;
  603. map[8][37]=178;
  604. map[7][38]=178;
  605.  
  606. map[10][36]='F';
  607. map[10][37]='I';
  608. map[10][38]='N';
  609. map[10][39]='A';
  610. map[10][40]='L';
  611.  
  612. map[8][39]=178;
  613. map[9][40]=178;
  614. map[10][41]=178;
  615. map[11][40]=178;
  616. map[12][39]=178;
  617. map[13][38]=178;
  618.  
  619.  
  620.  
  621.  
  622. map[13][53]=178;
  623. map[12][52]=178;
  624. map[11][51]=178;
  625. map[10][50]=178;
  626. map[9][51]=178;
  627. map[8][52]=178;
  628. map[7][53]=178;
  629.  
  630.  
  631. map[10][51]='F';
  632. map[10][52]='I';
  633. map[10][53]='N';
  634. map[10][54]='A';
  635. map[10][55]='L';
  636.  
  637.  
  638. map[8][54]=178;
  639. map[9][55]=178;
  640. map[10][56]=178;
  641. map[11][55]=178;
  642. map[12][54]=178;
  643. map[13][53]=178;
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652. map[21][76]= 176;
  653. map[21][75]= 176;
  654.  
  655. map[0][11]=0;
  656. map[4][2]='#';
  657. map[X][Y]=player;
  658. for (i=0;i<N;i++)
  659. {
  660. for (j=0;j<M;j++)
  661. {
  662.  
  663. printf("%c",map[i][j]);
  664.  
  665. }
  666. printf("\n");
  667. }
  668.  
  669. char move = getch();
  670.  
  671. switch (move)
  672. {
  673. case 'S':
  674. case 's':
  675. {
  676. if (map[X+1][Y] == (char)188 || map[X+1][Y] == (char)178 || map[X+1][Y] == (char)205)
  677. break;
  678. if (map[X+1][Y] == '#')
  679. {
  680. fight();
  681. break;
  682. }
  683. if (map[X+1][Y] == (char) 176)
  684. {
  685. stage = 1;
  686. break;
  687. }
  688. X++;
  689. break;
  690.  
  691. }
  692. case 'W':
  693. case 'w':
  694.  
  695. {
  696. if (X-1 == 0 && Y == 11 || map[X-1][Y] == (char)188 || map[X-1][Y] == (char)205 || map[X-1][Y] == (char)178)
  697. break;
  698.  
  699. if (map[X-1][Y] == '#')
  700. {
  701. fight();
  702. break;
  703. }
  704.  
  705. X--;
  706. break;
  707. }
  708. case 'A':
  709. case 'a':
  710. {
  711. if (map[X][Y-1] == (char) 178 || map[X][Y-1] == (char) 188 || map[X][Y-1] == (char) 186)
  712. break;
  713. if (map[X][Y-1] == '#')
  714. {
  715. fight();
  716. break;
  717. }
  718. Y--;
  719. break;
  720. }
  721. case 'D':
  722. case 'd':
  723.  
  724. {
  725. if (map[X][Y+1] == (char) 178 || map[X][Y+1] == (char) 186)
  726. break;
  727.  
  728. if (map[X][Y+1] == '#')
  729. {
  730. fight();
  731. break;
  732. }
  733. Y++;
  734. break;
  735. }
  736. }
  737. }while(stage==0);
  738.  
  739. finish();
  740. return 0;
  741. }
  742.  
  743. int fight()
  744. {
  745. int Q=10,W=26;
  746. char fightroom[Q][W];
  747. int i,j;
  748.  
  749. int round =1;
  750. int u,alive=0;
  751. int damage=0;
  752. PlayerHp=10000;
  753. BossHp=10000;
  754.  
  755.  
  756. //rand();
  757. srand(time(NULL));
  758.  
  759. for (i=0;i<Q;i++)
  760. for (j=0;j<W;j++)
  761. fightroom[i][j]=0;
  762.  
  763. if (auto_manual ==1)
  764. {
  765. u=5;
  766. do
  767. {
  768. system("cls");
  769.  
  770. fightroom[4][5]=player;
  771. fightroom[4][21]=boss;
  772. fightroom[0][0]=201;
  773. fightroom[0][W-1]=187;
  774. fightroom[Q-1][0]=200;
  775. fightroom[Q-1][W-1]=188;
  776.  
  777. for (i=1;i<W-1;i++)
  778. fightroom[0][i]=205;
  779. for (i=1;i<Q-1;i++)
  780. fightroom[i][0]=186;
  781. for (i=1;i<W-1;i++)
  782. fightroom[Q-1][i]=205;
  783. for (i=1;i<Q-1;i++)
  784. fightroom[i][W-1]=186;
  785.  
  786. printf("Round: %d",round);
  787. printf("\n\t\t\tPlayer\t\t Boss");
  788. printf("\n\n\t\t\t%d\t\t %d",PlayerHp,BossHp);
  789. printf("\n");
  790. printf("\n\t\t\t");
  791. for (i=0;i<Q;i++)
  792. {
  793. for (j=0;j<W;j++)
  794. {
  795. printf("\%c",fightroom[i][j]);
  796. }
  797. printf("\n\t\t\t");
  798. }
  799. printf("\n\t\t The fight will be start in %d seconds!",u);
  800. sleep(1);
  801. u--;
  802. }while (u>0);
  803. }
  804.  
  805. do
  806. {
  807. if (auto_manual ==1)
  808. sleep(1);
  809. system("cls");
  810.  
  811. fightroom[4][5]=player;
  812. fightroom[4][21]=boss;
  813. fightroom[0][0]=201;
  814. fightroom[0][W-1]=187;
  815. fightroom[Q-1][0]=200;
  816. fightroom[Q-1][W-1]=188;
  817.  
  818. for (i=1;i<W-1;i++)
  819. fightroom[0][i]=205;
  820. for (i=1;i<Q-1;i++)
  821. fightroom[i][0]=186;
  822. for (i=1;i<W-1;i++)
  823. fightroom[Q-1][i]=205;
  824. for (i=1;i<Q-1;i++)
  825. fightroom[i][W-1]=186;
  826.  
  827. printf("Round: %d",round);
  828. printf("\n\t\t\tPlayer\t\t Boss");
  829. printf("\n\n\t\t\t%d\t\t %d",PlayerHp,BossHp);
  830. printf("\n");
  831. printf("\n\t\t\t");
  832. for (i=0;i<Q;i++)
  833. {
  834. for (j=0;j<W;j++)
  835. {
  836. printf("\%c",fightroom[i][j]);
  837. }
  838. printf("\n\t\t\t");
  839. }
  840. printf("\n\n\n\n\n\n\n\t\t Press any key to attack or 'E' to exit...");
  841. if (auto_manual!=1)
  842. {
  843. char move = getch();
  844. if (move=='E'||move=='e')
  845. {
  846. alive=0;
  847. break;
  848. }
  849. }
  850.  
  851.  
  852. system("cls");
  853. //player ATTACK
  854. damage = rand()/10;
  855. BossHp -= damage;
  856.  
  857. if (BossHp <= 0 )
  858. {
  859. BossHp=0;
  860.  
  861. }
  862.  
  863. fightroom[4][5]=0;
  864. fightroom[4][20]=player;
  865. fightroom[4][6]=0;
  866. fightroom[4][21]=boss;
  867. fightroom[0][0]=201;
  868. fightroom[0][W-1]=187;
  869. fightroom[Q-1][0]=200;
  870. fightroom[Q-1][W-1]=188;
  871.  
  872. for (i=1;i<W-1;i++)
  873. fightroom[0][i]=205;
  874. for (i=1;i<Q-1;i++)
  875. fightroom[i][0]=186;
  876. for (i=1;i<W-1;i++)
  877. fightroom[Q-1][i]=205;
  878. for (i=1;i<Q-1;i++)
  879. fightroom[i][W-1]=186;
  880.  
  881. printf("Round: %d",round);
  882. printf("\n\t\t\tPlayer\t\t Boss");
  883. printf("\n\n\t\t\t%d\t\t %d",PlayerHp,BossHp);
  884. printf("\n");
  885. printf("\n\t\t\t");
  886. for (i=0;i<Q;i++)
  887. {
  888. for (j=0;j<W;j++)
  889. {
  890. printf("\%c",fightroom[i][j]);
  891. }
  892. printf("\n\t\t\t");
  893. }
  894.  
  895. if (damage > 2700)
  896. {
  897. printf("\n\t\t\t\tCritical Hit!");
  898. }
  899. else if (damage < 600)
  900. {
  901. printf("\n\t\t\t\tBlock Shield!");
  902. }
  903. else
  904. printf("\n");
  905. printf("\n\t\t\t You hit for %d damage!",damage);
  906.  
  907.  
  908. sleep(1);
  909.  
  910.  
  911. system("cls");
  912. fightroom[4][5]=player;
  913. fightroom[4][20]=0;
  914. fightroom[4][6]=0;
  915. fightroom[4][21]=boss;
  916. fightroom[0][0]=201;
  917. fightroom[0][W-1]=187;
  918. fightroom[Q-1][0]=200;
  919. fightroom[Q-1][W-1]=188;
  920.  
  921. for (i=1;i<W-1;i++)
  922. fightroom[0][i]=205;
  923. for (i=1;i<Q-1;i++)
  924. fightroom[i][0]=186;
  925. for (i=1;i<W-1;i++)
  926. fightroom[Q-1][i]=205;
  927. for (i=1;i<Q-1;i++)
  928. fightroom[i][W-1]=186;
  929.  
  930. printf("Round: %d",round);
  931. printf("\n\t\t\tPlayer\t\t Boss");
  932. printf("\n\n\t\t\t%d\t\t %d",PlayerHp,BossHp);
  933. printf("\n");
  934. printf("\n\t\t\t");
  935. for (i=0;i<Q;i++)
  936. {
  937. for (j=0;j<W;j++)
  938. {
  939. printf("\%c",fightroom[i][j]);
  940. }
  941. printf("\n\t\t\t");
  942. }
  943.  
  944. if (damage > 2700)
  945. {
  946. printf("\n\t\t\t\tCritical Hit!");
  947. }
  948. else if (damage < 600)
  949. {
  950. printf("\n\t\t\t\tBlock Shield!");
  951. }
  952. else
  953. printf("\n");
  954. printf("\n\t\t\t You hit for %d damage!",damage);
  955.  
  956.  
  957. //BOSS ATTACK
  958. sleep(1);
  959.  
  960. if (BossHp==0)
  961. {
  962. alive = 1;
  963. break;
  964. }
  965.  
  966. system("cls");
  967.  
  968. damage = rand()/10;
  969. PlayerHp -= damage;
  970.  
  971. if (PlayerHp <= 0 )
  972. {
  973. PlayerHp=0;
  974.  
  975. }
  976. fightroom[4][5]=player;
  977. fightroom[4][20]=0;
  978. fightroom[4][21]=0;
  979. fightroom[4][6]=boss;
  980. fightroom[0][0]=201;
  981. fightroom[0][W-1]=187;
  982. fightroom[Q-1][0]=200;
  983. fightroom[Q-1][W-1]=188;
  984.  
  985. for (i=1;i<W-1;i++)
  986. fightroom[0][i]=205;
  987. for (i=1;i<Q-1;i++)
  988. fightroom[i][0]=186;
  989. for (i=1;i<W-1;i++)
  990. fightroom[Q-1][i]=205;
  991. for (i=1;i<Q-1;i++)
  992. fightroom[i][W-1]=186;
  993.  
  994. printf("Round: %d",round);
  995. printf("\n\t\t\tPlayer\t\t Boss");
  996. printf("\n\n\t\t\t%d\t\t %d",PlayerHp,BossHp);
  997. printf("\n");
  998. printf("\n\t\t\t");
  999. for (i=0;i<Q;i++)
  1000. {
  1001. for (j=0;j<W;j++)
  1002. {
  1003. printf("\%c",fightroom[i][j]);
  1004. }
  1005. printf("\n\t\t\t");
  1006. }
  1007. if (damage > 2700)
  1008. {
  1009. printf("\n\t\t\t\tCritical Hit!");
  1010. }
  1011. else if (damage < 600)
  1012. {
  1013. printf("\n\t\t\t\tBlock Shield!");
  1014. }
  1015. else
  1016. printf("\n");
  1017. printf("\n\t\t\tBoss hit you for %d damage!",damage);
  1018.  
  1019.  
  1020. sleep(1);
  1021.  
  1022.  
  1023. system("cls");
  1024. round++;
  1025. fightroom[4][5]=player;
  1026. fightroom[4][20]=0;
  1027. fightroom[4][21]=boss;
  1028. fightroom[4][6]=0;
  1029. fightroom[0][0]=201;
  1030. fightroom[0][W-1]=187;
  1031. fightroom[Q-1][0]=200;
  1032. fightroom[Q-1][W-1]=188;
  1033.  
  1034. for (i=1;i<W-1;i++)
  1035. fightroom[0][i]=205;
  1036. for (i=1;i<Q-1;i++)
  1037. fightroom[i][0]=186;
  1038. for (i=1;i<W-1;i++)
  1039. fightroom[Q-1][i]=205;
  1040. for (i=1;i<Q-1;i++)
  1041. fightroom[i][W-1]=186;
  1042.  
  1043. printf("Round: %d",round);
  1044. printf("\n\t\t\tPlayer\t\t Boss");
  1045. printf("\n\n\t\t\t%d\t\t %d",PlayerHp,BossHp);
  1046. printf("\n");
  1047. printf("\n\t\t\t");
  1048. for (i=0;i<Q;i++)
  1049. {
  1050. for (j=0;j<W;j++)
  1051. {
  1052. printf("\%c",fightroom[i][j]);
  1053. }
  1054. printf("\n\t\t\t");
  1055. }
  1056.  
  1057. if (damage > 2700)
  1058. {
  1059. printf("\n\t\t\t\tCritical Hit!");
  1060. }
  1061. else if (damage < 600)
  1062. {
  1063. printf("\n\t\t\t\tBlock Shield!");
  1064. }
  1065. else
  1066. printf("\n");
  1067. printf("\n\t\t\tBoss hit you for %d damage!",damage);
  1068.  
  1069. if (PlayerHp<=0)
  1070. {
  1071. alive = 2;
  1072. break;
  1073. }
  1074.  
  1075.  
  1076. }while (alive == 0);
  1077.  
  1078. if (alive == 1)
  1079. {
  1080. system("cls");
  1081. printf("Nice you won! Go ahead now!");
  1082. printf("\n\n\n\tYou will be moved in the map in 3 seconds!");
  1083.  
  1084. sleep(3);
  1085. }
  1086. else
  1087. {
  1088. system("cls");
  1089. printf("Oh... You lost!");
  1090. printf("\n\n\n\tYou will be moved in the map in 3 seconds!");
  1091. sleep(3);
  1092. }
  1093.  
  1094. }
  1095.  
  1096. void start()
  1097. {
  1098. do
  1099. {
  1100. system("cls");
  1101.  
  1102.  
  1103.  
  1104. printf("\n\n\n\t\t\t\t %c\n\n\t\t\t\t %c\n\n\n\t\t\t ",24,25);
  1105. if (t==1)
  1106. {
  1107.  
  1108. printf("-> Start <-\n\n\t\t\t\t");
  1109. printf(" Settings \n\n\t\t\t");
  1110. printf(" How to play ");
  1111. }
  1112. else if (t==2)
  1113. {
  1114.  
  1115. printf(" Start\n\n\t\t\t");
  1116. printf(" -> Settings <-\n\n\t\t\t");
  1117. printf(" How to play ");
  1118. }
  1119.  
  1120. else if (t==3)
  1121. {
  1122.  
  1123. printf(" Start\n\n\t\t\t");
  1124. printf(" Settings \n\n\t\t\t");
  1125. printf(" -> How to play <-");
  1126. }
  1127. char move = getch();
  1128.  
  1129.  
  1130. if (move == 72 && t!=1)//up
  1131. t--;
  1132.  
  1133. if (move == 80 && t!=3)//down
  1134. t++;
  1135.  
  1136. if (move == 13 && t == 2)//enter
  1137. settings();
  1138.  
  1139. if (move == 13 && t==1 )
  1140. {
  1141. t=0;
  1142. }
  1143.  
  1144. if (move == 13 && t==3 )
  1145. {
  1146. HowTo();
  1147. }
  1148.  
  1149. }while (t!=0);
  1150. }
  1151. void settings()
  1152. {
  1153. char move;
  1154. do
  1155. {
  1156. system("cls");
  1157. printf("\n\n\n\n\n\n\n\n\t\t ");
  1158. if (s==1)
  1159. {
  1160. printf("Automatic boss fights : [Auto] Manual");
  1161. }
  1162. else if (s==2)
  1163. {
  1164. printf("Automatic boss fights : Auto [Manual]");
  1165.  
  1166. }
  1167.  
  1168. move = getch();
  1169.  
  1170. if (move == 75 && s==2)//left
  1171. s=1;
  1172. else if (move == 77 && s==1)//right
  1173. s=2;
  1174. if (move == 13 && s==1)
  1175. {
  1176. auto_manual=1;
  1177. break;
  1178. }
  1179.  
  1180. if (move == 13 && s==2)
  1181. {
  1182. auto_manual=2;
  1183. break;
  1184. }
  1185.  
  1186.  
  1187. }while (t!=0);
  1188. }
  1189. void HowTo()
  1190. {
  1191. system("cls");
  1192.  
  1193. printf("\tWhen the game start you can move by the 'W' , 'S' , 'A' , 'D' keys\n");
  1194. printf("\t\t\tto go Up , Down , Left , Right.\n");
  1195. printf("\tYou have to go in the finish door to complete the current stage,\n");
  1196. printf("\t take care about the bosses that are arround in the map.\n");
  1197. printf("\t\tIf your move is on the boss you will fight!\n");
  1198. printf("\tAt settings you can choose about the fight mode ( Manual or Auto ).\n\t\t\t Suggested option Auto.\n");
  1199. printf("\n\n\t\t\t\tGood Luck!");
  1200. getch();
  1201. }
  1202.  
  1203. void finish()
  1204. {
  1205. printf("\n\n\n\n\n\n\n\n\t\t\tWell Played! You finished the game!\n\n\n\n\n\t\t\t\tPress any key ...");
  1206. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement