From 32002101ad21b5d07075a5ef91192543c5c2ea80 Mon Sep 17 00:00:00 2001 From: Alexander Novotny Date: Sun, 19 Feb 2023 18:01:16 -0800 Subject: [PATCH] Prevent backgrounds from being used as commanders no matter what (#10007) --- .../src/mage/deck/AbstractCommander.java | 2 +- .../deck/CommanderDeckValidationTest.java | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/AbstractCommander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/AbstractCommander.java index b8a3090f6f..4f80709c18 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/AbstractCommander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/AbstractCommander.java @@ -83,7 +83,7 @@ public abstract class AbstractCommander extends Constructed { return false; } if (commander1.getAbilities().containsClass(ChooseABackgroundAbility.class) == commander2.hasSubTypeForDeckbuilding(SubType.BACKGROUND) - || commander2.getAbilities().containsClass(ChooseABackgroundAbility.class) == commander1.hasSubTypeForDeckbuilding(SubType.BACKGROUND)) { + && commander2.getAbilities().containsClass(ChooseABackgroundAbility.class) == commander1.hasSubTypeForDeckbuilding(SubType.BACKGROUND)) { return true; } if (commander1.hasSubTypeForDeckbuilding(SubType.BACKGROUND)) { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/deck/CommanderDeckValidationTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/deck/CommanderDeckValidationTest.java index 6301b9eefc..872c04f7fd 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/deck/CommanderDeckValidationTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/deck/CommanderDeckValidationTest.java @@ -71,4 +71,28 @@ public class CommanderDeckValidationTest extends MageTestBase { deckTester.validate(); } + + @Test(expected = AssertionError.class) + public void testBackgrounds() { + DeckTester deckTester = new DeckTester(new Commander()); + deckTester.addMaindeck("Forest", 98); + + deckTester.addSideboard("Thrasios, Triton Hero", 1); + deckTester.addSideboard("Haunted One", 1); + + deckTester.validate( + "Commanders without the 'Choose a Background' ability should not be able to have a background as an additional commander"); + } + + @Test() + public void testBackgrounds2() { + DeckTester deckTester = new DeckTester(new Commander()); + deckTester.addMaindeck("Plains", 98); + + deckTester.addSideboard("Abdel Adrian, Gorion's Ward", 1); + deckTester.addSideboard("Haunted One", 1); + + deckTester.validate( + "Commanders with the 'Choose a Background' ability should be able to have a background as an additional commander"); + } }