您的位置首页  日常

pascal游戏 clothes)

猜数。100以内,猜十次。会提示大了还是小了。programex(input,output);varn,a,i:integer;beginrandomize;n:=random(100);fori:=1to10dobeginreadln(a);i

猜数。

100以内,猜十次。

会提示大了还是小了。

program ex(input,output);var n,a,i:integer;beginrandomize;n:=random(100);for i:=1 to 10 dobeginreadln(a);if a=n then begin writeln('You win.');break;end;if aif i=10 then writeln('You fail.')end;readln;end.FreePascal、TurboPascal7通过。

江依童2021-07-04 23:41:34varplife,plifemax,patt,pre:integer;gr,ex,exmax:integer;alife,alife1,aatt,are:integer;name,fname:string;na:text;code,co:string;dz:integer;money:longint;mp,mpmax:integer;red,blue,knife,clothes:integer;i:integer;god:array[1..100] of 1..7;godthing:integer;procedure bag;varobj:integer;beginwriteln;writeln;writeln('百宝箱:');writeln('1:红色药丸: ',red,' 2:兰色药丸: ',blue,' 3:神剑:',knife,' 4:防身衣:',clothes,' 5;离开');writeln;writeln;writeln('请选择:');repeatreadln( obj);case obj of1:beginif red>0 then beginred:=red-1;plife:=plife+40;if plife>plifemax then plife:=plifemax;end;end;2:beginif blue>0 then beginblue:=blue-1;mp:=mp+40;if mp>mpmax then mp:=mpmax;end;end;3:beginif knife>0 then beginknife:=knife-1;patt:=patt+15;end;end;4:beginif clothes>0 then beginclothes:=clothes-1;pre:=pre+15;end;end;end;writeln;writeln;writeln;until obj=5;exit;end;procedure bagplus(sh:integer);begincase sh of1:red:=red+1;2:blue:=blue+1;3:knife:=knife+1;4:clothes:=clothes+1;end;end;procedure shop;varob:integer;beginwriteln;writeln;writeln('欢迎来到商店!');writeln(' 1:红色药丸 2:兰色药丸 3:神剑 4:防身衣 5:离开');writeln(' $15 $15 $30 $30');writeln;writeln('你想买什么?');writeln;repeatreadln(ob);case ob of1:beginif money>=15 thenbeginmoney:=money-15;bagplus(1);writeln('OK!');writeln(' 1:红色药丸 2:兰色药丸 3:神剑 4:防身衣 5:离开');writeln(' $15 $15 $30 $30');writeln;writeln('你想买什么?');writeln;endelse writeln('钱不够啊,老大!');end;2:beginif money>=15 thenbeginmoney:=money-15;bagplus(2);writeln('OK!');writeln(' 1:红色药丸 2:兰色药丸 3:神剑 4:防身衣 5:离开');writeln(' $15 $15 $30 $30');writeln;writeln('你想买什么?');writeln;endelse writeln('钱不够啊,老大!');end;3:beginif money>=30 thenbeginmoney:=money-30;bagplus(3);writeln('OK!');writeln(' 1:红色药丸 2:兰色药丸 3:神剑 4:防身衣 5:离开');writeln(' $15 $15 $30 $30');writeln;writeln('你想买什么?');writeln;endelse writeln('钱不够啊,老大!');end;4:beginif money>=30 thenbeginmoney:=money-30;bagplus(4);writeln('OK!');writeln(' 1:红色药丸 2:兰色药丸 3:神剑 4:防身衣 5:离开');writeln(' $15 $15 $30 $30');writeln;writeln('你想买什么?');writeln;endelse writeln('钱不够啊,老大!');end;end;until ob=5;exit;end;procedure storm;varka,kp:integer;beginif mp>=30 then beginwriteln;writeln;writeln('破天一剑!!!!!!!!!!');writeln(' 怪物生命:',alife1);writeln('你的生命:',plife,'/',plifemax);kp:=(random(patt)-random(are))*33;if kp>0 then beginwriteln('攻击!!怪物得到',kp,' 伤害!·!');alife1:=alife1-kp;endelse beginwriteln('你无法攻击');end;ka:=aatt-pre+random(aatt div 4)-aatt div 2;if ka>0 then beginwriteln('怪物攻击!!你得到',ka,' 伤害!·!');plife:=plife-ka;endelse beginwriteln( ' 怪物无法攻击');end;mp:=mp-30;endelse writeln('魔力不够!!');end;procedure wall;varka,kp:integer;beginif mp>=15 then beginwriteln;writeln;writeln('你用雷光!!!!');writeln('怪物生命:',alife1);writeln('你的生命:',plife,'/',plifemax);kp:=(random(patt)-random(are))*26;if kp>0 then beginwriteln('攻击!!怪物得到',kp,' 伤害!·!');alife1:=alife1-kp;endelse beginwriteln('你输了');end;ka:=aatt-pre+random(aatt div 4)-aatt div 2;if ka>0 then beginwriteln('怪物攻击!!你得到',ka,' 伤害!·!');plife:=plife-ka;endelse beginwriteln( ' 你赢了!!!!!');end;mp:=mp-10;endelse writeln('生命不够!!');end;procedure ball;varka,kp:integer;beginif mp>=5 then beginwriteln;writeln;writeln('你用粉碎神拳!!!');writeln('怪物生命:',alife1);writeln('你的生命:',plife,'/',plifemax);kp:=(random(patt)-random(are))*20;if kp>0 then beginwriteln('攻击!!怪物得到',kp,' 伤害!·!');alife1:=alife1-kp;endelse beginwriteln('你输了');end;ka:=aatt-pre+random(aatt div 4)-aatt div 2;if ka>0 then beginwriteln('怪物攻击!!你得到',ka,' 伤害!·!');plife:=plife-ka;endelse beginwriteln( ' 你赢了!!!!!');end;mp:=mp-10;endelse writeln('生命不够!!');end;procedure magic;varma:integer;beginwriteln;writeln;writeln('1. 粉碎神拳 [5] 2. 雷光 [15] 3.破天一剑 [30]');writeln('魔法值: ',mp,'/',mpmax);read(ma);case ma of1:ball;2:wall;3:storm;end;end;procedure plusmoney;varmoney1:longint;beginmoney1:=random(alife);writeln;writeln;writeln('你得到 $',money1);money:=money1+money;end;procedure load;beginclose(na);writeln;writeln;writeln('你的名字: ');readln;readln(name);fname:=concat(name,'.txt');assign(na,fname);reset(na);readln(na,code);writeln('输入密码:');readln(co);if cocode thenbeginwriteln('密码错误');readln;halt;end;readln(na,plife);readln(na,plifemax);readln(na,patt);readln(na,pre);readln(na,ex);readln(na,exmax);readln(na,gr);readln(na,money);readln(na,mp);readln(na,mpmax);readln(na,red);readln(na,blue);readln(na,knife);readln(na,clothes);end;procedure save;var i:integer;beginclose(na);assign(na,fname);rewrite(na);writeln(na,code);writeln(na,plife);writeln(na,plifemax);writeln(na,patt);writeln(na,pre);writeln(na,ex);writeln(na,exmax);writeln(na,gr);writeln(na,money);writeln(na,mp);writeln(na,mpmax);writeln(na,red);writeln(na,blue);writeln(na,knife);writeln(na,clothes);writeln(na,godthing);for i:=1 to godthing do writeln(god[i]);writeln;writeln;writeln('save successfully');writeln;writeln;end;procedure see;var i:integer;beginwriteln('你的名字: ',name);writeln('你的生命: ',plife,'/',plifemax);writeln('攻击力: ',patt);writeln('防御力: ',pre);writeln('经验: ',ex);writeln('升级经验',exmax);writeln('级数: ',gr);writeln('钞票:',money);writeln('魔力: ',mp,'/',mpmax);write('光之七神器:');for i:=1 to godthing do write(god[i],' ');writeln;writeln('百宝箱:');writeln('红色药丸:',red);writeln('兰色药丸:',blue);writeln('神剑:' ,knife);writeln('防身衣:',clothes);writeln;writeln;end;procedure people;beginplife:=100;plifemax:=100;patt:=20;pre:=15;money:=100;gr:=1;ex:=0;exmax:=20;mp:=50;mpmax:=50;red:=5;blue:=5;knife:=0;clothes:=0;end;procedure old;var i:integer;beginwriteln('输入你的名字 :');readln;readln(name);fname:=concat(name,'.txt');assign(na,fname);reset(na);readln(na,code);writeln('输入密码:');readln(co);if cocode thenbeginwriteln('密码错误!');readln;halt;end;readln(na,plife);readln(na,plifemax);readln(na,patt);readln(na,pre);readln(na,ex);readln(na,exmax);readln(na,gr);readln(na,money);readln(na,mp);readln(na,mpmax);readln(na,red);readln(na,blue);readln(na,knife);readln(na,clothes);readln(na,godthing);for i:=1 to godthing do readln(god[i]);end;procedure new;var i:integer;beginwriteln( ' 输入你的名字: ');readln;readln(name);if name'0' then beginfname:=concat(name,'.txt');assign(na,fname);rewrite(na);writeln('输入密码');readln(code);writeln(na,code);people;writeln(na,plife);writeln(na,plifemax);writeln(na,patt);writeln(na,pre);writeln(na,ex);writeln(na,exmax);writeln(na,gr);writeln(na,money);writeln(na,mp);writeln(na,mpmax);writeln(na,red);writeln(na,blue);writeln(na,knife);writeln(na,clothes);writeln(godthing);for i:=1 to godthing do writeln(god[i]);endelse halt;end;procedure denlu;vardl:byte;beginwriteln('-------------------自制的游戏不要笑----------------------');writeln('-----------------------仅供娱乐----------------------');writeln('1: 新游戏 2:老游戏 3:退出');read(dl);case dl of1:new;2:old;3:halt;end;end;procedure godthing2;varqi:integer;beginrandomize;qi:=random(50);case qi of0,8:beginwriteln('得到光之七神具----1:辟天宝剑');writeln('攻击增加60点!!!');patt:=patt+60;godthing:=godthing+1;god[godthing]:=1;end;3,16:beginwriteln('得到光之七神具----2:开地玄远剑');writeln('攻击力*2');patt:=patt*2;godthing:=godthing+1;god[godthing]:=2;end;end;end;procedure grow;beginif ex>=exmax then beginplife:=plifemax+50;plifemax:=plife;patt:=patt+15;pre:=pre+15;mpmax:=mpmax+30;mp:=mpmax;ex:=0;gr:=gr+1;exmax:=exmax+100;writeln('升级!!');godthing2;writeln;writeln;end;end;procedure experience;beginrandomize;ex:=ex+random(alife)+30;grow;end;procedure attack;varwin,lost,run:boolean;ch,ff,kp,ka:integer;procedure winner;beginwin:=false;if alife10 then beginwriteln('怪物攻击,你得到',ka,' 伤害');plife:=plife-ka;endelse beginwriteln( '怪物输了');end;writeln(' 怪物生命:',alife1);writeln('你生命:',plife,'/',plifemax);writeln('你的魔法值: ',mp,'/',mpmax);end;2:beginmagic;end;3:beginbag;end;4:beginrun:=true;writeln('逃跑失败');end;end;winner;loster;until win or lost or run;if win then begin experience; plusmoney; writeln('你赢了!!!'); writeln; end;if lost thenbeginwriteln('输了');readln;halt;end;endelse exit;end;procedure animal;beginalife:=plifemax+random(50);if plifemax=100 then beginaatt:=15;are:=10;endelse beginaatt:=aatt+10;are:=are+7;end;attack;end;procedure meet;varcc:integer;beginrandomize;cc:=random(100);if cc<40 then beginwriteln;writeln('你遇见一个怪物');animal;endelse writeln('没碰到.......');end;procedure choose;beginwriteln('1:找怪物; 2:去商店; 3:读取; 4:保存; 5:退出 6:查看 7:用百宝箱');read(dz);case dz of1:meet;2:shop;3:load;4:save;6:see;7:bag;end;end;begindenlu;while dz5 dochoose;close(na);end.编译完后执行EXE。

免责声明:本站所有信息均搜集自互联网,并不代表本站观点,本站不对其真实合法性负责。如有信息侵犯了您的权益,请告知,本站将立刻处理。
网站推荐更多>>