mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
* Modal double faces cards - fixed that color identity doesn't contains second side colors;
This commit is contained in:
parent
10ac8ab86f
commit
31d134843a
4 changed files with 48 additions and 24 deletions
|
@ -7,6 +7,7 @@ import mage.constants.SubType;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.ManaUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
@ -242,12 +243,15 @@ public class ModalDoubleFacesCardsTest extends CardTestPlayerBase {
|
|||
// mdf and legendary
|
||||
addCard(Zone.HAND, playerA, "Halvar, God of Battle");
|
||||
|
||||
// mdf and color identity
|
||||
addCard(Zone.HAND, playerA, "Esika, God of the Tree");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
Assert.assertEquals(2, getHandCards(playerA).size());
|
||||
Assert.assertEquals(3, getHandCards(playerA).size());
|
||||
|
||||
// stats in hand - normal
|
||||
Card card = getHandCards(playerA).stream().filter(c -> CardUtil.haveSameNames(c, "Akoum Warrior", currentGame)).findFirst().get();
|
||||
|
@ -262,6 +266,10 @@ public class ModalDoubleFacesCardsTest extends CardTestPlayerBase {
|
|||
Assert.assertTrue("must be legendary", card.isLegendary());
|
||||
Assert.assertTrue("must be creature", card.isCreature());
|
||||
Assert.assertTrue("must be god", card.hasSubtype(SubType.GOD, currentGame));
|
||||
|
||||
// stats in hand - mdf - color identity must be from both sides
|
||||
card = getHandCards(playerA).stream().filter(c -> CardUtil.haveSameNames(c, "Esika, God of the Tree", currentGame)).findFirst().get();
|
||||
Assert.assertEquals("color identity of mdf card must be from both sides", "{W}{U}{B}{R}{G}", ManaUtil.getColorIdentity(card).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestCommander3PlayersFFA;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CommanderColorIdentityTest extends CardTestCommander3PlayersFFA {
|
||||
|
@ -24,17 +23,17 @@ public class CommanderColorIdentityTest extends CardTestCommander3PlayersFFA {
|
|||
Assert.assertEquals("{W}", getColorIdentityString("Silvercoat Lion"));
|
||||
|
||||
// Multicolor
|
||||
Assert.assertEquals("{G}{W}", getColorIdentityString("Veteran Warleader"));
|
||||
Assert.assertEquals("{W}{G}", getColorIdentityString("Veteran Warleader"));
|
||||
Assert.assertEquals("{B}{R}", getColorIdentityString("Forerunner of Slaughter"));
|
||||
Assert.assertEquals("{R}{U}", getColorIdentityString("Brutal Expulsion"));
|
||||
Assert.assertEquals("{U}{R}", getColorIdentityString("Brutal Expulsion"));
|
||||
Assert.assertEquals("{B}{G}", getColorIdentityString("Catacomb Sifter"));
|
||||
Assert.assertEquals("{B}{U}", getColorIdentityString("Fathom Feeder"));
|
||||
Assert.assertEquals("{U}{B}", getColorIdentityString("Fathom Feeder"));
|
||||
|
||||
Assert.assertEquals("{R}{W}", getColorIdentityString("Angelic Captain"));
|
||||
Assert.assertEquals("{G}{U}", getColorIdentityString("Bring to Light"));
|
||||
Assert.assertEquals("{B}{W}", getColorIdentityString("Drana's Emissary"));
|
||||
Assert.assertEquals("{G}{R}", getColorIdentityString("Grove Rumbler"));
|
||||
Assert.assertEquals("{U}{W}", getColorIdentityString("Roil Spout"));
|
||||
Assert.assertEquals("{W}{R}", getColorIdentityString("Angelic Captain"));
|
||||
Assert.assertEquals("{U}{G}", getColorIdentityString("Bring to Light"));
|
||||
Assert.assertEquals("{W}{B}", getColorIdentityString("Drana's Emissary"));
|
||||
Assert.assertEquals("{R}{G}", getColorIdentityString("Grove Rumbler"));
|
||||
Assert.assertEquals("{W}{U}", getColorIdentityString("Roil Spout"));
|
||||
|
||||
// Cards with colors in the rule text
|
||||
Assert.assertEquals("{B}{R}", getColorIdentityString("Fires of Undeath"));
|
||||
|
@ -47,7 +46,7 @@ public class CommanderColorIdentityTest extends CardTestCommander3PlayersFFA {
|
|||
Assert.assertEquals("{B}", getColorIdentityString("Dismember"));
|
||||
|
||||
// Hybrid mana
|
||||
Assert.assertEquals("{G}{W}", getColorIdentityString("Kitchen Finks"));
|
||||
Assert.assertEquals("{W}{G}", getColorIdentityString("Kitchen Finks"));
|
||||
|
||||
// Lands with colored activation costs
|
||||
Assert.assertEquals("{G}", getColorIdentityString("Treetop Village"));
|
||||
|
@ -56,10 +55,18 @@ public class CommanderColorIdentityTest extends CardTestCommander3PlayersFFA {
|
|||
Assert.assertEquals("{W}", getColorIdentityString("Knight of Obligation"));
|
||||
|
||||
// Two face cards
|
||||
Assert.assertEquals("{G}{R}", getColorIdentityString("Daybreak Ranger"));
|
||||
Assert.assertEquals("{R}{W}", getColorIdentityString("Archangel Avacyn"));
|
||||
Assert.assertEquals("{R}{U}", getColorIdentityString("Civilized Scholar"));
|
||||
Assert.assertEquals("{R}{G}", getColorIdentityString("Daybreak Ranger"));
|
||||
Assert.assertEquals("{W}{R}", getColorIdentityString("Archangel Avacyn"));
|
||||
Assert.assertEquals("{U}{R}", getColorIdentityString("Civilized Scholar"));
|
||||
|
||||
// Split cards
|
||||
Assert.assertEquals("{U}{R}", getColorIdentityString("Fire // Ice"));
|
||||
|
||||
// MDF cards
|
||||
Assert.assertEquals("{W}{U}{B}{R}{G}", getColorIdentityString("Esika, God of the Tree"));
|
||||
|
||||
// Adventure cards
|
||||
Assert.assertEquals("{G}", getColorIdentityString("Rosethorn Acolyte"));
|
||||
}
|
||||
|
||||
private String getColorIdentityString(String cardName) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.filter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -115,11 +114,11 @@ public class FilterMana implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (black ? "{B}" : "")
|
||||
+ (green ? "{G}" : "")
|
||||
+ (red ? "{R}" : "")
|
||||
// wubrg order
|
||||
return (white ? "{W}" : "")
|
||||
+ (blue ? "{U}" : "")
|
||||
+ (white ? "{W}" : "");
|
||||
+ (black ? "{B}" : "")
|
||||
+ (red ? "{R}" : "")
|
||||
+ (green ? "{G}" : "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,10 @@ import mage.abilities.dynamicvalue.DynamicValue;
|
|||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.mana.*;
|
||||
import mage.cards.AdventureCard;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ModalDoubleFacesCard;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.choices.Choice;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.filter.FilterMana;
|
||||
|
@ -610,10 +613,17 @@ public final class ManaUtil {
|
|||
}
|
||||
|
||||
public static FilterMana getColorIdentity(Card card) {
|
||||
// TODO: is it support mdf cards?
|
||||
// TODO: is it support adventure cards?
|
||||
Card secondSide = card.getSecondCardFace();
|
||||
return getColorIdentity(card.getColor(null), card.getManaCost().getSymbols(), card.getRules(), secondSide);
|
||||
Card secondSide;
|
||||
if (card instanceof SplitCard) {
|
||||
secondSide = ((SplitCard) card).getRightHalfCard();
|
||||
} else if (card instanceof AdventureCard) {
|
||||
secondSide = ((AdventureCard) card).getSpellCard();
|
||||
} else if (card instanceof ModalDoubleFacesCard) {
|
||||
secondSide = ((ModalDoubleFacesCard) card).getRightHalfCard();
|
||||
} else {
|
||||
secondSide = card.getSecondCardFace();
|
||||
}
|
||||
return getColorIdentity(card.getColor(), card.getManaCost().getSymbols(), card.getRules(), secondSide);
|
||||
}
|
||||
|
||||
public static int getColorIdentityHash(FilterMana colorIdentity) {
|
||||
|
|
Loading…
Reference in a new issue