Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7185 | siemargl | 1 | #include "sst.h" |
2 | |||
3 | static void getcd(int, int); |
||
4 | |||
5 | void lmove(void) { |
||
6 | double angle, deltax, deltay, bigger, x, y, |
||
7 | finald, finalx, finaly, stopegy; |
||
8 | int oldquadx, oldquady; |
||
9 | int trbeam = 0, n, l, ix, iy, kink, kinks, iquad; |
||
10 | |||
11 | if (inorbit) { |
||
12 | /* prout("SULU- \"Leaving standard orbit.\""); */ |
||
13 | prout("Сулу- \"Покидаем стандартную орбиту.\""); |
||
14 | inorbit = 0; |
||
15 | } |
||
16 | |||
17 | angle = ((15.0 - direc) * 0.5235988); |
||
18 | deltax = -sin(angle); |
||
19 | deltay = cos(angle); |
||
20 | if (fabs(deltax) > fabs(deltay)) |
||
21 | bigger = fabs(deltax); |
||
22 | else |
||
23 | bigger = fabs(deltay); |
||
24 | |||
25 | deltay /= bigger; |
||
26 | deltax /= bigger; |
||
27 | |||
28 | #ifdef CLOAKING |
||
29 | if (iscloaked && d.date+Time >= future[FTBEAM]) |
||
30 | { /* We can't be tracto beamed if cloaked, so move the event into the future */ |
||
31 | future[FTBEAM] = d.date + Time + |
||
32 | expran(1.5*intime/d.remcom); |
||
33 | } |
||
34 | #endif |
||
35 | |||
36 | /* If tractor beam is to occur, don't move full distance */ |
||
37 | if (d.date+Time >= future[FTBEAM]) { |
||
38 | trbeam = 1; |
||
39 | condit = IHRED; |
||
40 | dist = dist*(future[FTBEAM]-d.date)/Time + 0.1; |
||
41 | Time = future[FTBEAM] - d.date + 1e-5; |
||
42 | } |
||
43 | /* Move within the quadrant */ |
||
44 | quad[sectx][secty] = IHDOT; |
||
45 | x = sectx; |
||
46 | y = secty; |
||
47 | n = 10.0*dist*bigger+0.5; |
||
48 | |||
49 | if (n > 0) { |
||
50 | for (l = 1; l <= n; l++) { |
||
51 | ix = (x += deltax) + 0.5; |
||
52 | iy = (y += deltay) + 0.5; |
||
53 | if (ix < 1 || ix > 10 || iy < 1 || iy > 10) { |
||
54 | /* Leaving quadrant -- allow final enemy attack */ |
||
55 | /* Don't do it if being pushed by Nova */ |
||
56 | if (nenhere != 0 && iattak != 2 |
||
57 | #ifdef CLOAKING |
||
58 | && !iscloaked |
||
59 | #endif |
||
60 | ) { |
||
61 | newcnd(); |
||
62 | for (l = 1; l <= nenhere; l++) { |
||
63 | finald = sqrt((ix-kx[l])*(double)(ix-kx[l]) + |
||
64 | (iy-ky[l])*(double)(iy-ky[l])); |
||
65 | kavgd[l] = 0.5 * (finald+kdist[l]); |
||
66 | } |
||
67 | if (d.galaxy[quadx][quady] != 1000) attack(0); |
||
68 | if (alldone) return; |
||
69 | } |
||
70 | /* compute final position -- new quadrant and sector */ |
||
71 | x = 10*(quadx-1)+sectx; |
||
72 | y = 10*(quady-1)+secty; |
||
73 | ix = x+10.0*dist*bigger*deltax+0.5; |
||
74 | iy = y+10.0*dist*bigger*deltay+0.5; |
||
75 | /* check for edge of galaxy */ |
||
76 | kinks = FALSE; |
||
77 | do { |
||
78 | kink = 0; |
||
79 | if (ix <= 0) { |
||
80 | ix = -ix + 1; |
||
81 | kink = 1; |
||
82 | } |
||
83 | if (iy <= 0) { |
||
84 | iy = -iy + 1; |
||
85 | kink = 1; |
||
86 | } |
||
87 | if (ix > 80) { |
||
88 | ix = 161 - ix; |
||
89 | kink = 1; |
||
90 | } |
||
91 | if (iy > 80) { |
||
92 | iy = 161 - iy; |
||
93 | kink = 1; |
||
94 | } |
||
95 | if (kink) kinks = TRUE; |
||
96 | } while (kink); |
||
97 | |||
98 | if (kinks) { |
||
99 | nkinks += 1; |
||
100 | if (nkinks == 3) { |
||
101 | /* Three strikes -- you're out! */ |
||
102 | finish(FNEG3); |
||
103 | return; |
||
104 | } |
||
105 | /* prout("\nYOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER\n" |
||
106 | "AT THE EDGE OF THE GALAXY. THE THIRD TIME YOU TRY THIS,\n" |
||
107 | "YOU WILL BE DESTROYED.\n"); |
||
108 | */ prout("\nВЫ СДЕЛАЛИ ПОПЫТКУ ПЕРЕСЕЧЬ БАРЬЕР НЕГАТИВНОЙ ЭНЕРГИИ\n" |
||
109 | "НА КРАЮ ГАЛАКТИКИ. ПОСЛЕ ТРЕТЬЕЙ ТАКОЙ ПОПЫТКИ,\n" |
||
110 | "ВЫ БУДЕТЕ УНИЧТОЖЕНЫ.\n"); |
||
111 | } |
||
112 | /* Compute final position in new quadrant */ |
||
113 | if (trbeam) return; /* Don't bother if we are to be beamed */ |
||
114 | oldquadx = quadx; |
||
115 | oldquady = quady; |
||
116 | quadx = (ix+9)/10; |
||
117 | quady = (iy+9)/10; |
||
118 | sectx = ix - 10*(quadx-1); |
||
119 | secty = iy - 10*(quady-1); |
||
120 | if (quadx != oldquadx || quady != oldquady) { |
||
121 | proutn("\nВходим в");/*Entering*/ |
||
122 | cramlc(1, quadx, quady); |
||
123 | } else { |
||
124 | /* prout("(Negative energy barrier disturbs quadrant.)"); */ |
||
125 | prout("(Квадрант нарушает барьер негативной энергии.)"); |
||
126 | } |
||
127 | skip(1); |
||
128 | quad[sectx][secty] = ship; |
||
129 | newqad(0); |
||
130 | return; |
||
131 | } |
||
132 | iquad = quad[ix][iy]; |
||
133 | if (iquad != IHDOT) { |
||
134 | /* object encountered in flight path */ |
||
135 | stopegy = 50.0*dist/Time; |
||
136 | dist=0.1*sqrt((sectx-ix)*(double)(sectx-ix) + |
||
137 | (secty-iy)*(double)(secty-iy)); |
||
138 | switch (iquad) { |
||
139 | case IHT: /* Ram a Tholean */ |
||
140 | case IHK: /* Ram enemy ship */ |
||
141 | case IHC: |
||
142 | case IHS: |
||
143 | case IHR: |
||
144 | sectx = ix; |
||
145 | secty = iy; |
||
146 | ram(0, iquad, sectx, secty); |
||
147 | finalx = sectx; |
||
148 | finaly = secty; |
||
149 | break; |
||
150 | case IHBLANK: |
||
151 | skip(1); |
||
152 | prouts("***ОПАСНОСТЬ! ОПАСНОСТЬ!");/*RED ALERT*/ |
||
153 | skip(1); |
||
154 | proutn("***"); |
||
155 | crmshp(); |
||
156 | proutn(" притягивается черной дырой в точке");/*pulled into black hole at*/ |
||
157 | cramlc(2, ix, iy); |
||
158 | skip(1); |
||
159 | finish(FHOLE); |
||
160 | return; |
||
161 | default: |
||
162 | /* something else */ |
||
163 | skip(1); |
||
164 | crmshp(); |
||
165 | if (iquad == IHWEB) |
||
166 | proutn(" попали в толиансую сеть в точке");/*encounters Tholian web at*/ |
||
167 | else |
||
168 | proutn(" блокированы объектом в точке");/*blocked by object at*/ |
||
169 | cramlc(2, ix,iy); |
||
170 | prout(";"); |
||
171 | proutn("Требуется аварийное торможение ");/*Emergency stop required*/ |
||
172 | cramf(stopegy, 0, 2); |
||
173 | prout(" единиц энергии.");/*units of energy*/ |
||
174 | energy -= stopegy; |
||
175 | finalx = x-deltax+0.5; |
||
176 | sectx = finalx; |
||
177 | finaly = y-deltay+0.5; |
||
178 | secty = finaly; |
||
179 | if (energy <= 0) { |
||
180 | finish(FNRG); |
||
181 | return; |
||
182 | } |
||
183 | break; |
||
184 | } |
||
185 | goto label100; /* sorry! */ /* ACTUALLY BREAK SHOULD WORK HERE */ |
||
186 | } |
||
187 | } |
||
188 | dist = 0.1*sqrt((sectx-ix)*(double)(sectx-ix) + |
||
189 | (secty-iy)*(double)(secty-iy)); |
||
190 | sectx = ix; |
||
191 | secty = iy; |
||
192 | } |
||
193 | finalx = sectx; /* THESE STATEMENTS DO NOTHING USEFUL */ |
||
194 | finaly = secty; |
||
195 | label100: |
||
196 | /* No quadrant change -- compute new avg enemy distances */ |
||
197 | quad[sectx][secty] = ship; |
||
198 | if (nenhere) { |
||
199 | for (l = 1; l <= nenhere; l++) { |
||
200 | finald = sqrt((ix-kx[l])*(double)(ix-kx[l]) + |
||
201 | (iy-ky[l])*(double)(iy-ky[l])); |
||
202 | kavgd[l] = 0.5 * (finald+kdist[l]); |
||
203 | kdist[l] = finald; |
||
204 | } |
||
205 | sortkl(); |
||
206 | if (d.galaxy[quadx][quady] != 1000 && iattak == 0) |
||
207 | attack(0); |
||
208 | for (l = 1 ; l <= nenhere; l++) kavgd[l] = kdist[l]; |
||
209 | } |
||
210 | newcnd(); |
||
211 | iattak = 0; |
||
212 | return; |
||
213 | } |
||
214 | |||
215 | void dock(void) { |
||
216 | chew(); |
||
217 | if (condit == IHDOCKED) { |
||
218 | prout("Вы уже в доке.");/*Already docked*/ |
||
219 | return; |
||
220 | } |
||
221 | if (inorbit) { |
||
222 | /* prout("You must first leave standard orbit."); */ |
||
223 | prout("Сначала покиньте стандартную орбиту."); |
||
224 | return; |
||
225 | } |
||
226 | if (basex==0 || abs(sectx-basex) > 1 || abs(secty-basey) > 1) { |
||
227 | crmshp(); |
||
228 | prout(" не рядом со станцией.");/*not adjacent to base*/ |
||
229 | return; |
||
230 | } |
||
231 | #ifdef CLOAKING |
||
232 | if (iscloaked) { |
||
233 | prout("Невозможна стыковка в состоянии невидимости.");/*You cannot dock while cloaked*/ |
||
234 | return; |
||
235 | } |
||
236 | #endif |
||
237 | condit = IHDOCKED; |
||
238 | prout("Стыковка выполнена.");/*Docked*/ |
||
239 | if (energy < inenrg) energy = inenrg; |
||
240 | shield = inshld; |
||
241 | torps = intorps; |
||
242 | lsupres = inlsr; |
||
243 | #ifdef CAPTURE |
||
244 | if (brigcapacity-brigfree > 0) |
||
245 | { |
||
246 | /* printf("%d captured Klingons transferred to base.\n", brigcapacity-brigfree); */ |
||
247 | printf("%d пленных клингонов переправлено на станцию.\n", brigcapacity-brigfree); |
||
248 | kcaptured += brigcapacity-brigfree; |
||
249 | brigfree = brigcapacity; |
||
250 | } |
||
251 | #endif |
||
252 | if (stdamtim != 1e30 && |
||
253 | (future[FCDBAS] < 1e30 || isatb == 1) && iseenit == 0) { |
||
254 | /* get attack report from base */ |
||
255 | /* prout("Lt. Uhura- \"Captain, an important message from the starbase:\""); */ |
||
256 | prout("Лейтенант Ухура- \"Капитан, срочное сообщение со станции:\""); |
||
257 | attakreport(); |
||
258 | iseenit = 1; |
||
259 | } |
||
260 | } |
||
261 | |||
262 | static void getcd(int isprobe, int akey) { |
||
263 | /* This program originally required input in terms of a (clock) |
||
264 | direction and distance. Somewhere in history, it was changed to |
||
265 | cartesian coordinates. So we need to convert. I think |
||
266 | "manual" input should still be done this way -- it's a real |
||
267 | pain if the computer isn't working! Manual mode is still confusing |
||
268 | because it involves giving x and y motions, yet the coordinates |
||
269 | are always displayed y - x, where +y is downward! */ |
||
270 | |||
271 | |||
272 | int irowq=quadx, icolq=quady, irows, icols, itemp=0, iprompt=0, key; |
||
273 | double xi, xj, xk, xl; |
||
274 | double deltax, deltay; |
||
275 | int automatic = -1; |
||
276 | |||
277 | /* Get course direction and distance. If user types bad values, return |
||
278 | with DIREC = -1.0. */ |
||
279 | |||
280 | direc = -1.0; |
||
281 | |||
282 | if (landed == 1 && !isprobe) { |
||
283 | /* prout("Dummy! You can't leave standard orbit until you"); |
||
284 | proutn("are back aboard the "); |
||
285 | */ prout("Болван! Невозножно покинуть стандартую орбиту"); |
||
286 | proutn("пока Вы не сядете на борт "); |
||
287 | crmshp(); |
||
288 | prout("."); |
||
289 | chew(); |
||
290 | return; |
||
291 | } |
||
292 | while (automatic == -1) { |
||
293 | if (damage[DCOMPTR]) { |
||
294 | if (isprobe) |
||
295 | /* prout("Computer damaged; manual navigation only"); */ |
||
296 | prout("Компьютер поврежден; только ручная навигация"); |
||
297 | else |
||
298 | /* prout("Computer damaged; manual movement only"); */ |
||
299 | prout("Компьютер поврежден; только перемещение вручную"); |
||
300 | chew(); |
||
301 | automatic = 0; |
||
302 | key = IHEOL; |
||
303 | break; |
||
304 | } |
||
305 | if (isprobe && akey != -1) { |
||
306 | /* For probe launch, use pre-scaned value first time */ |
||
307 | key = akey; |
||
308 | akey = -1; |
||
309 | } |
||
310 | else |
||
311 | key = scan(); |
||
312 | |||
313 | if (key == IHEOL) { |
||
314 | /* proutn("Manual or automatic- "); */ |
||
315 | proutn("Ручной (manual) or Автоматический (automatic)- "); |
||
316 | iprompt = 1; |
||
317 | chew(); |
||
318 | } |
||
319 | else if (key == IHALPHA) { |
||
320 | if (isit("manual")) { |
||
321 | automatic =0; |
||
322 | key = scan(); |
||
323 | break; |
||
324 | } |
||
325 | else if (isit("automatic")) { |
||
326 | automatic = 1; |
||
327 | key = scan(); |
||
328 | break; |
||
329 | } |
||
330 | else { |
||
331 | huh(); |
||
332 | chew(); |
||
333 | return; |
||
334 | } |
||
335 | } |
||
336 | else { /* numeric */ |
||
337 | if (isprobe) |
||
338 | /* prout("(Manual navigation assumed.)"); */ |
||
339 | prout("(Включена ручная навигация.)"); |
||
340 | else |
||
341 | /* prout("(Manual movement assumed.)"); */ |
||
342 | prout("(Включено ручное перемещение.)"); |
||
343 | automatic = 0; |
||
344 | break; |
||
345 | } |
||
346 | } |
||
347 | |||
348 | if (automatic) { |
||
349 | while (key == IHEOL) { |
||
350 | if (isprobe) |
||
351 | /* proutn("Target quadrant or quadrant§or- "); */ |
||
352 | proutn("Направление: квадрант или квадрант&сектор- "); |
||
353 | else |
||
354 | /* proutn("Destination sector or quadrant§or- "); */ |
||
355 | proutn("Точка назначения: квадрант или квадрант&сектор- "); |
||
356 | chew(); |
||
357 | iprompt = 1; |
||
358 | key = scan(); |
||
359 | } |
||
360 | |||
361 | if (key != IHREAL) { |
||
362 | huh(); |
||
363 | return; |
||
364 | } |
||
365 | xi = aaitem; |
||
366 | key = scan(); |
||
367 | if (key != IHREAL){ |
||
368 | huh(); |
||
369 | return; |
||
370 | } |
||
371 | xj = aaitem; |
||
372 | key = scan(); |
||
373 | if (key == IHREAL) { |
||
374 | /* both quadrant and sector specified */ |
||
375 | xk = aaitem; |
||
376 | key = scan(); |
||
377 | if (key != IHREAL) { |
||
378 | huh(); |
||
379 | return; |
||
380 | } |
||
381 | xl = aaitem; |
||
382 | |||
383 | irowq = xi + 0.5; |
||
384 | icolq = xj + 0.5; |
||
385 | irows = xk + 0.5; |
||
386 | icols = xl + 0.5; |
||
387 | } |
||
388 | else { |
||
389 | if (isprobe) { |
||
390 | /* only quadrant specified -- go to center of dest quad */ |
||
391 | irowq = xi + 0.5; |
||
392 | icolq = xj + 0.5; |
||
393 | irows = icols = 5; |
||
394 | } |
||
395 | else { |
||
396 | irows = xi + 0.5; |
||
397 | icols = xj + 0.5; |
||
398 | } |
||
399 | itemp = 1; |
||
400 | } |
||
401 | if (irowq<1 || irowq > 8 || icolq<1 || icolq > 8 || |
||
402 | irows<1 || irows > 10 || icols<1 || icols > 10) { |
||
403 | huh(); |
||
404 | return; |
||
405 | } |
||
406 | skip(1); |
||
407 | if (!isprobe) { |
||
408 | if (itemp) { |
||
409 | if (iprompt) { |
||
410 | /* proutn("Helmsman Sulu- \"Course locked in for"); */ |
||
411 | proutn("Рулевой Сулу- \"Курс проложен для"); |
||
412 | cramlc(2, irows, icols); |
||
413 | prout(".\""); |
||
414 | } |
||
415 | } |
||
416 | /* else prout("Ensign Chekov- \"Course laid in, Captain.\""); */ |
||
417 | else prout("Мичман Чехов- \"Курс готов, Капитан.\""); |
||
418 | } |
||
419 | deltax = icolq - quady + 0.1*(icols-secty); |
||
420 | deltay = quadx - irowq + 0.1*(sectx-irows); |
||
421 | } |
||
422 | else { /* manual */ |
||
423 | while (key == IHEOL) { |
||
424 | /* proutn("X and Y displacements- "); */ |
||
425 | proutn("X и Y смещения- "); |
||
426 | chew(); |
||
427 | iprompt = 1; |
||
428 | key = scan(); |
||
429 | } |
||
430 | itemp = 2; |
||
431 | if (key != IHREAL) { |
||
432 | huh(); |
||
433 | return; |
||
434 | } |
||
435 | deltax = aaitem; |
||
436 | key = scan(); |
||
437 | if (key == IHEOL) { |
||
438 | deltay = 0.0; |
||
439 | } else if (key != IHREAL) { |
||
440 | huh(); |
||
441 | return; |
||
442 | } else { |
||
443 | deltay = aaitem; |
||
444 | } |
||
445 | |||
446 | if (coordfixed) { |
||
447 | double temp = deltax; |
||
448 | deltax = deltay; |
||
449 | deltay = -temp; |
||
450 | } |
||
451 | } |
||
452 | /* Check for zero movement */ |
||
453 | if (deltax == 0 && deltay == 0) { |
||
454 | chew(); |
||
455 | return; |
||
456 | } |
||
457 | if (itemp == 2 && !isprobe) { |
||
458 | skip(1); |
||
459 | /* prout("Helmsman Sulu- \"Aye, Sir.\""); */ |
||
460 | prout("Рулевой Сулу- \"Так точно, Сэр.\""); |
||
461 | } |
||
462 | dist = sqrt(deltax*deltax + deltay*deltay); |
||
463 | direc = atan2(deltax, deltay)*1.90985932; |
||
464 | if (direc < 0.0) direc += 12.0; |
||
465 | chew(); |
||
466 | return; |
||
467 | |||
468 | } |
||
469 | |||
470 | |||
471 | |||
472 | void impuls(void) { |
||
473 | double power; |
||
474 | |||
475 | ididit = 0; |
||
476 | if (damage[DIMPULS]) { |
||
477 | chew(); |
||
478 | skip(1); |
||
479 | /* prout("Engineer Scott- \"The impulse engines are damaged, Sir.\""); */ |
||
480 | prout("Инженер Скотт- \"Импульсные двигатели повреждены, Сэр.\""); |
||
481 | return; |
||
482 | } |
||
483 | |||
484 | if (energy > 30.0) { |
||
485 | getcd(FALSE, 0); |
||
486 | if (direc == -1.0) return; |
||
487 | power = 20.0 + 100.0*dist; |
||
488 | } |
||
489 | else |
||
490 | power = 30.0; |
||
491 | |||
492 | if (power >= energy) { |
||
493 | /* Insufficient power for trip */ |
||
494 | skip(1); |
||
495 | /* prout("First Officer Spock- \"Captain, the impulse engines"); |
||
496 | prout("require 20.0 units to engage, plus 100.0 units per"); |
||
497 | */ prout("Первый офицер Спок- \"Капитан, импульсные двигатели"); |
||
498 | prout("потребляют 20.0 единиц на разогрев, плюс 100.0 единиц на"); |
||
499 | if (energy > 30) { |
||
500 | /* proutn("quadrant. We can go, therefore, a maximum of "); */ |
||
501 | proutn("квадрант. Следовательно, мы можем пролететь "); |
||
502 | cramf(0.01 * (energy-20.0)-0.05, 0, 1); |
||
503 | prout(" квадрантов.\"");/*quadrants*/ |
||
504 | } |
||
505 | else { |
||
506 | /* prout("quadrant. They are, therefore, useless.\""); */ |
||
507 | prout("квадрант. Следовательно, они сейчас бесполезны.\""); |
||
508 | } |
||
509 | chew(); |
||
510 | return; |
||
511 | } |
||
512 | /* Make sure enough time is left for the trip */ |
||
513 | Time = dist/0.095; |
||
514 | if (Time >= d.remtime) { |
||
515 | /* prout("First Officer Spock- \"Captain, our speed under impulse"); |
||
516 | prout("power is only 0.95 sectors per stardate. Are you sure"); |
||
517 | prout("we dare spend the time?\""); |
||
518 | */ prout("Первый офицер Спок- \"Капитан, наша скорость на импульсной"); |
||
519 | prout("тяге составляет 0.95 секторов в год. Вы уверены"); |
||
520 | prout("что мы можем потерять столько времени?\""); |
||
521 | if (ja() == 0) { Time = 0.0; return;} |
||
522 | } |
||
523 | /* Activate impulse engines and pay the cost */ |
||
524 | lmove(); |
||
525 | ididit = 1; |
||
526 | if (alldone) return; |
||
527 | power = 20.0 + 100.0*dist; |
||
528 | energy -= power; |
||
529 | // Time = dist/0.095; Don't recalculate because lmove may have |
||
530 | // adjusted it for tractor beaming |
||
531 | if (energy <= 0) finish(FNRG); |
||
532 | return; |
||
533 | } |
||
534 | |||
535 | |||
536 | void warp(int i) { |
||
537 | int blooey=0, twarp=0, iwarp; |
||
538 | double power; |
||
539 | |||
540 | if (i!=2) { /* Not WARPX entry */ |
||
541 | ididit = 0; |
||
542 | #ifdef CLOAKING |
||
543 | if (iscloaked) { |
||
544 | chew(); |
||
545 | skip(1); |
||
546 | /* prout("Engineer Scott- \"The warp engines can better not be used while cloaked, Sir.\""); */ |
||
547 | prout("Инженер Скотт- \"Варп-двигатели лучше не использовать из состояния маскировки, Сэр.\""); |
||
548 | return; |
||
549 | } |
||
550 | #endif |
||
551 | if (damage[DWARPEN] > 10.0) { |
||
552 | chew(); |
||
553 | skip(1); |
||
554 | /* prout("Engineer Scott- \"The warp engines are damaged, Sir.\""); // Was "Impulse" 10/2013 */ |
||
555 | prout("Инженер Скотт- \"Варп-двигатели повреждены, Сэр.\""); // Was "Impulse" 10/2013 |
||
556 | return; |
||
557 | } |
||
558 | if (damage[DWARPEN] > 0.0 && warpfac > 4.0) { |
||
559 | chew(); |
||
560 | skip(1); |
||
561 | prout("Инженер Скотт- \"Простите, Капитан. Пока мы не починимся,"); |
||
562 | prout(" я смогу обеспечить только варп 4.\""); |
||
563 | return; |
||
564 | } |
||
565 | |||
566 | /* Read in course and distance */ |
||
567 | getcd(FALSE, 0); |
||
568 | if (direc == -1.0) return; |
||
569 | |||
570 | /* Make sure starship has enough energy for the trip */ |
||
571 | power = (dist+0.05)*warpfac*warpfac*warpfac*(shldup+1); |
||
572 | |||
573 | |||
574 | if (power >= energy) { |
||
575 | /* Insufficient power for trip */ |
||
576 | ididit = 0; |
||
577 | skip(1); |
||
578 | /* prout("Engineering to bridge--"); */ |
||
579 | prout("Инженерный докладывает--"); |
||
580 | if (shldup==0 || 0.5*power > energy) { |
||
581 | iwarp = pow((energy/(dist+0.05)), 0.333333333); |
||
582 | if (iwarp <= 0) { |
||
583 | /* prout("We can't do it, Captain. We haven't the energy."); */ |
||
584 | prout("Мы не можем сделать это, Капитан. У нас не хватает энергии."); |
||
585 | } |
||
586 | else { |
||
587 | /* proutn("We haven't the energy, but we could do it at warp "); */ |
||
588 | proutn("У нас недостаточно энергии, но мы сможем сделать это в варпе "); |
||
589 | crami(iwarp, 1); |
||
590 | if (shldup) |
||
591 | /* prout(",\nif you'll lower the shields."); */ |
||
592 | prout(",\nесли отключить силовые щиты."); |
||
593 | else |
||
594 | prout("."); |
||
595 | } |
||
596 | } |
||
597 | else |
||
598 | /* prout("We haven't the energy to go that far with the shields up."); */ |
||
599 | prout("Недостаточно энергии для такой дальности полета при поднятых щитах."); |
||
600 | return; |
||
601 | } |
||
602 | |||
603 | /* Make sure enough time is left for the trip */ |
||
604 | Time = 10.0*dist/wfacsq; |
||
605 | if (Time >= 0.8*d.remtime) { |
||
606 | skip(1); |
||
607 | /* prout("First Officer Spock- \"Captain, I compute that such"); |
||
608 | proutn(" a trip would require approximately "); |
||
609 | cramf(100.0*Time/d.remtime, 0, 2); |
||
610 | prout(" percent of our"); |
||
611 | prout(" remaining time. Are you sure this is wise?\""); |
||
612 | */ prout("Первый офицер Спок- \"Капитан, я рассчитал, что этот маневр"); |
||
613 | proutn(" потребует приблизительно "); |
||
614 | cramf(100.0*Time/d.remtime, 0, 2); |
||
615 | prout(" процентов нашего"); |
||
616 | prout(" оставшегося времени. Вы уверены, что это мудро?\""); |
||
617 | if (ja() == 0) { Time = 0.0; return;} |
||
618 | } |
||
619 | } |
||
620 | /* Entry WARPX */ |
||
621 | if (warpfac > 6.0) { |
||
622 | /* Decide if engine damage will occur */ |
||
623 | double prob = dist*(6.0-warpfac)*(6.0-warpfac)/66.666666666; |
||
624 | if (prob > Rand()) { |
||
625 | blooey = 1; |
||
626 | dist = Rand()*dist; |
||
627 | } |
||
628 | /* Decide if time warp will occur */ |
||
629 | if (0.5*dist*pow(7.0,warpfac-10.0) > Rand()) twarp=1; |
||
630 | #ifdef DEBUG |
||
631 | if (idebug &&warpfac==10 && twarp==0) { |
||
632 | blooey=0; |
||
633 | proutn("Force time warp? "); |
||
634 | if (ja()==1) twarp=1; |
||
635 | } |
||
636 | #endif |
||
637 | if (blooey || twarp) { |
||
638 | /* If time warp or engine damage, check path */ |
||
639 | /* If it is obstructed, don't do warp or damage */ |
||
640 | double angle = ((15.0-direc)*0.5235998); |
||
641 | double deltax = -sin(angle); |
||
642 | double deltay = cos(angle); |
||
643 | double bigger, x, y; |
||
644 | int n, l, ix, iy; |
||
645 | if (fabs(deltax) > fabs(deltay)) |
||
646 | bigger = fabs(deltax); |
||
647 | else |
||
648 | bigger = fabs(deltay); |
||
649 | |||
650 | deltax /= bigger; |
||
651 | deltay /= bigger; |
||
652 | n = 10.0 * dist * bigger +0.5; |
||
653 | x = sectx; |
||
654 | y = secty; |
||
655 | for (l = 1; l <= n; l++) { |
||
656 | x += deltax; |
||
657 | ix = x + 0.5; |
||
658 | if (ix < 1 || ix > 10) break; |
||
659 | y += deltay; |
||
660 | iy = y +0.5; |
||
661 | if (iy < 1 || iy > 10) break; |
||
662 | if (quad[ix][iy] != IHDOT) { |
||
663 | blooey = 0; |
||
664 | twarp = 0; |
||
665 | } |
||
666 | } |
||
667 | } |
||
668 | } |
||
669 | |||
670 | |||
671 | /* Activate Warp Engines and pay the cost */ |
||
672 | lmove(); |
||
673 | if (alldone) return; |
||
674 | energy -= dist*warpfac*warpfac*warpfac*(shldup+1); |
||
675 | if (energy <= 0) finish(FNRG); |
||
676 | Time = 10.0*dist/wfacsq; |
||
677 | if (twarp) timwrp(); |
||
678 | if (blooey) { |
||
679 | damage[DWARPEN] = damfac*(3.0*Rand()+1.0); |
||
680 | skip(1); |
||
681 | /* prout("Engineering to bridge--"); |
||
682 | prout(" Scott here. The warp engines are damaged."); |
||
683 | prout(" We'll have to reduce speed to warp 4."); |
||
684 | */ prout("Инженерный докладывает--"); |
||
685 | prout(" Это Скотт. Варп-двигатели повреждены."); |
||
686 | prout(" Нам придется ограничиться скоростью варпа 4."); |
||
687 | } |
||
688 | ididit = 1; |
||
689 | return; |
||
690 | } |
||
691 | |||
692 | |||
693 | |||
694 | void setwrp(void) { |
||
695 | int key; |
||
696 | double oldfac; |
||
697 | |||
698 | while ((key=scan()) == IHEOL) { |
||
699 | chew(); |
||
700 | proutn("Варп фактор-");/*Warp factor*/ |
||
701 | } |
||
702 | chew(); |
||
703 | if (key != IHREAL) { |
||
704 | huh(); |
||
705 | return; |
||
706 | } |
||
707 | if (damage[DWARPEN] > 10.0) { |
||
708 | prout("Варп-двигатели не функционируют.");/*Warp engines inoperative*/ |
||
709 | return; |
||
710 | } |
||
711 | if (damage[DWARPEN] > 0.0 && aaitem > 4.0) { |
||
712 | /* prout("Engineer Scott- \"I'm doing my best, Captain,\n" |
||
713 | " but right now we can only go warp 4.\""); |
||
714 | */ prout("Инженер Скотт- \"Я делаю что могу, Капитан,\n" |
||
715 | " но пока что мы ограничены варп фактором 4.\""); |
||
716 | return; |
||
717 | } |
||
718 | if (aaitem > 10.0) { |
||
719 | /* prout("Helmsman Sulu- \"Our top speed is warp 10, Captain.\""); */ |
||
720 | prout("Рулевой Сулу- \"Сейчас мы сможем выжать варп 10, Капитан.\""); |
||
721 | return; |
||
722 | } |
||
723 | if (aaitem < 1.0) { |
||
724 | /* prout("Helmsman Sulu- \"We can't go below warp 1, Captain.\""); */ |
||
725 | prout("Рулевой Сулу- \"Мы не можем задать варп-скорость меньше 1, Captain.\""); |
||
726 | return; |
||
727 | } |
||
728 | oldfac = warpfac; |
||
729 | warpfac = aaitem; |
||
730 | wfacsq=warpfac*warpfac; |
||
731 | if (warpfac <= oldfac || warpfac <= 6.0) { |
||
732 | proutn("Рулевой Сулу-\"Варп-фактор ");/*Helmsman Sulu- \"Warp factor*/ |
||
733 | cramf(warpfac, 0, 1); |
||
734 | prout(", Капитан.\"");/*Captain*/ |
||
735 | return; |
||
736 | } |
||
737 | if (warpfac < 8.00) { |
||
738 | /* prout("Engineer Scott- \"Aye, but our maximum safe speed is warp 6.\""); */ |
||
739 | prout("Инженер Скотт- \"Так точно, но сейчас максимальная безопасная варп-скорость 6.\""); |
||
740 | return; |
||
741 | } |
||
742 | if (warpfac == 10.0) { |
||
743 | /* prout("Engineer Scott- \"Aye, Captain, we'll try it.\""); */ |
||
744 | prout("Инженер Скотт- \"Так точно, Капитан, мы сможем это.\""); |
||
745 | return; |
||
746 | } |
||
747 | /* prout("Engineer Scott- \"Aye, Captain, but our engines may not take it.\""); */ |
||
748 | prout("Engineer Scott- \"Так точно, Капитан, но наши двигатели могуть не потянуть.\""); |
||
749 | return; |
||
750 | } |
||
751 | |||
752 | void atover(int igrab) { |
||
753 | double power, distreq; |
||
754 | |||
755 | chew(); |
||
756 | /* is captain on planet? */ |
||
757 | if (landed==1) { |
||
758 | if (damage[DTRANSP]) { |
||
759 | finish(FPNOVA); |
||
760 | return; |
||
761 | } |
||
762 | /* prout("Scotty rushes to the transporter controls."); */ |
||
763 | prout("Скотти рванул к управлению транспортатором."); |
||
764 | if (shldup) { |
||
765 | /* prout("But with the shields up it's hopeless."); */ |
||
766 | prout("Но с поднятыми щитами все было бесполезно."); |
||
767 | finish(FPNOVA); |
||
768 | } |
||
769 | /* prouts("His desperate attempt to rescue you . . ."); */ |
||
770 | prouts("Его отчаянная попытка спасения Вас . . ."); |
||
771 | if (Rand() <= 0.5) { |
||
772 | prout("провалилась.");/*fails*/ |
||
773 | finish(FPNOVA); |
||
774 | return; |
||
775 | } |
||
776 | prout("УДАЛАСЬ!");/*SUCCEEDS*/ |
||
777 | if (imine) { |
||
778 | imine = 0; |
||
779 | proutn("Добытые кристаллы ");/*The crystals mined were*/ |
||
780 | if (Rand() <= 0.25) { |
||
781 | prout("потеряны.");/*lost*/ |
||
782 | } |
||
783 | else { |
||
784 | prout("спасены.");/*saved*/ |
||
785 | icrystl = 1; |
||
786 | } |
||
787 | } |
||
788 | } |
||
789 | if (igrab) return; |
||
790 | |||
791 | /* Check to see if captain in shuttle craft */ |
||
792 | if (icraft) finish(FSTRACTOR); |
||
793 | if (alldone) return; |
||
794 | |||
795 | /* Inform captain of attempt to reach safety */ |
||
796 | skip(1); |
||
797 | do { |
||
798 | if (justin) { |
||
799 | /* prouts("***RED ALERT! RED ALERT!"); |
||
800 | skip(1); |
||
801 | proutn("The "); |
||
802 | crmshp(); |
||
803 | prout(" has stopped in a quadrant containing"); |
||
804 | prouts(" a supernova."); |
||
805 | skip(2); |
||
806 | */ prouts("***ОПАСНОСТЬ! ОПАСНОСТЬ!"); |
||
807 | skip(1); |
||
808 | proutn("Корабль "); |
||
809 | crmshp(); |
||
810 | prout(" остановился в квадрате со"); |
||
811 | prouts(" сверхновой."); |
||
812 | skip(2); |
||
813 | } |
||
814 | /* proutn("***Emergency automatic override attempts to hurl "); */ |
||
815 | proutn("***Автоматическое срабатывание систем безопасности пытается вывести"); |
||
816 | crmshp(); |
||
817 | skip(1); |
||
818 | prout("из квадранта.");/*safely out of quadrant*/ |
||
819 | starch[quadx][quady] = damage[DRADIO] > 0.0 ? d.galaxy[quadx][quady]+1000:1; |
||
820 | |||
821 | /* Try to use warp engines */ |
||
822 | if (damage[DWARPEN]) { |
||
823 | skip(1); |
||
824 | prout("Варп-двигатели повреждены.");/*Warp engines damaged*/ |
||
825 | finish(FSNOVAED); |
||
826 | return; |
||
827 | } |
||
828 | warpfac = 6.0+2.0*Rand(); |
||
829 | wfacsq = warpfac * warpfac; |
||
830 | proutn("Варп-фактор установлен в ");/*Warp factor set to*/ |
||
831 | cramf(warpfac, 1, 1); |
||
832 | skip(1); |
||
833 | power = 0.75*energy; |
||
834 | dist = power/(warpfac*warpfac*warpfac*(shldup+1)); |
||
835 | distreq = 1.4142+Rand(); |
||
836 | if (distreq < dist) dist = distreq; |
||
837 | Time = 10.0*dist/wfacsq; |
||
838 | direc = 12.0*Rand(); /* How dumb! */ |
||
839 | justin = 0; |
||
840 | inorbit = 0; |
||
841 | warp(2); |
||
842 | if (justin == 0) { |
||
843 | /* This is bad news, we didn't leave quadrant. */ |
||
844 | if (alldone) return; |
||
845 | skip(1); |
||
846 | /* prout("Insufficient energy to leave quadrant."); */ |
||
847 | prout("Недостаточно энергии, чтобы улететь из квадранта."); |
||
848 | finish(FSNOVAED); |
||
849 | return; |
||
850 | } |
||
851 | /* Repeat if another snova */ |
||
852 | } while (d.galaxy[quadx][quady] == 1000); |
||
853 | if (d.remkl==0) finish(FWON); /* Snova killed remaining enemy. */ |
||
854 | } |
||
855 | |||
856 | void timwrp() { |
||
857 | int l, ll, gotit; |
||
858 | prout("***ВАРП ВО ВРЕМЕНИ.");/*TIME WARP ENTERED*/ |
||
859 | if (d.snap && Rand() < 0.5) { |
||
860 | /* Go back in time */ |
||
861 | /* proutn("You are traveling backwards in time "); */ |
||
862 | proutn("Вы провалились назад во времени на "); |
||
863 | cramf(d.date-snapsht.date, 0, 2); |
||
864 | prout(" звездных лет.");/*stardates*/ |
||
865 | d = snapsht; |
||
866 | d.snap = 0; |
||
867 | if (d.remcom) { |
||
868 | future[FTBEAM] = d.date + expran(intime/d.remcom); |
||
869 | future[FBATTAK] = d.date + expran(0.3*intime); |
||
870 | } |
||
871 | future[FSNOVA] = d.date + expran(0.5*intime); |
||
872 | future[FSNAP] = d.date +expran(0.25*d.remtime); /* next snapshot will |
||
873 | be sooner */ |
||
874 | if (d.nscrem) future[FSCMOVE] = 0.2777; |
||
875 | isatb = 0; |
||
876 | future[FCDBAS] = future[FSCDBAS] = 1e30; |
||
877 | batx = baty = 0; |
||
878 | |||
879 | /* Make sure Galileo is consistant -- Snapshot may have been taken |
||
880 | when on planet, which would give us two Galileos! */ |
||
881 | gotit = 0; |
||
882 | for (l = 1; l <= inplan; l++) { |
||
883 | if (d.plnets[l].known == 2) { |
||
884 | gotit = 1; |
||
885 | if (iscraft==1 && ship==IHE) { |
||
886 | /* prout("Checkov- \"Security reports the Galileo has disappeared, Sir!"); */ |
||
887 | prout("Чехов- \"Служба безопасности докладывает - Галилео исчез, Сэр!"); |
||
888 | iscraft = 0; |
||
889 | } |
||
890 | } |
||
891 | } |
||
892 | /* Likewise, if in the original time the Galileo was abandoned, but |
||
893 | was on ship earlier, it would have vanished -- lets restore it */ |
||
894 | if (iscraft==0 && gotit==0 && damage[DSHUTTL] >= 0.0) { |
||
895 | /* prout("Checkov- \"Security reports the Galileo has reappeared in the dock!\""); */ |
||
896 | prout("Чеков- \"Служба безопасности докладывает - Галилео снова возник в доке!\""); |
||
897 | iscraft = 1; |
||
898 | } |
||
899 | |||
900 | /* Revert star chart to earlier era, if it was known then*/ |
||
901 | if (damage[DRADIO]==0.0 || stdamtim > d.date) { |
||
902 | for (l = 1; l <= 8; l++) |
||
903 | for (ll = 1; ll <= 8; ll++) |
||
904 | if (starch[l][ll] > 1) |
||
905 | starch[l][ll]=damage[DRADIO]>0.0 ? d.galaxy[l][ll]+1000 :1; |
||
906 | /* prout("Spock has reconstructed a correct star chart from memory"); */ |
||
907 | prout("Спок восстановил звездную карту по памяти"); |
||
908 | if (damage[DRADIO] > 0.0) stdamtim = d.date; |
||
909 | } |
||
910 | } |
||
911 | else { |
||
912 | /* Go forward in time */ |
||
913 | Time = -0.5*intime*log(Rand()); |
||
914 | /* proutn("You are traveling forward in time "); */ |
||
915 | proutn("Вы провалились вперед по времени на "); |
||
916 | cramf(Time, 1, 2); |
||
917 | prout(" звездных лет.");/*stardates*/ |
||
918 | /* cheat to make sure no tractor beams occur during time warp */ |
||
919 | future[FTBEAM] += Time; |
||
920 | damage[DRADIO] += Time; |
||
921 | } |
||
922 | newqad(0); |
||
923 | } |
||
924 | |||
925 | void probe(void) { |
||
926 | double angle, bigger; |
||
927 | int key; |
||
928 | /* New code to launch a deep space probe */ |
||
929 | if (nprobes == 0) { |
||
930 | chew(); |
||
931 | skip(1); |
||
932 | if (ship == IHE) |
||
933 | /* prout("Engineer Scott- \"We have no more deep space probes, Sir.\""); */ |
||
934 | prout("Инженер Скотт- \"У нас закончились сканирующие зонды, Сэр.\""); |
||
935 | else |
||
936 | /* prout("Ye Faerie Queene has no deep space probes."); */ |
||
937 | prout("На Королеве Фей нет сканирующих зондов."); |
||
938 | return; |
||
939 | } |
||
940 | if (damage[DDSP] != 0.0) { |
||
941 | chew(); |
||
942 | skip(1); |
||
943 | /* prout("Engineer Scott- \"The probe launcher is damaged, Sir.\""); */ |
||
944 | prout("Инженер Скотт- \"Пусковая установка зондов повреждена, Сэр.\""); |
||
945 | return; |
||
946 | } |
||
947 | if (future[FDSPROB] != 1e30) { |
||
948 | chew(); |
||
949 | skip(1); |
||
950 | if (REPORTS) { |
||
951 | /* prout("Uhura- \"The previous probe is still reporting data, Sir.\""); */ |
||
952 | prout("Ухура- \"Ранее запущенные зонды еще работают, Сэр.\""); |
||
953 | } else { |
||
954 | /* prout("Spock- \"Records show the previous probe has not yet"); |
||
955 | prout(" reached its destination.\""); |
||
956 | */ prout("Спок- \"Судя по журналу, запущенные зонды"); |
||
957 | prout(" еще не долетели.\""); |
||
958 | } |
||
959 | return; |
||
960 | } |
||
961 | key = scan(); |
||
962 | |||
963 | if (key == IHEOL) { |
||
964 | /* slow mode, so let Kirk know how many probes there are left */ |
||
965 | crami(nprobes,1); |
||
966 | /* prout(nprobes==1 ? " probe left." : " probes left."); |
||
967 | proutn("Are you sure you want to fire a probe? "); |
||
968 | */ prout(nprobes==1 ? " зонд остался." : " зондов осталось."); |
||
969 | proutn("Вы уверены, что хотите запустить зонд? "); |
||
970 | if (ja()==0) return; |
||
971 | } |
||
972 | |||
973 | isarmed = FALSE; |
||
974 | if (key == IHALPHA && strcmp(citem,"armed") == 0) { |
||
975 | isarmed = TRUE; |
||
976 | key = scan(); |
||
977 | } |
||
978 | else if (key == IHEOL) { |
||
979 | proutn("Зарядить боеголовку NOVAMAX?");/*Arm NOVAMAX warhead*/ |
||
980 | isarmed = ja(); |
||
981 | } |
||
982 | getcd(TRUE, key); |
||
983 | if (direc == -1.0) return; |
||
984 | nprobes--; |
||
985 | angle = ((15.0 - direc) * 0.5235988); |
||
986 | probeinx = -sin(angle); |
||
987 | probeiny = cos(angle); |
||
988 | if (fabs(probeinx) > fabs(probeiny)) |
||
989 | bigger = fabs(probeinx); |
||
990 | else |
||
991 | bigger = fabs(probeiny); |
||
992 | |||
993 | probeiny /= bigger; |
||
994 | probeinx /= bigger; |
||
995 | proben = 10.0*dist*bigger +0.5; |
||
996 | probex = quadx*10 + sectx - 1; // We will use better packing than original |
||
997 | probey = quady*10 + secty - 1; |
||
998 | probecx = quadx; |
||
999 | probecy = quady; |
||
1000 | future[FDSPROB] = d.date + 0.01; // Time to move one sector |
||
1001 | /* prout("Ensign Chekov- \"The deep space probe is launched, Captain.\""); */ |
||
1002 | prout("Мичман Чехов- \"Зонд дальнего сканирования запущен, Капитан.\""); |
||
1003 | return; |
||
1004 | } |
||
1005 | |||
1006 | void help(void) { |
||
1007 | /* There's more than one way to move in this game! */ |
||
1008 | double ddist, xdist, probf; |
||
1009 | int line, l, ix, iy; |
||
1010 | |||
1011 | chew(); |
||
1012 | /* Test for conditions which prevent calling for help */ |
||
1013 | if (condit == IHDOCKED) { |
||
1014 | /* prout("Lt. Uhura- \"But Captain, we're already docked.\""); */ |
||
1015 | prout("Лейтенант Ухура- \"Но капитан, мы уже пристыкованы.\""); |
||
1016 | return; |
||
1017 | } |
||
1018 | if (damage[DRADIO] != 0) { |
||
1019 | /* prout("Subspace radio damaged."); */ |
||
1020 | prout("Подпространственное радио повреждено."); |
||
1021 | return; |
||
1022 | } |
||
1023 | if (d.rembase==0) { |
||
1024 | /* prout("Lt. Uhura- \"Captain, I'm not getting any response from Starbase.\""); */ |
||
1025 | prout("Лейтенант Ухура- \"Капитан, я не получаю ответа со станции.\""); |
||
1026 | return; |
||
1027 | } |
||
1028 | if (landed == 1) { |
||
1029 | proutn("Вы должны быть на борту ");/*You must be aboard the*/ |
||
1030 | crmshp(); |
||
1031 | prout("."); |
||
1032 | return; |
||
1033 | } |
||
1034 | /* OK -- call for help from nearest starbase */ |
||
1035 | nhelp++; |
||
1036 | if (basex!=0) { |
||
1037 | /* There's one in this quadrant */ |
||
1038 | ddist = sqrt(square(basex-sectx)+square(basey-secty)); |
||
1039 | } |
||
1040 | else { |
||
1041 | ddist = 1e30; |
||
1042 | for (l = 1; l <= d.rembase; l++) { |
||
1043 | xdist=10.0*sqrt(square(d.baseqx[l]-quadx)+square(d.baseqy[l]-quady)); |
||
1044 | if (xdist < ddist) { |
||
1045 | ddist = xdist; |
||
1046 | line = l; |
||
1047 | } |
||
1048 | } |
||
1049 | /* Since starbase not in quadrant, set up new quadrant */ |
||
1050 | quadx = d.baseqx[line]; |
||
1051 | quady = d.baseqy[line]; |
||
1052 | newqad(1); |
||
1053 | } |
||
1054 | /* dematerialize starship */ |
||
1055 | quad[sectx][secty]=IHDOT; |
||
1056 | proutn("Станция в точке");/*Starbase in*/ |
||
1057 | cramlc(1, quadx, quady); |
||
1058 | proutn(" ответила--");/*responds*/ |
||
1059 | crmshp(); |
||
1060 | prout(" дематериализован.");/*dematerializes*/ |
||
1061 | /* Give starbase three chances to rematerialize starship */ |
||
1062 | probf = pow((1.0 - pow(0.98,ddist)), 0.33333333); |
||
1063 | for (l = 1; l <= 3; l++) { |
||
1064 | switch (l) { |
||
1065 | case 1: proutn("1я"); break;/*1st*/ |
||
1066 | case 2: proutn("2я"); break;/*2nd*/ |
||
1067 | case 3: proutn("3я"); break;/*3rd*/ |
||
1068 | } |
||
1069 | proutn(" попытка материализовать обратно ");/*attempt to re-materialize*/ |
||
1070 | crmshp(); |
||
1071 | prouts(" . . . . . "); |
||
1072 | if (Rand() > probf) break; |
||
1073 | prout("провалилась.");/*fails*/ |
||
1074 | } |
||
1075 | if (l > 3) { |
||
1076 | finish(FMATERIALIZE); |
||
1077 | return; |
||
1078 | } |
||
1079 | /* Rematerialization attempt should succeed if can get adj to base */ |
||
1080 | for (l = 1; l <= 5; l++) { |
||
1081 | ix = basex+3.0*Rand()-1; |
||
1082 | iy = basey+3.0*Rand()-1; |
||
1083 | if (ix>=1 && ix<=10 && iy>=1 && iy<=10 && quad[ix][iy]==IHDOT) { |
||
1084 | /* found one -- finish up */ |
||
1085 | prout("удалась.");/*succeeds*/ |
||
1086 | sectx=ix; |
||
1087 | secty=iy; |
||
1088 | quad[ix][iy]=ship; |
||
1089 | dock(); |
||
1090 | skip(1); |
||
1091 | /* prout("Lt. Uhura- \"Captain, we made it!\""); */ |
||
1092 | prout("Лейтенант Ухура- \"Капитан, мы сделали это!\""); |
||
1093 | return; |
||
1094 | } |
||
1095 | } |
||
1096 | finish(FMATERIALIZE); |
||
1097 | return; |
||
1098 | }=10>=10>=>=>>=>=>=>=>>>=>=>>=>=>>=>>>=>=>=>>1>1>1>1>>>=>=>=>=>=>=>>>=> |