Merge branch 'master' into subTypeSwitch

This commit is contained in:
theelk801 2017-09-09 11:16:47 -04:00 committed by GitHub
commit 31acee7624
80 changed files with 2613 additions and 176 deletions

View file

@ -0,0 +1,307 @@
/*
* 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 org.mage.test.cards.continuous;
import mage.cards.Card;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class SubTypeChangingEffectsTest extends CardTestPlayerBase {
@Test
public void testConspiracyGiveType() {
// As Conspiracy enters the battlefield, choose a creature type.
// Creature cards you own that aren't on the battlefield, creature spells you control, and creatures you control are the chosen type.
addCard(Zone.HAND, playerA, "Conspiracy", 1); // Enchantment {3}{B}{B}
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.HAND, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
addCard(Zone.HAND, playerB, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Conspiracy");
setChoice(playerA, "Orc");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Conspiracy", 1);
Permanent silvercoatLion = getPermanent("Silvercoat Lion", playerA);
Assert.assertEquals(false, silvercoatLion.getSubtype(currentGame).contains(SubType.CAT));
Assert.assertEquals(true, silvercoatLion.getSubtype(currentGame).contains(SubType.ORC));
silvercoatLion = getPermanent("Silvercoat Lion", playerB);
Assert.assertEquals(true, silvercoatLion.getSubtype(currentGame).contains(SubType.CAT));
Assert.assertEquals(false, silvercoatLion.getSubtype(currentGame).contains(SubType.ORC));
for (Card card : playerA.getLibrary().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should have ORC type", true, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should not have CAT type", false, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerB.getLibrary().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerA.getHand().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should have ORC type", true, card.getSubtype(currentGame).contains(SubType.ORC));
}
}
for (Card card : playerB.getHand().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
}
}
for (Card card : playerA.getGraveyard().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should have ORC type", true, card.getSubtype(currentGame).contains(SubType.ORC));
}
}
for (Card card : playerB.getGraveyard().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
}
}
}
/**
* Conspiracy doesn't revert creature types of non-permanent cards when it
* leaves the battlefield
*/
@Test
public void testConspiracyIsRestCorrectly() {
// As Conspiracy enters the battlefield, choose a creature type.
// Creature cards you own that aren't on the battlefield, creature spells you control, and creatures you control are the chosen type.
addCard(Zone.HAND, playerA, "Conspiracy", 1); // Enchantment {3}{B}{B}
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.HAND, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
addCard(Zone.HAND, playerB, "Disenchant", 1); // Instant
addCard(Zone.BATTLEFIELD, playerB, "Plains", 2);
addCard(Zone.HAND, playerB, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Conspiracy");
setChoice(playerA, "Orc");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Disenchant", "Conspiracy");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, "Conspiracy", 1);
assertGraveyardCount(playerB, "Disenchant", 1);
Permanent silvercoatLion = getPermanent("Silvercoat Lion", playerA);
Assert.assertEquals(true, silvercoatLion.getSubtype(currentGame).contains(SubType.CAT));
Assert.assertEquals(false, silvercoatLion.getSubtype(currentGame).contains(SubType.ORC));
for (Card card : playerA.getLibrary().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerA.getHand().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerA.getGraveyard().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
}
@Test
public void testArcaneAdaptationGiveType() {
// As Arcane Adaptation enters the battlefield, choose a creature type.
// Creatures you control are the chosen type in addition to their other types. The same is true for creature spells you control and creature cards you own that aren't on the battlefield.
addCard(Zone.HAND, playerA, "Arcane Adaptation", 1); // Enchantment {2}{U}
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.HAND, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
addCard(Zone.HAND, playerB, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Arcane Adaptation");
setChoice(playerA, "Orc");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Arcane Adaptation", 1);
Permanent silvercoatLion = getPermanent("Silvercoat Lion", playerA);
Assert.assertEquals(true, silvercoatLion.getSubtype(currentGame).contains(SubType.CAT));
Assert.assertEquals(true, silvercoatLion.getSubtype(currentGame).contains(SubType.ORC));
silvercoatLion = getPermanent("Silvercoat Lion", playerB);
Assert.assertEquals(true, silvercoatLion.getSubtype(currentGame).contains(SubType.CAT));
Assert.assertEquals(false, silvercoatLion.getSubtype(currentGame).contains(SubType.ORC));
for (Card card : playerA.getLibrary().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should have ORC type", true, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerB.getLibrary().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerA.getHand().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should have ORC type", true, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerB.getHand().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerA.getGraveyard().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should have ORC type", true, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerB.getGraveyard().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
}
/**
* Arcane Adaptation doesn't revert creature types of non-permanent cards
* when it leaves the battlefield
*/
@Test
public void testArcaneAdaptationIsRestCorrectly() {
// As Arcane Adaptation enters the battlefield, choose a creature type.
// Creatures you control are the chosen type in addition to their other types. The same is true for creature spells you control and creature cards you own that aren't on the battlefield.
addCard(Zone.HAND, playerA, "Arcane Adaptation", 1); // Enchantment {2}{U}
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.HAND, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
addCard(Zone.HAND, playerB, "Disenchant", 1); // Instant
addCard(Zone.BATTLEFIELD, playerB, "Plains", 2);
addCard(Zone.HAND, playerB, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Arcane Adaptation");
setChoice(playerA, "Orc");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Disenchant", "Arcane Adaptation");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, "Arcane Adaptation", 1);
assertGraveyardCount(playerB, "Disenchant", 1);
Permanent silvercoatLion = getPermanent("Silvercoat Lion", playerA);
Assert.assertEquals(true, silvercoatLion.getSubtype(currentGame).contains(SubType.CAT));
Assert.assertEquals(false, silvercoatLion.getSubtype(currentGame).contains(SubType.ORC));
for (Card card : playerA.getLibrary().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerA.getHand().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
for (Card card : playerA.getGraveyard().getCards(currentGame)) {
if (card.isCreature()) {
Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC));
Assert.assertEquals(card.getName() + " should have CAT type", true, card.getSubtype(currentGame).contains(SubType.CAT));
}
}
}
}

View file

@ -2,6 +2,7 @@ package org.mage.test.cards.cost.modification;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -140,44 +141,80 @@ public class CostModificationTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Fated Conflagration", 1);
assertGraveyardCount(playerB, "Carnivorous Moss-Beast", 1);
}
/*
* Reported bug: Grand Arbiter Augustin IV makes moth spells you cast and your opponent cast {1} more. Should only affect opponent's spells costs.
*/
*/
@Test
public void testArbiterIncreasingCostBothPlayers() {
String gArbiter = "Grand Arbiter Augustin IV";
String divination = "Divination";
String doomBlade = "Doom Blade";
/*
Grand Arbiter Augustin IV {2}{W}{U}
Grand Arbiter Augustin IV {2}{W}{U}
2/3 Legendary Creature - Human Advisor
White spells you cast cost 1 less to cast.
Blue spells you cast cost 1 less to cast.
Spells your opponents cast cost 1 more to cast.
*/
*/
addCard(Zone.BATTLEFIELD, playerA, gArbiter);
addCard(Zone.HAND, playerA, divination); // {2}{U} Sorcery: draw two cards
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
addCard(Zone.HAND, playerB, doomBlade);
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2); // {1}{B} Instant: destroy target non-black creature
// Divination should only cost {1}{U} now with the cost reduction in place for your blue spells.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, divination);
// Doom Blade cast by the opponent should cost {2}{B} now with the cost increase in effect for opponent spells.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, doomBlade, gArbiter);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, divination, 1);
assertHandCount(playerA, 2);
assertTappedCount("Island", true, 2);
assertPermanentCount(playerA, gArbiter, 1);
assertHandCount(playerB, doomBlade, 1);
}
/**
* Zoetic Cavern's cast as creature cost is not modified as Animar, Soul of
* Elements gains counters.
*/
@Test
public void ReduceCostToCastZoeticCavern() {
// Protection from white and from black
// Whenever you cast a creature spell, put a +1/+1 counter on Animar, Soul of Elements.
// Creature spells you cast cost {1} less to cast for each +1/+1 counter on Animar.
addCard(Zone.BATTLEFIELD, playerA, "Animar, Soul of Elements");
addCard(Zone.HAND, playerA, "Silvercoat Lion", 2);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 6);
addCard(Zone.HAND, playerA, "Zoetic Cavern");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
playLand(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Zoetic Cavern");
setChoice(playerA, "Yes");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Silvercoat Lion", 2);
assertCounterCount(playerA, "Animar, Soul of Elements", CounterType.P1P1, 3);
assertHandCount(playerA, "Zoetic Cavern", 0);
assertPermanentCount(playerA, "Zoetic Cavern", 0);
assertTappedCount("Plains", false, 2); // 2 for 1st Lion 1 for 2nd lion and only 1 mana needed to cast face down Zoetic
}
}