mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
spjspj - Allow appending from the clipboard in deck editor
This commit is contained in:
parent
9227c4615f
commit
7a8055172d
2 changed files with 54 additions and 1 deletions
|
|
@ -56,6 +56,29 @@ public class Deck implements Serializable {
|
|||
public static Deck load(DeckCardLists deckCardLists, boolean ignoreErrors) throws GameException {
|
||||
return Deck.load(deckCardLists, ignoreErrors, true);
|
||||
}
|
||||
|
||||
public static Deck append(Deck deckToAppend, Deck currentDeck) throws GameException {
|
||||
List<String> deckCardNames = new ArrayList<>();
|
||||
|
||||
for (Card card : deckToAppend.getCards()) {
|
||||
if (card != null) {
|
||||
currentDeck.cards.add(card);
|
||||
deckCardNames.add(card.getName());
|
||||
}
|
||||
}
|
||||
List<String> sbCardNames = new ArrayList<>();
|
||||
for (Card card : deckToAppend.getSideboard()) {
|
||||
if (card != null) {
|
||||
currentDeck.sideboard.add(card);
|
||||
deckCardNames.add(card.getName());
|
||||
}
|
||||
}
|
||||
Collections.sort(deckCardNames);
|
||||
Collections.sort(sbCardNames);
|
||||
String deckString = deckCardNames.toString() + sbCardNames.toString();
|
||||
currentDeck.setDeckHashCode(DeckUtil.fixedHash(deckString));
|
||||
return currentDeck;
|
||||
}
|
||||
|
||||
public static Deck load(DeckCardLists deckCardLists, boolean ignoreErrors, boolean mockCards) throws GameException {
|
||||
Deck deck = new Deck();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue