* Some changes to EnterTheBattlefield events, some other fixes (fixes #2765).

This commit is contained in:
LevelX2 2017-01-15 15:22:33 +01:00
parent dd810f2678
commit 75cbfdf3b9
24 changed files with 562 additions and 319 deletions

View file

@ -127,11 +127,11 @@ public class MeldTest extends CardTestPlayerBase {
// When you cast Bruna, the Fading Light, you may return target Angel or Human creature card from your graveyard to the battlefield.
// Flying, Vigilance
// <i>(Melds with Gisela, the Broken Blade.)</i>
addCard(Zone.HAND, playerA, "Bruna, the Fading Light"); // {5}{W}{W}
addCard(Zone.HAND, playerA, "Bruna, the Fading Light"); // Creature {5}{W}{W} 5/7
// Flying, First strike, Lifelink
// At the beginning of your end step, if you both own and control Gisela, the Broken Blade and a
// creature named Bruna, the Fading Light, exile them, then meld them into Brisela, Voice of Nightmares.
addCard(Zone.HAND, playerA, "Gisela, the Broken Blade"); // {2}{W}{W}
addCard(Zone.HAND, playerA, "Gisela, the Broken Blade"); // Creature {2}{W}{W} 4/3
// Brisela, Voice of Nightmares 9/10
// Flying, First strike, Vigilance, Lifelink
// Your opponents can't cast spells with converted mana cost 3 or less.
@ -160,7 +160,7 @@ public class MeldTest extends CardTestPlayerBase {
assertGraveyardCount(playerB, "Vanish into Memory", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 2);
assertHandCount(playerB, 0);
assertHandCount(playerB, 1); // discard 10 upkeep turn 6 ==> 0 + draw 1 at draw phase turn 6
}

View file

@ -0,0 +1,128 @@
/*
* 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.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class MetallicMiminTest extends CardTestPlayerBase {
/**
* Additionally, if you play a Mimic naming, for example, "Dwarf", then if
* you play a second Mimic also naming "Dwarf", the second Mimic won't enter
* with a counter. Going by 616.2 in the Comp Rules, the second one should
* be getting a counter as long as you name the same type as the first one.
*
* 611.3c Continuous effects that modify characteristics of permanents do so
* simultaneously with the permanent entering the battlefield. They dont
* wait until the permanent is on the battlefield and then change it.
* Because such effects apply as the permanent enters the battlefield, they
* are applied before determining whether the permanent will cause an
* ability to trigger when it enters the battlefield. #
*
* Example: A permanent with the static ability All white creatures get
* +1/+1 is on the battlefield. A creature spell that would normally create
* a 1/1 white creature instead creates a 2/2 white creature. The creature
* doesnt enter the battlefield as 1/1 and then change to 2/2.
*
*/
@Test
public void testMetallicMimic() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
// As Metallic Mimic enters the battlefield, choose a creature type.
// Metallic Mimic is the chosen type in addition to its other types.
// Each other creature you control of the chosen type enters the battlefield with an additional +1/+1 counter on it.
addCard(Zone.HAND, playerA, "Metallic Mimic", 2); // Creature {2}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Metallic Mimic");
setChoice(playerA, "Dwarf");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Metallic Mimic");
setChoice(playerA, "Dwarf");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Metallic Mimic", 2);
assertPowerToughness(playerA, "Metallic Mimic", 2, 1);
assertPowerToughness(playerA, "Metallic Mimic", 3, 2);
}
@Test
public void testMetallicMimicBramblewoodParagon() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
// As Metallic Mimic enters the battlefield, choose a creature type.
// Metallic Mimic is the chosen type in addition to its other types.
// Each other creature you control of the chosen type enters the battlefield with an additional +1/+1 counter on it.
addCard(Zone.HAND, playerA, "Metallic Mimic", 2); // Creature {2}
// Each other Warrior creature you control enters the battlefield with an additional +1/+1 counter on it.
// Each creature you control with a +1/+1 counter on it has trample.
addCard(Zone.BATTLEFIELD, playerA, "Bramblewood Paragon", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Metallic Mimic");
setChoice(playerA, "Warrior");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Metallic Mimic", 1);
assertPowerToughness(playerA, "Metallic Mimic", 3, 2);
}
@Test
public void testMetallicLasts() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
// As Metallic Mimic enters the battlefield, choose a creature type.
// Metallic Mimic is the chosen type in addition to its other types.
// Each other creature you control of the chosen type enters the battlefield with an additional +1/+1 counter on it.
addCard(Zone.HAND, playerA, "Metallic Mimic", 2); // Creature {2}
// Flash (You may cast this spell any time you could cast an instant.)
// Each creature you control that's a Wolf or a Werewolf gets +1/+1 and has trample.
addCard(Zone.BATTLEFIELD, playerA, "Howlpack Resurgence", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Metallic Mimic");
setChoice(playerA, "Wolf");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Metallic Mimic", 1);
assertPowerToughness(playerA, "Metallic Mimic", 3, 2);
}
}

View file

@ -285,7 +285,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
if (card == null) {
throw new IllegalArgumentException("[TEST] Couldn't find a card: " + cardName);
}
PermanentCard p = new PermanentCard(card, player.getId(), currentGame);
PermanentCard p = new PermanentCard(card.copy(), player.getId(), currentGame);
p.setTapped(tapped);
getBattlefieldCards(player).add(p);
}
@ -466,7 +466,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
+ ", cardName=" + cardName, count > 0);
if (scope.equals(Filter.ComparisonScope.Any)) {
Assert.assertTrue("There is no such creature under player's control with specified power&toughness, player=" + player.getName()
Assert.assertTrue("There is no such creature under player's control with specified p/t of " + power + "/" + toughness + ", player=" + player.getName()
+ ", cardName=" + cardName + " (found similar: " + found + ", one of them: power=" + foundPower + " toughness=" + foundToughness + ")", fit > 0);
}
}