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 mil and units are automatically moved into the target. The mil are
moved in with no mobility charge. If the combat is assault, then 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 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 number of people leaving the ship.
as follows: .s1
.NF Assaulting units pay one update's worth of mobility, except for
Assault: If the land units are attacking from a ship with "land" capability, "marine" units, which pay only half of that. Unless assaulting from a
then land units are charged (update mob) mobility, except for ship with "land" capability, mobility is further decreased to one
"marine" units which are only charged half of that. For all update's worth of mobility negated (so that the unit will have zero
other kinds of ships, land units go to -(update mob), except for mobility after the update), except for "marine" units, whose mobility
"marine" units which go to zero. Here, (update mob) refers to is decreased to zero instead.
the amount of mobility that units gain at the update. .s1
Board: Marine units are charged 10 mobility and other land units are For boarding, "marine" units are charged 10 mobility and other land
charged 40. units are charged 40.
.FI
.s1 .s1
In the case of attack, the aggressor is asked what they'd 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 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 If you have land units with the 'assault' ability
aboard the ship assaulting, you will be asked if aboard the ship assaulting, you will be asked if
you wish them to join in the assault as well. you wish them to join in the assault as well.
Assaulting land units go to negative mobility when assaulting. Assaulting units pay one update's worth of mobility, except for marine
(by an amount equal to the mobility gain per update) units, which pay only half of that. Unless assaulting from a ship
Marine units go to 0 mobility instead. with landing capability, mobility is further decreased to one update's
If assaulting from a ship with the landing ability, a normal unit worth of mobility negated (so that the unit will have zero mobility
pays only mob equal to 1 update's worth of mobility. A marine unit after the update), except for marine units, whose mobility is
pays 1/2 that amount. (Example: in a game where land units gain 32 decreased to zero instead.
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)
.s1 .s1
.L NOTE .L NOTE
This mobility loss for units happens whether or not you 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 mob = llp->unit.land.lnd_mobil;
double gain = etu_per_update * land_mob_scale; double gain = etu_per_update * land_mob_scale;
double mobcost; double mobcost, moblim;
switch (combat_mode) { switch (combat_mode) {
case A_ATTACK: 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))); lnd_mobtype(&llp->unit.land)));
break; break;
case A_ASSAULT: case A_ASSAULT:
if (((struct lchrstr *)llp->chrp)->l_flags & L_MARINE) /*
mobcost = off->shp_mcp->m_flags & M_LAND ? gain / 2.0 : mob; * Set mobcost to basic assault cost, moblim to maximum
else * mobility to keep when assaulting from non-landing ship
mobcost = off->shp_mcp->m_flags & M_LAND ? gain : mob + gain; */
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; break;
case A_BOARD: case A_BOARD:
if (((struct lchrstr *)llp->chrp)->l_flags & L_MARINE) if (((struct lchrstr *)llp->chrp)->l_flags & L_MARINE)