]> git.pond.sub.org Git - empserver/commitdiff
Streamline missile hit chance messages
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 13 Sep 2009 17:44:07 +0000 (13:44 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 8 Dec 2009 07:15:50 +0000 (08:15 +0100)
Don't print hit chance for nuclear warheads, it's always 100%.
Instead, print "Arming nuclear warheads" there.  That message is now
printed after interception instead of before.

src/lib/subs/mslsub.c

index 4e648cade2d643fa999620f0dab9726abaa96c2a..a8ec1b4f08887acf3fe3dedf3c663ede0b967826 100644 (file)
@@ -73,7 +73,7 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, int news_item,
     struct sctstr sect;
     int sublaunch = 0;
     struct plchrstr *pcp = plchr + pp->pln_type;
-    int hitchance = pln_hitchance(pp, hardtarget, type);
+    int hitchance;
     char *from;
     int dam, dummyi;
 
@@ -130,11 +130,6 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, int news_item,
     putplane(pp->pln_uid, pp);
     mpr(pp->pln_own, "\tSHWOOOOOSH!  Missile launched!\n");
 
-    if (nuk_on_plane(pp) >= 0) {
-       mpr(pp->pln_own, "\tArming nuclear warheads...\n");
-       hitchance = 100;
-    }
-
     if (pcp->pl_flags & P_T)
        mpr(victim, "Incoming %s missile sighted at %s...\n",
            sublaunch ? "sub-launched" : cname(pp->pln_own),
@@ -152,10 +147,16 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, int news_item,
        }
     }
 
-    mpr(pp->pln_own, "\t%d%% hitchance...", hitchance);
-    hit = (roll(100) <= hitchance);
+    if (nuk_on_plane(pp) >= 0) {
+       mpr(pp->pln_own, "\tArming nuclear warheads...\n");
+       hit = 1;
+    } else {
+       hitchance = pln_hitchance(pp, hardtarget, type);
+       hit = (roll(100) <= hitchance);
+       mpr(pp->pln_own, "\t%d%% hitchance...%s\n", hitchance,
+           hit ? "HIT!" : "miss");
+    }
 
-    mpr(pp->pln_own, hit ? "HIT!\n" : "miss\n");
     if (pcp->pl_flags & P_T)
        mpr(victim, "...Incoming %s missile %s\n",
            sublaunch ? "" : cname(pp->pln_own),