mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merge remote-tracking branch 'origin/1124_broadcast_mark_rounding_message' into 1124_broadcast_mark_rounding_message
This commit is contained in:
@@ -231,27 +231,25 @@ public class GameState implements Runnable {
|
|||||||
Double trueWindAngle = Math.abs(windDirection - yacht.getHeading());
|
Double trueWindAngle = Math.abs(windDirection - yacht.getHeading());
|
||||||
Double boatSpeedInKnots = PolarTable.getBoatSpeed(getWindSpeedKnots(), trueWindAngle);
|
Double boatSpeedInKnots = PolarTable.getBoatSpeed(getWindSpeedKnots(), trueWindAngle);
|
||||||
Double maxBoatSpeed = GeoUtility.knotsToMMS(boatSpeedInKnots);
|
Double maxBoatSpeed = GeoUtility.knotsToMMS(boatSpeedInKnots);
|
||||||
|
// TODO: 15/08/17 remove magic numbers from these equations.
|
||||||
if (yacht.getSailIn() && yacht.getCurrentVelocity() <= maxBoatSpeed && maxBoatSpeed != 0d) {
|
if (yacht.getSailIn()) {
|
||||||
if (velocity < maxBoatSpeed) {
|
if (velocity < maxBoatSpeed - 500) {
|
||||||
yacht.changeVelocity(maxBoatSpeed / 15);
|
yacht.changeVelocity(maxBoatSpeed / 150);
|
||||||
}
|
} else if (velocity > maxBoatSpeed + 500) {
|
||||||
if (velocity > maxBoatSpeed) {
|
yacht.changeVelocity(-maxBoatSpeed / 100);
|
||||||
|
} else {
|
||||||
yacht.setCurrentVelocity(maxBoatSpeed);
|
yacht.setCurrentVelocity(maxBoatSpeed);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (velocity > 0d) {
|
if (velocity > 3000) {
|
||||||
if (maxBoatSpeed != 0d) {
|
yacht.changeVelocity(-velocity / 200);
|
||||||
yacht.changeVelocity(-maxBoatSpeed / 600);
|
} else if (velocity > 100) {
|
||||||
} else {
|
yacht.changeVelocity(-velocity / 50);
|
||||||
yacht.changeVelocity(-velocity / 100);
|
} else if (velocity <= 100){
|
||||||
}
|
|
||||||
if (velocity < 0) {
|
|
||||||
yacht.setCurrentVelocity(0d);
|
yacht.setCurrentVelocity(0d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user