- Puzzle Mode: don't award Challenge achievements in this mode (take two).

This commit is contained in:
Agetian
2017-08-13 09:46:51 +00:00
parent 670ccaf891
commit 36b493f03a
2 changed files with 16 additions and 3 deletions

View File

@@ -44,6 +44,9 @@ public class ChallengeAchievements extends AchievementCollection {
@Override
protected boolean eval(Player player, Game game) {
if (!ChallengeAchievements.checkValidGameMode(game)) {
return false;
}
return player.getOutcome().hasWon() &&
player.getAchievementTracker().challengesCompleted.contains(getKey());
}
@@ -56,9 +59,7 @@ public class ChallengeAchievements extends AchievementCollection {
@Override
protected final boolean eval(Player player, Game game) {
if (game.getRules().hasAppliedVariant(GameType.MomirBasic)
|| game.getRules().hasAppliedVariant(GameType.Puzzle)) {
// these modes use a fixed pre-defined deck format, so challenge achievements don't apply in them
if (!ChallengeAchievements.checkValidGameMode(game)) {
return false;
}
if (player.getOutcome().hasWon()) {
@@ -69,4 +70,13 @@ public class ChallengeAchievements extends AchievementCollection {
protected abstract boolean eval(Deck deck);
}
public static boolean checkValidGameMode(final Game game) {
if (game.getRules().hasAppliedVariant(GameType.MomirBasic)
|| game.getRules().hasAppliedVariant(GameType.Puzzle)) {
// these modes use a fixed pre-defined deck format, so challenge achievements don't apply in them
return false;
}
return true;
}
}

View File

@@ -1,7 +1,9 @@
package forge.puzzle;
import com.google.common.collect.Sets;
import forge.ai.GameState;
import forge.game.Game;
import forge.game.GameType;
import forge.game.ability.AbilityFactory;
import forge.game.card.Card;
import forge.game.player.Player;
@@ -153,6 +155,7 @@ public class Puzzle extends GameState implements InventoryItem, Comparable<Puzzl
setupMaxPlayerHandSize(game, 7);
super.applyGameOnThread(game);
addGoalEnforcement(game);
game.getRules().setAppliedVariants(Sets.newHashSet(GameType.Puzzle));
}
@Override