From: Eric S. Raymond Date: Fri, 6 Oct 2006 14:07:40 +0000 (+0000) Subject: Fixed bug in Python version's reporting of critical hits. X-Git-Tag: 2.0~138 X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=commitdiff_plain;h=1e83bccf057830e335d12b07fe37881a4c1d48ae;hp=aaf1baec91818fd274e6f291da6c5d813c5c1cc2 Fixed bug in Python version's reporting of critical hits. --- diff --git a/src/sst.py b/src/sst.py index 49b25d0..8765806 100644 --- a/src/sst.py +++ b/src/sst.py @@ -1568,8 +1568,6 @@ def torpedo(course, r, incoming, i, n): def fry(hit): # critical-hit resolution - ktr=1 - # a critical hit occured if hit < (275.0-25.0*game.skill)*randreal(1.0, 1.5): return ncrit = int(1.0 + hit/(500.0+randreal(100))) @@ -1585,17 +1583,14 @@ def fry(hit): cdam.append(j) extradm = (hit*game.damfac)/(ncrit*randreal(75, 100)) game.damage[j] += extradm - if loop1 > 0: - for loop2 in range(loop1): - if j == cdam[loop2]: - break - if loop2 < loop1: - continue - ktr += 1 - if ktr==3: - skip(1) - proutn(_(" and ")) + skipcount = 0 + for (i, j) in enumerate(cdam): proutn(device[j]) + if skipcount % 3 == 2 and i < len(cdam)-1: + skip() + skipcount += 1 + if i < len(cdam)-1: + proutn(_(" and ")) prout(_(" damaged.")) if damaged(DSHIELD) and game.shldup: prout(_("***Shields knocked down.")) @@ -2568,10 +2563,9 @@ def events(): game.iseenit = True announce() skip(1) - proutn(_("Lt. Uhura- \"Captain, the starbase in Quadrant %s") % game.battle) + prout(_("Lt. Uhura- \"Captain, the starbase in Quadrant %s") % game.battle) prout(_(" reports that it is under attack and that it can")) - proutn(_(" hold out only until stardate %d") % (int(scheduled(FCDBAS)))) - prout(".\"") + prout(_(" hold out only until stardate %d.\"") % (int(scheduled(FCDBAS)))) if cancelrest(): return elif evcode == FSCDBAS: # Supercommander destroys base