diff --git a/Mage.Sets/src/mage/sets/magic2010/JackalFamiliar.java b/Mage.Sets/src/mage/sets/magic2010/JackalFamiliar.java new file mode 100644 index 00000000000..7de5af5db69 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2010/JackalFamiliar.java @@ -0,0 +1,66 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magic2010; + +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.keyword.CantAttackAloneAbility; +import mage.abilities.keyword.CantBlockAloneAbility; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author magenoxx_at_gmail.com + */ +public class JackalFamiliar extends CardImpl { + + public JackalFamiliar(UUID ownerId) { + super(ownerId, 143, "Jackal Familiar", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}"); + this.expansionSetCode = "M10"; + this.subtype.add("Hound"); + + this.color.setRed(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Jackal Familiar can't attack or block alone. + this.addAbility(CantAttackAloneAbility.getInstance()); + this.addAbility(CantBlockAloneAbility.getInstance()); + } + + public JackalFamiliar(final JackalFamiliar card) { + super(card); + } + + @Override + public JackalFamiliar copy() { + return new JackalFamiliar(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2013/MoggFlunkies.java b/Mage.Sets/src/mage/sets/magic2013/MoggFlunkies.java new file mode 100644 index 00000000000..24353891c41 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2013/MoggFlunkies.java @@ -0,0 +1,66 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magic2013; + +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.keyword.CantAttackAloneAbility; +import mage.abilities.keyword.CantBlockAloneAbility; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author magenoxx_at_gmail.com + */ +public class MoggFlunkies extends CardImpl { + + public MoggFlunkies(UUID ownerId) { + super(ownerId, 143, "Mogg Flunkies", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}"); + this.expansionSetCode = "M13"; + this.subtype.add("Goblin"); + + this.color.setRed(true); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Mogg Flunkies can't attack or block alone. + this.addAbility(CantAttackAloneAbility.getInstance()); + this.addAbility(CantBlockAloneAbility.getInstance()); + } + + public MoggFlunkies(final MoggFlunkies card) { + super(card); + } + + @Override + public MoggFlunkies copy() { + return new MoggFlunkies(this); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/combat/CantAttackOrBlockAloneTest.java b/Mage.Tests/src/test/java/org/mage/test/combat/CantAttackOrBlockAloneTest.java new file mode 100644 index 00000000000..1e9f030be6f --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/combat/CantAttackOrBlockAloneTest.java @@ -0,0 +1,85 @@ +package org.mage.test.combat; + +import junit.framework.Assert; +import mage.Constants; +import mage.game.permanent.Permanent; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author magenoxx_at_gmail.com + */ +public class CantAttackOrBlockAloneTest extends CardTestPlayerBase { + + /** + * Try to attack alone + */ + @Test + public void testCantAttackAlone() { + addCard(Constants.Zone.BATTLEFIELD, playerB, "Mogg Flunkies"); + addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard"); + + attack(2, playerB, "Mogg Flunkies"); + + setStopAt(2, Constants.PhaseStep.END_TURN); + execute(); + + assertLife(playerA, 20); + + Permanent moggFlunkies = getPermanent("Mogg Flunkies", playerB.getId()); + Assert.assertTrue("Should be tapped because of attacking", moggFlunkies.isTapped()); + } + + /** + * This time attack in pair + */ + @Test + public void testCantAttackAlone2() { + addCard(Constants.Zone.BATTLEFIELD, playerB, "Mogg Flunkies"); + addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard"); + + attack(2, playerB, "Mogg Flunkies"); + attack(2, playerB, "Elite Vanguard"); + + setStopAt(2, Constants.PhaseStep.END_TURN); + execute(); + + assertLife(playerA, 15); + } + + /** + * Try to block alone + */ + @Test + public void testCantBlockAlone() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Mogg Flunkies"); + addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard"); + + attack(2, playerB, "Elite Vanguard"); + block(2, playerA, "Mogg Flunkies", "Elite Vanguard"); + + setStopAt(2, Constants.PhaseStep.END_TURN); + execute(); + + assertLife(playerA, 18); + } + + /** + * Try to block in pair + */ + @Test + public void testCantBlockAlone2() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Mogg Flunkies"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves"); + addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard"); + + attack(2, playerB, "Elite Vanguard"); + block(2, playerA, "Mogg Flunkies", "Elite Vanguard"); + block(2, playerA, "Llanowar Elves", "Elite Vanguard"); + + setStopAt(2, Constants.PhaseStep.END_TURN); + execute(); + + assertLife(playerA, 20); + } +}