function get_user_ship($ship_id) { global $db_name, $user_ship, $cw, $st; //not using an SD, get ship details if ($ship_id > 1) { db2("select * from {$db_name}_ships where ship_id = '{$ship_id}'"); $user_ship = dbr2(); empty_bays($user_ship); //don't complain if empty. !isset($user_ship['points_killed']) ? $user_ship['points_killed'] = 0 : 0; //get the exp level of the ship. $user_ship['exp'] = resolve_level($user_ship['points_killed']); } if (empty($user_ship)) { //give an SD $user_ship = array('ship_id' => 1, 'cargo_bays' => 0, 'empty_bays' => 0, 'ship_engaged' => 0, 'exp' => 0, 'config' => '', 'mine_rate_metal' => 0, 'mine_rate_fuel' => 0, 'fleet_id' => 0, 'shipclass' => 'SD'); } }
if ($target_fig_dam < 1) { $target_fig_dam = 1; } //declare up the attack modifiers. $user_fig_dam_xtra = 1; $user_fig_dam_less = 1; $target_fig_dam_xtra = 1; $target_fig_dam_less = 1; //take into account ship speed, and ship size. $user_fig_dam_xtra += $target_group['speed'] + $target_group['size'] * 1.5; $target_fig_dam_xtra += $user_group['speed'] + $user_group['size'] * 1.5; $user_fig_dam_xtra -= $user_group['speed'] * 2; $target_fig_dam_xtra -= $target_group['speed'] * 2; //ship experience - valuable stuff! $user_fig_dam_xtra += resolve_level($user_group['exp']); $target_fig_dam_xtra += resolve_level($target_group['exp']); //take into account ship specialties $user_fig_dam_xtra += inc_dam("bs", $user_group, 10); $target_fig_dam_xtra += inc_dam("bs", $target_group, 10); $user_fig_dam_xtra += inc_dam("hs", $user_group, 3.5); $target_fig_dam_xtra += inc_dam("hs", $target_group, 3.5); $user_fig_dam_xtra -= inc_dam("hs", $target_group, 4.5); $target_fig_dam_xtra -= inc_dam("hs", $user_group, 4.5); $user_fig_dam_xtra += inc_dam("ls", $user_group, 1); $target_fig_dam_xtra += inc_dam("ls", $target_group, 1); $user_fig_dam_xtra -= inc_dam("ls", $target_group, 3); $target_fig_dam_xtra -= inc_dam("ls", $user_group, 3); $user_fig_dam_xtra += inc_dam("sc", $user_group, 5); $target_fig_dam_xtra += inc_dam("sc", $target_group, 5); $user_fig_dam_xtra += inc_dam("fr", $user_group, 4); $target_fig_dam_xtra += inc_dam("fr", $target_group, 4);