} elseif ($this_action == 'restart') { // Redirect the user back to the prototype screen $this_redirect = 'battle.php?' . ($flag_wap ? 'wap=true' : 'wap=false') . '&this_battle_id=' . $this_battle_id . '&this_battle_token=' . $this_battle_token . '&this_field_id=' . $this_field_id . '&this_field_token=' . $this_field_token . '&this_player_id=' . $this_player_id . '&this_player_token=' . $this_player_token . '&this_player_robots=' . $this_player_robots . '&target_player_id=' . $target_player_id . '&target_player_token=' . $target_player_token . '&target_player_robots=' . $target_player_robots . ''; // Automatically empty all temporary battle variables $_SESSION['BATTLES'] = array(); $_SESSION['FIELDS'] = array(); $_SESSION['PLAYERS'] = array(); $_SESSION['ROBOTS'] = array(); $_SESSION['ABILITIES'] = array(); } elseif ($this_action == 'start') { //header('Content-type: text/plain'); //echo('action start'.PHP_EOL); // Define the battle's turn counter and start at 0 $this_battle->set_counter('battle_turn', 0); //echo 'battle_turn = '.$this_battle->get_counter('battle_turn').PHP_EOL; $this_battle->increase_counter('battle_turn', 1); //echo 'battle_turn = '.$this_battle->get_counter('battle_turn').PHP_EOL; //exit('action end'.PHP_EOL); // Collect the base point and zenny rewards for this battle $target_turns_base = !empty($this_battle->battle_turns_limit) ? $this_battle->battle_turns_limit : 0; $target_robots_base = !empty($this_battle->battle_robots_limit) ? $this_battle->battle_robots_limit : 0; $reward_points_base = !empty($this_battle->battle_rewards_points) ? number_format($this_battle->battle_rewards_points, 0, '.', ',') : 0; $reward_zenny_base = !empty($this_battle->battle_rewards_zenny) ? number_format($this_battle->battle_rewards_zenny, 0, '.', ',') : 0; // Define the first event body markup, regardless of player type $first_event_header = $this_battle->get_name() . ' <span class="pipe">|</span> ' . $this_field->get_name(); $first_event_body = $this_battle->get_description() . '<br />'; $first_event_body .= 'Target : ' . ($this_battle->battle_turns_limit == 1 ? '1 Turn' : $target_turns_base . ' Turns') . ' with ' . ($this_battle->battle_robots_limit == 1 ? '1 Robot' : $target_robots_base . ' Robots'); $first_event_body .= ' <span class="pipe">|</span> '; $first_event_body .= 'Reward : ' . ($this_battle->battle_rewards_points == 1 ? '1 Point' : $reward_points_base . ' Points') . ' and ' . ($this_battle->battle_rewards_zenny == 1 ? '1 Zenny' : $reward_zenny_base . ' Zenny'); $first_event_body .= ' <br /> '; // Update the summon counts for all this player's robots