Restriction to Air Interception

OrionVeteran

Deity
Joined
Dec 25, 2003
Messages
2,443
Location
Newport News VA
I would like to restrict the interception chance based upon enemy unit class or unit combat or special unit type.

For example: If I create an anti ballistic missile (ABM) air defense unit, then it should intercept missile units only (i.e. Tactical nukes and ICBMs) and not fighters and bombers.

Any ideas on how I might approach the coding of this restriction to air interception?
 
My guess is to mod this function:
PHP:
CvUnit::canAttack(const CvUnit& defender) const
{
	if (!canAttack())
	{
		return false;
	}

	if (defender.getDamage() >= combatLimit())
	{
		return false;
	}

	// Artillery can't amphibious attack
	if (plot()->isWater() && !defender.plot()->isWater())
	{
		if (combatLimit() < 100)
		{
			return false;
		}
	}

	return true;
}
Next question is how to do it precisely. It could be something hardcoded, or it could be something regarding unitCombat types. There are other options as well. Perhaps the easiest would actually be that if attacking unit is of combatType X, then it can only attack unitCombatType Y.

It should be noted that I haven't actually modded interception. This is my best guess, but I'm not 100% sure it would work.
 
I think you need the getNukeInterception as afaik the normal interception doesnt work against nukes (?). However it is only the SDI project that have that. Maybe do a check in NukeInterception for something specific to your ABM. Not at home atm so cant check the code.
 
Top Bottom