diff --git a/Attacken.txt b/Attacken.txt new file mode 100644 index 0000000..9bae18a Binary files /dev/null and b/Attacken.txt differ diff --git a/FileOfTPokemonRecord.txt b/FileOfTPokemonRecord.txt new file mode 100644 index 0000000..72b903b Binary files /dev/null and b/FileOfTPokemonRecord.txt differ diff --git a/Pokemon11.png b/Pokemon11.png new file mode 100644 index 0000000..52bc68c Binary files /dev/null and b/Pokemon11.png differ diff --git a/Pokemon12.png b/Pokemon12.png new file mode 100644 index 0000000..1b10110 Binary files /dev/null and b/Pokemon12.png differ diff --git a/Pokemon13.png b/Pokemon13.png new file mode 100644 index 0000000..d93bbfb Binary files /dev/null and b/Pokemon13.png differ diff --git a/Pokemon14.png b/Pokemon14.png new file mode 100644 index 0000000..d300db8 Binary files /dev/null and b/Pokemon14.png differ diff --git a/Pokemon15.png b/Pokemon15.png new file mode 100644 index 0000000..ca1a1de Binary files /dev/null and b/Pokemon15.png differ diff --git a/Pokemon16.png b/Pokemon16.png new file mode 100644 index 0000000..18097c5 Binary files /dev/null and b/Pokemon16.png differ diff --git a/Pokemon17.png b/Pokemon17.png new file mode 100644 index 0000000..26f0286 Binary files /dev/null and b/Pokemon17.png differ diff --git a/Pokemon18.png b/Pokemon18.png new file mode 100644 index 0000000..8d2915a Binary files /dev/null and b/Pokemon18.png differ diff --git a/Pokemon19.png b/Pokemon19.png new file mode 100644 index 0000000..f9b452c Binary files /dev/null and b/Pokemon19.png differ diff --git a/Pokemon2.png b/Pokemon2.png new file mode 100644 index 0000000..dee3c21 Binary files /dev/null and b/Pokemon2.png differ diff --git a/Pokemon20.png b/Pokemon20.png new file mode 100644 index 0000000..9676d6f Binary files /dev/null and b/Pokemon20.png differ diff --git a/Pokemon21.png b/Pokemon21.png new file mode 100644 index 0000000..0bbad28 Binary files /dev/null and b/Pokemon21.png differ diff --git a/Pokemon22.png b/Pokemon22.png new file mode 100644 index 0000000..e7135b0 Binary files /dev/null and b/Pokemon22.png differ diff --git a/Pokemon23.png b/Pokemon23.png new file mode 100644 index 0000000..f34bcda Binary files /dev/null and b/Pokemon23.png differ diff --git a/Pokemon24.png b/Pokemon24.png new file mode 100644 index 0000000..924e5ea Binary files /dev/null and b/Pokemon24.png differ diff --git a/Pokemon25.png b/Pokemon25.png new file mode 100644 index 0000000..56d2cc3 Binary files /dev/null and b/Pokemon25.png differ diff --git a/Pokemon26.png b/Pokemon26.png new file mode 100644 index 0000000..71869f9 Binary files /dev/null and b/Pokemon26.png differ diff --git a/Pokemon27.png b/Pokemon27.png new file mode 100644 index 0000000..14885c4 Binary files /dev/null and b/Pokemon27.png differ diff --git a/Pokemon28.png b/Pokemon28.png new file mode 100644 index 0000000..aa77474 Binary files /dev/null and b/Pokemon28.png differ diff --git a/Pokemon29.png b/Pokemon29.png new file mode 100644 index 0000000..46d2789 Binary files /dev/null and b/Pokemon29.png differ diff --git a/Pokemon3.png b/Pokemon3.png new file mode 100644 index 0000000..d775a72 Binary files /dev/null and b/Pokemon3.png differ diff --git a/Pokemon30.png b/Pokemon30.png new file mode 100644 index 0000000..ab91230 Binary files /dev/null and b/Pokemon30.png differ diff --git a/Pokemon31.png b/Pokemon31.png new file mode 100644 index 0000000..6349c1c Binary files /dev/null and b/Pokemon31.png differ diff --git a/Pokemon32.png b/Pokemon32.png new file mode 100644 index 0000000..4e96712 Binary files /dev/null and b/Pokemon32.png differ diff --git a/Pokemon33.png b/Pokemon33.png new file mode 100644 index 0000000..12bf530 Binary files /dev/null and b/Pokemon33.png differ diff --git a/Pokemon34.png b/Pokemon34.png new file mode 100644 index 0000000..2b41911 Binary files /dev/null and b/Pokemon34.png differ diff --git a/Pokemon35.png b/Pokemon35.png new file mode 100644 index 0000000..b4cde26 Binary files /dev/null and b/Pokemon35.png differ diff --git a/Pokemon36.png b/Pokemon36.png new file mode 100644 index 0000000..7c6caa4 Binary files /dev/null and b/Pokemon36.png differ diff --git a/Pokemon37.png b/Pokemon37.png new file mode 100644 index 0000000..7b7ff89 Binary files /dev/null and b/Pokemon37.png differ diff --git a/Pokemon38.png b/Pokemon38.png new file mode 100644 index 0000000..b7d2274 Binary files /dev/null and b/Pokemon38.png differ diff --git a/Pokemon39.png b/Pokemon39.png new file mode 100644 index 0000000..112de9e Binary files /dev/null and b/Pokemon39.png differ diff --git a/Pokemon4.png b/Pokemon4.png new file mode 100644 index 0000000..13d4825 Binary files /dev/null and b/Pokemon4.png differ diff --git a/Pokemon40.png b/Pokemon40.png new file mode 100644 index 0000000..a7c4cbe Binary files /dev/null and b/Pokemon40.png differ diff --git a/Pokemon41.png b/Pokemon41.png new file mode 100644 index 0000000..96feccc Binary files /dev/null and b/Pokemon41.png differ diff --git a/Pokemon42.png b/Pokemon42.png new file mode 100644 index 0000000..081778c Binary files /dev/null and b/Pokemon42.png differ diff --git a/Pokemon43.png b/Pokemon43.png new file mode 100644 index 0000000..9fcd74c Binary files /dev/null and b/Pokemon43.png differ diff --git a/Pokemon44.png b/Pokemon44.png new file mode 100644 index 0000000..aec0f0c Binary files /dev/null and b/Pokemon44.png differ diff --git a/Pokemon45.png b/Pokemon45.png new file mode 100644 index 0000000..da1dcc1 Binary files /dev/null and b/Pokemon45.png differ diff --git a/Pokemon46.png b/Pokemon46.png new file mode 100644 index 0000000..aaea6e3 Binary files /dev/null and b/Pokemon46.png differ diff --git a/Pokemon47.png b/Pokemon47.png new file mode 100644 index 0000000..6506219 Binary files /dev/null and b/Pokemon47.png differ diff --git a/Pokemon48.png b/Pokemon48.png new file mode 100644 index 0000000..44d680e Binary files /dev/null and b/Pokemon48.png differ diff --git a/Pokemon49.png b/Pokemon49.png new file mode 100644 index 0000000..38f4c8a Binary files /dev/null and b/Pokemon49.png differ diff --git a/Pokemon5.png b/Pokemon5.png new file mode 100644 index 0000000..bb2fa02 Binary files /dev/null and b/Pokemon5.png differ diff --git a/Pokemon50.png b/Pokemon50.png new file mode 100644 index 0000000..e3a8dea Binary files /dev/null and b/Pokemon50.png differ diff --git a/Pokemon51.png b/Pokemon51.png new file mode 100644 index 0000000..2e342ce Binary files /dev/null and b/Pokemon51.png differ diff --git a/Pokemon52.png b/Pokemon52.png new file mode 100644 index 0000000..7f4f295 Binary files /dev/null and b/Pokemon52.png differ diff --git a/Pokemon53.png b/Pokemon53.png new file mode 100644 index 0000000..d41cb3d Binary files /dev/null and b/Pokemon53.png differ diff --git a/Pokemon6.png b/Pokemon6.png new file mode 100644 index 0000000..67f57ab Binary files /dev/null and b/Pokemon6.png differ diff --git a/Pokemon63.PNG b/Pokemon63.PNG new file mode 100644 index 0000000..0a004ee Binary files /dev/null and b/Pokemon63.PNG differ diff --git a/Pokemon7.png b/Pokemon7.png new file mode 100644 index 0000000..7cd5df3 Binary files /dev/null and b/Pokemon7.png differ diff --git a/Pokemon8.png b/Pokemon8.png new file mode 100644 index 0000000..7a5da76 Binary files /dev/null and b/Pokemon8.png differ diff --git a/Pokemon9.png b/Pokemon9.png new file mode 100644 index 0000000..813f1a2 Binary files /dev/null and b/Pokemon9.png differ diff --git a/README.md b/README.md deleted file mode 100644 index 592f0c3..0000000 --- a/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# DelphiProject -Delphi Project 12/II - -Pokemon-Spiel am Spalatin. - -# ACHTUNG !! - -Die main_unit ist nicht ,so wie sie darin liegt, lauffähig, man brauch noch Bilder und die verschiedenen Klassen. - diff --git a/main_unit.pas b/main_unit.pas deleted file mode 100644 index 68a82c5..0000000 --- a/main_unit.pas +++ /dev/null @@ -1,157 +0,0 @@ -unit Unit1; - -{$mode objfpc}{$H+} - -interface - -uses - Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, - Buttons, ExtCtrls, TKarte, TSpielfigur, TBot; - // die 3 Klassen gibt es im Steuerung-Branch - -type - - { TForm1 } - - TForm1 = class(TForm) - // Wie schon erwähnt es brauch nur einen Timer mit dem Namen 'Timer1' als Komponente - Timer1: TTimer; - - procedure FormCreate(Sender: TObject); - procedure FormKeyPress(Sender: TObject; var Key: char); - procedure Timer1Timer(Sender: TObject); - - private - - public - - end; - -var - Form1: TForm1; - -implementation - -{$R *.lfm} - -var Karte : TKarte1; -var Spielfigur : TSpielfigur1; -var Bot,secBot :TBot1; - -{ TForm1 } - -procedure TForm1.FormCreate(Sender: TObject); -begin - - // Erschaffen von den 3 Klassen (Karte,Spielfigur,Bot) - // Davon 2 Bots - Karte := TKarte1.Create(Form1,0,0); - Karte.paintbackground('solidback.bmp'); - Spielfigur := TSpielfigur1.Create(Form1,240,176) ; - - // setFightDistance muss hier noch ausgeführt werden um später den Kampfeintritt zum richtigen Zeitpunkt zu bekommen - Bot := TBot1.Create(Form1,240,100) ; - // hier heißt das soviel wie "Es wird erst eingetreten wenn die Figur 0 in x und 21 in y-Richtung entfernt ist" - // wird später noch klarer - Bot.setFightDistanceX(0); - Bot.setFightDistanceY(21); - - secBot := TBot1.Create(Form1,30,110); - secBot.setFightDistanceX(21); - secBot.setFightDistanceY(3); - - - -end; - - - -procedure TForm1.FormKeyPress(Sender: TObject; var Key: char); -begin - - if (key = 'a') and Karte.prooveX(Karte.getPosX +5) then - begin - // passiert in allen if-Abfragen das selbe : Karte bewegt sich mit den Bots + Spielfigur wird korrekt gesetzt - Karte.setPosX(5); - Spielfigur.paintFigur(1); - Bot.setPosX(5); - - // Bei diesen setDistance Sachen wird der Abstand zwischen Spielfigur und Bot berechnet - Bot.setDistanceX(Spielfigur.getLeft); - Bot.setDistanceY(Spielfigur.getTop()); - - secBot.setPosX(5); - secBot.setDistanceX(Spielfigur.getLeft); - secBot.setDistanceY(Spielfigur.getTop()); - end; - - - if (key = 'd') and Karte.prooveX(Karte.getPosX -5) then - begin - Karte.setPosX(-5); - Bot.setPosX(-5); - Spielfigur.paintFigur(2); - Bot.setDistanceX(Spielfigur.getLeft); - Bot.setDistanceY(Spielfigur.getTop()); - - secBot.setPosX(-5); - secBot.setDistanceX(Spielfigur.getLeft); - secBot.setDistanceY(Spielfigur.getTop()); - - end; - - if (key = 'w') and Karte.prooveY(Karte.getPosY +5) then - begin - Karte.setPosY(5); - Bot.setPosY(5); - Spielfigur.paintFigur(3); - Bot.setDistanceX(Spielfigur.getLeft); - Bot.setDistanceY(Spielfigur.getTop()); - secBot.setPosY(5); - secBot.setDistanceX(Spielfigur.getLeft); - secBot.setDistanceY(Spielfigur.getTop()); - end; - - if (key = 's') and Karte.prooveY(Karte.getPosY -5) then - begin - Karte.setPosY(-5); - Bot.setPosY(-5); - Spielfigur.paintFigur(4); - Bot.setDistanceX(Spielfigur.getLeft); - Bot.setDistanceY(Spielfigur.getTop()); - secBot.setPosY(-5); - secBot.setDistanceX(Spielfigur.getLeft); - secBot.setDistanceY(Spielfigur.getTop()); - end; -// Das war im wesentlichen der Bewegungsapparat des Spiels -end; - - -// Hier kommt noch der Eintritt in den Kampf -procedure TForm1.Timer1Timer(Sender: TObject); -begin - -// Wenn die momentane Distance der Objekte (Spielfigur,Bot) kleiner als die oben definierte FightDistance ist wird der Timer angehalten -// und es wird in der ShowMessage 'Lass uns kämpfen ausgegeben' - - if (abs(Bot.getDistanceY()) <= abs(Bot.getFightDistanceY())) and (abs(Bot.getDistanceX()) <= abs(Bot.getFightDistanceX())) then - begin - Timer1.Enabled:= false; - ShowMessage(Bot.startConversation()); - //Hier könnte Tobias einsteigen und die Überleitung in die "Kampfarena" bringen - end; - - -if (abs(secBot.getDistanceY()) <= abs(secBot.getFightDistanceY())) and (abs(secBot.getDistanceX()) <= abs(secBot.getFightDistanceX())) then - begin - Timer1.Enabled:= false; - ShowMessage(secBot.startConversation()); - end; -end; - - - - - -end. - diff --git a/uTPokemon.pas b/uTPokemon.pas new file mode 100644 index 0000000..789bb7d --- /dev/null +++ b/uTPokemon.pas @@ -0,0 +1,265 @@ + unit uTPokemon; + +interface + +uses ExtCtrls, Forms, SysUtils; + + +type TAttacke = record + Name: String[20]; + Typ: String[10]; + Staerke: Integer; + AP: Integer; +end; + + +type TPokemon = class(TImage) +protected + FType1: String[10]; //wenn Pokemon nur einen Typ hat sind Typ 1 und 2 gleich + FType2: String[10]; + FName: String[30]; + FLevel:Integer; + FNumber:Integer; + FXP:Integer; + FMaxHP: Integer; + FcurrentHP:Integer; + Fwild: Boolean; //alles gilt als wild, was nicht Spieler gehört + FAttacken: array[1..4] of TAttacke; + +public + constructor create (Formular:TForm;Number, Level: Integer;wild: boolean); + procedure setlevel(Level: Integer); + procedure setXP(XP: Integer); + procedure setcurrentHP(HP:Integer); + + function getLevel:Integer; + function getNumber:Integer; + function getXP:Integer; + + function getmaxHP:Integer; + function getcurrentHP:Integer; + procedure drawPokemon(Formular: TForm; links,oben: Integer); + function getName:String; + function getType1:String; + function getType2:String; + + function getAttacke1: TAttacke; + function getAttacke2: TAttacke; + function getAttacke3: TAttacke; + function getAttacke4: TAttacke; + + procedure Angriff(Pokemon:Tpokemon; Attackennummer: Integer); +end; + +implementation + +constructor TPokemon.create(Formular:TForm;Number, Level: Integer; wild: boolean); +type TPokemonRecord=record + Number: Integer; + Name: String[30]; + Type1: String[10]; + Type2: String[10]; + end; +var f: File of TPokemonRecord; + pokemon: TPokemonRecord; + + g: File of TAttacke; + i,j: Integer; + Attacke: TAttacke; + +begin + inherited Create(Formular); + assignfile(f,'FileOfTPokemonRecord.txt') ; //File in dem alle Pokemon der 1. Generation gespeichert sind + reset(f); + seek(f,Number-1); + read(f,pokemon); + + if pokemon.Type1 = 'Fire' then FType1:='Feuer'; + if pokemon.Type1 = 'Water' then FType1:='Wasser'; + if pokemon.Type1 = 'Grass' then FType1:='Pflanze'; + if pokemon.Type1 = 'Bug' then FType1:='Käfer'; + if pokemon.Type1 = 'Ghost' then FType1:='Geist'; + if pokemon.Type1 = 'Dragon' then FType1:='Drache'; + if pokemon.Type1 = 'Flying' then FType1:='Flug'; + if pokemon.Type1 = 'Electric' then FType1:='Elektro'; + if pokemon.Type1 = 'Psychic' then FType1:='Psycho'; + if pokemon.Type1 = 'Ice' then FType1:='Eis'; + if pokemon.Type1 = 'Poison' then FType1:='Gift'; + if pokemon.Type1 = 'Rock' then FType1:='Gestein'; + if pokemon.Type1 = 'Ground' then FType1:='Boden'; + if pokemon.Type1 = 'Fight' then FType1:='Kampf'; + if pokemon.Type2 = 'Fire' then FType2:='Feuer'; + if pokemon.Type2 = 'Water' then FType2:='Wasser'; + if pokemon.Type2 = 'Grass' then FType2:='Pflanze'; + if pokemon.Type2 = 'Bug' then FType2:='Käfer'; + if pokemon.Type2 = 'Ghost' then FType2:='Geist'; + if pokemon.Type2 = 'Dragon' then FType2:='Drache'; + if pokemon.Type2 = 'Flying' then FType2:='Flug'; + if pokemon.Type2 = 'Electric' then FType2:='Elektro'; + if pokemon.Type2 = 'Psychic' then FType2:='Psycho'; + if pokemon.Type2 = 'Ice' then FType2:='Eis'; + if pokemon.Type2 = 'Poison' then FType2:='Gift'; + if pokemon.Type2 = 'Rock' then FType2:='Gestein'; + if pokemon.Type2 = 'Ground' then FType2:='Boden'; + if pokemon.Type2 = 'Fight' then FType2:='Kampf'; + + FName:= pokemon.Name; + FType1:= pokemon.Type1; + FType2:= pokemon.Type2; + FNumber:= pokemon.Number; + + closefile(f); + + if (Level<1) or (Level>100) then FLevel:=1 + else FLevel:= Level; + + Assignfile(g,'Attacken.txt'); + randomize; + i:= Random(100); + j:=1; + reset(g); + repeat + seek(g,i); + read(g,Attacke); + if (Attacke.Typ = 'Normal') or (Attacke.Typ = FType2) or (Attacke.Typ = FType1) then begin + FAttacken[j]:=Attacke; + Inc(j); + end; + Inc(i); + if i>100 then i:=1; + until j>4; + closefile(g); + + FMaxHP:= FLevel*10; //verbesserungswürdig + FcurrentHP:= FMaxHP; + + Fwild:= wild; +end; + +procedure TPokemon.setlevel(Level: Integer); +begin + if (Level<1) or (Level>100) then FLevel:=FLevel + else FLevel:= Level; + + FMaxHP:= FLevel*10; //verbesserungswürdig + + FMaxHP:= FLevel*10; //verbesserungswürdig + +end; + +procedure TPokemon.setXP(XP: Integer); +begin + if Xp<0 then xp:=0; + +//immer nach 100xp Level Up (verbesserungswürdig) + + if xp>100 then begin + SetLevel(FLevel+1); + xp:= xp-100; + end; + FXP:=XP; +end; + +procedure TPokemon.setcurrentHP(HP:Integer); +begin + if HP > FMaxHP then HP:=fMaxHP; + if HP<0 then HP:=0; + FcurrentHP:=HP; +end; + +function TPokemon.getcurrentHP:Integer; +begin + result:= FcurrentHP; +end; + +function TPokemon.getLevel:Integer; +begin + result:= FLevel; +end; + +function TPokemon.getNumber:Integer; +begin + result:= FNumber; +end; + +function TPokemon.getXP:Integer; +begin + result:=FXP; +end; + +function TPokemon.getmaxHP:Integer; +begin + result:= FMaxHP; +end; + +procedure TPokemon.drawPokemon(Formular: TForm; links,oben: Integer); +begin + Left:=Links; + Top:=oben; + Parent:=Formular; + Autosize:=true; + + Picture.LoadFromFile('Pokemon'+IntToStr(FNumber)+'.png'); + + Picture.LoadFromFile('Pokemon'+IntToStr(FNumber)+'.png'); + +end; + +function TPokemon.getName:String; +begin + result:=FName; +end; + +function TPokemon.getType1:String; +begin + result:=FType1; +end; + +function TPokemon.getType2:String; +begin + result:=FType2; +end; + + +function TPokemon.getAttacke1: TAttacke; +begin + result:=FAttacken[1]; +end; + +function TPokemon.getAttacke2: TAttacke; +begin + result:=FAttacken[2]; +end; + +function TPokemon.getAttacke3: TAttacke; +begin + result:=FAttacken[3]; +end; + +function TPokemon.getAttacke4: TAttacke; +begin + result:=FAttacken[4]; +end; + +procedure TPokemon.Angriff(Pokemon:Tpokemon; Attackennummer: Integer); +var i:Integer; +begin + if FWild=true then begin + i:= random(4)+1; + if FAttacken[i].Ap <> 0 then begin + FAttacken[i].Ap:= FAttacken[i].Ap -1; + Pokemon.setcurrentHP(Pokemon.getcurrentHP - FAttacken[i].Staerke div 10); + end; + end; + + if FWild=false then begin + if FAttacken[Attackennummer].Ap <> 0 then begin + FAttacken[Attackennummer].Ap:= FAttacken[Attackennummer].Ap -1; + Pokemon.setcurrentHP(Pokemon.getcurrentHP - FAttacken[Attackennummer].Staerke div 10); + if Pokemon.getcurrentHP <= 0 then setXP(FXP+40); + end; + end; +end; + + +end.