Sai ở đâu thế mn: (T đang làm thử cái rpg game OwO) Program Rpg_hunt; Uses crt; Var cmd: string; hp,exp,lv,hunt,mhp,bank,pot,pots,gear: longint; B

By Peyton

Sai ở đâu thế mn: (T đang làm thử cái rpg game OwO)
Program Rpg_hunt;
Uses crt;
Var cmd: string;
hp,exp,lv,hunt,mhp,bank,pot,pots,gear: longint;
Begin
Clrscr;
lv:=0;hp:=100;exp:=9;mhp:=100;bank:=0;hunt:=0;pot:=0;pots:=0;gear:=0;
Readln(cmd);
(*Lenh hunt*)
If cmd=’hunt’ then
Begin
Randomize;
Hunt:=Random(5);
If hunt=1 then
Begin
If gear=0 then
Begin
hp:=hp-10;
writeln(‘You just killed a slime’);
Writeln(‘You have ‘,hp,’/100hp’);
Writeln(‘You gained 10 exp and 1000 gold!’);
exp:=exp+10;
bank:=bank+1000;
delay(1000);
End;
If gear=1 then
Begin
hp:=hp-5;
Writeln(‘You just killed a slime’);
Writeln(‘You have ‘,hp,’/100hp’);
Writeln(‘You gained 10 exp and 1000 gold!’);
exp:=exp+10;
bank:=bank+1000;
delay(1000);
End;
End;
If hunt=2 then
Begin
If gear=1 then
Begin
hp:=hp-15;
writeln(‘You just killed a slime lord’);
writeln(‘You have ‘,hp,’/100hp’);
writeln(‘You gained 15 exp and 1500 golds!’);
exp:=exp+15;
bank:=bank+1500;
delay(1000);
End;
If gear=1 then
Begin
hp:=hp-7;
Writeln(‘You just killed a slime’);
Writeln(‘You have ‘,hp,’/100hp’);
Writeln(‘You gained 15 exp and 1500 gold!’);
exp:=exp+15;
bank:=bank+1500;
delay(1000);
End;
End;
If hunt=3 then
Begin
If gear=0 then
Begin
hp:=hp-40;
Writeln(‘You just killed a wolf( but stronger)’);
writeln(‘You have ‘,hp,’/100hp’);
Writeln(‘You gained 40 exp and 4000 golds!’);
exp:=exp+40;
bank:=bank+4000;
delay(1000);
End;
If gear=1 then
Begin
hp:=hp-20;
Writeln(‘You just killed a slime’);
Writeln(‘You have ‘,hp,’/100hp’);
Writeln(‘You gained 40 exp and 4000 gold!’);
exp:=exp+40;
bank:=bank+4000;
delay(1000);
End;
End;
If hunt=4 then
Begin
If gear=0 then
Begin
hp:=hp-25;
Writeln(‘You just killed a wolf’);
writeln(‘You have ‘,hp,’/100hp’);
Writeln(‘You gained 25 exp and 2500 golds!’);
exp:=exp+25;
bank:=bank+2500;
delay(1000);
End;
If gear=1 then
Begin
hp:=hp-12;
Writeln(‘You just killed a slime’);
Writeln(‘You have ‘,hp,’/100hp’);
Writeln(‘You gained 25 exp and 2500 gold!’);
exp:=exp+25;
bank:=bank+2500;
delay(1000);
End;
End;
(*Die*)
If hp=0 then
Begin
lv:=lv-1;
mhp:=mhp-20;
Write(‘You died, cry, you just demoted to lv ‘,lv);
end;
(*Lenh tinh exp*)
If exp>=200 then
Begin
exp:=exp-200;
lv:=lv+1;
mhp:=mhp+20;
Writeln(‘GG, you advenced to level ‘,lv);
End;
If cmd=’exp’ then Writeln(‘Your level is ‘,lv,’ ‘,exp,’/200′);
(*Lenh check heal*)
If cmd=’heal now’ then writeln(‘Your hp is ‘,hp);
(*Lenh heal*)
If cmd=’heal’ then
Begin
If pot>0 then
Begin
hp:=mhp;
Writeln(‘Your heal is ‘,hp,’ now’);
pot:=pot-1;
End
else
Writeln(‘You dont have enough potion, please buy more in shop!’);
End;
(*Lenh shop*)
If cmd=’shop’ then
Begin
Writeln(‘ Welcome to Rpg Shop!!!’);
Writeln(‘Here is some items for you OwO’);
Writeln(‘ Life Potion: 200 golds’);
Writeln(‘ Armor: 20.000 golds’);
Writeln(‘ Sword: 30.000 golds’);
End;
(*Lenh mua armor/sword*)
If (cmd=’buy armor’) or (cmd=’buy sword’) then
Begin
Write(‘You just bought a armor/sword for 100.000′);
bank:=bank-100000;
gear:=gear+1;
End;
(*Lenh mua do*)
If cmd=’buy pots’ then
Begin
Writeln(‘How many potions do you want?’); Readln(pots);
If bank-(pots*200) >=0 then
Begin
Writeln(‘You successful bought ‘,pots,’ potions!’);
bank:=bank-(pots*200);
pot:=pot+pots;
pots:=0;
End
else Writeln(‘You dont have enough golds!’);
End;
(*Lenh check inven*)
If cmd=’inv’ then
Begin
Writeln(‘Here is your inventory:’);
Writeln(‘Life potions: ‘,pot);
Writeln(‘Golds: ‘,bank);
End;
(*Lenh thoat*)
If cmd=’exit’ then exit;
Until 2=1;
End.

0 bình luận về “Sai ở đâu thế mn: (T đang làm thử cái rpg game OwO) Program Rpg_hunt; Uses crt; Var cmd: string; hp,exp,lv,hunt,mhp,bank,pot,pots,gear: longint; B”

  1. Begin If gear=0 then

    Begin hp:=hp-25;

    Writeln(‘You just killed a wolf’);

    writeln(‘You have ‘,hp,’/100hp’);

    Writeln(‘You gained 25 exp and 2500 golds!’); exp:=exp+25; bank:=bank+2500; delay(1000);

    End;

    Ở đây có 2 chữ begin nhưng chỉ có 1 chữ end;

    Các đoạn khác tương tự

    Chúc bạn học tốt!

    Trả lời

Viết một bình luận