added tore
This commit is contained in:
parent
47d57b8a88
commit
9dc5fdc6e2
|
|
@ -148,34 +148,39 @@ public class Spiel {
|
||||||
}
|
}
|
||||||
if (weiter) {
|
if (weiter) {
|
||||||
double tordis = s.p.getDistance(nichtballteam.torwart.p);
|
double tordis = s.p.getDistance(nichtballteam.torwart.p);
|
||||||
Spieler t = null;
|
if(tordis <10){
|
||||||
boolean ss = false;
|
tor();
|
||||||
for (Spieler m : ballteam.spieler) {
|
}else{
|
||||||
|
tordis = s.p.getDistance(nichtballteam.torwart.p);
|
||||||
|
Spieler t = null;
|
||||||
|
boolean ss = false;
|
||||||
|
for (Spieler m : ballteam.spieler) {
|
||||||
|
|
||||||
if (!m.equals(s)) {
|
if (!m.equals(s)) {
|
||||||
if (m.p.getDistance(nichtballteam.torwart.p) < tordis) {
|
if (m.p.getDistance(nichtballteam.torwart.p) < tordis) {
|
||||||
t = m;
|
t = m;
|
||||||
ss = true;
|
ss = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (t != null&&ss) {
|
if (t != null&&ss) {
|
||||||
Flugbahn fb = new Flugbahn(s.p, t.p);
|
Flugbahn fb = new Flugbahn(s.p, t.p);
|
||||||
boolean succes = false;
|
boolean succes = false;
|
||||||
for (Spieler temp : nichtballteam.spieler) {
|
for (Spieler temp : nichtballteam.spieler) {
|
||||||
if (fb.isInRange(temp.p)) {
|
if (fb.isInRange(temp.p)) {
|
||||||
// Pass wurde unterbrochen
|
// Pass wurde unterbrochen
|
||||||
temp.takeBall(s);
|
temp.takeBall(s);
|
||||||
succes = true;
|
succes = true;
|
||||||
ballWechsel();
|
ballWechsel();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!succes) {
|
||||||
|
System.out.println(s.getname() + " passt Ball an " + t.getname());
|
||||||
|
// Ball wurde weg gepasst
|
||||||
|
t.takeBall(s);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!succes) {
|
|
||||||
System.out.println(s.getname() + " passt Ball an " + t.getname());
|
|
||||||
// Ball wurde weg gepasst
|
|
||||||
t.takeBall(s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -184,8 +189,18 @@ public class Spiel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean torMoeglich(){
|
public void tor(){
|
||||||
return false;
|
if(ballBesitz){
|
||||||
|
heimteam.tore++;
|
||||||
|
System.out.println("Heimteam punktet!");
|
||||||
|
heimteam.setPositions(true);
|
||||||
|
auswärtsteam.setPositions(false);
|
||||||
|
}else{
|
||||||
|
auswärtsteam.tore++;
|
||||||
|
System.out.println("Auswärtsteam punktet!");
|
||||||
|
heimteam.setPositions(true);
|
||||||
|
auswärtsteam.setPositions(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ballWechsel(){
|
public void ballWechsel(){
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ public class Team {
|
||||||
public Spieler[] spieler = new Spieler[10];
|
public Spieler[] spieler = new Spieler[10];
|
||||||
Torwart torwart;
|
Torwart torwart;
|
||||||
int siege = 0;
|
int siege = 0;
|
||||||
|
int tore;
|
||||||
|
|
||||||
public Team(String name){
|
public Team(String name){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue