Land unit reactions are overly complex because we have two different
concepts controlling them: reaction radius (set with lrange) and
reserve mission (set with mission). You need to deal with both to set
up or query reactions.
Commit
8d0e1af5 "fixed" this by making reserve missions meaningless.
The previous commit made reserve missions meaningful again: they
support an op-area now. This brought back the problem of having to
deal with two separate commands to accomplish one thing.
Fix this for good by removing non-mission land unit reaction
alltogether. The only feature we lose by that is the ability to order
land units to react until the order is explicitely cancelled. That's
because missions are implicitely cleared by many commands and events,
while non-mission reaction wasn't. Closes #858121 and #858122.
Remove the non-mission reaction case from att_reacting_units().
Don't limit reserve missions to the land unit's reaction radius: make
lnd_reaction_range() return the type's maximum radius instead of
lnd_rad_max.
The reaction radius is now useless. Remove the lrange command, and
struct lndstr member lnd_rad_max along with its selector react.
Remove land command's column rd. Make ldump show column react as
zero. Deprecate edit key 'P' in dounit(), and don't show it in
pr_land().
short lnd_retreat; /* retreat percentage */
int lnd_rflags; /* When do I retreat? */
char lnd_rpath[RET_LEN]; /* retreat path */
- unsigned char lnd_rad_max; /* max radius for this unit */
unsigned char lnd_scar; /* how experienced the unit is (not used) */
short lnd_item[I_MAX+1]; /* amount of items on board */
short lnd_pstage; /* plague stage */
int look(void);
int lost(void);
int lrad(void);
-int lrange(void);
int lretr(void);
int lsta(void);
int ltend(void);
.s1
.L "(4) Move reacting defensive units to the target sector."
.s1
-If the target is not a mountain, then defensive units in nearby
-sectors may react. Defensive units will keep reacting until the
+If the target is not a mountain, then nearby land units on reserve
+missions may react. Reserve units will keep reacting until the
defense strength is 1.2 times the offense strength. The following
restrictions apply to reacting land units:
.NF
+- The target must be in the mission's op-area, and in reaction range.
- The efficiency of the unit must be higher than it's retreat percentage.
- The unit must be in supply.
- The unit must have enough mobility to get to the target.
-- The unit must be in range.
.FI
If the unit is in a 60% efficient headquarters, then 1 is added to its
-reaction radius.
-Note that you can limit the reaction radius of your land
-units using the "lrange" command.
+reaction range.
.s1
.L "(5) Calculate support."
.s1
.s1
.EX land *
.NF
- # unit type x,y a eff mil fort mu fd tech retr rd xl ship
- 0 inf infantry 8,0 96% 100 0 93 24 0 42% 1 0
+ # unit type x,y a eff mil frt mu fd tch retr xl ln carry
+ 0 inf infantry 8,0 96% 100 0 93 1 50 42% 0 0
1 unit
.FI
.s1
This land unit is an infantry unit, located at 8,0. In many games, you will
start with 1-2 basic land units of this type. Some of the things about it are
familiar. It is 96% efficient, has 93 mobility units, carries 1 food,
-and is tech 0 and currently contains 100 mi. It carries 0 extra-light
-planes, and is not on a ship. The 'a'
+and is tech 50 and currently contains 100 mi. It carries 0 extra-light
+planes and land units, and is not on a ship. The 'a'
stands for army, and is just like fleets or wings, i.e. a way of grouping your
units. (See info \*Qarmy\*U for more information)
-Fort is the level of fortification of the land
+Frt is the level of fortification of the land
unit. The higher the fortification, the harder the unit is to hurt.
.s1
The 'retr' stands for retreat percentage. This
setting this, see info \*Qmorale\*U. For information on morale checks, see info
\*QAttacking\*U)
.s1
-The 'rd' field is referred to as the unit's 'reaction radius',
-and is the distance to which the unit can react to defend your country.
-Basically, if an enemy attacks a sector close enough to the unit, it will go
-to the threatened sector and fight, like a plane intercepting. If it survives
-the attack without failing a morale check, it will return to the sector it
-started from, just like a plane would. (For more information on reacting and
-morale checks, see info \*QAttacking\*U) Just as you can use \*Qrange\*U to change the
-range of your planes and control how far away they'll intercept, you can
-change the reaction radius for land units with \*Qlrange\*U. Units with a base reaction
-radius of 0, or those whose radius you have set to 0, will not react.
-When built, the unit will have as its reaction radius set to zero.
-.s1
.L Cargo
.s1
Each land unit can carry cargo. The cargo display for land units is very
"info \*QSpies\*U" for more information.
.s1
Rad is the maximum reaction radius for the unit.
-If you change the reaction radius by using
-the \*Qlrange\*U command, you will be able to select any value that is
-between 0 and the maximum.
.s1
Frg is the unit's firing range. The unit can fire as far as the frg, modified
by the unit's tech. Accuracy is the unit's firing accuracy, and helps to
(1) Build 100% forts and put 10 guns and at least 100 shells in them.
(2) Put at least 5 mil in all of your coastal sectors.
(3) Build infantry units, put them in the forts, "fortify" them,
- put them on "reserve" mission (info mission) and set their
- reaction radius to maximum (info lrange).
+ and put them on "reserve" mission (info mission).
(4) Build battleships and artillery and put them on "interdiction"
mission. Put the artillery in forts and fortify them.
(5) Put infantry units in your banks and capitals and fortify them.
example:
.EX land *
.NF
- # unit type x,y a eff mil frt mu fd tch retr rd xl ln carry
- 0 cav cavalry 1,-1 100% 10 0 127 12 992 75% 3 0 0
- 1 cav cavalry 0,0 100% 0 0 127 12 968 75% 3 0 0
- 2 cav cavalry 0,0 100% 10 0 127 12 40 75% 3 0 0
+ # unit type x,y a eff mil frt mu fd tch retr xl ln carry
+ 0 cav cavalry 1,-1 100% 10 0 127 12 992 75% 0 0
+ 1 cav cavalry 0,0 100% 0 0 127 12 968 75% 0 0
+ 2 cav cavalry 0,0 100% 10 0 127 12 40 75% 0 0
3 units
.FI
.s1
the tech level of the land unit,
.L retr
the retreat percentage of the land unit (see info \*morale\*U),
-.L rd
-the land unit's reaction radius (see info \*Qfortify\*U),
.L xl
the number of extra-light planes on board,
.L ln
+++ /dev/null
-.TH Command LRANGE
-.NA lrange "Edit the reaction range of a unit"
-.LV Expert
-.SY "lrange <UNITS> <reaction-radius>"
-The \*Qlrange\*U command is used to limit the maximum reaction radius of
-land units. This can be useful in restricting the area which a unit will
-attempt to defend. (see info attack for details of the reaction process)
-.s1
-A unit with a radius of 0 will not react.
-.s1
-.SA "attack, LandUnits"
sector. This is the center of an area that the mission is focused on.
The op sector may be any sector that is within the unit's range.
(Firing range for ships & land units on interdiction, reaction range
-for land units on reserve, changeable with lrange command, flying
+for land units on reserve, flying
range for planes, changeable with range command).
The unit will exert influence in a radius around the op sector.
By default, the radius will be as large as possible, i.e. the biggest range
pr("Fortification <F>: %d\t", land->lnd_harden);
pr("Land unit <Y>: %d\n", land->lnd_land);
pr("Ship <S>: %d\t\t", land->lnd_ship);
- pr("Radius <P>: %d\n", land->lnd_rad_max);
pr("Retreat percentage <Z>: %d\n", land->lnd_retreat);
pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
land->lnd_rpath, land->lnd_rflags);
land->lnd_ship = arg;
break;
case 'P':
- land->lnd_rad_max = arg;
+ warn_deprecated(op);
break;
case 'Z':
land->lnd_retreat = arg;
if (player->god)
pr("own ");
pr(" # unit type x,y a eff mil frt mu fd");
- pr(" tch retr rd xl ln carry\n");
+ pr(" tch retr xl ln carry\n");
}
if (land.lnd_off)
noff++;
pr("%4d", land.lnd_item[I_FOOD]);
pr("%4d ", land.lnd_tech);
pr("%3d%%", land.lnd_retreat);
- pr("%3d", land.lnd_rad_max);
pr("%3d", lnd_nxlight(&land));
pr("%3d", lnd_nland(&land));
if (land.lnd_ship >= 0)
pr(" %d", land.lnd_retreat);
break;
case 13:
- pr(" %d", land.lnd_rad_max);
+ pr(" 0");
break;
case 14:
pr(" %d", lnd_nxlight(&land));
return RET_OK;
}
-
-int
-lrange(void)
-{
- struct nstr_item np;
- struct lndstr land;
- int i;
- char *p;
- char prompt[128];
- char buf[1024];
-
- if (!snxtitem(&np, EF_LAND, player->argp[1], NULL))
- return RET_SYN;
- while (nxtitem(&np, &land)) {
- if (!player->owner || land.lnd_own == 0)
- continue;
- sprintf(prompt, "New range for %s? ", prland(&land));
- if ((p = getstarg(player->argp[2], prompt, buf)) == 0)
- return RET_SYN;
- if (!check_land_ok(&land))
- return RET_SYN;
- if ((i = atoi(p)) < 0)
- continue;
- land.lnd_rad_max = MIN(i, lchr[land.lnd_type].l_rad);
- pr("%s reaction radius changed to %d\n",
- prland(&land), land.lnd_rad_max);
- putland(land.lnd_uid, &land);
- }
-
- return RET_OK;
-}
{"rflags", fldoff(lnd_rflags), NSC_INT, 0, NULL,
EF_RETREAT_FLAGS, NSC_BITS},
{"rpath", fldoff(lnd_rpath), NSC_STRINGY, RET_LEN, NULL, EF_BAD, 0},
- {"react", fldoff(lnd_rad_max), NSC_UCHAR, 0, NULL, EF_BAD, 0},
NSC_IVEC(fldoff(lnd_item), ""),
{"pstage", fldoff(lnd_pstage), NSC_SHORT, 0, NULL,
EF_PLAGUE_STAGES, NSC_DEITY},
{"lookout <SHIPS>", 1, look, 0, NORM + CAP},
{"lost", 0, lost, 0, NORM},
{"lradar <UNITS | SECTS>", 1, lrad, 0, NORM + CAP},
- {"lrange <UNITS> <range>", 1, lrange, C_MOD, NORM + CAP},
{"lretreat <UNITS|ARMY> <PATH> [i|h|b|c]",
1, lretr, C_MOD, NORM + CAP},
{"lstat <UNITS>", 0, lsta, C_MOD, NORM},
while (nxtitem(&ni, &land) && dtotal + new_land * eff < 1.2 * ototal) {
if (!land.lnd_own)
continue;
- if (!land.lnd_rad_max)
+ if (land.lnd_mission != MI_RESERVE)
continue;
if ((land.lnd_x == def->x) && (land.lnd_y == def->y))
continue;
if (!has_supply(&land))
continue;
- if (land.lnd_mission == MI_RESERVE) {
- if (!in_oparea((struct empobj *)&land, def->x, def->y))
- continue;
- } else {
- if (mapdist(land.lnd_x, land.lnd_y, def->x, def->y)
- > lnd_reaction_range(&land))
- continue;
- }
+ if (!in_oparea((struct empobj *)&land, def->x, def->y))
+ continue;
getsect(land.lnd_x, land.lnd_y, §);
getsect(def->x, def->y, &dsect);
getsect(lp->lnd_x, lp->lnd_y, §);
if (sect.sct_type == SCT_HEADQ && sect.sct_effic >= 60)
- return lp->lnd_rad_max + 1;
- return lp->lnd_rad_max;
+ return lchr[lp->lnd_type].l_rad + 1;
+ return lchr[lp->lnd_type].l_rad;
}
void
lp->lnd_retreat = morale_base;
lp->lnd_rflags = 0;
lp->lnd_rpath[0] = 0;
- lp->lnd_rad_max = 0;
break;
case EF_NUKE:
break;