Skip to content
Snippets Groups Projects

#604 Fixed problem with computing score with new rules in NightWatch game

Merged Anton Danilov requested to merge feature-nightwatchgame-newrules into devel
Compare and
1 file
+ 3
2
Preferences
Compare changes
@@ -20,6 +20,7 @@ package cz.nic.tablexia.shared.model.resolvers;
import java.util.ArrayList;
import java.util.List;
import cz.nic.tablexia.game.ranksystem.RankProcessingScript;
import cz.nic.tablexia.shared.model.Game;
import cz.nic.tablexia.shared.model.GameScore;
import cz.nic.tablexia.shared.model.definitions.DifficultyDefinition;
@@ -49,7 +50,7 @@ public class NightWatchScoreResolver extends AbstractGameScoreResolver {
@Override
public GameResultDefinition getGameCupsResult(Game game) {
if (game.getApplicationVersionCode() > Game.DEFAULT_APPLICATION_VERSION_CODE) {
if (game.getRankSystemVersionCode() > RankProcessingScript.V3_3.getScriptVersion()) {
return getNumberOfStarsForResult(Integer.parseInt(game.getGameScore(SCORE_ROUND_COUNT, "0")), false);
} else {
int correctWindows = LEVELS_COUNT - Integer.valueOf(game.getGameScore(SCORE_WRONG_WINDOWS, "0"));
@@ -81,7 +82,7 @@ public class NightWatchScoreResolver extends AbstractGameScoreResolver {
@Override
public float getGameScoreResult(Game game) {
if (game.getApplicationVersionCode() > Game.DEFAULT_APPLICATION_VERSION_CODE) {
if (game.getRankSystemVersionCode() > RankProcessingScript.V3_3.getScriptVersion()) {
return Float.parseFloat(game.getGameScore(SCORE_ROUND_COUNT, "0"));
} else {
int wrongTime = Integer.parseInt(game.getGameScore(SCORE_WRONG_TIME, Integer.toString(LEVELS_COUNT)));