mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Commander: SB is 0 or 10 cards
Quest: sold cards should be correctly removed from sideboard
This commit is contained in:
@@ -33,13 +33,13 @@ import forge.util.Aggregates;
|
|||||||
*/
|
*/
|
||||||
public enum DeckFormat {
|
public enum DeckFormat {
|
||||||
|
|
||||||
// Main board: allowed size SB: restriction Max distinct non basic cards
|
// Main board: allowed size SB: restriction Max distinct non basic cards
|
||||||
Constructed ( new IntRange(60, Integer.MAX_VALUE), new IntRange(15), 4),
|
Constructed ( new IntRange(60, Integer.MAX_VALUE), new IntRange(15), 4),
|
||||||
Limited ( new IntRange(40, Integer.MAX_VALUE), null, Integer.MAX_VALUE),
|
Limited ( new IntRange(40, Integer.MAX_VALUE), null, Integer.MAX_VALUE),
|
||||||
Commander ( new IntRange(99), new IntRange(0, 10), 1),
|
Commander ( new IntRange(99), new IntRange(10), 1),
|
||||||
Vanguard ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
Vanguard ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
||||||
Planechase ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
Planechase ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
||||||
Archenemy ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4);
|
Archenemy ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4);
|
||||||
|
|
||||||
private final IntRange mainRange;
|
private final IntRange mainRange;
|
||||||
private final IntRange sideRange; // null => no check
|
private final IntRange sideRange; // null => no check
|
||||||
|
|||||||
@@ -336,7 +336,19 @@ public final class QuestUtilCards {
|
|||||||
final int leftInPool = this.qa.getCardPool().count(card);
|
final int leftInPool = this.qa.getCardPool().count(card);
|
||||||
// remove sold cards from all decks:
|
// remove sold cards from all decks:
|
||||||
for (final Deck deck : this.qc.getMyDecks()) {
|
for (final Deck deck : this.qc.getMyDecks()) {
|
||||||
deck.getMain().remove(card, deck.getMain().count(card) - leftInPool);
|
int cntInMain = deck.getMain().count(card);
|
||||||
|
int cntInSb = deck.getSideboard().count(card);
|
||||||
|
int nToRemoveFromThisDeck = cntInMain + cntInSb - leftInPool;
|
||||||
|
if ( nToRemoveFromThisDeck <= 0 ) continue; // this is not the deck you are looking for
|
||||||
|
|
||||||
|
int nToRemoveFromSb = cntInSb - nToRemoveFromThisDeck;
|
||||||
|
if( nToRemoveFromSb > 0 ) {
|
||||||
|
deck.getSideboard().remove(card, nToRemoveFromSb);
|
||||||
|
nToRemoveFromThisDeck -= cntInSb; // actual removed count should be, but I take upper bound here
|
||||||
|
if ( nToRemoveFromThisDeck <= 0 ) continue; // done here
|
||||||
|
}
|
||||||
|
|
||||||
|
deck.getMain().remove(card, nToRemoveFromThisDeck);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user