feat: correction plupart des bug

- TODO: hybridCar a regler
This commit is contained in:
2025-12-18 21:00:13 +01:00
parent d210eedb5a
commit 6c75a5363f
11 changed files with 44 additions and 38 deletions

View File

@@ -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());
}
/**