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