diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/GainAbilitiesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/GainAbilitiesTest.java index 242898b65e..f7a7cb6078 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/GainAbilitiesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/GainAbilitiesTest.java @@ -6,6 +6,7 @@ import mage.constants.PhaseStep; import mage.constants.Zone; import mage.game.permanent.Permanent; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -65,4 +66,48 @@ public class GainAbilitiesTest extends CardTestPlayerBase { ).count()); } + + /** + * Reported bug: https://github.com/magefree/mage/issues/9565 + * 1. Cast all three of Frondland Felidar, Jubilant Skybonder, and Proud Wildbonder. + * 2. When the third one is cast (order doesn't matter), the other two will lose their abilities + */ + @Ignore + @Test + public void gainAbilitiesDontRemoveEachOther() { + // {2}{W}{G} + // Vigilance + // Creatures you control with vigilance have “{1}, {T}: Tap target creature.” + String frondlandFelidar = "Frondland Felidar"; + // {1}{W/U}{W/U} + // Flying + // Creatures you control with flying have “Spells your opponents cast that target this creature cost {2} more to cast.” + String jubilantSkybonder = "Jubilant Skybonder"; + // {2}{R/G}{R/G} + // Trample + // Creatures you control with trample have “You may have this creature assign its combat damage as though it weren’t blocked.” + String proudWildbonder = "Proud Wildbonder"; + + addCard(Zone.HAND, playerA, frondlandFelidar); + addCard(Zone.HAND, playerA, jubilantSkybonder); + addCard(Zone.HAND, playerA, proudWildbonder); + addCard(Zone.BATTLEFIELD, playerA, "Alloy Myr", 11); + + showAvailableAbilities("", 1, PhaseStep.PRECOMBAT_MAIN, playerA); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, frondlandFelidar, true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, jubilantSkybonder, true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, proudWildbonder); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + Permanent frondlandFelidarPerm = getPermanent(frondlandFelidar); + Permanent jubilantSkybonderPerm = getPermanent(jubilantSkybonder); + Permanent proudWildbonderPerm = getPermanent(proudWildbonder); + + Assert.assertEquals(4, frondlandFelidarPerm.getAbilities(currentGame).size()); // Cast + Vigilence/Flying/Trample + "creature you control gain..." + Ability Gained from own effect. + Assert.assertEquals(4, jubilantSkybonderPerm.getAbilities(currentGame).size()); // Cast + Vigilence/Flying/Trample + "creature you control gain..." + Ability Gained from own effect. + Assert.assertEquals(4, proudWildbonderPerm.getAbilities(currentGame).size()); // Cast + Vigilence/Flying/Trample + "creature you control gain..." + Ability Gained from own effect. + } } diff --git a/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java index e15bc56054..67d6c145b0 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java @@ -62,37 +62,37 @@ public class HybridManaCost extends ManaCostImpl { public boolean testPay(Mana testMana) { switch (mana1) { case B: - if (testMana.getBlack() > 0) { + if (testMana.getBlack() > 0 || testMana.getAny() > 0) { return true; } case U: - if (testMana.getBlue() > 0) { + if (testMana.getBlue() > 0 || testMana.getAny() > 0) { return true; } case R: - if (testMana.getRed() > 0) { + if (testMana.getRed() > 0 || testMana.getAny() > 0) { return true; } case W: - if (testMana.getWhite() > 0) { + if (testMana.getWhite() > 0 || testMana.getAny() > 0) { return true; } case G: - if (testMana.getGreen() > 0) { + if (testMana.getGreen() > 0 || testMana.getAny() > 0) { return true; } } switch (mana2) { case B: - return testMana.getBlack() > 0; + return testMana.getBlack() > 0 || testMana.getAny() > 0; case U: - return testMana.getBlue() > 0; + return testMana.getBlue() > 0 || testMana.getAny() > 0; case R: - return testMana.getRed() > 0; + return testMana.getRed() > 0 || testMana.getAny() > 0; case W: - return testMana.getWhite() > 0; + return testMana.getWhite() > 0 || testMana.getAny() > 0; case G: - return testMana.getGreen() > 0; + return testMana.getGreen() > 0 || testMana.getAny() > 0; } return false; }