never seen that

This commit is contained in:
delta1805 2017-09-24 22:45:36 +02:00
parent c68897c5d1
commit a2405abab4
1 changed files with 27 additions and 31 deletions

View File

@ -148,41 +148,37 @@ public class Spiel {
} }
if (weiter) { if (weiter) {
double tordis = s.p.getDistance(nichtballteam.torwart.p); double tordis = s.p.getDistance(nichtballteam.torwart.p);
if(tordis <10){ Spieler t = null;
tor(); boolean ss = false;
}else{ for (Spieler m : ballteam.spieler) {
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) {
Flugbahn fb = new Flugbahn(s.p, t.p);
boolean succes = false;
for (Spieler temp : nichtballteam.spieler) {
if (fb.isInRange(temp.p)) {
// Pass wurde unterbrochen
temp.takeBall(s);
succes = true;
ballWechsel();
break;
}
}
if (!succes) {
System.out.println(s.getname() + " passt Ball an " + t.getname());
// Ball wurde weg gepasst
t.takeBall(s);
} }
} }
} }
if (t != null&&ss) {
Flugbahn fb = new Flugbahn(s.p, t.p);
boolean succes = false;
for (Spieler temp : nichtballteam.spieler) {
if (fb.isInRange(temp.p)) {
// Pass wurde unterbrochen
temp.takeBall(s);
succes = true;
ballWechsel();
break;
}
}
if (!succes) {
System.out.println(s.getname() + " passt Ball an " + t.getname());
// Ball wurde weg gepasst
t.takeBall(s);
}
}
} }
break; break;
} }
@ -191,11 +187,11 @@ public class Spiel {
public void torPhase(){ public void torPhase(){
if(ballBesitz){ if(ballBesitz){
if(b.s.p.getDistance(auswärtsteam.torwart.p)<20){ if(b.s.p.getDistance(auswärtsteam.torwart.p)<5){
tor(); tor();
} }
}else{ }else{
if(b.s.p.getDistance(heimteam.torwart.p)<20){ if(b.s.p.getDistance(heimteam.torwart.p)<5){
tor(); tor();
} }
} }