mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Added tests.
This commit is contained in:
parent
5754d53b3b
commit
e7014f385b
4 changed files with 114 additions and 16 deletions
|
@ -28,13 +28,12 @@
|
||||||
package mage.sets.alarareborn;
|
package mage.sets.alarareborn;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
|
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
|
||||||
import mage.abilities.keyword.CascadeAbility;
|
import mage.abilities.keyword.CascadeAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,9 +47,6 @@ public class DemonicDread extends CardImpl {
|
||||||
super(ownerId, 38, "Demonic Dread", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{B}{R}");
|
super(ownerId, 38, "Demonic Dread", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{B}{R}");
|
||||||
this.expansionSetCode = "ARB";
|
this.expansionSetCode = "ARB";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Cascade
|
// Cascade
|
||||||
this.addAbility(new CascadeAbility());
|
this.addAbility(new CascadeAbility());
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
package mage.sets.planechase;
|
package mage.sets.planechase;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||||
import mage.abilities.effects.common.continuous.BoostAllEffect;
|
import mage.abilities.effects.common.continuous.BoostAllEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
|
@ -68,7 +68,7 @@ public class NoxiousGhoul extends CardImpl {
|
||||||
filter2.add(Predicates.not(
|
filter2.add(Predicates.not(
|
||||||
new SubtypePredicate("Zombie")));
|
new SubtypePredicate("Zombie")));
|
||||||
|
|
||||||
final String rule = "Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.";
|
final String rule = "Whenever {this} or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.";
|
||||||
|
|
||||||
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
|
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
|
||||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter2, false), filter, false, rule));
|
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter2, false), filter, false, rule));
|
||||||
|
|
|
@ -29,6 +29,7 @@ package org.mage.test.cards.triggers;
|
||||||
|
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.Filter;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
@ -227,4 +228,101 @@ public class EntersTheBattlefieldTriggerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test self trigger
|
||||||
|
@Test
|
||||||
|
public void testNoxiousGhoul1() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||||
|
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
|
||||||
|
addCard(Zone.HAND, playerA, "Noxious Ghoul", 1); // {3}{B}{B}
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Zephyr Falcon", 1); // 1/1
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); // 2/2
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Scathe Zombies", 1); // 2/2 Zombie
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Noxious Ghoul");
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Noxious Ghoul", 1);
|
||||||
|
assertPowerToughness(playerB, "Silvercoat Lion", 1, 1);
|
||||||
|
assertPowerToughness(playerB, "Scathe Zombies", 2, 2);
|
||||||
|
assertGraveyardCount(playerB, "Zephyr Falcon", 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test another zombie trigger
|
||||||
|
@Test
|
||||||
|
public void testNoxiousGhoul2() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 8);
|
||||||
|
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
|
||||||
|
addCard(Zone.HAND, playerA, "Noxious Ghoul", 1); // 3/3 Zombie {3}{B}{B}
|
||||||
|
addCard(Zone.HAND, playerA, "Scathe Zombies", 1); // 2/2 Zombie {2}{B}
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); // 2/2
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
|
||||||
|
// Changeling (This card is every creature type.)
|
||||||
|
// Creatures target player controls get -2/-0 and lose all creature types until end of turn.
|
||||||
|
addCard(Zone.HAND, playerB, "Ego Erasure", 1); // {2}{U}
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Zephyr Falcon", 1); // 1/1
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); // 2/2
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Scathe Zombies", 1); // 2/2 Zombie {2}{B}
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Noxious Ghoul");
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Ego Erasure", "targetPlayer=PlayerA", "Whenever");
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Scathe Zombies");
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Noxious Ghoul", 1);
|
||||||
|
assertGraveyardCount(playerB, "Ego Erasure", 1);
|
||||||
|
assertPowerToughness(playerA, "Noxious Ghoul", -1, 1);// -2/0 from Ego Erasure / -2/0 from the 2 zombies coming into play
|
||||||
|
assertPermanentCount(playerA, "Scathe Zombies", 1);
|
||||||
|
assertPowerToughness(playerB, "Scathe Zombies", 2, 2);
|
||||||
|
assertGraveyardCount(playerB, "Zephyr Falcon", 1);
|
||||||
|
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||||
|
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test copy of Noxious Ghoul
|
||||||
|
@Test
|
||||||
|
public void testCopyNoxiousGhoul() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 9);
|
||||||
|
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
|
||||||
|
addCard(Zone.HAND, playerA, "Noxious Ghoul", 1); // 3/3 Zombie {3}{B}{B}
|
||||||
|
// You may have Clone enter the battlefield as a copy of any creature on the battlefield.
|
||||||
|
addCard(Zone.HAND, playerA, "Clone", 1); // 0/0 Shapeshifter {3}{U}
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Carnivorous Plant", 1); // 4/5
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
|
||||||
|
// Changeling (This card is every creature type.)
|
||||||
|
// Creatures target player controls get -2/-0 and lose all creature types until end of turn.
|
||||||
|
addCard(Zone.HAND, playerB, "Ego Erasure", 1); // {2}{U}
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Zephyr Falcon", 1); // 1/1
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Carnivorous Plant", 1); // 4/5
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Scathe Zombies", 1); // 2/2 Zombie {2}{B}
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Noxious Ghoul");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Clone");
|
||||||
|
setChoice(playerA, "Noxious Ghoul");
|
||||||
|
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ego Erasure", "targetPlayer=PlayerA", "Whenever");
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Noxious Ghoul", 2);
|
||||||
|
assertGraveyardCount(playerB, "Ego Erasure", 1);
|
||||||
|
assertPowerToughness(playerA, "Noxious Ghoul", -1, 1, Filter.ComparisonScope.All);// -1/-1 from the second Noxious Ghoul also if it's no zombie
|
||||||
|
|
||||||
|
assertGraveyardCount(playerB, "Zephyr Falcon", 1);
|
||||||
|
assertPowerToughness(playerB, "Carnivorous Plant", 2, 3);
|
||||||
|
assertPowerToughness(playerA, "Carnivorous Plant", 0, 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -987,9 +987,13 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
||||||
*/
|
*/
|
||||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, StackClause clause) {
|
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, StackClause clause) {
|
||||||
if (StackClause.WHILE_ON_STACK.equals(clause)) {
|
if (StackClause.WHILE_ON_STACK.equals(clause)) {
|
||||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$target=" + targetName + "$spellOnStack=" + spellOnStack);
|
player.addAction(turnNum, step, "activate:Cast " + cardName
|
||||||
|
+ "$" + (targetName.startsWith("target") ? targetName : "target=" + targetName)
|
||||||
|
+ "$spellOnStack=" + spellOnStack);
|
||||||
} else {
|
} else {
|
||||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$target=" + targetName + "$!spellOnStack=" + spellOnStack);
|
player.addAction(turnNum, step, "activate:Cast " + cardName
|
||||||
|
+ "$" + (targetName.startsWith("target") ? targetName : "target=" + targetName)
|
||||||
|
+ "$!spellOnStack=" + spellOnStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue