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
/
STAR3.PRO
< prev
next >
Wrap
Text File
|
1989-09-27
|
7KB
|
251 lines
procedure hirecrew;
begin
index:=random(complement-crew)+1;
if index>5 then index:=5;
realvar:=random*random*credits;
if realvar<0 then realvar:=0;
realvar:=realvar+1E5;
writeln(chr(7),'You have found ',index,' crewmen in port.');
write('They will sign on for a bonus of ');
format(realvar);
writeln(' credits.');
repeat
writeln('Will you take them on?');
readln(yorn);
if upcase(yorn)='Y' then
begin
credits:=credits-realvar;
crew:=crew+index;
writeln('Crew=',crew);
end;{ifthen}
if upcase(yorn)='N' then morale:=morale-3;
until (upcase(yorn)='Y') or (upcase(yorn)='N');
end;
procedure arrive;
begin
if cspeed=0 then
begin
writeln('Your drive is worthless');
if prize=true then
begin
writeln('and you must use the captive bandit ship to tow you in');
cspeed:=10;
end
else
begin
realvar:=random*random;
t:=t-realvar;
write('You are rescued after only ');
format(realvar);
writeln(' years.');
end;{else}
end;{if cspeed=0}
writeln('You have arrived at star number ',star);
writeln('Expenses were:');
writeln(' Docking Reservation 5000 credits');
triplength:=distance[star];
if cspeed>0 then dt:=(0.02+triplength*0.025)/(cspeed/10)
else dt:=realvar; {if no drive then time is rescue time}
leave:=false;
t:=t-dt;
realvar:=salary*dt;
write(' Salaries');
format(realvar);
writeln;
credits:=credits-(realvar+5000);
realvar:=triplength*2E3;
credits:=credits-realvar;
write(' Fuel and supplies, taxes and Old Spacers'' Fund');
format(realvar);
writeln;
if newship=true then getship;
thistar:=star;
map;
local1:=false;
local6:=false;
local7:=false;
if random>0.7 then localevent;
forsale;
if been[star]=false then firstvisit;
been[star]:=true;
evaluate;
if local1=true then
begin
writeln(chr(7),'DISREGARD THE PRICES ABOVE');
writeln('Shortages are rampant--prices are up everywhere');
realvar:=1.1+(random(10))/10;
for index:=1 to holdnum do with holdnow[index] do
begin
if category>0 then
begin
percent:=percent*realvar;
aprice:=aprice*realvar;
end{if}
end;{with,for}
for index:=1 to forsalenum do with availnow[index] do
begin
percent:=percent*realvar;
aprice:=aprice*realvar;
end;{with,for}
end;{ifthen on local1}
if local7=true then
begin
index:=random(holdnum)+1; {find a random full hold}
jndex:=index;
repeat
index:=index-1;
if index=0 then index:=20;
until((index=jndex) or (holdnow[index].category<>0));
with holdnow[index] do {add to price}
begin
realvar:=1.1+random(12)/5;
realround(aprice);
aprice:=aprice*realvar;
percent:=percent*realvar;
if index<>jndex then
begin
writeln('Contacts at the local Crawlspace Festival offer you more');
writeln('than portside prices for the cargo in hold #',index);
end;{ifthen}
end;{with}
end;{ifthen}
if random>0.7 then boathere:=true else boathere:=false;
if random>0.8 then probehere:=true else probehere:=false;
if ((speed<tspeed) or (hull<thull) or (laser<tlaser)) and (newship=false) then repair;
morale:=morale+1;
if moralebounce>0 then {temporary morale effects wear off}
begin
moralebounce:=moralebounce-1;
morale:=morale-1;
end;{ifthen}
if moralebounce<0 then
begin
moralebounce:=moralebounce+1;
morale:=morale+1;
end;{ifthen}
showcash;
if (morale<120) and (random*random*random*crew*sqr(morale)/complement<100) then jumpship;
if (complement-crew>random(6)) and (random>0.6) then hirecrew;
if crew=0 then
begin
writeln('You have no crewmen, and you are out of the trading business.');
credits:=credits+(gamelength-t)*5E4;
writeln('You get half the unused lease money back');
t:=0;
end;{ifthen}
if (morale<100) and (crew<complement) then
begin
morale:=morale-2;
moralebounce:=moralebounce-1;
end;{ifhten}
end;{procedure arrive}
procedure travel;
begin
if boats=0 then
begin
morale:=morale-3;
moralebounce:=moralebounce-1;
writeln('Lifting with no lifeboats');
end;{ifthen on boats}
navy:=false;
objectcount:=0;
badguys:=false;
prize:=false;
if crew>6 then cspeed:=speed else
begin
lasercrew:=0;
hullcrew:=0;
drivecrew:=crew;
shortposts;
writeln('speed=',cspeed,' with all ',crew,' crew on navigation.');
end;
if cspeed<1 then repair;
while triplength*chance/10*random*random*random>1 do
objectcount:=objectcount+1;
if triplength*danger/10*random*random*random/(cspeed/10)>1 then badguys:=true;
if (objectcount>0) or (badguys=true) or (crew<7) then chain(chnfile);
arrive; {in case of chaining, arrive is provided by the main}
end;{travel}
procedure test;
{debugging test routine}
begin
(*credits:=credits*30;*)
end;
procedure menu;
begin
writeln(' COMMANDS:');
writeln;
writeln('1: list of cargo in hold');
writeln('2: list of cargo for sale');
writeln('3: buy');
writeln('4: sell');
writeln('5: star travel data');
writeln('6: drop to another star');
writeln('7: buy or sell probes or small craft');
writeln('8: status of the ',name);
writeln('9: quit the trading business');
writeln('10: give the crew extra groundleave');
writeln('98: PROGRAMMER''S TEMPORARY TEST ROUTINE');
writeln('type anything else to see this menu');
writeln;
end;
procedure command;
begin
writeln('Your command? (0 for the command list)');
inputs;
case inp of
1: showhold;
2: showforsale;
3: buy;
4: sell;
5: showstars;
6: begin
if credits<0 then
begin
writeln('Port authorities will not let you lift without clearing your debts.');
showhold;
exit;
end;{ifthen on credits}
writeln('what star number');
inputs;
star:=inp;
if (star>10) or (star<1) then
begin
writeln(chr(7),'No such star number');
exit;
end;
if star=thistar then
begin
writeln('You are already at ',star);
exit;
end;{ifthen}
travel;
inp:=99;
end;{case 6}
7: lifeboats;
8: status;
9: begin
writeln('Do you really want to quit?');
readln(yorn);
if upcase(yorn)='Y' then quitter:=true;
end;
10:if leave=true then writeln('A second leave won''t help.')
else begin
writeln('The crew feels better after .3 years in port.');
t:=t-0.3;
morale:=morale+1+random(4);
leave:=true;
end;{else and case 10}
98:test;
else menu;
end;{case}
if inp<>99 then showcash;
if ((inp=3) or (inp=4) or (inp=7)) and
(random*random*random<5*credits/(salary*morale)) then strike;
end;{command}