Random foiling moved to per-player settings, is set up before starting a match

This commit is contained in:
Maxmtg
2014-01-24 04:35:22 +00:00
parent 7687637783
commit 308039739f
5 changed files with 20 additions and 13 deletions

View File

@@ -8,7 +8,6 @@ public class Dependencies {
@Deprecated public abstract boolean getCloneModeSource();
@Deprecated public abstract String getLogEntryType();
@Deprecated public abstract String getCurrentAiProfile();
@Deprecated public abstract boolean canRandomFoil();
@Deprecated public abstract boolean isManaBurnEnabled();
@Deprecated public abstract boolean areBlocksFree();
}

View File

@@ -16,7 +16,6 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import forge.Dependencies;
import forge.deck.CardPool;
import forge.deck.Deck;
import forge.deck.DeckSection;
@@ -97,14 +96,13 @@ public class Match {
* TODO: Write javadoc for this method.
*/
public void startGame(final Game game, final CountDownLatch latch) {
final boolean canRandomFoil = Dependencies.preferences.canRandomFoil() && gameType == GameType.Constructed;
// This code could be run run from EDT.
game.getAction().invoke(new Runnable() {
@Override
public void run() {
prepareAllZones(game, canRandomFoil);
prepareAllZones(game);
if (useAnte) { // Deciding which cards go to ante
Multimap<Player, Card> list = game.chooseCardsForAnte();
for (Entry<Player, Card> kv : list.entries()) {
@@ -254,7 +252,7 @@ public class Match {
library.setCards(newLibrary);
}
private void prepareAllZones(final Game game, final boolean canRandomFoil) {
private void prepareAllZones(final Game game) {
// need this code here, otherwise observables fail
Trigger.resetIDs();
game.getTriggerHandler().clearDelayedTrigger();
@@ -305,9 +303,9 @@ public class Match {
Random generator = MyRandom.getRandom();
preparePlayerLibrary(player, ZoneType.Library, myDeck.getMain(), canRandomFoil, generator);
preparePlayerLibrary(player, ZoneType.Library, myDeck.getMain(), psc.useRandomFoil(), generator);
if (myDeck.has(DeckSection.Sideboard)) {
preparePlayerLibrary(player, ZoneType.Sideboard, myDeck.get(DeckSection.Sideboard), canRandomFoil, generator);
preparePlayerLibrary(player, ZoneType.Sideboard, myDeck.get(DeckSection.Sideboard), psc.useRandomFoil(), generator);
}
player.shuffle(null);

View File

@@ -155,4 +155,13 @@ public class RegisteredPlayer {
public void restoreDeck() {
currentDeck = (Deck) originalDeck.copyTo(originalDeck.getName());
}
private boolean randomFoil = false;
public void setRandomFoil(boolean useRandomFoil) {
this.randomFoil = useRandomFoil;
}
public boolean useRandomFoil() {
return randomFoil;
}
}