forked from External/mage
* Sideboarding: fixed that it possible to auto-submit 40 cards deck instead 60 in constructed formats (#5579);
Sideboarding: fixed that cheated deck with sideboard can be used instead lose the game;
This commit is contained in:
parent
3dd6836559
commit
de4befb9c2
22 changed files with 204 additions and 124 deletions
|
|
@ -389,7 +389,9 @@ public abstract class MatchImpl implements Match {
|
|||
// Check if the cards included in the deck are the same as in the original deck
|
||||
validDeck = (player.getDeck().getDeckCompleteHashCode() == deck.getDeckCompleteHashCode());
|
||||
if (validDeck == false) {
|
||||
deck.getCards().clear(); // Clear the deck so the player cheating looses the game
|
||||
// clear the deck so the player cheating looses the game
|
||||
deck.getCards().clear();
|
||||
deck.getSideboard().clear();
|
||||
}
|
||||
player.updateDeck(deck);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
package mage.game.match;
|
||||
|
||||
import java.io.Serializable;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidator;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class MatchPlayer implements Serializable {
|
||||
|
|
@ -78,9 +78,9 @@ public class MatchPlayer implements Serializable {
|
|||
this.deck = deck;
|
||||
}
|
||||
|
||||
public Deck generateDeck() {
|
||||
//TODO: improve this
|
||||
while (deck.getCards().size() < 40 && !deck.getSideboard().isEmpty()) {
|
||||
public Deck generateDeck(DeckValidator deckValidator) {
|
||||
// auto complete deck
|
||||
while (deck.getCards().size() < deckValidator.getDeckMinSize() && !deck.getSideboard().isEmpty()) {
|
||||
Card card = deck.getSideboard().iterator().next();
|
||||
deck.getCards().add(card);
|
||||
deck.getSideboard().remove(card);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.game.tournament;
|
||||
|
||||
import java.util.Set;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.constants.TournamentPlayerState;
|
||||
import mage.game.result.ResultProtos.TourneyPlayerProto;
|
||||
|
|
@ -10,8 +8,9 @@ import mage.players.Player;
|
|||
import mage.players.PlayerType;
|
||||
import mage.util.TournamentUtil;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class TournamentPlayer {
|
||||
|
|
@ -93,7 +92,9 @@ public class TournamentPlayer {
|
|||
// Check if the cards included in the deck are the same as in the original deck
|
||||
boolean validDeck = (getDeck().getDeckCompleteHashCode() == deck.getDeckCompleteHashCode());
|
||||
if (validDeck == false) {
|
||||
deck.getCards().clear(); // Clear the deck so the player cheating looses the game
|
||||
// Clear the deck so the player cheating looses the game
|
||||
deck.getCards().clear();
|
||||
deck.getSideboard().clear();
|
||||
}
|
||||
this.deck = deck;
|
||||
return validDeck;
|
||||
|
|
@ -177,7 +178,6 @@ public class TournamentPlayer {
|
|||
|
||||
/**
|
||||
* Free resources no longer needed if tournament has ended
|
||||
*
|
||||
*/
|
||||
public void cleanUpOnTournamentEnd() {
|
||||
this.deck = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue