Стабилизировать переход через пилу уровня 5
This commit is contained in:
@@ -250,8 +250,10 @@ public final class LevelPlaytestBot {
|
|||||||
snapshot -> snapshot.playerAlive() && snapshot.playerX() < 250f)
|
snapshot -> snapshot.playerAlive() && snapshot.playerX() < 250f)
|
||||||
.step("Approach the saw", 4_000L, Input.right(),
|
.step("Approach the saw", 4_000L, Input.right(),
|
||||||
snapshot -> snapshot.playerAlive() && snapshot.playerX() >= 390f)
|
snapshot -> snapshot.playerAlive() && snapshot.playerX() >= 390f)
|
||||||
.step("Jump over the saw", 2_000L, Input.rightJump(),
|
.step("Take off before the saw", 1_000L, Input.rightJump(),
|
||||||
snapshot -> snapshot.playerX() >= 430f)
|
snapshot -> snapshot.playerAlive() && snapshot.playerY() <= 700f)
|
||||||
|
.step("Clear the saw", 2_000L, Input.right(),
|
||||||
|
snapshot -> snapshot.playerAlive() && snapshot.playerX() >= 680f)
|
||||||
.step("Run to the ledge", 4_000L, Input.right(),
|
.step("Run to the ledge", 4_000L, Input.right(),
|
||||||
snapshot -> snapshot.playerX() >= 750f)
|
snapshot -> snapshot.playerX() >= 750f)
|
||||||
.step("Jump onto the ledge", 2_000L, Input.rightJump(),
|
.step("Jump onto the ledge", 2_000L, Input.rightJump(),
|
||||||
|
|||||||
@@ -118,6 +118,17 @@ public final class LevelPlaytestBotTest {
|
|||||||
assertTrue(result.doorOpened());
|
assertTrue(result.doorOpened());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void levelFiveDelayedDecisionStillClearsTheSawWithOneVolunteer() {
|
||||||
|
LevelFiveDriver driver = new LevelFiveDriver(true);
|
||||||
|
|
||||||
|
LevelPlaytestBot.Result result = new LevelPlaytestBot().proveLevelFive(driver, 25_000L);
|
||||||
|
|
||||||
|
assertTrue(result.diagnostic(), result.completed());
|
||||||
|
assertEquals(1, result.deaths());
|
||||||
|
assertEquals(1, result.corpseCount());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void automationSnapshotDefaultsToNoMovingPlatform() {
|
public void automationSnapshotDefaultsToNoMovingPlatform() {
|
||||||
GameView.AutomationSnapshot snapshot = new GameView.AutomationSnapshot(
|
GameView.AutomationSnapshot snapshot = new GameView.AutomationSnapshot(
|
||||||
@@ -275,6 +286,7 @@ public final class LevelPlaytestBotTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final class LevelFiveDriver implements LevelPlaytestBot.Driver {
|
private static final class LevelFiveDriver implements LevelPlaytestBot.Driver {
|
||||||
|
private final boolean overshootApproach;
|
||||||
private int startedLevel;
|
private int startedLevel;
|
||||||
private long nowMillis;
|
private long nowMillis;
|
||||||
private boolean moveRight;
|
private boolean moveRight;
|
||||||
@@ -285,6 +297,16 @@ public final class LevelPlaytestBotTest {
|
|||||||
private int deaths;
|
private int deaths;
|
||||||
private int corpses;
|
private int corpses;
|
||||||
private float x = 130f;
|
private float x = 130f;
|
||||||
|
private float y = 760f;
|
||||||
|
private boolean sawTakeoffObserved;
|
||||||
|
|
||||||
|
LevelFiveDriver() {
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
LevelFiveDriver(boolean overshootApproach) {
|
||||||
|
this.overshootApproach = overshootApproach;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startLevel(int oneBasedLevelNumber) {
|
public void startLevel(int oneBasedLevelNumber) {
|
||||||
@@ -301,7 +323,7 @@ public final class LevelPlaytestBotTest {
|
|||||||
public GameView.AutomationSnapshot snapshot() {
|
public GameView.AutomationSnapshot snapshot() {
|
||||||
return new GameView.AutomationSnapshot(
|
return new GameView.AutomationSnapshot(
|
||||||
completed, alive, doorOpen, false, moveRight || jump,
|
completed, alive, doorOpen, false, moveRight || jump,
|
||||||
startedLevel, nowMillis, x, 760f, deaths, corpses);
|
startedLevel, nowMillis, x, y, deaths, corpses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -310,6 +332,7 @@ public final class LevelPlaytestBotTest {
|
|||||||
if (!alive) {
|
if (!alive) {
|
||||||
alive = true;
|
alive = true;
|
||||||
x = 130f;
|
x = 130f;
|
||||||
|
y = 760f;
|
||||||
} else if (deaths == 0 && moveRight && !jump) {
|
} else if (deaths == 0 && moveRight && !jump) {
|
||||||
deaths = 1;
|
deaths = 1;
|
||||||
corpses = 1;
|
corpses = 1;
|
||||||
@@ -317,11 +340,24 @@ public final class LevelPlaytestBotTest {
|
|||||||
doorOpen = true;
|
doorOpen = true;
|
||||||
x = 570f;
|
x = 570f;
|
||||||
} else if (moveRight && jump) {
|
} else if (moveRight && jump) {
|
||||||
|
if (x < 750f) {
|
||||||
|
sawTakeoffObserved = true;
|
||||||
|
y = 690f;
|
||||||
|
}
|
||||||
x += 60f;
|
x += 60f;
|
||||||
} else if (moveRight && x < 390f) {
|
} else if (moveRight && x < 390f) {
|
||||||
x = 400f;
|
x = overshootApproach ? 440f : 400f;
|
||||||
} else if (moveRight && x < 750f) {
|
} else if (moveRight && x < 750f) {
|
||||||
|
if (overshootApproach && !sawTakeoffObserved) {
|
||||||
|
deaths++;
|
||||||
|
corpses++;
|
||||||
|
alive = false;
|
||||||
|
x = 510f;
|
||||||
|
y = 780f;
|
||||||
|
} else {
|
||||||
x = 760f;
|
x = 760f;
|
||||||
|
y = 760f;
|
||||||
|
}
|
||||||
} else if (moveRight && x < 1_390f) {
|
} else if (moveRight && x < 1_390f) {
|
||||||
x = 1_500f;
|
x = 1_500f;
|
||||||
} else if (moveRight) {
|
} else if (moveRight) {
|
||||||
|
|||||||
Reference in New Issue
Block a user