home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
GAMES
/
STARSHIP.ARC
/
E2.PRO
< prev
next >
Wrap
Text File
|
1989-09-27
|
11KB
|
393 lines
procedure handfight(localbyte:byte);
begin
roll:=false;
if (crew+10*localbyte)<2 then mndex:=2 else mndex:=crew+10*localbyte;
case random(mndex) of
0: begin
writeln('You and your crew are killed!');
halt;
end;
1: begin
writeln('you are overcome and captured');
surrender;
end;
2..8:
begin
crewloss(random(4)+1);
writeln('several enemy are killed and the rest flee');
morale:=morale+5;
moralebounce:=moralebounce+5;
end;
9..15:
begin
crewloss(random(4)+1);
writeln('several enemy are killed and the rest surrender');
roll:=true;
morale:=morale+5;
moralebounce:=moralebounce+4;
end;
else
begin
writeln('the enemy are all killed.');
roll:=true;
morale:=morale+6;
moralebounce:=moralebounce+3;
end;
end;{case}
end;{handfight}
procedure strikefirst;
begin
if random>0.7 then writeln('Your unexpected attack scatters the enemy')
else handfight(2);
morale:=morale+2;
moralebounce:=moralebounce+1;
end;
procedure dlaser;
begin
write(' hit on lasers, ');
if laser<1 then writeln('but they were worthless anyway')
else begin
laser:=laser-1;
if claser<1 then claser:=1;
claser:=claser-1;
writeln('laser power now ',claser);
end;{else}
end;
procedure dspeed;
begin
write(' drive section hit, ');
if speed<1 then writeln('but you had no drive anyway, speed still 0')
else begin
if hull=0 then mndex:=random(4)+1 else mndex:=1;
if speed<mndex then speed:=mndex;
speed:=speed-mndex;
if cspeed<mndex then cspeed:=mndex;
cspeed:=cspeed-mndex;
writeln('speed of the ',name,' now ',cspeed);
end;{else}
end;
procedure dhull;
begin
write(' hull integrity damaged, ');
hull:=hull-1;
if chull<1 then chull:=1;
chull:=chull-1;
writeln('hullpoints of the ',name,' now ',chull);
end;
procedure dboats;
begin
write(' lifeboat bays hit, ');
if boats<1 then writeln('but you had no boats anyway.')
else begin
boats:=boats-1;
writeln(boats,' boats left.');
end;{else}
end;
procedure dprobes;
begin
write(' probe launchers hit, ');
if probes<1 then writeln('but you had no probes anyway.')
else begin
probes:=probes-1;
writeln(probes,' probes left.');
end;{else}
end;
procedure minordamage;
begin
writeln(name,' damaged;');
kndex:=random(20);
case kndex of
0..3: dspeed;
4..7: dlaser;
8: if random>0.5 then dprobes else dboats;
9: crewloss(random(3)+1);
10..19: if hull<1 then
begin
case kndex-9 of
0..3: if speed>0 then dspeed else dlaser;
4..7: if laser>0 then dlaser else dspeed;
8: if boats>0 then dboats else dspeed;
9: if probes>0 then dprobes else dspeed;
10: crewloss(random(3)+1);
end;{case on kndex-7}
end{ifthen on hull}
else dhull;
end;{case 10..19}
end;{minordamage}
procedure majordamage;
begin
writeln('the ',name,' is shaken from stem to stern.');
for mndex:=1 to random(5)+1 do minordamage;
end;
procedure damage;
begin
if random>0.93 then majordamage else minordamage;
if (hull=0) and (speed=0) and (laser=0) then
begin
writeln('The good ship ',name,' is a cloud of various particles,');
battle:=false;
if boats>0 then
begin
writeln('but you have escaped her destruction.');
abandon;
end{if on boats}
else
begin
writeln('and there are no boats left.');
writeln('Your loved ones will probably never learn your fate.');
halt;
end;{else}
end;{ifthen on 000}
end;{damage}
procedure Esurrender;
var pndex: byte;
begin
write('The enemy has surrendered. You get a reward of ');
format(OrigEpower*3000.0);
writeln;
realvar:=Epower*random*3E4;
writeln('And ',realvar:6:0,' credits for bringing in their ship.');
writeln('If, of course, you get to a civilized star.');
credits:=credits+(3000.0*OrigEpower)+realvar;
battle:=false;
prize:=true;
morale:=morale+5;
moralebounce:=moralebounce+2;
if random>0.7 then
begin;
pndex:=random(3)+2;
writeln('There were ',pndex,' captive vacuumariners aboard, and they join you.');
crew:=crew+pndex;
morale:=morale+5*pndex;
moralebounce:=moralebounce+2*pndex;
end;{if}
end;{Esurrender}
procedure negotiate;
begin;
index:=random(Epower)+1;
if index>10 then index:=10;
if index<10 then writeln('Captian, there is a message coming in. It says:');
case index of
1: begin
writeln('Help! don''t hurt us!');
Esurrender;
end;{case 1}
2: begin
writeln('We were only kidding');
battle:=false;
end;{case 2}
3: begin
writeln('Let''s settle this peacably.');
battle:=false;
end;{case 3}
4: begin
writeln('You''re a trader, not a fighter. Give us one cargo (Y or N)');
readln(yorn);
if upcase(yorn)='Y' then
begin
confiscation;
battle:=false;
end;{if}
end;{case 4}
5: begin
writeln('Why struggle against us? Just hand over three cargos. (Y or N)');
readln(yorn);
if upcase(yorn)='Y' then
begin
confiscation;
confiscation;
confiscation;
battle:=false;
end;{if}
end;{case 5}
6,7: begin
writeln('We''ll have three cargos from you, or your miserable lives. Answer "Y" at once.');
if boats>0 then writeln('And I believe we''ll be taking a boat, too.');
readln(yorn);
if upcase(yorn)='Y' then
begin
confiscation;
confiscation;
confiscation;
battle:=false;
if boats>0 then boats:=boats-1;
end;{if}
end;{case 7}
8: begin
writeln('Give up, and we may let you live. Answer "Y" now, we''re tired of waiting.');
readln(yorn);
if upcase(yorn)='Y' then surrender;
end;{case 8}
9: writeln('Eat high-intensity light, scum');
10: if nomessage=false then writeln('No reply, Captain');
end;{case}
action:=true;
end;{negotiate}
procedure Edamage(weapon:byte);
var pndex: byte;
begin
if weapon<1 then {this is a redundant check}
begin {but it gets used}
writeln('Ship''s computer erroneously allowed you to attack with useless weapon.');
exit;
end;
pndex:=random(weapon*5);
Epower:=Epower-pndex;
writeln(pndex,' points damage to enemy vessel');
if Epower<1 then
begin
writeln('enemy destroyed');
battle:=false;
writeln('There was a reward of ',3000.0*OrigEpower:6:0);
credits:=credits+3000.0*OrigEpower;
morale:=morale+4;
moralebounce:=moralebounce+2;
end{if}
else if (pndex>0) and ((Epower/OrigEpower)<0.4*random) then
begin
battle:=false;
writeln('Message coming in, Captain. It says "Ouch! We give up."');
Esurrender;
end{else,ifthen}
else if (OrigEpower*random>(Epower-pndex)*random+5) then
begin
nomessage:=true;
negotiate;
end;{else}
end;{edamage}
procedure bandit;
begin
writeln;
writeln('Ship approaching on intercept course.......SPACE BANDITS');
if navy=true then begin writeln('Needleship melts bandits'); exit end;
if jump=true then Edamage(claser);
if (crew<complement) and (crew<>drivecrew+lasercrew+hullcrew) then shortcrew
else status;
battle:=true;
moraleflag:=false;
OrigEpower:=random(60)+1;
Epower:=OrigEpower;
while battle=true do
begin
nomessage:=false;
if random*random*random*(100-morale)>10 then
begin
writeln('Your demoralized crew surrenders.');
battle:=false;
surrender;
exit;
end;{if}
writeln;writeln;
writeln('You may:');
if claser>0 then writeln('1. Attack with lasers');
if cspeed>0 then writeln('2. Try to escape');
writeln('3. Negotiate');
if (cspeed>0) and (chull>0) then writeln('4. Try to ram');
if boats>0 then writeln('5. Abandon ship');
writeln('6. Surrender');
writeln('7. Re-assign crew');
writeln(' Your orders, Captain?');
inputs;
action:=false;
case inp of
1: if claser<1 then writeln('No lasers')
else
begin
writeln('fire control computer aims and fires lasers');
edamage(claser);
action:=true;
moraleflag:=true;
end;{else}
2: if cspeed<1 then writeln('Drive useless')
else
begin
action:=true;
if sqr(sqr(cspeed))<random*20000 then writeln('the other ship follows you!')
else
begin
battle:=false;
writeln('You got away.');
writeln('The bandit takes a parting shot');
if chull+10*random>9 then writeln('They missed you')
else damage
end{inside else}
end;{main else}
3: negotiate;
4: if chull<1 then writeln('it would be like batting them with a sponge.')
else
if cspeed=0 then writeln('No drive')
else
begin
moraleflag:=true;
if random(cspeed)>2 then
begin
writeln('Collision!');
impact:=chull;
damage;
damage;
writeln('Ship''s engineer estimates');
writeln('6 to 10 points internal damage to enemy vessel. We can plainly see');
Epower:=Epower-8;
edamage(impact)
end{ifthen}
else writeln('The other ship avoids you.');
action:=true
end;{else on cspeed}
5: if boats> 0 then begin
abandon;
battle:=false;
end{ifthen}
else writeln('There are no boats to leave the ship in');
6: surrender;
7: shortcrew;
end;{case}
if (battle=true) and (action=true) then
begin
write('The other ship attacks with ');
jndex:=random(5);
case jndex of
1: writeln('lasers');
2: writeln('a flood of tiny rockets');
3: writeln('a flash missile');
4: writeln('an ion beam');
0: writeln('a haze of antimatter particles');
end;{case}
if chull+random(10)>9 then
begin
index:=random(3);
case index of
0: writeln('No effect on the ',name);
1: writeln('Misfire');
2: writeln('a near miss');
end;{case}
end{if}
else damage;
end;{ifthen}
status;
end;{whiledo}
if moraleflag=true then
begin
morale:=morale+5;
moralebounce:=moralebounce+5;
end;{if}
writeln;
writeln('Crisis over');
writeln('<Carriage Return> to continue');
readln(yorn);
end;{procedure bandit}