mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
GUI: fixed broken add lands and random deck dialogs in deck editor (#7562);
This commit is contained in:
parent
e94fd1b456
commit
eb64a7bb73
7 changed files with 34 additions and 20 deletions
|
@ -191,7 +191,7 @@ public final class DeckGenerator {
|
|||
while (count < spellCount) {
|
||||
Card card = cardPool.get(RandomUtil.nextInt(retrievedCount)).getMockCard();
|
||||
if (genPool.isValidSpellCard(card)) {
|
||||
int cardCMC = card.getManaCost().convertedManaCost();
|
||||
int cardCMC = card.getConvertedManaCost();
|
||||
for (DeckGeneratorCMC.CMC deckCMC : deckCMCs) {
|
||||
if (cardCMC >= deckCMC.min && cardCMC <= deckCMC.max) {
|
||||
int currentAmount = deckCMC.getAmount();
|
||||
|
|
|
@ -473,12 +473,13 @@ public class AddLandDialog extends MageDialog {
|
|||
land_number = 0;
|
||||
}
|
||||
for (Card cd : cards) {
|
||||
Mana m = cd.getManaCost().getMana();
|
||||
red += m.getRed();
|
||||
green += m.getGreen();
|
||||
black += m.getBlack();
|
||||
blue += m.getBlue();
|
||||
white += m.getWhite();
|
||||
for (String s : cd.getManaCostSymbols()) {
|
||||
if (s.contains("W")) white++;
|
||||
if (s.contains("U")) blue++;
|
||||
if (s.contains("B")) black++;
|
||||
if (s.contains("R")) red++;
|
||||
if (s.contains("G")) green++;
|
||||
}
|
||||
}
|
||||
int total = red + green + black + blue + white;
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ public final class DeckBuilder {
|
|||
}
|
||||
|
||||
private int getManaCostScore(Card card, List<ColoredManaSymbol> allowedColors) {
|
||||
int converted = card.getManaCost().convertedManaCost();
|
||||
int converted = card.getConvertedManaCost();
|
||||
final Map<String, Integer> singleCount = new HashMap<>();
|
||||
int maxSingleCount = 0;
|
||||
int multicolor = 0;
|
||||
|
@ -276,7 +276,7 @@ public final class DeckBuilder {
|
|||
}
|
||||
|
||||
public int getConvertedCost() {
|
||||
return this.card.getManaCost().convertedManaCost();
|
||||
return this.card.getConvertedManaCost();
|
||||
}
|
||||
|
||||
public Card getCard() {
|
||||
|
|
|
@ -386,14 +386,14 @@ public class Commander extends Constructed {
|
|||
whenYouCast |= s.contains("when you cast") || s.contains("whenever you cast");
|
||||
}
|
||||
|
||||
for (ManaCost cost : card.getManaCost()) {
|
||||
if (cost.getText().contains("X")) {
|
||||
for (String s : card.getManaCostSymbols()) {
|
||||
if (s.contains("X")) {
|
||||
xCost = true;
|
||||
}
|
||||
}
|
||||
for (Ability a : card.getAbilities()) {
|
||||
for (ManaCost cost : a.getManaCosts()) {
|
||||
if (cost.getText().contains("X")) {
|
||||
for (String s : a.getManaCostSymbols()) {
|
||||
if (s.contains("X")) {
|
||||
xCost = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ public class TinyLeaders extends Constructed {
|
|||
* would be legal independently.
|
||||
*/
|
||||
|
||||
if (commander == null || commander.getManaCost().convertedManaCost() > 3) {
|
||||
if (commander == null || commander.getConvertedManaCost() > 3) {
|
||||
if (commander == null) {
|
||||
if (deck.getName() == null) {
|
||||
addError(DeckValidatorErrorType.PRIMARY, "Leader", "You have to save your deck with the leader card name entered to the DECK NAME field of the DECK EDITOR (top left) so that XMage knows your leader."
|
||||
|
@ -141,7 +141,7 @@ public class TinyLeaders extends Constructed {
|
|||
|
||||
}
|
||||
}
|
||||
if (commander != null && commander.getManaCost().convertedManaCost() > 3) {
|
||||
if (commander != null && commander.getConvertedManaCost() > 3) {
|
||||
addError(DeckValidatorErrorType.PRIMARY, "Leader", "Commanders converted mana cost is greater than 3");
|
||||
}
|
||||
return false;
|
||||
|
@ -201,13 +201,13 @@ public class TinyLeaders extends Constructed {
|
|||
// as zero for this purpose. Split cards are legal only if both of their halves would be legal independently.
|
||||
List<Integer> costs = new ArrayList<>();
|
||||
if (card instanceof SplitCard) {
|
||||
costs.add(((SplitCard) card).getLeftHalfCard().getManaCost().convertedManaCost());
|
||||
costs.add(((SplitCard) card).getRightHalfCard().getManaCost().convertedManaCost());
|
||||
costs.add(((SplitCard) card).getLeftHalfCard().getConvertedManaCost());
|
||||
costs.add(((SplitCard) card).getRightHalfCard().getConvertedManaCost());
|
||||
} else if (card instanceof ModalDoubleFacesCard) {
|
||||
costs.add(((ModalDoubleFacesCard) card).getLeftHalfCard().getManaCost().convertedManaCost());
|
||||
costs.add(((ModalDoubleFacesCard) card).getRightHalfCard().getManaCost().convertedManaCost());
|
||||
costs.add(((ModalDoubleFacesCard) card).getLeftHalfCard().getConvertedManaCost());
|
||||
costs.add(((ModalDoubleFacesCard) card).getRightHalfCard().getConvertedManaCost());
|
||||
} else {
|
||||
costs.add(card.getManaCost().convertedManaCost());
|
||||
costs.add(card.getConvertedManaCost());
|
||||
}
|
||||
|
||||
return costs.stream().allMatch(cost -> {
|
||||
|
|
|
@ -10,6 +10,7 @@ import mage.cards.repository.CardInfo;
|
|||
import mage.cards.repository.CardRepository;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -99,6 +100,14 @@ public class MockCard extends CardImpl {
|
|||
|
||||
public MockCard(final MockCard card) {
|
||||
super(card);
|
||||
|
||||
this.startingLoyalty = card.startingLoyalty;
|
||||
this.manaCostLeftStr = new ArrayList<>(card.manaCostLeftStr);
|
||||
this.manaCostRightStr = new ArrayList<>(card.manaCostRightStr);
|
||||
this.manaCostStr = new ArrayList<>(card.manaCostStr);
|
||||
this.adventureSpellName = card.adventureSpellName;
|
||||
this.isModalDoubleFacesCard = card.isModalDoubleFacesCard;
|
||||
this.convertedManaCost = card.convertedManaCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import mage.cards.SplitCard;
|
|||
import mage.cards.SplitCardHalf;
|
||||
import mage.cards.repository.CardInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -29,6 +30,9 @@ public class MockSplitCardHalf extends MockCard implements SplitCardHalf {
|
|||
|
||||
public MockSplitCardHalf(final MockSplitCardHalf card) {
|
||||
super(card);
|
||||
this.splitCardParent = card.splitCardParent;
|
||||
this.manaCosts = card.manaCosts.copy();
|
||||
this.manaCostsSymbols = new ArrayList<>(card.manaCostsSymbols);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue