Clean up land unit retreat chance and fix its documentation
Change chance in percent lnd_retreat - lnd_effic - 1 to lnd_retreat - lnd_effic. It's been that way since Empire 2, but I can't bring myself to document the silly -1. "info morale" wasn't updated when the retreat chance was changed in Empire 2. Fix that.
This commit is contained in:
parent
f18c46824d
commit
5507ff3116
2 changed files with 7 additions and 9 deletions
|
@ -5,11 +5,9 @@
|
||||||
The \*Qmorale\*U command is used to set the retreat percentage of land
|
The \*Qmorale\*U command is used to set the retreat percentage of land
|
||||||
units.
|
units.
|
||||||
.s1
|
.s1
|
||||||
Normally, a land unit must start making morale checks during combat
|
Whenever a land unit takes a hit in combat, it may break off combat
|
||||||
when its efficiency is less than or equal to its retreat percentage.
|
and attempt to retreat. This is called \*Qfailing a morale check\*U.
|
||||||
(The chance of failing a morale check is: sqrt(100-effic)%/(men in unit).
|
The chance for it to happen is unit's retreat percentage - efficiency.
|
||||||
Example: a 25 man unit is at 75% efficiency. Its chance of failing is
|
|
||||||
sqrt(100-75)%/25 = sqrt(25)%/25 = 20%)
|
|
||||||
.s1
|
.s1
|
||||||
The morale command
|
The morale command
|
||||||
allows you to adjust this percentage within a range. If, for example, you
|
allows you to adjust this percentage within a range. If, for example, you
|
||||||
|
@ -19,8 +17,8 @@ the enemy down a bit. Or, you could set your retreat percentage to the minimum,
|
||||||
and make the unit stick around and fight more, but at the cost of more
|
and make the unit stick around and fight more, but at the cost of more
|
||||||
casualties.
|
casualties.
|
||||||
.s1
|
.s1
|
||||||
The maximum allowed value is 100% (i.e. start making morale checks after
|
The maximum allowed value is 100%. The minimum value is based on
|
||||||
any casualties). The minimum value is based on happiness:
|
happiness:
|
||||||
.ti 3
|
.ti 3
|
||||||
(morale_base) - happiness
|
(morale_base) - happiness
|
||||||
.s1
|
.s1
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Ken Stevens, 1995
|
* Ken Stevens, 1995
|
||||||
* Steve McClure, 1998-2000
|
* Steve McClure, 1998-2000
|
||||||
* Markus Armbruster, 2004-2010
|
* Markus Armbruster, 2004-2012
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -211,7 +211,7 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
|
||||||
/* Have to make a retreat check */
|
/* Have to make a retreat check */
|
||||||
|
|
||||||
ret_chance = llp->unit.land.lnd_retreat - llp->unit.land.lnd_effic;
|
ret_chance = llp->unit.land.lnd_retreat - llp->unit.land.lnd_effic;
|
||||||
if (roll(100) < ret_chance) {
|
if (roll(100) <= ret_chance) {
|
||||||
pr("\n");
|
pr("\n");
|
||||||
lnd_print(llp->unit.land.lnd_own, llp, "fails morale check!");
|
lnd_print(llp->unit.land.lnd_own, llp, "fails morale check!");
|
||||||
llp->unit.land.lnd_mission = 0;
|
llp->unit.land.lnd_mission = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue