* Fixed failing M21 Tests (related to 51af4e7e1d).

This commit is contained in:
LevelX2 2020-07-29 11:49:54 +02:00
parent 0385d9a653
commit 57de10d609
5 changed files with 30 additions and 17 deletions

View file

@ -26,7 +26,7 @@ public final class ChandrasMagmutt extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {T}: Chandra's Magmutt deals 1 damage to target player or planeswalker.
// {T}: Chandra's Magmutt deals 1 damage to target player or planeswalker.<
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(1), new TapSourceCost());
ability.addTarget(new TargetPlayerOrPlaneswalker());
this.addAbility(ability);

View file

@ -29,7 +29,10 @@ public final class GoblinBalloonBrigade extends CardImpl {
this.power = new MageInt(1);
this.toughness = new MageInt(1);
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{R}")));
// {R}: Goblin Balloon Brigade gains flying until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new GainAbilitySourceEffect(FlyingAbility.getInstance(),
Duration.EndOfTurn), new ManaCostsImpl("{R}")));
}
public GoblinBalloonBrigade(final GoblinBalloonBrigade card) {

View file

@ -10,9 +10,10 @@ public class ChandrasMagmuttTest extends CardTestPlayerBase {
@Test
public void pingPlayer(){
// {T}: Chandra's Magmutt deals 1 damage to target player or planeswalker.<
addCard(Zone.BATTLEFIELD, playerA, "Chandra's Magmutt");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Chandra's Magmutt", playerB);
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals", playerB);
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
setStrictChooseMode(true);
@ -24,10 +25,14 @@ public class ChandrasMagmuttTest extends CardTestPlayerBase {
@Test
public void pingPlanesWalker(){
// {T}: Chandra's Magmutt deals 1 damage to target player or planeswalker.<
addCard(Zone.BATTLEFIELD, playerA, "Chandra's Magmutt");
// +1: Put a +1/+1 counter on up to one target creature. It gains indestructible until end of turn.
// 2: Whenever one or more nontoken creatures attack this turn, create that many 1/1 white Soldier creature tokens that are tapped and attacking.
// 6: You get an emblem with "At the beginning of combat on your turn, create a 1/1 white Soldier creature token, then put a +1/+1 counter on each creature you control."
addCard(Zone.BATTLEFIELD, playerB, "Basri Ket");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Chandra's Magmutt", "Basri Ket");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals", "Basri Ket");
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
setStrictChooseMode(true);
execute();

View file

@ -26,9 +26,12 @@ public class ConspicuousSnoopTest extends CardTestPlayerBase {
public void castGoblinSpellsFromLibrary(){
// You may cast Goblin spells from the top of your library.
addCard(Zone.BATTLEFIELD, playerA, "Conspicuous Snoop");
addCard(Zone.LIBRARY, playerA, "Goblin Lackey");
skipInitShuffling();
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
// Whenever Goblin Lackey deals damage to a player, you may put a Goblin permanent card from your hand onto the battlefield.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Goblin Lackey");
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
@ -41,18 +44,22 @@ public class ConspicuousSnoopTest extends CardTestPlayerBase {
@Test
public void hasActivatedAbilities(){
// As long as the top card of your library is a Goblin card,
// Conspicuous Snoop has all activated abilities of that card.
addCard(Zone.BATTLEFIELD, playerA, "Conspicuous Snoop");
addCard(Zone.LIBRARY, playerA, "Goblin Balloon Brigade");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
// Play with the top card of your library revealed.
// You may cast Goblin spells from the top of your library.
// As long as the top card of your library is a Goblin card, Conspicuous Snoop has all activated abilities of that card.
addCard(Zone.BATTLEFIELD, playerA, "Conspicuous Snoop");
// {R}: Goblin Balloon Brigade gains flying until end of turn.
addCard(Zone.LIBRARY, playerA, "Goblin Balloon Brigade");
skipInitShuffling();
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertAbilityCount(playerA, "Conspicuous Snoop", ActivatedAbility.class,5);
assertAbilityCount(playerA, "Conspicuous Snoop", ActivatedAbility.class, 3); // (2 X casts + gains flying )
}
}

View file

@ -906,21 +906,19 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
}
}
public void assertAbilityCount(Player player, String cardName, Class<? extends Ability> ability, int amount) {
int foundCount = 0;
public void assertAbilityCount(Player player, String cardName, Class<? extends Ability> searchedAbility, int amount) {
Permanent found = null;
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(player.getId())) {
if (isObjectHaveTargetNameOrAlias(player, permanent, cardName)) {
found = permanent;
foundCount++;
break;
}
}
Assert.assertNotNull("There is no such permanent under player's control, player=" + player.getName()
+ ", cardName=" + cardName, found);
Assert.assertEquals(amount, found.getAbilities(currentGame).stream()
.filter(a -> a.getClass().isAssignableFrom(ability)).collect(Collectors.toList()).size());
.filter(a -> searchedAbility.isAssignableFrom(a.getClass())).collect(Collectors.toList()).size());
}
/**