Allowed fractional health deductions per frame
- Fixed boundary penalty system #story[1291]
This commit is contained in:
@@ -378,8 +378,8 @@ public class MockRace extends RaceState {
|
||||
}
|
||||
|
||||
// Remove one unit of health for every frame spent outside boundary
|
||||
if(!finish && checkBearingInsideCourse(boat.getBearing(), boat.getPosition())) {
|
||||
boat.updateHealth(-1);
|
||||
if(!finish && !GPSCoordinate.isInsideBoundary(boat.getPosition(), getBoundary())) {
|
||||
boat.updateHealth(-0.1);
|
||||
}
|
||||
|
||||
this.updateEstimatedTime(boat);
|
||||
|
||||
@@ -273,7 +273,7 @@ public class RaceServer {
|
||||
private BoatState parseIndividualBoatState(MockBoat boat) {
|
||||
return new BoatState(
|
||||
boat.getSourceID(),
|
||||
boat.getHealth()
|
||||
(int)boat.getHealth()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public class Boat extends Collider {
|
||||
/**
|
||||
* Amount of health boat currently has, between 0 and 100
|
||||
*/
|
||||
private int health;
|
||||
private double health;
|
||||
|
||||
/**
|
||||
* Constructs a boat object with a given sourceID, name, country/team abbreviation, and polars table.
|
||||
@@ -441,11 +441,11 @@ public class Boat extends Collider {
|
||||
isColliding = colliding;
|
||||
}
|
||||
|
||||
public int getHealth() {
|
||||
public double getHealth() {
|
||||
return health;
|
||||
}
|
||||
|
||||
public void setHealth(int health) {
|
||||
public void setHealth(double health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ public class Boat extends Collider {
|
||||
* Add a given amount of HP to boat health
|
||||
* @param delta amount of HP to add
|
||||
*/
|
||||
public void updateHealth(int delta) {
|
||||
public void updateHealth(double delta) {
|
||||
health += delta;
|
||||
if(health < 0) health = 0;
|
||||
else if(health > 100) health = 100;
|
||||
|
||||
Reference in New Issue
Block a user