Integrate air defense missions into interception

The ancients designed interception dead simple: when you overfly a
sector, you get intercepted by the sector owner.  Fine print
interception rules govern which planes intercept.

Then complexity got piled on top of it.

Chainsaw 2 added an extra interception by surface ship owners, in the
target sector only.

Chainsaw 3 added an extra interception by land unit owners, in the
target sector only (Empire 4 later merged this extra land unit
interception with the extra surface ship interception).

Chainsaw 3 added an entirely separate kind of interception: air
defense missions.  When you enter a sector in some air defense op
area, you get intercepted.  Fine print air defense rules govern which
planes intercept.  These rules differ significantly from the
interception fine print.

Additional complexity comes from these facts:

* Air defense mission interception happens in addition to non-mission
  interception.  You can boost your total interception by setting up
  air defense.  Which means you must set it up, or forgo an advantage.

* Air defense planes are not available for non-mission interception
  duty.  You need to decide on a split.

* In contrast to non-mission interception, interceptors flying air
  defense get intercepted.

Moreover, the air defense code breaks one of the plane code's design
assumptions, namely that just one plane sortie is active at a time.
The air defense sortie runs while the sortie it intercepts is in
progress.  This leads to two interceptions being active at the same
time: the one intercepting the original sortie, and the one
intercepting the air defense sortie.  The same plane can fly in both
interceptions, and damage received in the interception of the air
defense sortie is wiped out, triggering a seqno mismatch oops.

The previous commit already simplified non-mission interception: you
get intercepted by anyone who owns the sector, or a surface ship or a
land unit there, whether it's the target sector or not.

Now simplify mission interception, by merging air defense back into
ordinary interception: when you overfly a sector, you get intercepted
by anyone who owns the sector, or a surface ship or land unit there,
or has an air defense mission covering the sector.  That's all.  No
multiple interceptions, no separate air defense rules.

Remove air_defense().  Simplify ac_encounter() and sam_intercept()
accordingly; both lose their last parameter.

Change sam_intercept() and ac_intercept() to intercept in mission op
areas.  New parameter only_mission to suppress non-mission
interception.  Pass zero when the intercepting country owns the sector
or a surface ship or land unit in the sector.

ac_encounter() can't efficiently predict whether a country intercepts,
so it needs to call ac_intercept() unconditionally.  This kills the
optimization to collect interceptors only when needed; simplify
accordingly, replacing getilist() by getilists().
This commit is contained in:
Markus Armbruster 2008-09-25 21:51:21 -04:00
parent d1490b9ba5
commit 6564ff2240
10 changed files with 71 additions and 306 deletions

View file

@ -36,14 +36,13 @@ or "order").
.s1
Artillery units less than 40% efficient will not fire.
.s1
Planes flying missions will be intercepted normally. (i.e. if you fly
over enemy territory, you'll get intercepted. Any mission except air
missions may also be intercepted by planes on air defense missions)
Planes flying missions other than air defense will be intercepted
normally. (i.e. if you fly over enemy territory, you'll get
intercepted.
.s1
Planes of less than 40% efficiency will not fly missions.
.s1
Planes assigned to missions are \*QNOT\*U eligible to intercept
normally. For example, if a fighter is assigned to an escort or air-defense
Planes assigned to missions other than air defense are \*QNOT\*U
eligible to intercept normally. For example, if a fighter is assigned
to an escort
or interdiction or support mission, it will \*QNOT\*U rise to intercept
an intruding enemy plane. (planes on air-defense missions will intercept
planes flying in their op-area, in accordance with the air-defense mission,
@ -232,22 +231,11 @@ pays to put your bombing planes and escorting planes together.
Only planes with the 'escort' or 'intercept' abilities can fly escort missions.
.s1
AIR DEFENSE MISSIONS (planes only)
When given an air defense mission, an intercept capable plane will attempt
to intercept any enemy plane (defined as any plane belonging to a country
you re at war with) flying into its operations area, irregardless
of whether the enemy planes are flying over owned sectors. For example, if
a plane is given an air defense mission with an op area covering some
owned sectors, some sea, some allied sectors, and some enemy sectors, it
would try to intercept over any of them.
.s1
When a plane enters a sector, any planes with air defense missions that are
at war with the owner of the plane will fly there to fight it.
The air defense planes
encounter normal interception along the way (but do \*QNOT\*U trigger
more air defense missions, but \*QMAY\*U be intercepted normally).
Once the air defense planes get to the sector,
they fight the plane. Then, if the owner of the sector
is hostile to the plane, still more planes may intercept it.
Putting a plane on an air defense mission modifies where the plane
intercepts. Without a mission, it intercepts over own sectors,
surface ships and land units. With an air defense mission, it
intercepts over any sector in its op area.
.s1
.L Example
Groonland wants to run a recon flight over Bannannarama. Joeland has a
@ -275,12 +263,10 @@ This is within the Joeland aircraft's op-area, so it flies to intercept.
It takes the shortest path there, and fights the Groonland plane.
Let's say that both take 20 points of damage, and neither aborts.
.s1
Next, the Groonland plane overflies a Bannannarama sector. The Joeland
plane flies there, and is intercepted by the Bannannarama plane. Let's
say that it comes through the fight without being aborted. It then fights
the Groonland plane. After this combat, if the Groonland plane is not
aborted, it may be intercepted again by the busy Bannannarama fighter,
assuming that that plane is still efficient enough, has mob enough, etc.
Next, the Groonland plane overflies a Bannannarama sector. It gets
intercepted by Joeland's fighter, because the sector is in its
op-area, and by Bannannarama's fighter, because the sector belongs to
Bannannarama. And so forth.
.s1
A good use of this mission is to provide a wider CAP around a carrier,
so that enemy planes get intercepted several times on the way to the