mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Added UT for #3251.
This commit is contained in:
parent
47de4cac6b
commit
26e81ab26d
2 changed files with 56 additions and 2 deletions
|
@ -75,7 +75,8 @@ class RichesEffect extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null) {
|
||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||
if (opponent.chooseTarget(Outcome.Detriment, target, source, game)) {
|
||||
target.setNotTarget(true);
|
||||
if (opponent.choose(Outcome.Detriment, target, source.getSourceId(), game)) {
|
||||
creaturesToSteal.add(target.getTargets().get(0));
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +86,7 @@ class RichesEffect extends OneShotEffect {
|
|||
// Has to be done as a separate loop in case there's a situation where one creature's
|
||||
// controller depends on another creatures controller.
|
||||
for (UUID target : creaturesToSteal) {
|
||||
GainControlTargetEffect eff = new GainControlTargetEffect(Duration.EndOfGame, true);
|
||||
GainControlTargetEffect eff = new GainControlTargetEffect(Duration.Custom, true);
|
||||
eff.setTargetPointer(new FixedTarget(target));
|
||||
game.addEffect(eff, source);
|
||||
}
|
||||
|
|
|
@ -95,4 +95,57 @@ public class TheGitrogMonsterTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "The Gitrog Monster", 0);
|
||||
assertPermanentCount(playerB, "Planar Outburst", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* I took control of a Gitrog Monster, while the Gitrog Monster's owner
|
||||
* controlled a Dryad Arbor and cast Toxic Deluge for 6.
|
||||
*/
|
||||
@Test
|
||||
public void controlChange() {
|
||||
// Deathtouch
|
||||
// At the beginning of your upkeep, sacrifice The Gitrog Monster unless you sacrifice a land.
|
||||
// You may play an additional land on each of your turns.
|
||||
// Whenever one or more land cards are put into your graveyard from anywhere, draw a card.
|
||||
addCard(Zone.HAND, playerA, "The Gitrog Monster", 1); // Creature 6/6 {3}{B}{G}
|
||||
addCard(Zone.HAND, playerA, "Toxic Deluge", 1); // Sorcery {2}{B}
|
||||
// (Dryad Arbor isn't a spell, it's affected by summoning sickness, and it has "{T}: Add {G} to your mana pool.")
|
||||
addCard(Zone.HAND, playerA, "Dryad Arbor", 1); // Land Creature 1/1
|
||||
addCard(Zone.HAND, playerA, "Swamp", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
|
||||
// Rags Sorcery {2}{B}{B}
|
||||
// All creatures get -2/-2 until end of turn.
|
||||
// Riches Sorcery {5}{U}{U}
|
||||
// Each opponent chooses a creature he or she controls. You gain control of each of those creatures.
|
||||
addCard(Zone.GRAVEYARD, playerB, "Rags // Riches", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 7);
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Swamp");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "The Gitrog Monster");
|
||||
playLand(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Dryad Arbor");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Riches");
|
||||
setChoice(playerA, "The Gitrog Monster");
|
||||
|
||||
// As an additional cost to cast Toxic Deluge, pay X life.
|
||||
// All creatures get -X/-X until end of turn.
|
||||
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Toxic Deluge");
|
||||
setChoice(playerA, "X=6");
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertExileCount(playerB, "Rags // Riches", 1);
|
||||
|
||||
assertGraveyardCount(playerA, "Toxic Deluge", 1);
|
||||
assertLife(playerA, 14);
|
||||
|
||||
assertGraveyardCount(playerA, "The Gitrog Monster", 1);
|
||||
assertGraveyardCount(playerA, "Dryad Arbor", 1);
|
||||
|
||||
assertHandCount(playerB, 1); // 1 drawn in draw of turn 2
|
||||
assertHandCount(playerA, 1); // 1 drawn in draw of turn 3 - no card sfro Gitrog
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue