Implemented wind walker algorithm. Refactored some GameState updating logic to allow for better token logic integration

GameState: Moved all token logic into its own function startPoint so that it is dsijoint from other updating logic
GameState: Implemented wind walker algorithm.
GameState: Changed Generic 'speedMultiplier' to 'serverSpeedMultiplier' to make it obviously disjoint from a boats speed multiplier
MessageFactory: Moved some found message creation (Chatter Message)  server side into MessageFactory that wasnt already there
ServerYacht: Added a speed multiplier and a handling multiplier to the serveryacht class that is set and reset upon powerup / down

#story[1293]
This commit is contained in:
William Muir
2017-09-22 23:44:03 +12:00
parent a3c555d5fe
commit 061e49bab9
5 changed files with 158 additions and 51 deletions
+23 -1
View File
@@ -56,6 +56,8 @@ public class ServerYacht {
//PowerUp
private TokenType powerUp;
private Long powerUpStartTime;
private Integer speedMultiplier;
private Integer handlingMultiplier;
public ServerYacht(BoatMeshType boatType, Integer sourceId, String hullID, String shortName,
@@ -77,6 +79,8 @@ public class ServerYacht {
this.legNumber = 0;
this.boatColor = Colors.getColor(sourceId - 1);
this.powerUp = null;
this.speedMultiplier = 1;
this.handlingMultiplier = 1;
this.hasEnteredRoundingZone = false;
this.hasPassedLine = false;
@@ -114,6 +118,8 @@ public class ServerYacht {
public void powerDown() {
this.powerUp = null;
this.speedMultiplier = 1;
this.handlingMultiplier = 1;
}
public Long getPowerUpStartTime() {
@@ -130,7 +136,7 @@ public class ServerYacht {
* @param amount the amount by which to adjust the boat heading.
*/
public void adjustHeading(Double amount) {
Double newVal = heading + amount;
Double newVal = heading + amount * handlingMultiplier;
lastHeading = heading;
heading = (double) Math.floorMod(newVal.longValue(), 360L);
}
@@ -429,4 +435,20 @@ public class ServerYacht {
public BoatMeshType getBoatType() {
return boatType;
}
public Integer getSpeedMultiplier() {
return speedMultiplier;
}
public void setSpeedMultiplier(Integer speedMultiplier) {
this.speedMultiplier = speedMultiplier;
}
public Integer getHandlingMultiplier() {
return handlingMultiplier;
}
public void setHandlingMultiplier(Integer handlingMultiplier) {
this.handlingMultiplier = handlingMultiplier;
}
}