Clean up and document nuclear damage's chance to destroy nuke

Change chance in percent from damage-1 to damage.  It's always been
damage-1, but I can't bring myself to document the silly -1.
This commit is contained in:
Markus Armbruster 2012-08-16 08:24:15 +02:00
parent b288f62538
commit f18c46824d
2 changed files with 9 additions and 2 deletions

View file

@ -87,6 +87,10 @@ Land unit
Plane
%damage = damage
Nuke
can't be damaged by conventional weapons
nuclear damage may destroy it (chance in percent equal to damage)
Sector
sectdamage = damage / ((sectdef - 2) * eff + 2)
%damage = (100 * sectdamage / (sectdamage + 100))
@ -97,5 +101,8 @@ planes take 1/7 of the damage done to land units
Commodity
%damage = (100 * damage / (damage + 50))
Note: when a ship, plane, land unit or bridge is destroyed, its
contents is lost. This includes nukes.
.fi
.SA "fire, launch, torpedo, lmine, bomb, Hitchance, Attacking, Combat"

View file

@ -28,7 +28,7 @@
*
* Known contributors to this file:
* Steve McClure, 1998-2000
* Markus Armbruster, 2004-2010
* Markus Armbruster, 2004-2012
*/
#include <config.h>
@ -279,7 +279,7 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
continue;
if ((damage = nukedamage(ncp, ni.curdist, airburst)) <= 0)
continue;
if (roll(100) >= damage)
if (roll(100) > damage)
continue;
nuke.nuk_effic = 0;
if (own == player->cnum) {