fix ispassable
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package worms.facade;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.operations.Mod;
|
||||
import worms.model.Food;
|
||||
import worms.model.Team;
|
||||
import worms.model.World;
|
||||
|
@@ -142,13 +142,21 @@ public class World {
|
||||
public boolean isPassable(double[] center, double radius) {
|
||||
|
||||
for (double i = 0; i < 2 * Math.PI; i += Math.PI / 180) {
|
||||
double lenX = center[0] + radius * Math.cos(i);
|
||||
double lenY = center[1] + radius * Math.sin(i);
|
||||
double lenX = Math.round((center[0] + radius * Math.cos(i)) * 10000) / 10000;
|
||||
double lenY = Math.round((center[1] + radius * Math.sin(i)) * 10000) / 10000;
|
||||
|
||||
if (!isPassable(lenX, lenY)) return false;
|
||||
if (i < 1.58 && i > 1.57) {
|
||||
lenY -= 0.00001;
|
||||
}
|
||||
else if (i < 0.79 && i > 0.78 ) {
|
||||
lenX -= 0.00001;
|
||||
}
|
||||
|
||||
if (!isPassable(lenX, lenY)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private boolean isUnderCircle(Coordinate square, Coordinate center, double radius) {
|
||||
|
Reference in New Issue
Block a user