From 82f2d73fb9978a2373f384c064c3cf4543d8e8f7 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Tue, 29 Sep 2015 13:15:09 +0300 Subject: [PATCH] Add DontUntapAsLongAsSourceTappedEffect and connectSource parameter to TapTargetEffect. Use them for existing cards. Implement card: Thalakos Dreamsower --- .../journeyintonyx/DesertersQuarters.java | 88 +---------- .../src/mage/sets/mirage/AmberPrison.java | 138 +----------------- .../mage/sets/scarsofmirrodin/RustTick.java | 88 +---------- .../mage/sets/tempest/ThalakosDreamsower.java | 76 ++++++++++ .../DontUntapAsLongAsSourceTappedEffect.java | 78 ++++++++++ .../effects/common/TapTargetEffect.java | 31 +++- 6 files changed, 189 insertions(+), 310 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/tempest/ThalakosDreamsower.java create mode 100644 Mage/src/mage/abilities/effects/common/DontUntapAsLongAsSourceTappedEffect.java diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/DesertersQuarters.java b/Mage.Sets/src/mage/sets/journeyintonyx/DesertersQuarters.java index 41c34c3891..6604ae9340 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/DesertersQuarters.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/DesertersQuarters.java @@ -29,21 +29,16 @@ package mage.sets.journeyintonyx; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.Mode; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect; import mage.abilities.effects.common.TapTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; /** @@ -60,12 +55,11 @@ public class DesertersQuarters extends CardImpl { this.addAbility(new SkipUntapOptionalAbility()); // {6}, T: Tap target creature. It doesn't untap during its controller's untap step for as long as Deserter's Quarters remains tapped. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DesertersQuartersTapTargetEffect(), new GenericManaCost(6)); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(true), new GenericManaCost(6)); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); + ability.addEffect(new DontUntapAsLongAsSourceTappedEffect()); this.addAbility(ability); - - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DesertersQuartersRestrictionEffect())); } public DesertersQuarters(final DesertersQuarters card) { @@ -77,79 +71,3 @@ public class DesertersQuarters extends CardImpl { return new DesertersQuarters(this); } } - -class DesertersQuartersTapTargetEffect extends TapTargetEffect { - - public DesertersQuartersTapTargetEffect() { - super(); - staticText = "Tap target creature. It doesn't untap during its controller's untap step for as long as {this} remains tapped"; - } - - public DesertersQuartersTapTargetEffect(final DesertersQuartersTapTargetEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null) { - sourcePermanent.clearConnectedCards("DesertersQuarters"); - } - for (UUID target : targetPointer.getTargets(game, source)) { - Permanent permanent = game.getPermanent(target); - if (sourcePermanent != null) { - sourcePermanent.addConnectedCard("DesertersQuarters", permanent.getId()); - } - if (permanent != null) { - permanent.tap(game); - } - } - return true; - } - - @Override - public DesertersQuartersTapTargetEffect copy() { - return new DesertersQuartersTapTargetEffect(this); - } - - @Override - public String getText(Mode mode) { - return staticText; - } -} - -class DesertersQuartersRestrictionEffect extends RestrictionEffect { - - public DesertersQuartersRestrictionEffect() { - super(Duration.WhileOnBattlefield); - } - - public DesertersQuartersRestrictionEffect(final DesertersQuartersRestrictionEffect effect) { - super(effect); - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - Permanent rustTick = game.getPermanent(source.getSourceId()); - if (rustTick != null && rustTick.isTapped()) { - if (rustTick.getConnectedCards("DesertersQuarters").size() > 0) { - UUID target = rustTick.getConnectedCards("DesertersQuarters").get(0); - if (target != null && target.equals(permanent.getId())) { - return true; - } - } - } - return false; - } - - @Override - public boolean canBeUntapped(Permanent permanent, Ability source, Game game) { - return false; - } - - @Override - public DesertersQuartersRestrictionEffect copy() { - return new DesertersQuartersRestrictionEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/mirage/AmberPrison.java b/Mage.Sets/src/mage/sets/mirage/AmberPrison.java index 3653f69be8..4e1de790d6 100644 --- a/Mage.Sets/src/mage/sets/mirage/AmberPrison.java +++ b/Mage.Sets/src/mage/sets/mirage/AmberPrison.java @@ -29,27 +29,19 @@ package mage.sets.mirage; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect; +import mage.abilities.effects.common.TapTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; /** @@ -75,12 +67,11 @@ public class AmberPrison extends CardImpl { this.addAbility(new SkipUntapOptionalAbility()); // {4}, {tap}: Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as Amber Prison remains tapped. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AmberPrisonTapTargetEffect(), new GenericManaCost(4)); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(true), new GenericManaCost(4)); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetPermanent(filter)); + ability.addEffect(new DontUntapAsLongAsSourceTappedEffect()); this.addAbility(ability); - this.addAbility(new AmberPrisonUntapTriggeredAbility()); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AmberPrisonRestrictionEffect())); } public AmberPrison(final AmberPrison card) { @@ -92,124 +83,3 @@ public class AmberPrison extends CardImpl { return new AmberPrison(this); } } - -class AmberPrisonTapTargetEffect extends OneShotEffect { - - public AmberPrisonTapTargetEffect() { - super(Outcome.Tap); - this.staticText = "Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as {source} remains tapped."; - } - - public AmberPrisonTapTargetEffect(final AmberPrisonTapTargetEffect effect) { - super(effect); - } - - @Override - public AmberPrisonTapTargetEffect copy() { - return new AmberPrisonTapTargetEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - for (UUID target : targetPointer.getTargets(game, source)) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - if (sourcePermanent != null) { - sourcePermanent.addConnectedCard("AmberPrison", permanent.getId()); - } - permanent.tap(game); - } - } - return true; - } - -} - -class AmberPrisonRestrictionEffect extends RestrictionEffect { - - public AmberPrisonRestrictionEffect() { - super(Duration.WhileOnBattlefield); - } - - public AmberPrisonRestrictionEffect(final AmberPrisonRestrictionEffect effect) { - super(effect); - } - - @Override - public AmberPrisonRestrictionEffect copy() { - return new AmberPrisonRestrictionEffect(this); - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null && sourcePermanent.isTapped()) { - if (sourcePermanent.getConnectedCards("AmberPrison") != null) { - return sourcePermanent.getConnectedCards("AmberPrison").contains(permanent.getId()); - } - } - return false; - } - - @Override - public boolean canBeUntapped(Permanent permanent, Ability source, Game game) { - return false; - } - -} - -class AmberPrisonUntapTriggeredAbility extends TriggeredAbilityImpl { - - public AmberPrisonUntapTriggeredAbility() { - super(Zone.BATTLEFIELD, new AmberPrisonReleaseOnUntapEffect(), false); - this.usesStack = false; - this.ruleVisible = false; - } - - public AmberPrisonUntapTriggeredAbility(final AmberPrisonUntapTriggeredAbility ability) { - super(ability); - } - - @Override - public AmberPrisonUntapTriggeredAbility copy() { - return new AmberPrisonUntapTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UNTAP; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - return event.getTargetId().equals(this.getSourceId()); - } -} - -class AmberPrisonReleaseOnUntapEffect extends OneShotEffect { - - public AmberPrisonReleaseOnUntapEffect() { - super(Outcome.Detriment); - } - - public AmberPrisonReleaseOnUntapEffect(final AmberPrisonReleaseOnUntapEffect effect) { - super(effect); - } - - @Override - public AmberPrisonReleaseOnUntapEffect copy() { - return new AmberPrisonReleaseOnUntapEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null) { - sourcePermanent.clearConnectedCards("AmberPrison"); - return true; - } - return false; - } - -} diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/RustTick.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/RustTick.java index db24b40406..01a7294134 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/RustTick.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/RustTick.java @@ -30,22 +30,17 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.Mode; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.RestrictionEffect; import mage.abilities.effects.common.TapTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.common.TargetArtifactPermanent; +import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect; /** * @author nantuko @@ -64,12 +59,11 @@ public class RustTick extends CardImpl { this.addAbility(new SkipUntapOptionalAbility()); // {1}, {tap}: Tap target artifact. It doesn't untap during its controller's untap step for as long as Rust Tick remains tapped. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RustTickTapTargetEffect(), new GenericManaCost(1)); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(true), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetArtifactPermanent()); + ability.addEffect(new DontUntapAsLongAsSourceTappedEffect()); this.addAbility(ability); - - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RustTickRestrictionEffect())); } public RustTick(final RustTick card) { @@ -81,79 +75,3 @@ public class RustTick extends CardImpl { return new RustTick(this); } } - -class RustTickTapTargetEffect extends TapTargetEffect { - - public RustTickTapTargetEffect() { - super(); - staticText = "Tap target artifact. It doesn't untap during its controller's untap step for as long as Rust Tick remains tapped"; - } - - public RustTickTapTargetEffect(final RustTickTapTargetEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent rustTick = game.getPermanent(source.getSourceId()); - if (rustTick != null) { - rustTick.clearConnectedCards("RustTick"); - } - for (UUID target : targetPointer.getTargets(game, source)) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - rustTick.addConnectedCard("RustTick", permanent.getId()); - permanent.tap(game); - } else { - return false; - } - } - return true; - } - - @Override - public RustTickTapTargetEffect copy() { - return new RustTickTapTargetEffect(this); - } - - @Override - public String getText(Mode mode) { - return staticText; - } -} - -class RustTickRestrictionEffect extends RestrictionEffect { - - public RustTickRestrictionEffect() { - super(Duration.WhileOnBattlefield); - } - - public RustTickRestrictionEffect(final RustTickRestrictionEffect effect) { - super(effect); - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - Permanent rustTick = game.getPermanent(source.getSourceId()); - if (rustTick != null && rustTick.isTapped()) { - if (rustTick.getConnectedCards("RustTick").size() > 0) { - UUID target = rustTick.getConnectedCards("RustTick").get(0); - if (target != null && target.equals(permanent.getId())) { - return true; - } - } - } - return false; - } - - @Override - public boolean canBeUntapped(Permanent permanent, Ability source, Game game) { - return false; - } - - @Override - public RustTickRestrictionEffect copy() { - return new RustTickRestrictionEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/tempest/ThalakosDreamsower.java b/Mage.Sets/src/mage/sets/tempest/ThalakosDreamsower.java new file mode 100644 index 0000000000..d03c8eb1d4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/ThalakosDreamsower.java @@ -0,0 +1,76 @@ +/* + * 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 mage.sets.tempest; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.common.SkipUntapOptionalAbility; +import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.keyword.ShadowAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class ThalakosDreamsower extends CardImpl { + + public ThalakosDreamsower(UUID ownerId) { + super(ownerId, 92, "Thalakos Dreamsower", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "TMP"; + this.subtype.add("Thalakos"); + this.subtype.add("Wizard"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Shadow + this.addAbility(ShadowAbility.getInstance()); + // You may choose not to untap Thalakos Dreamsower during your untap step. + this.addAbility(new SkipUntapOptionalAbility()); + // Whenever Thalakos Dreamsower deals damage to an opponent, tap target creature. That creature doesn't untap during its controller's untap step for as long as Thalakos Dreamsower remains tapped. + Ability ability = new DealsDamageToOpponentTriggeredAbility(new TapTargetEffect(true), false); + ability.addTarget(new TargetCreaturePermanent()); + ability.addEffect(new DontUntapAsLongAsSourceTappedEffect()); + this.addAbility(ability); + } + + public ThalakosDreamsower(final ThalakosDreamsower card) { + super(card); + } + + @Override + public ThalakosDreamsower copy() { + return new ThalakosDreamsower(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/DontUntapAsLongAsSourceTappedEffect.java b/Mage/src/mage/abilities/effects/common/DontUntapAsLongAsSourceTappedEffect.java new file mode 100644 index 0000000000..b6ee8a4061 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/DontUntapAsLongAsSourceTappedEffect.java @@ -0,0 +1,78 @@ +/* + * 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 mage.abilities.effects.common; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.RestrictionEffect; +import mage.constants.Duration; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LoneFox + */ + +public class DontUntapAsLongAsSourceTappedEffect extends RestrictionEffect { + + public DontUntapAsLongAsSourceTappedEffect() { + super(Duration.WhileOnBattlefield); + staticText = "It doesn't untap during its controller's untap step for as long as {source} remains tapped."; + } + + public DontUntapAsLongAsSourceTappedEffect(final DontUntapAsLongAsSourceTappedEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + if(sourcePermanent != null && sourcePermanent.isTapped()) { + String name = sourcePermanent.getName(); + if(sourcePermanent.getConnectedCards(name).size() > 0) { + UUID target = sourcePermanent.getConnectedCards(name).get(0); + if(target != null && target.equals(permanent.getId())) { + return true; + } + } + } + return false; + } + + @Override + public boolean canBeUntapped(Permanent permanent, Ability source, Game game) { + return false; + } + + @Override + public DontUntapAsLongAsSourceTappedEffect copy() { + return new DontUntapAsLongAsSourceTappedEffect(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/TapTargetEffect.java b/Mage/src/mage/abilities/effects/common/TapTargetEffect.java index e8fa976f4b..964f24bf53 100644 --- a/Mage/src/mage/abilities/effects/common/TapTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/TapTargetEffect.java @@ -28,15 +28,14 @@ package mage.abilities.effects.common; -import mage.constants.Outcome; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.Target; - -import java.util.UUID; import mage.util.CardUtil; /** @@ -44,17 +43,31 @@ import mage.util.CardUtil; */ public class TapTargetEffect extends OneShotEffect { + private final boolean connectSource; + public TapTargetEffect() { - super(Outcome.Tap); + this(null, false); + } + + public TapTargetEffect(boolean connectSource) { + this(null, connectSource); } public TapTargetEffect(String text) { - this(); - this.staticText = text; + this(text, false); + } + + public TapTargetEffect(String text, boolean connectSource) { + super(Outcome.Tap); + this.connectSource = connectSource; + if(text != null) { + this.staticText = text; + } } public TapTargetEffect(final TapTargetEffect effect) { super(effect); + this.connectSource = effect.connectSource; } @Override @@ -68,6 +81,12 @@ public class TapTargetEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target); if (permanent != null) { permanent.tap(game); + if(connectSource) { + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + if(sourcePermanent != null) { + sourcePermanent.addConnectedCard(sourcePermanent.getName(), permanent.getId()); + } + } } } return true;