示例#1
0
/**
 * @brief Set Intercept mission: choose between attacking aircraft or installations.
 * @note Intercept mission -- Stage 1
 */
static void CP_InterceptMissionSet (mission_t* mission)
{
	assert(mission->ufo);

	/* Only large UFOs can attack installations -- if there are installations to attack */
	if (UFO_CanDoMission(mission->ufo->getUfoType(), "interceptbombing"))
		if (INS_HasAny()) {
			/* Probability to get a UFO that targets installations. */
			const float TARGET_INS_PROBABILITY = 0.25;
			/* don't make attack on installation happen too often */
			if (frand() < TARGET_INS_PROBABILITY)
				CP_InterceptGoToInstallation(mission);
		}

	CP_InterceptAircraftMissionSet(mission);
}
/**
 * @brief Set Intercept mission: choose between attacking aircraft or installations.
 * @note Intercept mission -- Stage 1
 */
static void CP_InterceptMissionSet (mission_t* mission)
{
	assert(mission->ufo);

	/* Only large UFOs can attack installations -- if there are installations to attack */
	switch (mission->ufo->ufotype) {
	case UFO_HARVESTER:
	case UFO_CORRUPTER:
		if (INS_HasAny())
			CP_InterceptGoToInstallation(mission);
		break;
	default:
		break;
	}

	CP_InterceptAircraftMissionSet(mission);
}