mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
* Conspiracy - Fixed that it doesn't revert creature types of non-permanent cards when it leaves the battlefield (fixes #3911).
This commit is contained in:
parent
634c79a0a5
commit
66c4aec499
2 changed files with 187 additions and 12 deletions
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
* 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 CAR type", true, card.getSubtype(currentGame).contains(SubType.ORC));
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -5,42 +5,43 @@
|
|||
*/
|
||||
package mage.game;
|
||||
|
||||
import java.io.Serializable;
|
||||
import mage.ObjectColor;
|
||||
import mage.cards.Card;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class saves changed attributes of cards (e.g. in graveyard, exile or player hands or libraries).
|
||||
*
|
||||
* This class saves changed attributes of cards (e.g. in graveyard, exile or
|
||||
* player hands or libraries).
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CardAttribute implements Serializable {
|
||||
|
||||
public class CardAttribute implements Serializable {
|
||||
|
||||
protected ObjectColor color;
|
||||
protected SubTypeList subtype;
|
||||
|
||||
public CardAttribute(Card card) {
|
||||
color = card.getColor(null).copy();
|
||||
subtype = card.getSubtype(null);
|
||||
subtype = new SubTypeList();
|
||||
subtype.addAll(subtype);
|
||||
}
|
||||
|
||||
public CardAttribute(CardAttribute cardAttribute) {
|
||||
this.color = cardAttribute.color;
|
||||
this.subtype = cardAttribute.subtype;
|
||||
}
|
||||
|
||||
|
||||
public CardAttribute copy() {
|
||||
return new CardAttribute(this);
|
||||
}
|
||||
|
||||
|
||||
public ObjectColor getColor() {
|
||||
return color;
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
public SubTypeList getSubtype() {
|
||||
return subtype;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue