Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL ^ E_NOTICE);
- $heal = 0;
- $damage = 0;
- $op = $_GET["op"];
- $link = $_GET["link"];
- $type = $_GET["type"];
- $turn = $_GET["turn"];
- $health1 = $_GET["health1"];
- $health2 = $_GET["health2"];
- if($turn == ""){
- echo "Player 1 eile";
- $health1 = 100;
- $health2 = 100;
- $turn=2;
- }else{
- echo "Player $turn eile";
- }
- if (!$link){
- $arr = array (
- ) ;
- for($i = 0; $i < 10; $i++){
- $random = rand(0,5);
- switch ($random){
- case 0:
- $arr[$i] = "c1";
- break;
- case 1:
- $arr[$i] = "c2";
- break;
- case 2:
- $arr[$i] = "c3";
- break;
- case 3:
- $arr[$i] = "c4";
- break;
- case 4:
- $arr[$i] = "c5";
- break;
- case 5:
- $arr[$i] = "c6";
- break;
- }
- }
- }else {
- $arr = explode (",", $link ); array_pop ($arr);
- }
- $count = count ($arr) ;
- switch ($op){
- case 1:
- if ($count > 1 ){
- if($arr[0] == "c1"){
- $heal = 15;
- }elseif($arr[0] == "c2"){
- $damage = 10;
- }elseif($arr[0]== "c3"){
- $damage = 15;
- }elseif($arr[0]== "c4"){
- $damage = 20;
- }elseif($arr[0]== "c5"){
- $damage = 25;
- }elseif($arr[0]== "c6"){
- $damage = 40;
- }
- array_shift($arr);
- if( $turn == 1 && $heal == 0) {
- $health1 = $health1 - $damage;
- $turn = 2;
- }elseif($turn == 2 && $heal == 0){
- $health2 = $health2 - $damage;
- $turn = 1;
- }elseif($turn == 1 && $heal != 0){
- $health2 = $health2 + $heal;
- $heal = 0;
- $turn = 2;
- }elseif($turn == 2 && $heal != 0){
- $health1 = $health1 + $heal;
- $heal = 0;
- $turn = 1;
- }
- }
- break;
- case 3:
- if ($count > 1 ){
- if($arr[($count - 1)] == "c1"){
- $heal = 15;
- }elseif($arr[($count - 1)] == "c2"){
- $damage = 10;
- }elseif($arr[($count - 1)]== "c3"){
- $damage = 15;
- }elseif($arr[($count - 1)]== "c4"){
- $damage = 20;
- }elseif($arr[($count - 1)]== "c5"){
- $damage = 25;
- }elseif($arr[($count - 1)]== "c6"){
- $damage = 40;
- }
- array_pop($arr);
- if( $turn == 1 && $heal == 0) {
- $health1 = $health1 - $damage;
- $turn = 2;
- }elseif($turn == 2 && $heal == 0){
- $health2 = $health2 - $damage;
- $turn = 1;
- }elseif($turn == 1 && $heal != 0){
- $health2 = $health2 + $heal;
- $heal = 0;
- $turn = 2;
- }elseif($turn == 2 && $heal != 0){
- $health1 = $health1 + $heal;
- $heal = 0;
- $turn = 1;
- }
- }
- break;
- default:
- }
- unset ($link);
- foreach ($arr as $k => $v){
- $link .= "$v,";
- }
- $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");
- $content .= "<table align = \"center\" ><tr>" ;
- foreach ($arr as $k => $v){
- $content .= "<td><img src = \"{$arrPic[$v]}\" width = \"50\" /></td>";
- }
- $content .= "</tr></table>" ;
- $menu = "
- <table width = \"500\" align = \"center\" ><tr>
- <td>
- <a href = \"?op=1&turn=$turn&health1=$health1&health2=$health2&link=$link\" ><font color = \"red\">NUIMTI IS PRIEKIO</font></a><br /><br />
- </td>
- <td>
- <a href = \"?op=3&turn=$turn&health1=$health1&health2=$health2&link=$link\" ><font color = \"red\">NUIMTI IS GALO</a></font><br /><br />
- </td></tr></table>
- <br />";
- if(count($arr)==1 || $health1 <= 0 || $health2 <= 0){
- if($health1 <= 0){
- echo "</br>PLAYER 2 WON!";
- }elseif($health2 <= 0){
- echo "</br>PLAYER 1 WON!";
- }
- echo "</br><a href = \"?\" ><font color = \"green\">IS NAUJO</a><br />";
- }
- print "<div align = \"center\" >$menu<br/><br/><br/><br/>$content</div>";
- echo "<color:\"white\">PLAYER 1 HEALTH = $health1</br></color>";
- echo "PLAYER 2 HEALTH = $health2</br>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement