mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
spjspj - Add the option of having a .dck file as a cube
This commit is contained in:
parent
548b05ba74
commit
26d38f0773
6 changed files with 153 additions and 13 deletions
|
|
@ -67,6 +67,22 @@ public class CubeFactory {
|
|||
return draftCube;
|
||||
}
|
||||
|
||||
public DraftCube createDeckDraftCube(String draftCubeName, String chosenDckFile) {
|
||||
|
||||
DraftCube draftCube;
|
||||
Constructor<?> con;
|
||||
try {
|
||||
con = draftCubes.get(draftCubeName).getConstructor(new Class[]{String.class});
|
||||
draftCube = (DraftCube)con.newInstance(new Object[] {chosenDckFile});
|
||||
} catch (Exception ex) {
|
||||
logger.fatal("CubeFactory error", ex);
|
||||
return null;
|
||||
}
|
||||
logger.debug("Draft cube created: " + draftCube.getName());
|
||||
|
||||
return draftCube;
|
||||
}
|
||||
|
||||
public Set<String> getDraftCubes() {
|
||||
return draftCubes.keySet();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
|
|
@ -35,6 +35,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import mage.cards.Sets;
|
||||
import mage.game.draft.DraftCube;
|
||||
import mage.game.tournament.Tournament;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
import mage.game.tournament.TournamentType;
|
||||
|
|
@ -78,7 +79,14 @@ public class TournamentFactory {
|
|||
}
|
||||
tournament.getOptions().getLimitedOptions().setNumberBoosters(tournament.getTournamentType().getNumBoosters());
|
||||
if (tournament.getTournamentType().isCubeBooster()) {
|
||||
tournament.getOptions().getLimitedOptions().setDraftCube(CubeFactory.getInstance().createDraftCube(tournament.getOptions().getLimitedOptions().getDraftCubeName()));
|
||||
DraftCube draftCube = null;
|
||||
|
||||
if (tournament.getOptions().getLimitedOptions().getCubeFromDeckFilename().length() != 0) {
|
||||
draftCube = CubeFactory.getInstance().createDeckDraftCube(tournament.getOptions().getLimitedOptions().getDraftCubeName(), tournament.getOptions().getLimitedOptions().getCubeFromDeckFilename());
|
||||
} else {
|
||||
draftCube = CubeFactory.getInstance().createDraftCube(tournament.getOptions().getLimitedOptions().getDraftCubeName());
|
||||
}
|
||||
tournament.getOptions().getLimitedOptions().setDraftCube(draftCube);
|
||||
tournament.setBoosterInfo(tournament.getOptions().getLimitedOptions().getDraftCubeName());
|
||||
} else if (tournament.getTournamentType().isRandom()) {
|
||||
StringBuilder rv = new StringBuilder( "Random Draft using sets: ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue