diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 29c26cd..c106b98 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -268,10 +268,16 @@ switch ($_POST['act']){ 'target' => $x.",".$y, 'result' => $result ); + if(count( $_SESSION['strikes'][$currentPlayer]) < 10){ + $continue=1; + }else{ + $continue=0; + } echo json_encode(array( 'opponent'=> $opponent, 'target' => $x.",".$y, - 'log' => $currentBot['name']."tire en ".$x.",".$y." ".$result + 'log' => $currentBot['name']."tire en ".$x.",".$y." ".$result, + 'continue' => $continue )); die; diff --git a/src/arenas/Battleship/js.js b/src/arenas/Battleship/js.js index 7f0f8ff..679ff4d 100644 --- a/src/arenas/Battleship/js.js +++ b/src/arenas/Battleship/js.js @@ -36,7 +36,10 @@ function fight(xd_check){ var p=createElem("p"); p.innerHTML=strike['log']; document.getElementById('logs').appendChild(p); - //fight(xd_check); + + if( strike['continue'] == 1){ + fight(xd_check); + } }