因为原来的那个有中文不能运行,所以我特的做了一个改良版大家看看,有问题的地方还请大家修改~~~
程序如下:
program game;
var a:char;
i,j,m,n:integer;
ma:array[1..10,1..10]of integer;
hp,mp,money,ql,dengji,fy,atc,mc,hpmax,mpmax,zhiye,jy,mcp:integer;
procedure map;
begin
randomize;
m:=random(10);
n:=random(10);
writeln('******* map ********');
for i:=1 to 10 do
begin
for j:=1 to 10 do
begin
if (i=m)and(j=n)then
begin
ma[i,j]:=9;
write('9 ');
end
else
begin
ma[i,j]:=random(3);
if ma[i,j]=0 then write('0 ');
if ma[i,j]=1 then write('1 ');
if ma[i,j]=2 then write('2 ');
end;
end;
writeln;
end;
writeln('*******************');
readln;
end;
{procedure loud;
var t:text;
begin
rewrite(t);
writeln(t,dengji);
writeln(t,hpmax,' ',hp);
writeln(t,mpmax,' ',mp);
writeln(t,ql);
writeln(t,fy);
writeln(t,mc);
writeln(t,atc);
writeln(t,money);
end;
procedure save;
var t:text;
begin
reset(t);
readln(t,dengji);
readln(t,hpmax,hp);
readln(t,mpmax,mp);
readln(t,ql);
readln(t,fy);
readln(t,mc);
readln(t,atc);
readln(t,money);
end;}
procedure ziliao;
begin
writeln('******************** xing xi **********************');
writeln('* dengji',dengji,' *');
writeln('* hp ',hpmax,'/',hp,' *');
writeln('* mp ',mpmax,'/',mp,' *');
writeln('* money',money,' *');
writeln('* Exp ',dengji*100+30,'/',JY,' *');
writeln('**************************************************');
end;
procedure shengji;
begin
writeln('sheng ji le (xi xi) ');
dengji:=dengji+1;
jy:=jy-dengji*100-30;
atc:=atc+dengji*2+10;
fy:=fy+dengji*2+10;
mcp:=mcp+dengji*2+4;
hpmax:=hpmax+dengji*10;
mpmax:=mpmax+dengji*8;
writeln('############# zhi liao ###########');
writeln('dengji ',dengji);
hp:=hpmax;
writeln('hp ',hpmax,'/',hp);
mp:=mpmax;
writeln('mp ',mpmax,'/',mp);
writeln('gong ji li ',atc);
writeln('fang yu li ',fy);
writeln('mo ji le ',mc);
end;
procedure guaishou;
var
p:char;
z,ghp,fyl,gatc,hp0,jy,mcp:integer;
begin
gatc:=random(100)+dengji*10;
writeln('yu dao guan shou le , K ta ma (Y\N) : ');
readln(p);
ghp:=random(100)*20;
hp0:=ghp;
fyl:=fy;
if p='Y' then
begin
writeln(' zhan dou kan shi ');
while (hp>0)and(ghp>0) do
begin
writeln('You HP ',hpmax,'/',hp,' ','MP:',mpmax,'/',mp,' ','qi li',ql);
writeln('HE HP ',hp0,'/',ghp);
writeln(' K , 1 : pu tong 2 : mo fa 3 : jue dui bi sa ji 4 : tang 5 : tao ');
readln(p);
z:=random(11);
if z=5 then
begin
if p='1' then
begin
write(' gong ji wu xiao ');
readln;
end;
if p='2' then
begin
write(' mei da zhong ');
readln;
end;
end
else
begin
if p='1'
then
begin
ghp:=ghp-atc;
if ghp<=0
then
begin
write(' K le guai shou EXP + ',hp0);
readln;
z:=random(5);
jy:=jy+hp0;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if z=2 then writeln(' money + ',(hp0 div 10)*10);
money:=money+((hp0 div 10)*10);
readln;
ql:=ql+10;
break;
end
else
begin
write('guan shou HP - ',atc,' guai xian you HP',hp0,'/',ghp);
readln;
ql:=ql+10;
end;
end;
if p='2'
then
begin
begin
writeln(' xuan zhe ');
if dengji>=0 then
writeln('1.huo qiu chu shi gong ji li 110 mp-2');
if dengji>=2 then
writeln('2.huo yan chu shi gong ji li 150 mp-5');
if dengji>=4 then
writeln('3.bing qiu chu shi gong ji li 250 bing dong xiao guo 1 hui he bu neng dong mp-10');
if dengji>=6 then
writeln('4.bing zhu chu shi gong ji li 250 bing dong xiao guo 3 hui he bu neng dong mp-20');
if dengji>=8 then
writeln('5.mong hu yan shen chu shi gong ji li 400 shao shang xiao guo mei hui he - 10%HP mp-40');
if dengji>=10 then
writeln('6.bing huan bao chu shi gong ji li 450 bing dong xiao guo 3 hui he bu neng dong mp-40');
readln(p);
if p='1' then
if mp>=2
then
begin
mp:=mp-2;
mcp:=110+mc;
end
else writeln(' MP bu gou ');
if p='2' then
if mp>=5
then
begin
mp:=mp-5;
mcp:=150+mc;
end
else writeln(' MP bu gou ');
if p='3' then
if mp>=10
then
begin
mp:=mp-10;
mcp:=200+mc;
end
else writeln(' MP bu gou ');
if p='4' then
if mp>=20
then
begin
mp:=mp-20;
mcp:=250+mc;
end
else writeln(' MP bu gou ');
if p='5' then
if mp>=40
then
begin
mp:=mp-40;
mcp:=400+mc;
end
else writeln(' MP bu gou ');
if p='6' then
if mp>=40
then
begin
mp:=mp-40;
mcp:=400+mc;
end
else writeln(' MP bu gou ');
end;
ghp:=ghp-mcp;
if ghp<0
then
begin
write(' K le guai shou EXP + ',hp0);
readln;
z:=random(5);
jy:=jy+hp0;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if jy >= dengji * 130 then shengji ;
if z<3 then begin
writeln(' money + ',(hp0 div 10)*10);
money:=money+((hp0 div 10)*10);
readln;
ql:=ql+10;
end;
break;
end
else
begin
write(' guai shou bei K le yi dun HP - ',mcp,' xian zhan hai you HP : ',hp0,'/',ghp);
readln;
ql:=ql+10;
end;
end;
if p='4' then fyl:=fy*2;
if p='5' then begin
z:=random(4);
if z=3 then writeln(' mei tao zhou ')
else exit;
end;
end;
writeln(' hui he jie shu ');
writeln(' guai shou gong ji ');
z:=random(9);
if z=1 then
begin
write(' miss! ye! ya ge ba lu !!!');
readln;
end
else
begin
if fy>=gatc then
begin
write(' tang zhu ');
readln;
end
else
begin
hp:=hp+fyl-gatc;
if hp>0 then
begin
write(' ni de HP - ',gatc-fyl,' ',hpmax,'/',hp);
readln;
end
else
begin
write(' Game Over ( ni qiao bian zhi le , cong lai )');
readln;
halt;
end;
end;
write('hui he jie shu');
readln;
end;
end;
shengji;
end;
end;
procedure shangdian;
var p:char;
begin
writeln('*********************SHOP****************************');
if money<=0 then
begin
writeln(' lao ban : ta ma de , mei qian jing shang dian , si chu qu ! ! ! ! ');
exit;
end
else
writeln('1.shang yao HP+50 100 kuai 2. sheng xian shui MP+50 100 kuai');
write('(1/2 Q:Quit)');
while (money>0)and(p<>'Q') do
begin
readln(p);
if p='1' then
begin
if hp+100>hpmax
then
begin
hp:=hpmax;
writeln(' sheng ming ',hpmax,'/',hp);
money:=money-100;
end
else
begin
hp:=hp+100;
writeln(' sheng ming ',hpmax,'/',hp);
money:=money-100;
end;
end
else
if p='2' then
begin
if mp+50>mpmax
then
begin
mp:=mpmax;
writeln(' mo li ',mpmax,'/',mp);
money:=money-100;
end
else
begin
mp:=mp+50;
money:=money-100;
writeln(' mo li ',mpmax,'/',mp);
end;
end;
end;
if money<=0 then writeln(' lao ban : mei qian , si chu qu ! ! ! ! ');
end;
procedure kaishi;
var s,m,n,k,l:integer;
p:char;
begin
write(' xuan jue she 1. xi wu zhe 2. qiu xian zhe :');
readln(l);
if l=1 then
begin
hp:=500;
hpmax:=hp;
mp:=30;
mpmax:=mp;
money:=1000;
fy:=100;
dengji:=1;
atc:=150;
mc:=50;
zhiye:=1;
end;
if l=2 then
begin
hp:=300;
hpmax:=hp;
mp:=50;
mpmax:=mp;
money:=1000;
fy:=50;
dengji:=1;
atc:=80;
mc:=150;
zhiye:=2;
end;
randomize;
repeat
writeln('hp:',hpmax,'/',hp,' ','mp:',mpmax,'/',mp,' ','money:',money);
m:=1;
n:=1;
writeln(' F: yi dong B: gou mai wu qing Z:ren wu zhuang tai M: di tu Q: zhou ren ');
readln(p);
if p='F' then
begin
writeln('W:shang S:xia A: zuo D:you ');
readln(p);
if p='W'
then
begin
m:=m+1;
if m>100 then
begin
writeln(' bu neng zhou !');
m:=m-1;
end
else
if (m mod 2 = 0) or (m mod 3 = 0) then guaishou
else writeln(' mei jia huo ......');
end;
if p='D'
then
begin
m:=m+1;
if m>10 then
begin
writeln(' bu neng zhou !');
m:=m-1;
end
else
if (m mod 2 = 0) or (m mod 3 = 0) then guaishou
else writeln(' mei jia huo ......');
end;
end;
if p='A'
then
begin
m:=m+1;
if m>10 then
begin
writeln(' bu neng zhou !');
m:=m-1;
end
else
if ma[m,n]=0 then writeln(' mei jia huo ......');
if ma[m,n]=1 then guaishou;
end;
if p='S'
then
begin
m:=m+1;
if m>100 then
begin
writeln(' bu neng zhou !');
m:=m-1;
end
else
if (m mod 2 = 0) or (m mod 3 = 0) then guaishou
else writeln(' mei jia huo ......');
end;
if p='B' then shangdian;
if p='Z' then ziliao;
if p='M' then map;
until p='Q';
end;
begin
writeln('qing shu ru ');
readln(a);
writeln(' B : kai shi , Q : li kai ');
if a='B' then kaishi
else if a='Q' then halt;
end.