Beispiel #1
0
    $target_player = $this_battle->get_player($target_player_id);
    // Load the object data for this and the target robot from the battle
    $this_robot = $this_battle->get_robot($this_robot_id);
    $target_robot = $this_battle->get_robot($target_robot_id);
} elseif ($this_action == 'start') {
    // Collect the preset battle info from the index
    $this_preset_battle = rpg_battle::get_index_info($this_battleinfo['battle_token']);
    if (!empty($this_preset_battle)) {
        $this_battleinfo = array_replace($this_preset_battle, $this_battleinfo);
    }
    // Define the battle object using the loaded battle data and update session
    $this_battle = new rpg_battle($this_battleinfo);
    // Start the battle turn off at zero
    $this_battle->set_counter('battle_turn', 0);
    // Collect preset field info from the battle
    $this_preset_field = $this_battle->get_field_info();
    if (!empty($this_preset_field)) {
        $this_fieldinfo = array_replace($this_preset_field, $this_fieldinfo);
    }
    // Collect this player's preset info from the battle
    $this_preset_player = $this_battle->get_this_player();
    if (!empty($this_preset_player)) {
        $this_playerinfo = array_merge($this_preset_player, $this_playerinfo);
    }
    // Collect this player's preset robots from the battle
    $this_preset_robots = array();
    if (isset($this_playerinfo['player_robots'])) {
        $this_preset_robots = $this_playerinfo['player_robots'];
    }
    $this_playerinfo['player_robots'] = array();
    // Update this player's name if this is a player battle