]> git.pond.sub.org Git - empserver/commitdiff
Fix mobility cost for marines assaulting from non-landing ships
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 16 Feb 2008 19:42:11 +0000 (20:42 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 17 Feb 2008 05:56:46 +0000 (06:56 +0100)
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).

info/Attacking.t
info/assault.t
src/lib/subs/attsub.c

index 45ccdfd362f5d73cd956256d87c246e53d0ffee2..18a139edcb13bb6f364bc2106cf0040cccb33a17 100644 (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
index d6f0fbf761b3a3e3bed44a53c6032c790097d37a..e8c8a02752acd1e32c74c03cca0af98ee98b5c0a 100644 (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
index 03d1cc3ca3d28d0ca8f9d4d40f77cd805578fc81..1284a14315f63dd978bc040246f47c628ffc2607 100644 (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)