Advertisement
Guest User

etoeto

a guest
Nov 30th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. error_reporting(E_ALL ^ E_NOTICE);
  5. $heal = 0;
  6. $damage = 0;
  7. $op = $_GET["op"];
  8. $link = $_GET["link"];
  9. $type = $_GET["type"];
  10. $turn = $_GET["turn"];
  11. $health1 = $_GET["health1"];
  12. $health2 = $_GET["health2"];
  13.  
  14. if($turn == ""){
  15. echo "Player 1 eile";
  16. $health1 = 100;
  17. $health2 = 100;
  18. $turn=2;
  19. }else{
  20. echo "Player $turn eile";
  21. }
  22.  
  23. if (!$link){
  24.  
  25. $arr = array (
  26.  
  27. ) ;
  28.  
  29. for($i = 0; $i < 10; $i++){
  30.  
  31. $random = rand(0,5);
  32. switch ($random){
  33.  
  34. case 0:
  35. $arr[$i] = "c1";
  36. break;
  37.  
  38. case 1:
  39. $arr[$i] = "c2";
  40. break;
  41.  
  42. case 2:
  43. $arr[$i] = "c3";
  44. break;
  45.  
  46. case 3:
  47. $arr[$i] = "c4";
  48. break;
  49.  
  50. case 4:
  51. $arr[$i] = "c5";
  52. break;
  53.  
  54. case 5:
  55. $arr[$i] = "c6";
  56. break;
  57.  
  58.  
  59. }
  60. }
  61. }else {
  62.  
  63. $arr = explode (",", $link ); array_pop ($arr);
  64.  
  65. }
  66.  
  67. $count = count ($arr) ;
  68.  
  69. switch ($op){
  70. case 1:
  71. if ($count > 1 ){
  72. if($arr[0] == "c1"){
  73. $heal = 15;
  74. }elseif($arr[0] == "c2"){
  75. $damage = 10;
  76. }elseif($arr[0]== "c3"){
  77. $damage = 15;
  78. }elseif($arr[0]== "c4"){
  79. $damage = 20;
  80. }elseif($arr[0]== "c5"){
  81. $damage = 25;
  82. }elseif($arr[0]== "c6"){
  83. $damage = 40;
  84. }
  85. array_shift($arr);
  86. if( $turn == 1 && $heal == 0) {
  87. $health1 = $health1 - $damage;
  88. $turn = 2;
  89. }elseif($turn == 2 && $heal == 0){
  90. $health2 = $health2 - $damage;
  91. $turn = 1;
  92. }elseif($turn == 1 && $heal != 0){
  93. $health2 = $health2 + $heal;
  94. $heal = 0;
  95. $turn = 2;
  96. }elseif($turn == 2 && $heal != 0){
  97. $health1 = $health1 + $heal;
  98. $heal = 0;
  99. $turn = 1;
  100. }
  101. }
  102. break;
  103.  
  104. case 3:
  105. if ($count > 1 ){
  106. if($arr[($count - 1)] == "c1"){
  107. $heal = 15;
  108. }elseif($arr[($count - 1)] == "c2"){
  109. $damage = 10;
  110. }elseif($arr[($count - 1)]== "c3"){
  111. $damage = 15;
  112. }elseif($arr[($count - 1)]== "c4"){
  113. $damage = 20;
  114. }elseif($arr[($count - 1)]== "c5"){
  115. $damage = 25;
  116. }elseif($arr[($count - 1)]== "c6"){
  117. $damage = 40;
  118. }
  119. array_pop($arr);
  120. if( $turn == 1 && $heal == 0) {
  121. $health1 = $health1 - $damage;
  122. $turn = 2;
  123. }elseif($turn == 2 && $heal == 0){
  124. $health2 = $health2 - $damage;
  125. $turn = 1;
  126. }elseif($turn == 1 && $heal != 0){
  127. $health2 = $health2 + $heal;
  128. $heal = 0;
  129. $turn = 2;
  130. }elseif($turn == 2 && $heal != 0){
  131. $health1 = $health1 + $heal;
  132. $heal = 0;
  133. $turn = 1;
  134. }
  135. }
  136. break;
  137. default:
  138.  
  139. }
  140.  
  141. unset ($link);
  142.  
  143. foreach ($arr as $k => $v){
  144.  
  145. $link .= "$v,";
  146.  
  147. }
  148.  
  149.  
  150. $arrPic = array ( "c1" => "c_1.png" , "c2" =>"c_2.png", "c3" => "c_3.png", "c4" => "c_4.png", "c5" => "c_5.png", "c6" => "c_6.png");
  151.  
  152.  
  153. $content .= "<table align = \"center\" ><tr>" ;
  154.  
  155. foreach ($arr as $k => $v){
  156.  
  157. $content .= "<td><img src = \"{$arrPic[$v]}\" width = \"50\" /></td>";
  158.  
  159. }
  160.  
  161. $content .= "</tr></table>" ;
  162.  
  163. $menu = "
  164.  
  165.  
  166.  
  167. <table width = \"500\" align = \"center\" ><tr>
  168. <td>
  169. <a href = \"?op=1&turn=$turn&health1=$health1&health2=$health2&link=$link\" ><font color = \"red\">NUIMTI IS PRIEKIO</font></a><br /><br />
  170. </td>
  171. <td>
  172. <a href = \"?op=3&turn=$turn&health1=$health1&health2=$health2&link=$link\" ><font color = \"red\">NUIMTI IS GALO</a></font><br /><br />
  173. </td></tr></table>
  174. <br />";
  175.  
  176. if(count($arr)==1 || $health1 <= 0 || $health2 <= 0){
  177. if($health1 <= 0){
  178. echo "</br>PLAYER 2 WON!";
  179. }elseif($health2 <= 0){
  180. echo "</br>PLAYER 1 WON!";
  181. }
  182. echo "</br><a href = \"?\" ><font color = \"green\">IS NAUJO</a><br />";
  183. }
  184.  
  185. print "<div align = \"center\" >$menu<br/><br/><br/><br/>$content</div>";
  186.  
  187. echo "<color:\"white\">PLAYER 1 HEALTH = $health1</br></color>";
  188. echo "PLAYER 2 HEALTH = $health2</br>";
  189.  
  190. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement