UTs duplicating glyphkeeper issue #3180

This commit is contained in:
drmDev 2017-04-20 00:38:32 -04:00
parent a098718405
commit 0e95e39748
2 changed files with 131 additions and 18 deletions

View file

@ -29,7 +29,8 @@ package org.mage.test.cards.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import mage.counters.CounterType;
import mage.filter.Filter;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -45,9 +46,10 @@ public class TargetedTriggeredTest extends CardTestPlayerBase {
*
*/
@Test
@Ignore
// this does not currently work in test, because the target event will be fired earlier during tests,
//@Ignore
// this does not currently work in test (????), because the target event will be fired earlier during tests,
// so the zone change counter for the fixed target of the counterspell will not work
// UPDATE: seems to work fine now? 04/19/2017 escplan9
public void testKiraGreatGlassSpinnerFirstSpellTurn() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.HAND, playerA, "Lightning Bolt");
@ -89,4 +91,115 @@ public class TargetedTriggeredTest extends CardTestPlayerBase {
assertPowerToughness(playerB, "Ashenmoor Liege", 4, 1);
}
@Test
public void testGlyphKeeperCountersFirstSpell() {
/*
Glyph Keeper {3}{U}{U}
Creature - Sphinx
Flying 5/3
Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability."
*/
String gKeeper = "Glyph Keeper";
String bolt = "Lightning Bolt"; // {R} instant deal 3 dmg
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerB, gKeeper);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, gKeeper);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, bolt, 1);
assertPermanentCount(playerB, gKeeper, 1);
}
@Test
public void testGlyphKeeperCountersFirstSpellButNotSecondSpell() {
/*
Glyph Keeper {3}{U}{U}
Creature - Sphinx
Flying 5/3
Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability."
*/
String gKeeper = "Glyph Keeper";
String bolt = "Lightning Bolt"; // {R} instant deal 3 dmg
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.HAND, playerA, bolt, 2);
addCard(Zone.BATTLEFIELD, playerB, gKeeper);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, gKeeper);
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, bolt, gKeeper);
setStopAt(1, PhaseStep.DECLARE_ATTACKERS);
execute();
assertGraveyardCount(playerA, bolt, 2);
assertPermanentCount(playerB, gKeeper, 0);
}
/*
NOTE: test is failing due to card bug as of 04/20/2017. See issue #3180
I had a Glyph Keeper on board (cloned with Vizier of many faces). -- note this test is a simplified version, next test will test on the Clone if needed
First I played a Soulstinger and targeted the Glyph Keeper, the ability was countered. Then on the same main phase I played a Cartouche of Strength targeting the Glyph Keeper, that was also countered.
Only the first should have been countered.
*/
@Test
public void testGlyphKeeperCountersFirstAbilityButNotSecondOne() {
/*
Glyph Keeper {3}{U}{U}
Creature - Sphinx
Flying 5/3
Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability."
*/
String gKeeper = "Glyph Keeper";
/*
Soulstinger {3}{B}
Creature - Scorpion Demon 4/5
When Soulstinger enters the battlefield, put two -1/-1 counter on target creature you control.
When Soulstinger dies, you may put a -1/-1 counter on target creature for each -1/-1 counter on Soulstinger.
*/
String sStinger = "Soulstinger";
/*
Cartouche of Strength {2}{G}
Enchantment - Aura Cartouche
Enchant creature you control
When Cartouche of Strength enters the battlefield, you may have enchanted creature fight target creature an opponent controls.
Enchanted creature gets +1/+1 and has trample.
*/
String cStrength = "Cartouche of Strength";
String memnite = "Memnite"; // {0} 1/1
addCard(Zone.BATTLEFIELD, playerA, gKeeper);
addCard(Zone.HAND, playerA, sStinger);
addCard(Zone.HAND, playerA, cStrength);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 6);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 6);
addCard(Zone.BATTLEFIELD, playerB, memnite);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, sStinger);
addTarget(playerA, gKeeper); // should be countered by Glyph Keeper clause as first ability targetting it
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, cStrength, gKeeper); // should not be countered anymore
addTarget(playerA, memnite); // Cartouche of Strength fight
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, gKeeper, 1);
assertGraveyardCount(playerA, sStinger, 0); // countered
assertGraveyardCount(playerA, cStrength, 0); // should not be countered
assertPermanentCount(playerA, cStrength, 1);
assertGraveyardCount(playerB, memnite, 1); // dies from fight
assertPowerToughness(playerA, gKeeper, 5, 3, Filter.ComparisonScope.All); // Soul Stinger should never have given it two -1/-1 counters
assertCounterCount(playerA, gKeeper, CounterType.M1M1, 0);
}
}

View file

@ -2,8 +2,7 @@ package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -11,27 +10,28 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
* Created by IGOUDT on 30-3-2017.
*/
public class KiraGreatGlassSpinnerTest extends CardTestPlayerBase {
private final String kira = "Kira, Great Glass-Spinner";
private final String shock = "Shock";
@Test
public void counterFirst(){
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
addCard(Zone.BATTLEFIELD, playerA, "Ugin, the Spirit Dragon"); // starts with 7 Loyality counters
public void counterFirst() {
String ugin = "Ugin, the Spirit Dragon";
addCard(Zone.BATTLEFIELD, playerA, ugin); // starts with 7 Loyality counters
/*
Kira, Great Glass-Spinner {1}{U}{U}
Legendary Creature - Spirit 2/2
Flying
Creatures you control have "Whenever this creature becomes the target of a spell or ability for the first time each turn, counter that spell or ability."
*/
addCard(Zone.BATTLEFIELD, playerA, kira);
addCard(Zone.HAND, playerA, shock);
addCard(Zone.HAND, playerA, shock);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+2: {source} deals 3 damage to target creature or player.", kira);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+2: {source} deals 3 damage to target creature or player.", kira); // Ugin ability
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
Permanent _kira = getPermanent(kira, playerA.getId());
Assert.assertNotNull(_kira);
assertPermanentCount(playerA, kira, 1);
assertCounterCount(playerA, ugin, CounterType.LOYALTY, 9);
}
}