From: Markus Armbruster Date: Thu, 16 Aug 2012 06:24:15 +0000 (+0200) Subject: Clean up and document nuclear damage's chance to destroy nuke X-Git-Tag: v4.3.31~95 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=f18c46824dc74abb7afc8348ee64ff42f4270e92;hp=b288f625385d2b9052610cea6ba0c1bba12f9c23 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. --- diff --git a/info/Damage.t b/info/Damage.t index a9abf6c42..b07d70043 100644 --- a/info/Damage.t +++ b/info/Damage.t @@ -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" diff --git a/src/lib/subs/detonate.c b/src/lib/subs/detonate.c index 171f98f7f..a60923ad3 100644 --- a/src/lib/subs/detonate.c +++ b/src/lib/subs/detonate.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Steve McClure, 1998-2000 - * Markus Armbruster, 2004-2010 + * Markus Armbruster, 2004-2012 */ #include @@ -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) {