A little RPG
Chaobs reprinted
VaR
Plife, 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;
VaR
OBJ: integer;
Begin
Writeln;
Writeln;
Writeln ('treasure chest :');
Writeln ('1: red pill: ', Red, '2: blue pill:', Blue, '3: Sword: ', knife, '4: Body clothing :', clothes, '5; login ');
Writeln;
Writeln;
Writeln ('select :');
Repeat
Readln (OBJ );
Case OBJ
1: Begin
If red> 0 then begin
RED: = red-1;
Plife: = plife + 40;
If plife> plifemax then plife: = plifemax;
End;
End;
2: Begin
If Blue> 0 then begin
Blue: = blue-1;
MP: = MP + 40;
If MP> mpmax then MP: = mpmax;
End;
End;
3: Begin
If knife> 0 then begin
Knife: = knife-1;
Patt: = patt + 15;
End;
End;
4: Begin
If Clothes> 0 then begin
Clothes: = clothes-1;
Pre: = pre + 15;
End;
End;
End;
Writeln;
Writeln;
Writeln;
Until OBJ = 5;
Exit;
End;
Procedure bagplus (SH: integer );
Begin
Case SH
1: Red: = red + 1;
2: Blue: = blue + 1;
3: knife: = knife + 1;
4: Clothes: = clothes + 1;
End;
End;
Procedure shop;
VaR
Ob: integer;
Begin
Writeln;
Writeln;
Writeln ('Welcome to the store! ');
Writeln ('1: red pill 2: Blue Pill 3: Sword 4: Body Clothing 5: Leaving ');
Writeln ('$15 $15 $30 $30 ');
Writeln;
Writeln ('What do you want to buy? ');
Writeln;
Repeat
Readln (OB );
Case ob
1: Begin
If money> = 15 then
Begin
Money: = money-15;
Bagplus (1 );
Writeln ('OK! ');
Writeln ('1: red pill 2: Blue Pill 3: Sword 4: Body Clothing 5: Leaving ');
Writeln ('$15 $15 $30 $30 ');
Writeln;
Writeln ('What do you want to buy? ');
Writeln;
End
Else writeln ('the money is not enough, boss! ');
End;
2: Begin
If money> = 15 then
Begin
Money: = money-15;
Bagplus (2 );
Writeln ('OK! ');
Writeln ('1: red pill 2: Blue Pill 3: Sword 4: Body Clothing 5: Leaving ');
Writeln ('$15 $15 $30 $30 ');
Writeln;
Writeln ('What do you want to buy? ');
Writeln;
End
Else writeln ('the money is not enough, boss! ');
End;
3: Begin
If money> = 30 then
Begin
Money: = money-30;
Bagplus (3 );
Writeln ('OK! ');
Writeln ('1: red pill 2: Blue Pill 3: Sword 4: Body Clothing 5: Leaving ');
Writeln ('$15 $15 $30 $30 ');
Writeln;
Writeln ('What do you want to buy? ');
Writeln;
End
Else writeln ('the money is not enough, boss! ');
End;
4: Begin
If money> = 30 then
Begin
Money: = money-30;
Bagplus (4 );
Writeln ('OK! ');
Writeln ('1: red pill 2: Blue Pill 3: Sword 4: Body Clothing 5: Leaving ');
Writeln ('$15 $15 $30 $30 ');
Writeln;
Writeln ('What do you want to buy? ');
Writeln;
End
Else writeln ('the money is not enough, boss! ');
End;
End;
Until Ob = 5;
Exit;
End;
Procedure storm;
VaR
Ka, KP: integer;
Begin
If MP> = 30 then begin
Writeln;
Writeln;
Writeln ('day-Breaking sword !!!!!!!!!! ');
Writeln ('monster life: ', alife1 );
Writeln ('your life: ', plife,'/', plifemax );
Kp: = (random (patt)-random (are) * 33 ;;
If KP> 0 then begin
Writeln ('attack !! Monsters get ', KP,' damage! ·! ');
Alife1: = alife1-kp;
End
Else begin
Writeln ('You cannot attack ');
End;
KA: = aatt-pre + random (aatt Div 4)-aatt Div 2;
If Ka> 0 then begin
Writeln ('monster attack !! You get ', ka,' damage! ·! ');
Plife: = plife-Ka;
End
Else begin
Writeln ('monsters cannot attack ');
End;
MP: = mp-30;
End
Else writeln ('The magic is not enough !! ');
End;
Procedure wall;
VaR
Ka, KP: integer;
Begin
If MP> = 15 then begin
Writeln;
Writeln;
Writeln ('You use Raytheon !!!! ');
Writeln ('monster life: ', alife1 );
Writeln ('your life: ', plife,'/', plifemax );
Kp: = (random (patt)-random (are) * 26;
If KP> 0 then begin
Writeln ('attack !! Monsters get ', KP,' damage! ·! ');
Alife1: = alife1-kp;
End
Else begin
Writeln ('You lost ');
End;
KA: = aatt-pre + random (aatt Div 4)-aatt Div 2;
If Ka> 0 then begin
Writeln ('monster attack !! You get ', ka,' damage! ·! ');
Plife: = plife-Ka;
End
Else begin
Writeln ('You win !!!!! ');
End;
MP: = mp-10;
End
Else writeln ('life is not enough !! ');
End;
Procedure ball;
VaR
Ka, KP: integer;
Begin
If MP> = 5 then begin
Writeln;
Writeln;
Writeln ('You use the fist !!! ');
Writeln ('monster life: ', alife1 );
Writeln ('your life: ', plife,'/', plifemax );
Kp: = (random (patt)-random (are) * 20;
If KP> 0 then begin
Writeln ('attack !! Monsters get ', KP,' damage! ·! ');
Alife1: = alife1-kp;
End
Else begin
Writeln ('You lost ');
End;
KA: = aatt-pre + random (aatt Div 4)-aatt Div 2;
If Ka> 0 then begin
Writeln ('monster attack !! You get ', ka,' damage! ·! ');
Plife: = plife-Ka;
End
Else begin
Writeln ('You win !!!!! ');
End;
MP: = mp-10;
End
Else writeln ('life is not enough !! ');
End;
Procedure magic;
VaR
MA: integer;
Begin
Writeln;
Writeln;
Writeln ('1. Smash the fist [5] 2. Raytheon [15] 3. skysword [30] ');
Writeln ('Magic value: ', MP,'/', mpmax );
Read (MA );
Case Ma
1: ball;
2: wall;
3: storm;
End;
End;
Procedure plusmoney;
VaR
Money1: longint;
Begin
Money1: = random (alife );
Writeln;
Writeln;
Writeln ('you get $ ', money1 );
Money: = money1 + money;
End;
Procedure load;
Begin
Close (NA );
Writeln;
Writeln;
Writeln ('your name :');
Readln;
Readln (name );
Fname: Your concat(name,'.txt ');
Assign (Na, fname );
Reset (NA );
Readln (Na, Code );
Writeln ('enter password :');
Readln (CO );
If Co <> code then
Begin
Writeln ('password error ');
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;
Begin
Close (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;
Begin
Writeln ('your name: ', name );
Writeln ('your life: ', plife,'/', plifemax );
Writeln ('attack capability: ', patt );
Writeln ('defensive force: ', pre );
Writeln ('experience: ', ex );
Writeln ('upgrade experience', exmax );
Writeln ('series: ', GR );
Writeln ('banknote: ', money );
Writeln ('Magic: ', MP,'/', mpmax );
Write ('seven objects of light: '); for I: = 1 to godthing do write (God [I], '');
Writeln;
Writeln ('treasure chest :');
Writeln ('red pill: ', red );
Writeln ('Blue pill: ', blue );
Writeln ('sword: ', knife );
Writeln ('bodysuit: ', clothes );
Writeln;
Writeln;
End;
Procedure people;
Begin
Plife: = 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;
Begin
Writeln ('enter your name :');
Readln;
Readln (name );
Fname: Your concat(name,'.txt ');
Assign (Na, fname );
Reset (NA );
Readln (Na, Code );
Writeln ('enter password :');
Readln (CO );
If Co <> code then
Begin
Writeln ('wrong password! ');
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;
Begin
Writeln ('enter your name :');
Readln;
Readln (name );
If name <> '0' then begin
Fname: Your concat(name,'.txt ');
Assign (Na, fname );
Rewrite (NA );
Writeln ('enter password ');
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]);
End
Else halt;
End;
Procedure denlu;
VaR
DL: byte;
Begin
Writeln ('------------------- do not laugh at homemade games ----------------------');
Writeln ('----------------------- for entertainment only ----------------------');
Writeln ('1: New Game 2: Old Game 3: Exited ');
Read (DL );
Case DL
1: new;
2: old;
3: Halt;
End;
End;
Procedure godthing2;
VaR
Qi: integer;
Begin
Randomize;
Qi: = random (50 );
Case Qi
0, 8: Begin
Writeln ('get the seven God of Light ---- 1: The Sword of heaven ');
Writeln ('attack increase by 60 points !!! ');
Patt: = patt + 60;
Godthing: = godthing + 1;
// I have not finished writing it here. I don't want to play it anymore!