diff --git a/Mage.Client/src/main/java/mage/client/deck/generator/DeckGenerator.java b/Mage.Client/src/main/java/mage/client/deck/generator/DeckGenerator.java index 374ba29c51..523d235ce6 100644 --- a/Mage.Client/src/main/java/mage/client/deck/generator/DeckGenerator.java +++ b/Mage.Client/src/main/java/mage/client/deck/generator/DeckGenerator.java @@ -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(); diff --git a/Mage.Client/src/main/java/mage/client/dialog/AddLandDialog.java b/Mage.Client/src/main/java/mage/client/dialog/AddLandDialog.java index c833801f9f..a34543af42 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/AddLandDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/AddLandDialog.java @@ -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; diff --git a/Mage.Common/src/main/java/mage/utils/DeckBuilder.java b/Mage.Common/src/main/java/mage/utils/DeckBuilder.java index 01e872d83b..e0eebb9b2d 100644 --- a/Mage.Common/src/main/java/mage/utils/DeckBuilder.java +++ b/Mage.Common/src/main/java/mage/utils/DeckBuilder.java @@ -238,7 +238,7 @@ public final class DeckBuilder { } private int getManaCostScore(Card card, List allowedColors) { - int converted = card.getManaCost().convertedManaCost(); + int converted = card.getConvertedManaCost(); final Map 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() { diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java index 0a5dd23ddf..b731982025 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java @@ -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; } } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java index b4b0582418..76b6a9e7f8 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java @@ -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 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 -> { diff --git a/Mage/src/main/java/mage/cards/mock/MockCard.java b/Mage/src/main/java/mage/cards/mock/MockCard.java index 015a0a8f6e..629a26d2d7 100644 --- a/Mage/src/main/java/mage/cards/mock/MockCard.java +++ b/Mage/src/main/java/mage/cards/mock/MockCard.java @@ -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 diff --git a/Mage/src/main/java/mage/cards/mock/MockSplitCardHalf.java b/Mage/src/main/java/mage/cards/mock/MockSplitCardHalf.java index f13f681d9e..ac81660124 100644 --- a/Mage/src/main/java/mage/cards/mock/MockSplitCardHalf.java +++ b/Mage/src/main/java/mage/cards/mock/MockSplitCardHalf.java @@ -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