- Sealed Deck and Booster Draft limited modes now correctly handle and support cards with different art.

This commit is contained in:
Agetian
2014-01-13 14:46:12 +00:00
parent 9fbc7a17c3
commit 10fd05478d
3 changed files with 28 additions and 10 deletions

View File

@@ -54,7 +54,7 @@ public class CardPool extends ItemPool<PaperCard> {
/** /**
* Adds the. * Adds the card.
* *
* @param cardName * @param cardName
* the card name * the card name
@@ -62,20 +62,35 @@ public class CardPool extends ItemPool<PaperCard> {
* the set code * the set code
*/ */
public void add(final String cardName, final String setCode) { public void add(final String cardName, final String setCode) {
this.add(cardName, setCode, 1); this.add(cardName, setCode, -1, 1);
} }
/** /**
* Adds the. * Adds the card.
*
* @param cardName
* the card name
* @param setCode
* the set code
* @param amount
* the amount of cards to add
*/
public void add(final String cardName, final String setCode, final int amount) {
this.add(cardName, setCode, -1, amount);
}
/**
* Adds the card.
* *
* @param cardName the card name * @param cardName the card name
* @param setCode the set code * @param setCode the set code
* @param artIndex the card art index, -1 for random
* @param amount the amount * @param amount the amount
*/ */
public void add(final String cardName, final String setCode, final int amount) { public void add(final String cardName, final String setCode, final int artIndex, final int amount) {
PaperCard cp = StaticData.instance().getCommonCards().tryGetCard(cardName, setCode); PaperCard cp = StaticData.instance().getCommonCards().tryGetCard(cardName, setCode, artIndex);
if ( cp == null ) if ( cp == null )
cp = StaticData.instance().getVariantCards().tryGetCard(cardName, setCode); cp = StaticData.instance().getVariantCards().tryGetCard(cardName, setCode, artIndex);
if ( cp != null) if ( cp != null)
this.add(cp, amount); this.add(cp, amount);

View File

@@ -153,13 +153,14 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
final Deck deck = new Deck(); final Deck deck = new Deck();
// add sideboard to deck // add sideboard to deck
CardPool side = deck.getOrCreate(DeckSection.Sideboard); deck.getOrCreate(DeckSection.Sideboard).addAll(this.getDeckManager().getPool());
side.addAll(this.getDeckManager().getPool());
final CardEdition landSet = IBoosterDraft.LAND_SET_CODE[0]; final CardEdition landSet = IBoosterDraft.LAND_SET_CODE[0];
final int landsCount = 20; final int landsCount = 20;
for(String landName : MagicColor.Constant.BASIC_LANDS) { for(String landName : MagicColor.Constant.BASIC_LANDS) {
side.add(Singletons.getMagicDb().getCommonCards().getCard(landName, landSet.getCode()), landsCount); for (int i = 0; i < landsCount; i++) {
deck.get(DeckSection.Sideboard).add(landName, landSet.getCode(), -1, 1);
}
} }
return deck; return deck;

View File

@@ -172,7 +172,9 @@ public enum CSubmenuSealed implements ICDoc {
deck.getOrCreate(DeckSection.Sideboard).addAll(humanPool); deck.getOrCreate(DeckSection.Sideboard).addAll(humanPool);
for (final String element : MagicColor.Constant.BASIC_LANDS) { for (final String element : MagicColor.Constant.BASIC_LANDS) {
deck.get(DeckSection.Sideboard).add(element, sd.getLandSetCode(), 18); for (int i = 0; i < 18; i++) {
deck.get(DeckSection.Sideboard).add(element, sd.getLandSetCode(), -1, 1);
}
} }
final IStorage<DeckGroup> sealedDecks = Singletons.getModel().getDecks().getSealed(); final IStorage<DeckGroup> sealedDecks = Singletons.getModel().getDecks().getSealed();