Exemplo n.º 1
0
 // Load the player objects from the battle
 $this_player = $this_battle->get_player($this_player_id);
 $target_player = $this_battle->get_player($target_player_id);
 //echo '<pre>$this_player->export_array() = '."\n".print_r($this_player->export_array(), true).'</pre>'."\n";
 //echo '<pre>$target_player->export_array() = '."\n".print_r($target_player->export_array(), true).'</pre>'."\n";
 // Break apart and filter this player's robots, adding to player and battle
 $this_player_robots_strings = strstr($this_player_robots, ',') ? explode(',', $this_player_robots) : array($this_player_robots);
 foreach ($this_player_robots_strings as $temp_key => $temp_string) {
     // Break apart the string into robot ID and token
     list($temp_id, $temp_token) = explode('_', $temp_string);
     // Define the basic lookup array for this robot
     $temp_robotinfo = array('robot_id' => $temp_id, 'robot_token' => $temp_token);
     // Collect rewards and settings for human-controller robots
     $temp_robotinfo['robot_level'] = rpg_game::robot_level($this_player_token, $temp_token);
     $temp_robotinfo['robot_experience'] = rpg_game::robot_experience($this_player_token, $temp_token);
     $temp_robotinfo['robot_abilities'] = rpg_game::robot_settings_abilities($this_player_token, $temp_token);
     // If preset info exists, merge it with the lookup array
     if (isset($this_preset_robots[$temp_key])) {
         $temp_robotinfo = array_merge($this_preset_robots[$temp_key], $temp_robotinfo);
     }
     // Add this robot to the player to index and apply stat bonuses
     $this_player->add_robot($temp_robotinfo, $temp_key, true);
 }
 // Update this player's count and other stat variables
 $this_player->update_session();
 // Break apart and filter the target player's robots, adding to player and battle
 $target_player_robots_strings = strstr($target_player_robots, ',') ? explode(',', $target_player_robots) : array($target_player_robots);
 foreach ($target_player_robots_strings as $temp_key => $temp_string) {
     // Break apart the string into robot ID and token
     list($temp_id, $temp_token) = explode('_', $temp_string);
     // Define the basic lookup array for this robot