mirror of
https://github.com/guezoloic/L3-racing-game.git
synced 2026-03-30 11:56:14 +00:00
feat: correction plupart des bug
- TODO: hybridCar a regler
This commit is contained in:
@@ -134,10 +134,8 @@ public class BasicCar implements Car {
|
||||
* @param move nombre de positions à avancer
|
||||
* @return cette même instance (pour chaînage fluide)
|
||||
*/
|
||||
@Override
|
||||
public void move() {
|
||||
if (decreaseDamage()) {
|
||||
System.out.println(NAME + " est en\taccident " + damageRound);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -150,7 +148,6 @@ public class BasicCar implements Car {
|
||||
Circuit element = map.getElement(point.x, point.y);
|
||||
|
||||
if (hasAccident(element, jump)) {
|
||||
System.out.println(NAME + " a un\taccident");
|
||||
setDamage();
|
||||
return;
|
||||
}
|
||||
@@ -167,7 +164,6 @@ public class BasicCar implements Car {
|
||||
*
|
||||
* @return cette même instance pour chaînage
|
||||
*/
|
||||
@Override
|
||||
public void consumeFuel() {
|
||||
fuel = state.fuelConsumption(fuel);
|
||||
if (fuel < 0)
|
||||
@@ -190,6 +186,7 @@ public class BasicCar implements Car {
|
||||
public boolean apply() {
|
||||
if (fuel > 0) {
|
||||
move();
|
||||
consumeFuel();
|
||||
}
|
||||
return !hasFinished();
|
||||
}
|
||||
@@ -203,7 +200,7 @@ public class BasicCar implements Car {
|
||||
* @return la position actuelle dans la boucle
|
||||
*/
|
||||
public int getPosition() {
|
||||
return pos;
|
||||
return Math.floorMod(pos, map.getPathSize());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user