From f18c46824dc74abb7afc8348ee64ff42f4270e92 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 16 Aug 2012 08:24:15 +0200 Subject: [PATCH 1/1] 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. --- info/Damage.t | 7 +++++++ src/lib/subs/detonate.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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) { -- 2.43.0