From 8ebc0ab72fcb2eb755cb76c1cc155ead1c077474 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 10 Jul 2017 09:17:35 -0500 Subject: [PATCH 1/3] - Fixed issue #3634 --- Mage.Sets/src/mage/cards/r/RalZarek.java | 54 +++++++++++++++++------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/Mage.Sets/src/mage/cards/r/RalZarek.java b/Mage.Sets/src/mage/cards/r/RalZarek.java index 6211d8c2631..2d15024ad90 100644 --- a/Mage.Sets/src/mage/cards/r/RalZarek.java +++ b/Mage.Sets/src/mage/cards/r/RalZarek.java @@ -31,11 +31,8 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; -import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; -import mage.abilities.effects.common.TapTargetEffect; -import mage.abilities.effects.common.UntapTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -43,11 +40,11 @@ import mage.constants.Outcome; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.AnotherTargetPredicate; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.game.turn.TurnMod; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetCreatureOrPlayer; -import mage.target.targetpointer.SecondTargetPointer; /** * @@ -62,23 +59,14 @@ public class RalZarek extends CardImpl { } public RalZarek(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{U}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{U}{R}"); this.subtype.add("Ral"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); // +1: Tap target permanent, then untap another target permanent. - LoyaltyAbility ability1 = new LoyaltyAbility(new TapTargetEffect(), 1); - TargetPermanent firstTarget = new TargetPermanent(); - firstTarget.setTargetTag(1); - ability1.addTarget(firstTarget); - Effect effect = new UntapTargetEffect(); - effect.setText(", then untap another target permanent"); - effect.setTargetPointer(new SecondTargetPointer()); - ability1.addEffect(effect); - TargetPermanent secondTarget = new TargetPermanent(secondFilter); - secondTarget.setTargetTag(2); - ability1.addTarget(secondTarget); + LoyaltyAbility ability1 = new LoyaltyAbility(new RalZarekEffect(), 1); + ability1.addTarget(new TargetPermanent(2, 2, new FilterPermanent(), false)); this.addAbility(ability1); // -2: Ral Zarek deals 3 damage to target creature or player. @@ -101,6 +89,40 @@ public class RalZarek extends CardImpl { } } +class RalZarekEffect extends OneShotEffect { + + public RalZarekEffect() { + super(Outcome.Tap); + this.staticText = "Tap target permanent, then untap another target permanent"; + } + + public RalZarekEffect(final RalZarekEffect effect) { + super(effect); + } + + @Override + public RalZarekEffect copy() { + return new RalZarekEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Permanent tapPermanent = game.getPermanent(source.getTargets().get(0).getTargets().get(0)); + if (tapPermanent != null) { + tapPermanent.tap(game); + } + Permanent unTapPermanent = game.getPermanent(source.getTargets().get(0).getTargets().get(1)); + if (unTapPermanent != null) { + unTapPermanent.untap(game); + } + return true; + } + return false; + } +} + class RalZarekExtraTurnsEffect extends OneShotEffect { public RalZarekExtraTurnsEffect() { From 5a3243890d5dbd237c7ca0ee7a55824505715b26 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 10 Jul 2017 16:53:02 +0200 Subject: [PATCH 2/3] Fixed that the information what mana was payed to pay the mana cost of a spell or ability were not correct if "spend mana as though" abilities were involved in the payment (fixes #3604). --- .../enters/GreenbeltRampagerTest.java | 10 +++-- .../test/cards/mana/MycosynthLatticeTest.java | 30 +++++++++++++- Mage/src/main/java/mage/Mana.java | 41 +++++++++++++++++-- .../mage/abilities/costs/mana/ManaCost.java | 2 + .../abilities/costs/mana/ManaCostImpl.java | 32 +++++++++------ .../abilities/costs/mana/ManaCostsImpl.java | 9 ++++ .../common/ColorsOfManaSpentToCastCount.java | 2 +- Mage/src/main/java/mage/players/ManaPool.java | 6 ++- 8 files changed, 109 insertions(+), 23 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GreenbeltRampagerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GreenbeltRampagerTest.java index e34a5802ee7..6505a3e4808 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GreenbeltRampagerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GreenbeltRampagerTest.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package org.mage.test.cards.abilities.enters; import mage.constants.PhaseStep; @@ -90,9 +89,14 @@ public class GreenbeltRampagerTest extends CardTestPlayerBase { @Test public void testCastNotOwned() { addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10); - addCard(Zone.HAND, playerA, "Gonti, Lord of Luxury"); + // Deathtouch + // When Gonti, Lord of Luxury enters the battlefield, look at the top four cards of target opponent's library, exile one of them face down, + // then put the rest on the bottom of that library in a random order. For as long as that card remains exiled, + // you may look at it, you may cast it, and you may spend mana as though it were mana of any type to cast it. + addCard(Zone.HAND, playerA, "Gonti, Lord of Luxury"); // Creature {2}{B}{B} - addCard(Zone.LIBRARY, playerB, "Greenbelt Rampager"); + // When Greenbelt Rampager enters the battlefield, pay {E}{E}. If you can't, return Greenbelt Rampager to its owner's hand and you get {E}. + addCard(Zone.LIBRARY, playerB, "Greenbelt Rampager"); // Creature {G} 3/4 skipInitShuffling(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/MycosynthLatticeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/MycosynthLatticeTest.java index 531ecf77927..629190c7469 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/MycosynthLatticeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/MycosynthLatticeTest.java @@ -8,10 +8,38 @@ import org.mage.test.serverside.base.CardTestPlayerBase; public class MycosynthLatticeTest extends CardTestPlayerBase { + @Test + public void testMycoSynthLatticeNormal() { + // Converge - Crystalline Crawler enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it. + // Remove a +1/+1 counter from Crystalline Crawler: Add one mana of any color to your mana pool. + // {T}: Put a +1/+1 counter on Crystalline Crawler. + String crawler = "Crystalline Crawler"; + + addCard(Zone.BATTLEFIELD, playerA, "Plains"); + addCard(Zone.BATTLEFIELD, playerA, "Island"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp"); + addCard(Zone.BATTLEFIELD, playerA, "Mountain"); + addCard(Zone.HAND, playerA, crawler); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, crawler); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + + execute(); + + assertCounterCount(playerA, crawler, CounterType.P1P1, 4); + } @Test - public void testMycoSynthLatticeWithCrystallineCrawler(){ + public void testMycoSynthLatticeWithCrystallineCrawler() { + // Converge - Crystalline Crawler enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it. + // Remove a +1/+1 counter from Crystalline Crawler: Add one mana of any color to your mana pool. + // {T}: Put a +1/+1 counter on Crystalline Crawler. String crawler = "Crystalline Crawler"; + + // All permanents are artifacts in addition to their other types. + // All cards that aren't on the battlefield, spells, and permanents are colorless. + // Players may spend mana as though it were mana of any color. String lattice = "Mycosynth Lattice"; addCard(Zone.BATTLEFIELD, playerA, lattice); diff --git a/Mage/src/main/java/mage/Mana.java b/Mage/src/main/java/mage/Mana.java index 7eb518ed5e9..3eae16609ce 100644 --- a/Mage/src/main/java/mage/Mana.java +++ b/Mage/src/main/java/mage/Mana.java @@ -237,6 +237,38 @@ public class Mana implements Comparable, Serializable, Copyable { any += mana.getAny(); } + /** + * Increases the given mana by one. + * + * @param manaType + */ + public void increase(ManaType manaType) { + switch (manaType) { + case BLACK: + black++; + break; + case BLUE: + blue++; + break; + case COLORLESS: + colorless++; + break; + case GENERIC: + generic++; + break; + case GREEN: + green++; + break; + case RED: + red++; + break; + case WHITE: + white++; + break; + } + + } + /** * Increases the Red mana by one. */ @@ -815,11 +847,12 @@ public class Mana implements Comparable, Serializable, Copyable { } /** - * Returns if this objects mana contains any coloured mana the same as the passed in - * {@link Mana}'s mana. + * Returns if this objects mana contains any coloured mana the same as the + * passed in {@link Mana}'s mana. * * @param mana the mana to check for - * @return true if this contains any of the same type of coloured mana that this has + * @return true if this contains any of the same type of coloured mana that + * this has */ public boolean containsAny(final Mana mana) { if (mana.black > 0 && this.black > 0) { @@ -832,7 +865,7 @@ public class Mana implements Comparable, Serializable, Copyable { return true; } else if (mana.green > 0 && this.green > 0) { return true; - } + } return false; } diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCost.java index be6109e9b98..7780d4660e9 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCost.java @@ -47,6 +47,8 @@ public interface ManaCost extends Cost { Mana getPayment(); + Mana getUsedManaToPay(); + void assignPayment(Game game, Ability ability, ManaPool pool, Cost costsToPay); void setPayment(Mana mana); diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java index 9a0f7a37339..906dc777a7c 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java @@ -46,18 +46,21 @@ import mage.util.ManaUtil; public abstract class ManaCostImpl extends CostImpl implements ManaCost { protected Mana payment; + protected Mana usedManaToPay; protected Mana cost; protected ManaOptions options; protected Filter sourceFilter; public ManaCostImpl() { payment = new Mana(); + usedManaToPay = new Mana(); options = new ManaOptions(); } public ManaCostImpl(final ManaCostImpl manaCost) { super(manaCost); this.payment = manaCost.payment.copy(); + this.usedManaToPay = manaCost.usedManaToPay.copy(); this.cost = manaCost.cost.copy(); this.options = manaCost.options.copy(); if (manaCost.sourceFilter != null) { @@ -70,6 +73,11 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { return payment; } + @Override + public Mana getUsedManaToPay() { + return usedManaToPay; + } + @Override public Mana getMana() { return cost; @@ -118,31 +126,31 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { // first check special mana switch (mana) { case B: - if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseBlack(); return true; } break; case U: - if (pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseBlue(); return true; } break; case W: - if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseWhite(); return true; } break; case G: - if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseGreen(); return true; } break; case R: - if (pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseRed(); return true; } @@ -154,7 +162,7 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { protected void assignColorless(Ability ability, Game game, ManaPool pool, int mana, Cost costToPay) { int conditionalCount = pool.getConditionalCount(ability, game, null, costToPay); while (mana > payment.count() && (pool.count() > 0 || conditionalCount > 0)) { - if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseColorless(); } break; @@ -164,27 +172,27 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { protected boolean assignGeneric(Ability ability, Game game, ManaPool pool, int mana, Cost costToPay) { int conditionalCount = pool.getConditionalCount(ability, game, null, costToPay); while (mana > payment.count() && (pool.count() > 0 || conditionalCount > 0)) { - if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseColorless(); continue; } - if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseBlack(); continue; } - if (pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseBlue(); continue; } - if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseWhite(); continue; } - if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseGreen(); continue; } - if (pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay)) { + if (pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay, usedManaToPay)) { this.payment.increaseRed(); continue; } diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java index e912ce2fb04..f040a8f2cd2 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java @@ -120,6 +120,15 @@ public class ManaCostsImpl extends ArrayList implements M return manaTotal; } + @Override + public Mana getUsedManaToPay() { + Mana manaTotal = new Mana(); + for (ManaCost cost : this) { + manaTotal.add(cost.getUsedManaToPay()); + } + return manaTotal; + } + @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { return pay(ability, game, sourceId, controllerId, noMana, this); diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java index 497b4e02dec..1bc24e1aa6d 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java @@ -43,7 +43,7 @@ public class ColorsOfManaSpentToCastCount implements DynamicValue { } if (spell != null) { // NOT the cmc of the spell on the stack - Mana mana = spell.getSpellAbility().getManaCostsToPay().getPayment(); + Mana mana = spell.getSpellAbility().getManaCostsToPay().getUsedManaToPay(); if (mana.getBlack() > 0) { count++; } diff --git a/Mage/src/main/java/mage/players/ManaPool.java b/Mage/src/main/java/mage/players/ManaPool.java index 0df36cae431..1ffeeffc40e 100644 --- a/Mage/src/main/java/mage/players/ManaPool.java +++ b/Mage/src/main/java/mage/players/ManaPool.java @@ -110,9 +110,10 @@ public class ManaPool implements Serializable { * @param filter * @param game * @param costToPay complete costs to pay (needed to check conditional mana) + * @param usedManaToPay the information about what mana was paid * @return */ - public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay) { + public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay, Mana usedManaToPay) { if (!autoPayment && manaType != unlockedManaType) { // if manual payment and the needed mana type was not unlocked, nothing will be paid return false; @@ -149,6 +150,7 @@ public class ManaPool implements Serializable { GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAID, ability.getId(), mana.getSourceId(), ability.getControllerId(), 0, mana.getFlag()); event.setData(mana.getOriginalId().toString()); game.fireEvent(event); + usedManaToPay.increase(mana.getFirstAvailable()); mana.remove(usableManaType); if (mana.count() == 0) { // so no items with count 0 stay in list manaItems.remove(mana); @@ -479,7 +481,7 @@ public class ManaPool implements Serializable { return false; } - public boolean isEmpty(){ + public boolean isEmpty() { return count() == 0; } } From b50d557c7539b36b7cc3904d47694b5752c808d4 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 10 Jul 2017 17:17:01 +0200 Subject: [PATCH 3/3] * Ral Zarek - Reverted workaround fix and fixed the cause of the problem the untap did not work. --- Mage.Sets/src/mage/cards/r/RalZarek.java | 52 ++++---------- .../test/cards/planeswalker/RalZarekTest.java | 68 +++++++++++++++++++ .../effects/common/UntapTargetEffect.java | 1 + 3 files changed, 84 insertions(+), 37 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/RalZarekTest.java diff --git a/Mage.Sets/src/mage/cards/r/RalZarek.java b/Mage.Sets/src/mage/cards/r/RalZarek.java index 2d15024ad90..b88a1dfeb50 100644 --- a/Mage.Sets/src/mage/cards/r/RalZarek.java +++ b/Mage.Sets/src/mage/cards/r/RalZarek.java @@ -31,8 +31,11 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.UntapTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -40,11 +43,11 @@ import mage.constants.Outcome; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.AnotherTargetPredicate; import mage.game.Game; -import mage.game.permanent.Permanent; import mage.game.turn.TurnMod; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetCreatureOrPlayer; +import mage.target.targetpointer.SecondTargetPointer; /** * @@ -65,8 +68,17 @@ public class RalZarek extends CardImpl { this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); // +1: Tap target permanent, then untap another target permanent. - LoyaltyAbility ability1 = new LoyaltyAbility(new RalZarekEffect(), 1); - ability1.addTarget(new TargetPermanent(2, 2, new FilterPermanent(), false)); + LoyaltyAbility ability1 = new LoyaltyAbility(new TapTargetEffect(), 1); + TargetPermanent firstTarget = new TargetPermanent(); + firstTarget.setTargetTag(1); + ability1.addTarget(firstTarget); + Effect effect = new UntapTargetEffect(); + effect.setText(", then untap another target permanent"); + effect.setTargetPointer(new SecondTargetPointer()); + ability1.addEffect(effect); + TargetPermanent secondTarget = new TargetPermanent(secondFilter); + secondTarget.setTargetTag(2); + ability1.addTarget(secondTarget); this.addAbility(ability1); // -2: Ral Zarek deals 3 damage to target creature or player. @@ -89,40 +101,6 @@ public class RalZarek extends CardImpl { } } -class RalZarekEffect extends OneShotEffect { - - public RalZarekEffect() { - super(Outcome.Tap); - this.staticText = "Tap target permanent, then untap another target permanent"; - } - - public RalZarekEffect(final RalZarekEffect effect) { - super(effect); - } - - @Override - public RalZarekEffect copy() { - return new RalZarekEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Permanent tapPermanent = game.getPermanent(source.getTargets().get(0).getTargets().get(0)); - if (tapPermanent != null) { - tapPermanent.tap(game); - } - Permanent unTapPermanent = game.getPermanent(source.getTargets().get(0).getTargets().get(1)); - if (unTapPermanent != null) { - unTapPermanent.untap(game); - } - return true; - } - return false; - } -} - class RalZarekExtraTurnsEffect extends OneShotEffect { public RalZarekExtraTurnsEffect() { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/RalZarekTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/RalZarekTest.java new file mode 100644 index 00000000000..8da714e4de3 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/RalZarekTest.java @@ -0,0 +1,68 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package org.mage.test.cards.planeswalker; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX + */ +public class RalZarekTest extends CardTestPlayerBase { + + @Test + public void testFirstAbility() { + // +1: Tap target permanent, then untap another target permanent. + // -2: Ral Zarek deals 3 damage to target creature or player. + // -7: Flip five coins. Take an extra turn after this one for each coin that comes up heads. + String ralZarek = "Ral Zarek"; // {2}{U}{R} + addCard(Zone.HAND, playerA, ralZarek); + addCard(Zone.BATTLEFIELD, playerA, "Island", 3); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, ralZarek); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1:", "Silvercoat Lion"); // Ral Zarek +1 + addTarget(playerA, "Mountain"); // Untap the Mountain + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, ralZarek, 1); + assertCounterCount(playerA, ralZarek, CounterType.LOYALTY, 5); + + assertTapped("Mountain", false); + assertTapped("Silvercoat Lion", true); + } +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java index ce24f5097d9..e9f5fbc0f8c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java @@ -56,6 +56,7 @@ public class UntapTargetEffect extends OneShotEffect { public UntapTargetEffect(final UntapTargetEffect effect) { super(effect); + this.useOnlyTargetPointer = effect.useOnlyTargetPointer; } @Override