Commit 96644dc8 authored by Lukas Marik's avatar Lukas Marik

#945 ProtocolTest: back chaned in doCorrect

parent cb6c0d84
......@@ -28,7 +28,7 @@ public enum WallObjectDescriptor {
CUCKOO_CLOCK (GameObjectType.CUCKOO_CLOCK, WallType.LEFT_WALL, new EdgePoints(new float[]{0.06f, 0.97f}, new float[]{0.1f, 0.03f}, new float[]{0.92f, 0.98f}, new float[]{0.93f, 0.04f}), Arrays.asList( new float[]{0.044f, 0.55f}, new float[]{0.42f, 0.87f}, new float[]{0.92f, 0.65f})),
LADY_AND_PANDA (GameObjectType.LADY_AND_PANDA, WallType.LEFT_WALL, new EdgePoints(new float[]{0.11f, 0.68f}, new float[]{0.19f, 0.04f}, new float[]{0.86f, 0.94f}, new float[]{0.93f, 0.31f}), Arrays.asList( new float[]{0.08f, 0.66f}, new float[]{0.45f, 0.8f}, new float[]{0.92f, 0.65f})),
LANDSCAPE (GameObjectType.LANDSCAPE, WallType.RIGHT_WALL, new EdgePoints(new float[]{0.09f, 0.93f}, new float[]{0.08f, 0.38f}, new float[]{0.9f, 0.62f}, new float[]{0.9f, 0.05f}), Arrays.asList( new float[]{0.08f, 0.66f}, new float[]{0.57f, 0.87f}, new float[]{0.92f, 0.65f})),
MIRROR (GameObjectType.MIRROR, WallType.RIGHT_WALL, new EdgePoints(new float[]{0.2f, 0.97f}, new float[]{0.07f, 0.18f}, new float[]{0.91f, 0.82f}, new float[]{0.74f, 0.03f}), Arrays.asList( new float[]{0.08f, 0.52f}, new float[]{0.5f, 0.78f}, new float[]{0.92f, 0.52f})),
MIRROR (GameObjectType.MIRROR, WallType.RIGHT_WALL, new EdgePoints(new float[]{0.2f, 0.97f}, new float[]{0.07f, 0.18f}, new float[]{0.91f, 0.82f}, new float[]{0.74f, 0.03f}), Arrays.asList( new float[]{0.1f, 0.54f}, new float[]{0.5f, 0.78f}, new float[]{0.9f, 0.54f})),
//BONUS
KABUKI (GameObjectType.KABUKI, WallType.LEFT_WALL, new EdgePoints(new float[]{0.07f, 0.9f}, new float[]{0.1f, -0.13f}, new float[]{0.9f, 1.07f}, new float[]{0.93f, 0.13f}), Arrays.asList( new float[]{0.07f, 0.66f}, new float[]{0.6f, 0.78f}, new float[]{0.83f, 0.74f})),
MASK_AFRICA (GameObjectType.MASK_AFRICA, WallType.RIGHT_WALL, new EdgePoints(new float[]{0.1f, 1.04f}, new float[]{0.07f, 0.12f}, new float[]{0.95f, 0.9f}, new float[]{0.74f, -0.02f}), Arrays.asList( new float[]{0.07f, 0.66f}, new float[]{0.4f, 0.78f}, new float[]{0.83f, 0.74f})),
......
......@@ -182,6 +182,7 @@ public class TestGameProtocol extends AbstractTestGame {
}
private void playRound() {
recountCorrectObjects();
takeScreenShot();
ProtocolGenerator generator = gameState.getProtocolGenerator();
......@@ -222,6 +223,15 @@ public class TestGameProtocol extends AbstractTestGame {
}
private void recountCorrectObjects() {
Game game = loadGameFromDao(getGameID());
int actualGameScore = Integer.valueOf(game.getGameScore(ProtocolScoreResolver.SCORE_COUNT, "0"));
logInfo("Default correct item position/undefined item position: game score = " + gameScore + " changed to actual score = " + actualGameScore);
if(gameScore!=actualGameScore) gameScore = actualGameScore;
}
/////////////////////////////// ROOM ACTION
/**
......@@ -639,14 +649,11 @@ public class TestGameProtocol extends AbstractTestGame {
int sumObjectsCnt = LevelDefinition.DifficultyDefinition.getDefinitionByDifficulty(difficulty).getSumObjectCount();
int[] scoreResult = ProtocolScoreResolver.ResultStars.values()[difficulty.ordinal() - 1].getScoreResult();
int remainingObjects = sumObjectsCnt - objectsCnt;
if (expectedResult == AbstractTablexiaGame.GameResult.TWO_STAR && (objectsCnt >= (sumObjectsCnt - scoreResult[1]+ gameScore) || (remainingObjects <= scoreResult[1] && mistakeCnt < scoreResult[1])))
if (expectedResult == AbstractTablexiaGame.GameResult.TWO_STAR && objectsCnt >= (sumObjectsCnt - scoreResult[1]+ gameScore))
return true;
else if (expectedResult == AbstractTablexiaGame.GameResult.ONE_STAR && (objectsCnt >= (sumObjectsCnt - scoreResult[0]+ gameScore)|| (remainingObjects <= scoreResult[0] && mistakeCnt < scoreResult[0])))
else if (expectedResult == AbstractTablexiaGame.GameResult.ONE_STAR && objectsCnt >= (sumObjectsCnt - scoreResult[0]+ gameScore))
return true;
else if (expectedResult == AbstractTablexiaGame.GameResult.THREE_STAR) return true;
return false;
else return expectedResult == AbstractTablexiaGame.GameResult.THREE_STAR;
}
private boolean canMistake(GameObjectType objectType){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment