function playerFires($attacker, &$port, &$players, &$weapons) { if (DEBUG) { print "Player fires<br>"; } global $db, $session, $player; $num_weapons = count($players[$attacker][WEAPONS]); // Process each weapon in turn for ($i = 0; $i < $num_weapons; ++$i) { $result = playerFiresWeapon($players[$attacker][WEAPONS][$i], $attacker, $port, $players, $weapons); // Take the appropriate damage from the port $port[PORT_SHIELDS] -= $result[SHIELD_DMG_DONE]; $port[PORT_DRONES] -= floor($result[DRONE_DMG_DONE] / 3); $port[PORT_DRONES] -= floor($result[DRONES_HIT_BEHIND_SHIELDS] / 60); $port[PORT_ARMOR] -= $result[ARMOR_DMG_DONE]; $players[$attacker][RESULTS][] = $result; } }
function playerFires($attacker, &$planet, &$players, &$weapons) { if (DEBUG) { print "Player fires<br>"; } global $db, $session, $player; $num_weapons = count($players[$attacker][WEAPONS]); // Process each weapon in turn for ($i = 0; $i < $num_weapons; ++$i) { $result = playerFiresWeapon($players[$attacker][WEAPONS][$i], $attacker, $planet, $players, $weapons); // Take the appropriate damage from the planet $planet[PLANET_SHIELDS] -= $result[SHIELD_DMG_DONE]; $planet[PLANET_DRONES] -= floor($result[DRONE_DMG_DONE] / 3); $planet[PLANET_DRONES] -= floor($result[DRONES_HIT_BEHIND_SHIELDS] / 12); $players[$attacker][RESULTS][] = $result; // Did they kill somebody? if ($result[RESULT_OF_WEAPON] == PLANET_DEAD || $result[RESULT_OF_WEAPON] == FINAL_HIT) { //planet is dead, launch players, ownership, pw $db->query("UPDATE player SET land_on_planet = 'FALSE' WHERE sector_id = {$player->sector_id} AND game_id = {$player->game_id}"); $db->query("UPDATE planet SET owner_id = 0, password = '' WHERE sector_id = {$player->sector_id} AND game_id = {$player->game_id}"); } } }