mirror of
https://github.com/correl/mage.git
synced 2025-04-09 01:01:06 -09:00
5 tests for Switcheroo. Card is not implemented yet.
This commit is contained in:
parent
5b83ffe518
commit
0b9dec5ad0
3 changed files with 212 additions and 0 deletions
Mage.Sets/src/mage/sets/magic2013
Mage.Tests/src/test/java/org/mage/test
59
Mage.Sets/src/mage/sets/magic2013/Switcheroo.java
Normal file
59
Mage.Sets/src/mage/sets/magic2013/Switcheroo.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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.cards.CardImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class Switcheroo extends CardImpl<Switcheroo> {
|
||||
|
||||
public Switcheroo(UUID ownerId) {
|
||||
super(ownerId, 71, "Switcheroo", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{4}{U}");
|
||||
this.expansionSetCode = "M13";
|
||||
|
||||
this.color.setBlue(true);
|
||||
|
||||
// Exchange control of two target creatures.
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
public Switcheroo(final Switcheroo card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Switcheroo copy() {
|
||||
return new Switcheroo(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package org.mage.test.cards.control;
|
||||
|
||||
import mage.Constants;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class ExchangeControlTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests switching controls for two creatures on different sides
|
||||
*/
|
||||
@Test
|
||||
public void testSimpleExchange() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 5);
|
||||
addCard(Constants.Zone.HAND, playerA, "Switcheroo");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Switcheroo", "Llanowar Elves^Elite Vanguard");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
// check creatures changes their controllers
|
||||
assertPermanentCount(playerA, "Elite Vanguard", 1);
|
||||
assertPermanentCount(playerB, "Llanowar Elves", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests switching control for two creature on one side (both creatures are under the same player's control)
|
||||
*
|
||||
* Also tests "7/1/2012: You don't have to control either target."
|
||||
*/
|
||||
@Test
|
||||
public void testOneSideExchange() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 5);
|
||||
addCard(Constants.Zone.HAND, playerA, "Switcheroo");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Llanowar Elves");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Switcheroo", "Llanowar Elves^Elite Vanguard");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
// check spell was cast
|
||||
assertGraveyardCount(playerA, "Switcheroo", 1);
|
||||
|
||||
// check nothing happened
|
||||
assertPermanentCount(playerB, "Elite Vanguard", 1);
|
||||
assertPermanentCount(playerB, "Llanowar Elves", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests:
|
||||
* 7/1/2012: If one of the target creatures is an illegal target when Switcheroo resolves, the exchange won't happen.
|
||||
*
|
||||
* Targets opponent's creature
|
||||
*/
|
||||
@Test
|
||||
public void testOneTargetBecomesIllegal() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 5);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Constants.Zone.HAND, playerA, "Switcheroo");
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Switcheroo", "Llanowar Elves^Elite Vanguard");
|
||||
// cast in response
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Elite Vanguard");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
// check nothing happened
|
||||
assertPermanentCount(playerA, "Llanowar Elves", 1);
|
||||
assertPermanentCount(playerB, "Elite Vanguard", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests:
|
||||
* 7/1/2012: If one of the target creatures is an illegal target when Switcheroo resolves, the exchange won't happen.
|
||||
*
|
||||
* Targets its own creature.
|
||||
*/
|
||||
@Test
|
||||
public void testOneTargetBecomesIllegal2() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 5);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Constants.Zone.HAND, playerA, "Switcheroo");
|
||||
addCard(Constants.Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Switcheroo", "Llanowar Elves^Elite Vanguard");
|
||||
// cast in response
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Llanowar Elves");
|
||||
|
||||
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
// check nothing happened
|
||||
assertPermanentCount(playerA, "Llanowar Elves", 1);
|
||||
assertPermanentCount(playerB, "Elite Vanguard", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* First gain control by Act of Treason.
|
||||
* Then exchange control with other opponent's creature.
|
||||
*
|
||||
* Finally second creature should stay under ours control permanently.
|
||||
*/
|
||||
@Test
|
||||
public void testInteractionWithOtherChangeControlEffect() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 5);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Constants.Zone.HAND, playerA, "Switcheroo");
|
||||
addCard(Constants.Zone.HAND, playerA, "Act of Treason");
|
||||
|
||||
// both creatures on opponent's side
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Llanowar Elves");
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Elite Vanguard");
|
||||
|
||||
// get control
|
||||
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Act of Treason", "Elite Vanguard");
|
||||
|
||||
// attack
|
||||
attack(1, playerA, "Elite Vanguard");
|
||||
|
||||
// exchange control after combat
|
||||
castSpell(1, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Switcheroo", "Llanowar Elves^Elite Vanguard");
|
||||
|
||||
// check the control effect still works on second turn
|
||||
setStopAt(2, Constants.PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
// now it is our creature for ages
|
||||
assertPermanentCount(playerA, "Llanowar Elves", 1);
|
||||
// this one is still on opponent's side
|
||||
assertPermanentCount(playerB, "Elite Vanguard", 1);
|
||||
}
|
||||
}
|
|
@ -285,6 +285,9 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (ability.getTargets().size() == 0) {
|
||||
throw new AssertionError("Ability has no targets.");
|
||||
}
|
||||
for (UUID id: ability.getTargets().get(0).possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
|
||||
MageObject object = game.getObject(id);
|
||||
if (object != null && object.getName().equals(t)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue