/ Vijos / 讨论 / 游戏 /

game

对@王帅炜 的游戏修改并修复上百bug得到https://vijos.org/discuss/5207aacf48c5fc295bd3ec47

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,mcp,JY:integer;
procedure map;
begin
m:=5;
n:=5;
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
randomize;
ma[i,j]:=random(10);
if ma[i,j]>=5 then write('0 ');
if ma[i,j]<4 then write('1 ');
end;
end;
writeln;
end;
writeln('*************');
readln;
end;
procedure save;
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 load;
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('**************RENWU*****************');
writeln('DENGJI',dengji);
writeln('HP',hpmax,'/',hp);
writeln('MP',mpmax,'/',mp);
writeln('money',money);
writeln('SHENJIJY/xzJY',dengji*100+30,'/',JY);
writeln('************************************************');
end;
procedure shengji;
begin
if JY>=dengji*100+30 then
begin
writeln('level up');
dengji:=dengji+1;
JY:=JY-dengji*100+70;
if zhiye=1 then
begin
atc:=atc+dengji*15;
fy:=fy+dengji*10;
mcp:=mcp+dengji*6;
hpmax:=hpmax+dengji*50;
mpmax:=mpmax+dengji*3;
end;
if zhiye=2 then
begin
atc:=atc+dengji*8;
fy:=fy+dengji*5;
mcp:=mcp+dengji*15;
hpmax:=hpmax+dengji*30;
mpmax:=mpmax+dengji*5;
end;
if zhiye=3 then
begin
atc:=atc+dengji*25;
fy:=fy+dengji*4;
mcp:=mcp+dengji*12;
hpmax:=hpmax+dengji*20;
mpmax:=mpmax+dengji*4;
end;
writeln('#############ZILIAO###########');
writeln('dengji',dengji);
hp:=hpmax;
writeln('HP',hpmax,'/',hp);
mp:=mpmax;
writeln('MP',mpmax,'/',mp);
writeln('atc',atc);
writeln('fy',fy);
writeln('MC',mc);
end;
end;

procedure guaishou;
var p:char;
z,ghp,fyl,gatc,gatc1,hp0,mcp,burn,ice:integer;
begin
ql:=0;
ice:=0;
burn:=0;
writeln('GUAISHOU Y fight N run Y/N');
readln(p);
ghp:=random(2000+dengji*dengji*dengji*4);
gatc:=ghp mod 5+random(100)+dengji*50;
hp0:=ghp;
fyl:=fy;
if p='Y' then
begin
writeln('fight start');
while (hp>0)and(ghp>0) do
begin
writeln('HP',hpmax,'/',hp,' ','MP:',mpmax,'/',mp,' ','QILI',ql);
writeln('gs HP',hp0,'/',ghp);
writeln('1 putong 2 mofa 3 bisha 4 fangyu 5 taopao');
writeln('(bisha de xiaoguo youleijide qili jueding,qilimeihuihe+10)');
readln(p);
z:=random(5);
if z=5 then
begin
if p='1' then
begin
write('invalid');
readln;
end;
if p='2' then
begin
write('miss');
readln;
end;
end
else
begin
if p='1'
then
begin
ghp:=ghp-atc;
if ghp<=0
then
begin
write('win jy+',hp0 div 5);
readln;
z:=random(3);
JY:=JY+(hp0 div 5);
if z=2 then
begin
writeln('money+',(hp0 div 5));
money:=money+(hp0 div 5);
end;
shengji;
shengji;
ql:=ql+10;
break;
end
else
begin
write('guai HP-',atc,'guai HP',hp0,'/',ghp);
readln;
ql:=ql+10;
end;
end;
if p='2'
then
begin
begin
writeln('choice mofa');
if dengji>=0 then writeln('1.fireball -110+ mp-2');
if dengji>=2 then writeln('2.fire -150+ burn meihuihe-100 mp-5');
if dengji>=4 then writeln('3.iceball -200+ ice 1 mp-10');
if dengji>=6 then writeln('4.icecolumn -250+ ice 2 mp-20');
if dengji>=8 then writeln('5.tigerfire -400+ burn meihuihe-500 mp-40');
if dengji>=10 then writeln('6.icewind -450+ ice 3 mp-40');
if dengji>=14 then writeln('7.Gasoline bomb -300+ burn meihuihe-2000 mp-80');
if dengji>=20 then writeln('8. -600+ absolute zero ice 5 mp-150');
readln(p);
if p='1' then
if mp>=2
then
begin
mp:=mp-2;
mcp:=110+mc;
end;
if p='2' then
if mp>=5
then
begin
mp:=mp-5;
mcp:=600+mc*5 mod 4;
burn:=burn+100;
end;
if p='3' then
if mp>=10
then
begin
mp:=mp-10;
mcp:=300+mc*3 mod 2;
ice:=ice+1;
end;
if p='4' then
if mp>=20
then
begin
mp:=mp-20;
mcp:=250+mc*2;
ice:=ice+2;
end;
if p='5' then
if mp>=40
then
begin
mp:=mp-40;
mcp:=800+mc*5 mod 2;
burn:=burn+500;
end;
if p='6' then
if mp>=40
then
begin
mp:=mp-40;
mcp:=450+mc*3;
ice:=ice+3;
end;
if p='7' then
if mp>=80
then
begin
mp:=mp-80;
mcp:=600+mc*5 mod 2;
burn:=burn+2000;
end;
if p='8' then
if mp>=150
then
begin
mp:=mp-250;
mcp:=600+mc*4;
ice:=ice+5;
end;
end;
ghp:=ghp-mcp;
if ghp<0
then
begin
write('win jy+',(hp0 div 5));
readln;
JY:=JY+(hp0 div 5);
z:=random(3);
if z=3
then
begin
writeln('money',(hp0 div 5));
money:=money+(hp0 div 5);
end;
shengji;
shengji;
ql:=ql+10;
break;
end
else
begin
write('guai HP-',mcp,'guai HP:',hp0,'/',ghp);
readln;
ql:=ql+10;
end;
end;
if p='3'
then
begin
ghp:=ghp-ql*dengji*150;
if ghp<=0
then
begin
write('win jy+',hp0 div 5);
readln;
z:=random(3);
JY:=JY+(hp0 div 5);
if z=2 then
begin
writeln('money+',(hp0 div 5));
money:=money+(hp0 div 5);
end;
shengji;
shengji;
ql:=0;
break;
end
else
begin
write('guai HP-',atc,'guai HP',hp0,'/',ghp);
readln;
ql:=0;
end;
end;
if p='4' then fyl:=fy*2;
if p='5' then begin
z:=random(3);
if z=3 then writeln('run fail')
else exit;
end;
end;
writeln('huihe over');
writeln('guaishou gongji');
z:=random(4);
if z=1 then
begin
write('miss! ye!');
readln;
end
else
begin
if ice>0
then
begin
ice:=ice-1;
gatc1:=0;
writeln('guaishou ice')
end
else
gatc1:=gatc;
if fyl>=gatc then
begin
write('fangyu chenggong');
readln;
end
else
begin
hp:=hp+fyl-gatc1;
if hp>0 then
begin
write('hp-',gatc1-fyl,' ',hpmax,'/',hp);
readln;
end
else
begin
write('game over');
readln;
halt;
end;
end;
write('huihe over');
if burn>0 then begin
writeln('burn guai HP-',burn,'guai HP',hp0,'/',ghp);
ghp:=ghp-burn;
if ghp<=0
then
begin
write('win jy+',hp0 div 5);
readln;
z:=random(5);
JY:=JY+(hp0 div 5);
if z=2 then writeln('money+',(hp0 div 5));
money:=money+(hp0 div 5);
shengji;
ql:=ql+10;
break;
end
end
end;
end;
end;
end;

procedure shangdian;
var p:char;
begin
writeln('******************store*************************');
if money<=0 then
begin
writeln('boss:go way');
exit;
end
else
writeln('1.HPyao HP+100 100yuan 2.MPyao MP+25 100yuan');
write('(what do you want 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('HP',hpmax,'/',hp);
money:=money-100;
end
else
begin
hp:=hp+100;
writeln('HP',hpmax,'/',hp);
money:=money-100;
end;
end
else
if p='2' then
begin
if mp+25>mpmax
then
begin
mp:=mpmax;
writeln('mp',mpmax,'/',mp);
money:=money-100;
end
else
begin
mp:=mp+25;
money:=money-100;
writeln('mp',mpmax,'/',mp);
end;
end;
end;
if money<=0 then writeln(' boss:go way');
end;
procedure kaishi;
var s,m,n,k,l:integer;
p:char;
begin
write('choice job 1.jianshi 2.fashi 3.cike:');
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;
if l=3 then
begin
hp:=200;
hpmax:=hp;
mp:=30;
mpmax:=mp;
money:=1000;
fy:=40;
dengji:=1;
atc:=250;
mc:=120;
zhiye:=3;
end;
randomize;
repeat
writeln('hp:',hpmax,'/',hp,' ','mp:',mpmax,'/',mp,' ','money:',money);
m:=1;
n:=1;
writeln('F walk B buy Z renwu M:map Q quit');
readln(p);
if p='F' then
begin
writeln('W/S/A/D');
readln(p);
if p='W'
then
begin
m:=m+1;
if m>10 then
begin
writeln('cannot walk');
m:=m-1;
end
else
guaishou;
end;
if p='S'
then
begin
m:=m-1;
if m<1 then
begin
writeln('cannot walk');
m:=m+1;
end
else
guaishou;
end;
if p='D'
then
begin
m:=n+1;
if n>10 then
begin
writeln('cannot walk');
n:=n-1;
end
else guaishou;
end;
if p='A'
then
begin
n:=n-1;
if n<1 then
begin
writeln('cannot walk');
n:=n+1;
end
else guaishou;
end;
end;
if p='B' then shangdian;
if p='Z' then ziliao;
if p='M' then map;
until p='Q';
end;

procedure shuoming;
var p:char;
begin
writeln('*********************shuoming************************');
writeln('shuomingshangweiwanshan');
writeln('......');
writeln('......');
writeln('......');
writeln('......');
writeln('......');
writeln('start now Y/N');
readln(p);
if p='N' then halt
else if p='Y' then kaishi
else
begin
writeln('fool me you will die');
readln;
halt;
end;
end;
begin
writeln('*********************start************************');
writeln('F:shuoming');
writeln('B:start');
writeln('Q:quit');
writeln('***********************************************************');
writeln('please write');
readln(a);
if a='F' then shuoming
else if a='B' then kaishi
else if a='Q' then halt;
end.

4 条评论

  • @ 2017-04-21 07:00:31

    建议使用vcs(比如git)或者发diff,比较容易看到改了什么

  • @ 2017-04-20 16:40:05

    有没有中文

  • @ 2016-03-11 17:39:04

    能不能用C++重写一份呀~

  • @ 2016-03-10 19:57:32

    该死的编辑器

    • @ 2016-03-11 17:20:16

      请使用 ``` 将代码块上下包裹起来,比如:


      //I'm code

    • @ 2016-03-11 17:38:46

      是您不会用。

  • 1