Limit nukes to strategic missions
Before Empire 2, nukes could be delivered only with bomb (special mission 'n', airburst only) and launch (targeting sectors or satellites only). Empire 2 made nukes available for any kind of bombing, and for any missile strike on sectors or ships. This included interdiction and support missions. Nuclear-tipped anti-sats and bomb mission n were removed. Unfortunately, this was done in a messy way, which led to inconsistencies and bugs. The problem is that ordinary damage affects just the target, while nuke damage affects an area. Code dealing with plane damage was designed for the former. Instead of rewriting it to cope with area damage cleanly, nuke damage got shoehorned into pln_damage(), the function to compute conventional plane damage, as a side effect: computing damage blasted sectors in the area. If the plane carried a nuke, pln_damage() returned zero (conventional) damage. Without further logic, this simply bypassed the code to apply damage to the target. This worked out okay when the target already got damaged correctly by the side effect. However, some targets are immune to the side effect: when interdicting a move or explore command, the commodities being moved are not in any sector. For other targets, damage has effects other than damaging the target: offensive and defensive support don't apply the (conventional) damage to the target sector. Instead, they turn it into a combat bonus. Without further logic, nuclear damage doesn't contribute to that. To make all that work, pln_damage() returned the nuclear damage for ground zero as well. Because a plane does either conventional or nuclear damage, one of them is always zero. Most callers simply ignored the nuclear damage, and applied only the conventional damage. Bug: land units and ships failed to retreat when pin-bombed or missiled with a nuke. That's because they received zero conventional damage. The mission code flies planes and missiles and tallies their damage. This mission damage included nuclear damage at ground zero (except for missiles sometimes, see below), to make support and commodity interdiction work. Unfortunately, this broke other things. Bug: when bombers interdicted ships or land units, nukes first damaged the ships or land units by the side effect, then again through mission damage. Interdicting missiles had a special case to avoid this. Bug: when interdicting move, explore or transport, nukes first damaged the sector by the side effect, then again through mission damage's collateral damage. There may well be more bugs hiding in this mess. The mess is not worth fixing. While the idea of interdicting and supporting with nukes sounds kind of cool, I believe it's pretty irrelevant in actual play. Instead, go back to a variation of the original rules: nukes can be delivered only through bomb mission 's' and launch at sectors. Make arm reject marine missiles in addition to satellites, ABMs and SAMs, and clear the mission. Make mission reject planes armed with nukes. Oops when they show up in mission_pln_equip() anyway. Make pln_equip() allow planes with nukes only for missions 's' and 't'. Clean up pln_damage() to just compute damage, without side effect. Change strat_bomb() and launch_missile() to detonate nukes. Simplify the other callers. Parameter mission of msl_launch_mindam() is now unused, remove it. Missiles exploding on launch no longer set off their nukes. That was pretty ridiculous anyway.
This commit is contained in:
parent
b0ba9022dc
commit
a269cdd7e9
14 changed files with 102 additions and 124 deletions
|
@ -551,7 +551,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
|||
/* I arbitrarily chose 100 mindam -KHS */
|
||||
dam +=
|
||||
msl_launch_mindam(&missiles, x, y, hardtarget, EF_SECTOR, 100,
|
||||
"sector", victim, mission);
|
||||
"sector", victim);
|
||||
qp = missiles.q_forw;
|
||||
while (qp != (&missiles)) {
|
||||
newqp = qp->q_forw;
|
||||
|
@ -902,8 +902,6 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, char mission)
|
|||
itype = I_NONE;
|
||||
switch (mission) {
|
||||
case 'p': /* pinpoint bomb */
|
||||
if (nuk_on_plane(pp) >= 0)
|
||||
break;
|
||||
itype = I_SHELL;
|
||||
break;
|
||||
case 'i': /* missile interception */
|
||||
|
@ -923,6 +921,8 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, char mission)
|
|||
needed = load / ichr[itype].i_lbs;
|
||||
if (needed <= 0)
|
||||
return -1;
|
||||
if (CANT_HAPPEN(nuk_on_plane(pp) >= 0))
|
||||
return -1;
|
||||
if (itype == I_SHELL && item[itype] < needed) {
|
||||
if (pp->pln_ship >= 0)
|
||||
shp_supply(&ship, I_SHELL, needed);
|
||||
|
@ -1014,7 +1014,6 @@ air_damage(struct emp_qelem *bombers, coord x, coord y, int mission,
|
|||
struct plnstr *pp;
|
||||
int newdam, dam = 0;
|
||||
int hitchance;
|
||||
int nukedam;
|
||||
|
||||
for (qp = bombers->q_forw; qp != bombers; qp = qp->q_forw) {
|
||||
plp = (struct plist *)qp;
|
||||
|
@ -1053,24 +1052,14 @@ air_damage(struct emp_qelem *bombers, coord x, coord y, int mission,
|
|||
hitchance = 100;
|
||||
else if (hardtarget != SECT_HARDTARGET)
|
||||
wu(0, pp->pln_own, "\t\t%d%% hitchance...", hitchance);
|
||||
/* Always calculate damage */
|
||||
if (roll(100) <= hitchance) {
|
||||
newdam = pln_damage(&plp->plane, x, y, 'p', &nukedam, 1);
|
||||
if (nukedam) {
|
||||
if (mission == MI_INTERDICT) {
|
||||
wu(0, pp->pln_own,
|
||||
"\t\tnuclear warhead on plane %s does %d damage to %s %s\n",
|
||||
prplane(pp), nukedam, cname(victim), s);
|
||||
dam += nukedam;
|
||||
}
|
||||
} else {
|
||||
wu(0, pp->pln_own,
|
||||
"\t\thit %s %s for %d damage\n",
|
||||
cname(victim), s, newdam);
|
||||
dam += newdam;
|
||||
}
|
||||
newdam = pln_damage(&plp->plane, 'p', 1);
|
||||
wu(0, pp->pln_own,
|
||||
"\t\thit %s %s for %d damage\n",
|
||||
cname(victim), s, newdam);
|
||||
dam += newdam;
|
||||
} else {
|
||||
newdam = pln_damage(&plp->plane, x, y, 'p', &nukedam, 0);
|
||||
newdam = pln_damage(&plp->plane, 'p', 0);
|
||||
wu(0, pp->pln_own, "missed\n");
|
||||
if (mission == MI_SINTERDICT) {
|
||||
mpr(victim,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue