mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
13 tests for Soulbond keyword
This commit is contained in:
parent
321927b104
commit
cd7e10e186
3 changed files with 373 additions and 0 deletions
65
Mage.Sets/src/mage/sets/avacynrestored/TrustedForcemage.java
Normal file
65
Mage.Sets/src/mage/sets/avacynrestored/TrustedForcemage.java
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* 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.avacynrestored;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Rarity;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author noxx
|
||||||
|
|
||||||
|
*/
|
||||||
|
public class TrustedForcemage extends CardImpl<TrustedForcemage> {
|
||||||
|
|
||||||
|
public TrustedForcemage(UUID ownerId) {
|
||||||
|
super(ownerId, 199, "Trusted Forcemage", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{G}");
|
||||||
|
this.expansionSetCode = "AVR";
|
||||||
|
this.subtype.add("Human");
|
||||||
|
this.subtype.add("Shaman");
|
||||||
|
|
||||||
|
this.color.setGreen(true);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
// Soulbond
|
||||||
|
// As long as Trusted Forcemage is paired with another creature, each of those creatures gets +1/+1.
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrustedForcemage(final TrustedForcemage card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TrustedForcemage copy() {
|
||||||
|
return new TrustedForcemage(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,296 @@
|
||||||
|
package org.mage.test.cards.abilities.keywords;
|
||||||
|
|
||||||
|
import mage.Constants;
|
||||||
|
import mage.filter.Filter;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author noxx
|
||||||
|
*/
|
||||||
|
public class SoulbondKeywordTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPairOnCast() {
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
|
||||||
|
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 1);
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 3, 3);
|
||||||
|
assertPowerToughness(playerA, "Elite Vanguard", 3, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests pair on another creature without Soulbond entering battlefield
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testPairOnEntersBattlefield() {
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Elite Vanguard");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard");
|
||||||
|
|
||||||
|
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 1);
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 3, 3);
|
||||||
|
assertPowerToughness(playerA, "Elite Vanguard", 3, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests two creatures with Soulbond paired with each other
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testTwoSoulbondCreaturesOnBattlefield() {
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Trusted Forcemage", 2);
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 6);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
|
||||||
|
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 1);
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 3, 3, Filter.ComparisonScope.All);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests no Soulbond effect possible on single creature
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testNoPairOnSingleCreature() {
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage", 1);
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
|
||||||
|
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 1);
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 2, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests Soulbond effect disabling whenever Soulbond creature changes its controller
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testChangeControllerForSoulbondCreature() {
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||||
|
|
||||||
|
addCard(Constants.Zone.HAND, playerB, "Act of Treason");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain", 3);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Act of Treason", "Trusted Forcemage");
|
||||||
|
|
||||||
|
setStopAt(2, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 0);
|
||||||
|
assertPermanentCount(playerA, "Elite Vanguard", 1);
|
||||||
|
assertPowerToughness(playerA, "Elite Vanguard", 2, 1);
|
||||||
|
|
||||||
|
assertPermanentCount(playerB, "Trusted Forcemage", 1);
|
||||||
|
assertPowerToughness(playerB, "Trusted Forcemage", 2, 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests Soulbond effect disabling when paired creture changes its controller
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testChangeControllerForAnotherCreature() {
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||||
|
|
||||||
|
addCard(Constants.Zone.HAND, playerB, "Act of Treason");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain", 3);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Act of Treason", "Elite Vanguard");
|
||||||
|
|
||||||
|
setStopAt(2, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 1);
|
||||||
|
assertPermanentCount(playerA, "Elite Vanguard", 0);
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 2, 2);
|
||||||
|
|
||||||
|
assertPermanentCount(playerB, "Elite Vanguard", 1);
|
||||||
|
assertPowerToughness(playerB, "Elite Vanguard", 2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests Soulbond effect disabling when Soulbond creture changes its controller and then returns back.
|
||||||
|
* Effect should not be restored.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testChangeControllerAndGettingBack() {
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||||
|
|
||||||
|
addCard(Constants.Zone.HAND, playerB, "Act of Treason");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain", 3);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Act of Treason", "Trusted Forcemage");
|
||||||
|
|
||||||
|
setStopAt(3, Constants.PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 1);
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 2, 2);
|
||||||
|
assertPermanentCount(playerA, "Elite Vanguard", 1);
|
||||||
|
assertPowerToughness(playerA, "Elite Vanguard", 2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that stealing creature will allow to use Soulbond ability on controller's creature
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSoulbondWorksOnControllerSide() {
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||||
|
|
||||||
|
addCard(Constants.Zone.HAND, playerB, "Act of Treason");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain", 3);
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerB, "Plains", 1);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Act of Treason", "Trusted Forcemage");
|
||||||
|
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Elite Vanguard");
|
||||||
|
|
||||||
|
setStopAt(2, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
// stolen
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 0);
|
||||||
|
|
||||||
|
// both paired and have boost
|
||||||
|
assertPowerToughness(playerB, "Trusted Forcemage", 3, 3);
|
||||||
|
assertPowerToughness(playerB, "Elite Vanguard", 3, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests effect also disappeared when creature is returned back to owner
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testReturnBack() {
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||||
|
|
||||||
|
addCard(Constants.Zone.HAND, playerB, "Act of Treason");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain", 3);
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerB, "Plains", 1);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Act of Treason", "Trusted Forcemage");
|
||||||
|
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Elite Vanguard");
|
||||||
|
|
||||||
|
setStopAt(3, Constants.PhaseStep.PRECOMBAT_MAIN); // Effect of "Act of Treason" will end here
|
||||||
|
execute();
|
||||||
|
|
||||||
|
// returned back with no boost
|
||||||
|
assertPermanentCount(playerA, "Trusted Forcemage", 1);
|
||||||
|
assertPowerToughness(playerB, "Trusted Forcemage", 2, 2);
|
||||||
|
|
||||||
|
// no boost on next turn (gets unpaired)
|
||||||
|
assertPowerToughness(playerB, "Elite Vanguard", 2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests returning one of the paired creatures back to its owner's hand
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testUnsummon() {
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Unsummon", 1);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Unsummon", "Elite Vanguard");
|
||||||
|
|
||||||
|
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 2, 2);
|
||||||
|
assertPermanentCount(playerA, "Elite Vanguard", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that it is possible to animate land and pair it on next coming Soulbond creature
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testPairOnAnimatedLand() {
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 4);
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Blinkmoth Nexus", 1);
|
||||||
|
|
||||||
|
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{1}: ");
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
|
||||||
|
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
// test paired with boost
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 3, 3);
|
||||||
|
assertPowerToughness(playerA, "Blinkmoth Nexus", 2, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests no effect whether land was animated after Soulbond creature has entered the battlefield
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testPairOnPostAnimatedLand() {
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 4);
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Blinkmoth Nexus", 1);
|
||||||
|
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{1}: ");
|
||||||
|
|
||||||
|
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
// no effect on later animation
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 2, 2);
|
||||||
|
assertPowerToughness(playerA, "Blinkmoth Nexus", 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that creature type loss leads to Soulbond effect disabling
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCreatureTypeLoss() {
|
||||||
|
addCard(Constants.Zone.HAND, playerA, "Trusted Forcemage");
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 4);
|
||||||
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Blinkmoth Nexus", 1);
|
||||||
|
|
||||||
|
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{1}: ");
|
||||||
|
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Trusted Forcemage");
|
||||||
|
|
||||||
|
setStopAt(2, Constants.PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
// test boost loss
|
||||||
|
assertPowerToughness(playerA, "Trusted Forcemage", 2, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -315,6 +315,18 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #assertPowerToughness(mage.players.Player, String, int, int, mage.filter.Filter.ComparisonScope)}
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @param cardName
|
||||||
|
* @param power
|
||||||
|
* @param toughness
|
||||||
|
*/
|
||||||
|
public void assertPowerToughness(Player player, String cardName, int power, int toughness) {
|
||||||
|
assertPowerToughness(player, cardName, power, toughness, Filter.ComparisonScope.Any);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue