Merge pull request #6244 from Dilnu/Chaos

Fix Chaos Wand
This commit is contained in:
Oleg Agafonov 2020-02-03 23:19:34 +01:00 committed by GitHub
commit 4c5ea62cea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 4 deletions

View file

@ -83,15 +83,16 @@ class ChaosWandEffect extends OneShotEffect {
opponent.moveCards(card, Zone.EXILED, source, game); opponent.moveCards(card, Zone.EXILED, source, game);
controller.revealCards(source, new CardsImpl(card), game); controller.revealCards(source, new CardsImpl(card), game);
if (card.isInstant() || card.isSorcery()) { if (card.isInstant() || card.isSorcery()) {
boolean cardWasCast = false;
if (controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName() if (controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName()
+ " without paying its mana cost?", source, game)) { + " without paying its mana cost?", source, game)) {
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE); game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true), cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game)); game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
if (!cardWasCast) { }
cardsToShuffle.add(card); if (!cardWasCast) {
} cardsToShuffle.add(card);
} }
break; break;
} else { } else {

View file

@ -0,0 +1,26 @@
package org.mage.test.cards.abilities.activated;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class ChaosWandTest extends CardTestPlayerBase {
@Test
public void testChaosWant() {
addCard(Zone.BATTLEFIELD, playerA, "Chaos Wand");
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
addCard(Zone.LIBRARY, playerB, "Blood Tithe");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{4}, {T}: ");
setChoice(playerA, "Yes");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerB, 17);
}
}