From 2673a258fe6afdb71b028927c8bcd1bfe358d862 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 17 Jun 2006 14:28:59 +0000 Subject: [PATCH] (ask_olist): Let land units attack as long as they have positive mobility, except for high-mobility terrain (mountains), where the rules remain as they were: land units need to have all the mobility charged for the attack, not counting combat and moving in to occupy. Rationale: Making sure your land units reach attack positions with enough mobility left is a pain in the neck. Requiring only positive mobility is friendlier, but allows rushing of mountains. --- src/lib/subs/attsub.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/lib/subs/attsub.c b/src/lib/subs/attsub.c index 94dd69ae..14fb8359 100644 --- a/src/lib/subs/attsub.c +++ b/src/lib/subs/attsub.c @@ -1037,13 +1037,29 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def, } switch (combat_mode) { case A_ATTACK: - mobcost = lnd_pathcost(&land, - att_mobcost(off->own, def, - lnd_mobtype(&land))); - if (land.lnd_mobil < mobcost) { - pr("%s does not have enough mobility (%d needed)\n", - prland(&land), (int)ceil(mobcost)); - continue; + /* + * We used to let land units attack only if they have the + * mobility consumed by the attack, not counting combat + * and moving in to occupy. Making sure your land units + * reach attack positions with enough mobility left is a + * pain in the neck. We now require positive mobility, + * just like for marching. Except we don't allow rushing + * of high-mobility sectors (mountains): for those we + * still require attack mobility. + */ + mobcost = att_mobcost(off->own, def, lnd_mobtype(&land)); + if (mobcost < 1.0) { + if (land.lnd_mobil <= 0) { + pr("%s is out of mobility\n", prland(&land)); + continue; + } + } else { + mobcost = lnd_pathcost(&land, mobcost); + if (land.lnd_mobil < mobcost) { + pr("%s does not have enough mobility (%d needed)\n", + prland(&land), (int)ceil(mobcost)); + continue; + } } break; case A_ASSAULT: