Merge pull request #2127 from fwannmacher/master

Fixed Emrakul Mindslaver ability
This commit is contained in:
Felipe Wannmacher 2016-07-29 19:12:42 -03:00 committed by GitHub
commit cf6d7a3e0b
2 changed files with 37 additions and 5 deletions

View file

@ -37,6 +37,7 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CastSourceTriggeredAbility; import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.turn.ControlTargetPlayerNextTurnEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.ProtectionAbility; import mage.abilities.keyword.ProtectionAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
@ -143,10 +144,10 @@ class EmrakulThePromisedEndCostReductionEffect extends CostModificationEffectImp
} }
} }
class EmrakulThePromisedEndGainControlEffect extends OneShotEffect { class EmrakulThePromisedEndGainControlEffect extends ControlTargetPlayerNextTurnEffect {
EmrakulThePromisedEndGainControlEffect() { EmrakulThePromisedEndGainControlEffect() {
super(Outcome.GainControl); super();
this.staticText = "you gain control of target opponent during that player's next turn. After that turn, that player takes an extra turn"; this.staticText = "you gain control of target opponent during that player's next turn. After that turn, that player takes an extra turn";
} }
@ -165,9 +166,7 @@ class EmrakulThePromisedEndGainControlEffect extends OneShotEffect {
Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (controller != null && targetPlayer != null) { if (controller != null && targetPlayer != null) {
game.getState().getTurnMods().add(new TurnMod(targetPlayer.getId(), false)); game.getState().getTurnMods().add(new TurnMod(targetPlayer.getId(), false));
game.getState().getTurnMods().add(new TurnMod(targetPlayer.getId(), controller.getId()));
return true;
} }
return false; return super.apply(game, source);
} }
} }

View file

@ -120,4 +120,37 @@ public class NykthosShrineToNyxTest extends CardTestPlayerBase {
Assert.assertEquals("amount of colorless mana", 10, playerA.getManaPool().getColorless()); // 6 - 2 (2.Activation) = 4 + 6 = 10 colorless mana Assert.assertEquals("amount of colorless mana", 10, playerA.getManaPool().getColorless()); // 6 - 2 (2.Activation) = 4 + 6 = 10 colorless mana
assertPowerToughness(playerA, "Kruphix, God of Horizons", 4,7); assertPowerToughness(playerA, "Kruphix, God of Horizons", 4,7);
} }
@Test
public void testNormalUseWithTokens() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.BATTLEFIELD, playerA, "Nykthos, Shrine to Nyx", 1);
// Green mana doesn't empty from your mana pool as steps and phases end.
// Omnath, Locus of Mana gets +1/+1 for each green mana in your mana pool.
addCard(Zone.BATTLEFIELD, playerA, "Omnath, Locus of Mana", 1);
// Simic Guildmage {G/U}{G/U}
// Creature - Elf Wizard
// {1}{G}: Move a +1/+1 counter from target creature onto another target creature with the same controller.
// {1}{U}: Attach target Aura enchanting a permanent to another permanent with the same controller.
addCard(Zone.BATTLEFIELD, playerA, "Simic Guildmage");
// Cackling Counterpart {1}{U}{U}
// Instant
// Put a token onto the battlefield that's a copy of target creature you control.
// Flashback {5}{U}{U} (You may cast this card from your graveyard for its flashback cost. Then exile it.)
addCard(Zone.HAND, playerA, "Cackling Counterpart");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cackling Counterpart");
addTarget(playerA, "Simic Guildmage");
activateManaAbility(1, PhaseStep.BEGIN_COMBAT, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.");
setChoice(playerA, "Green");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Simic Guildmage", 2);
Assert.assertEquals("amount of green mana", 5, playerA.getManaPool().getGreen()); // 6 green mana
assertPowerToughness(playerA, "Omnath, Locus of Mana", 6, 6);
}
} }