Fix mobility cost for marines assaulting from non-landing ships

Always charge land units at least as much mobility for assaulting from
non-landing ships as for landing ships.  Before, marines lost all
mobility when assaulting from a non-landing ship, which could be less
than what the same assault costs from a landing ship (half an update's
worth).
This commit is contained in:
Markus Armbruster 2008-02-16 20:42:11 +01:00
parent f0cd142fa3
commit 6110da1ef4
3 changed files with 32 additions and 25 deletions

View file

@ -307,18 +307,17 @@ If the combat was an assault, paradrop, board or lboard, then all victorious
mil and units are automatically moved into the target. The mil are
moved in with no mobility charge. If the combat is assault, then
the mil will take an amount of food with them proportional to the
number of people leaving the ship. The mobility cost to land units is
as follows:
.NF
Assault: If the land units are attacking from a ship with "land" capability,
then land units are charged (update mob) mobility, except for
"marine" units which are only charged half of that. For all
other kinds of ships, land units go to -(update mob), except for
"marine" units which go to zero. Here, (update mob) refers to
the amount of mobility that units gain at the update.
Board: Marine units are charged 10 mobility and other land units are
charged 40.
.FI
number of people leaving the ship.
.s1
Assaulting units pay one update's worth of mobility, except for
"marine" units, which pay only half of that. Unless assaulting from a
ship with "land" capability, mobility is further decreased to one
update's worth of mobility negated (so that the unit will have zero
mobility after the update), except for "marine" units, whose mobility
is decreased to zero instead.
.s1
For boarding, "marine" units are charged 10 mobility and other land
units are charged 40.
.s1
In the case of attack, the aggressor is asked what they'd
like to move in as follows: First, the aggressor is asked how many mil

View file

@ -20,14 +20,12 @@ semi-lander flag, which allows them to land 25% of their troops.
If you have land units with the 'assault' ability
aboard the ship assaulting, you will be asked if
you wish them to join in the assault as well.
Assaulting land units go to negative mobility when assaulting.
(by an amount equal to the mobility gain per update)
Marine units go to 0 mobility instead.
If assaulting from a ship with the landing ability, a normal unit
pays only mob equal to 1 update's worth of mobility. A marine unit
pays 1/2 that amount. (Example: in a game where land units gain 32
mobility per update, a non-marine unit would pay 32 mobility to assault
from a landing ship. A marine unit would pay only 16 mobility)
Assaulting units pay one update's worth of mobility, except for marine
units, which pay only half of that. Unless assaulting from a ship
with landing capability, mobility is further decreased to one update's
worth of mobility negated (so that the unit will have zero mobility
after the update), except for marine units, whose mobility is
decreased to zero instead.
.s1
.L NOTE
This mobility loss for units happens whether or not you

View file

@ -2525,7 +2525,7 @@ take_move_in_mob(int combat_mode, struct ulist *llp, struct combat *off,
{
double mob = llp->unit.land.lnd_mobil;
double gain = etu_per_update * land_mob_scale;
double mobcost;
double mobcost, moblim;
switch (combat_mode) {
case A_ATTACK:
@ -2534,10 +2534,20 @@ take_move_in_mob(int combat_mode, struct ulist *llp, struct combat *off,
lnd_mobtype(&llp->unit.land)));
break;
case A_ASSAULT:
if (((struct lchrstr *)llp->chrp)->l_flags & L_MARINE)
mobcost = off->shp_mcp->m_flags & M_LAND ? gain / 2.0 : mob;
else
mobcost = off->shp_mcp->m_flags & M_LAND ? gain : mob + gain;
/*
* Set mobcost to basic assault cost, moblim to maximum
* mobility to keep when assaulting from non-landing ship
*/
if (((struct lchrstr *)llp->chrp)->l_flags & L_MARINE) {
mobcost = gain / 2.0;
moblim = 0;
} else {
mobcost = gain;
moblim = -gain;
}
if (!(off->shp_mcp->m_flags & M_LAND))
/* Not a landing ship, ensure we go to or below moblim */
mobcost = MAX(mobcost, mob - moblim);
break;
case A_BOARD:
if (((struct lchrstr *)llp->chrp)->l_flags & L_MARINE)