$ship_amount = $defend_shipcollection[$i]->getAmount();
					$hitted_armor = ($ship_amount * $single_shipdata['firepower']) * $single_shipdata['accurate'];

					$attackfleet->newRemoveShips($defend_shipcollection[$i]->getPrim(), $defend_shipcollection[$i]->getSec(), $hitted_armor);
					appendPlayerLog($defend_shipcollection[$i]->getPlayerId(), 'Removing ships for attacker. Prim target: '.$defend_shipcollection[$i]->getPrim().'. Sec target: '.$defend_shipcollection[$i]->getSec().'. Hitted armor: '.$hitted_armor, '');
				}
			}

			$attack_shipcollection = $attackfleet->getShipCollection($ship_id);

			for ($i = 0; $i < count($attack_shipcollection); $i++) {
				if (($attack_shipcollection[$i]->getPrim() > 0) || ($attack_shipcollection[$i]->getSec() > 0)) {
					$ship_amount = $attack_shipcollection[$i]->getAmount();
					$hitted_armor = ($ship_amount * $single_shipdata['firepower']) * $single_shipdata['accurate'];

					$defendfleet->newRemoveShips($attack_shipcollection[$i]->getPrim(), $attack_shipcollection[$i]->getSec(), $hitted_armor);
					appendPlayerLog($attack_shipcollection[$i]->getPlayerId(), 'Removing ships for defender. Prim target: '.$attack_shipcollection[$i]->getPrim().'. Sec target: '.$attack_shipcollection[$i]->getSec().'. Hitted armor: '.$hitted_armor, '');
				}
			}
		}
	}

	$target_id = $id;
	$target_steelroids = $new['roid_steel'];
	$target_crystalroids = $new['roid_crystal'];
	$target_erbiumroids = $new['roid_erbium'];
	$target_unusedroids = $new['roid_unused'];
	$target_totalroids = $target_steelroids + $target_crystalroids + $target_erbiumroids + $target_unusedroids;

	if ($target_totalroids > 0) {
		for ($i = 0; $i < count($shipdata); $i++) {