From f5c925d26c4b542e4af0c8172222e9ef9af4e703 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 5 Jul 2017 07:58:46 +0200 Subject: [PATCH] [HOU] Added Imaginary Threats. --- .../src/mage/cards/i/ImaginaryThreats.java | 106 ++++++++++++++++++ Mage.Sets/src/mage/cards/i/InciteWar.java | 4 +- .../src/mage/sets/HourOfDevastation.java | 1 + ...ntapInOpponentsNextUntapStepAllEffect.java | 10 +- 4 files changed, 114 insertions(+), 7 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/i/ImaginaryThreats.java diff --git a/Mage.Sets/src/mage/cards/i/ImaginaryThreats.java b/Mage.Sets/src/mage/cards/i/ImaginaryThreats.java new file mode 100644 index 00000000000..14f997c4f98 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/ImaginaryThreats.java @@ -0,0 +1,106 @@ +/* + * 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.cards.i; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.RequirementEffect; +import mage.abilities.effects.common.DontUntapInOpponentsNextUntapStepAllEffect; +import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect; +import mage.abilities.keyword.CyclingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetOpponent; + +/** + * + * @author LevelX2 + */ +public class ImaginaryThreats extends CardImpl { + + public ImaginaryThreats(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}"); + + // Creatures target opponent controls attack this turn if able. During that player's next untap step, creatures he or she controls don't untap. + getSpellAbility().addEffect(new ImaginaryThreatsEffect()); + getSpellAbility().addTarget(new TargetOpponent()); + getSpellAbility().addEffect(new DontUntapInOpponentsNextUntapStepAllEffect(new FilterCreaturePermanent()) + .setText("During that player's next untap step, creatures he or she controls don't untap")); + // Cycling {2} + this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); + + } + + public ImaginaryThreats(final ImaginaryThreats card) { + super(card); + } + + @Override + public ImaginaryThreats copy() { + return new ImaginaryThreats(this); + } +} + +class ImaginaryThreatsEffect extends OneShotEffect { + + public ImaginaryThreatsEffect() { + super(Outcome.Detriment); + staticText = "Creatures target opponent controls attack this turn if able"; + } + + public ImaginaryThreatsEffect(final ImaginaryThreatsEffect effect) { + super(effect); + } + + @Override + public ImaginaryThreatsEffect copy() { + return new ImaginaryThreatsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); + if (player != null) { + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(new ControllerIdPredicate(player.getId())); + RequirementEffect effect = new AttacksIfAbleAllEffect(filter, Duration.EndOfTurn); + game.addEffect(effect, source); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/i/InciteWar.java b/Mage.Sets/src/mage/cards/i/InciteWar.java index 8e97aeb00ce..26dcef22f1c 100644 --- a/Mage.Sets/src/mage/cards/i/InciteWar.java +++ b/Mage.Sets/src/mage/cards/i/InciteWar.java @@ -63,7 +63,7 @@ public class InciteWar extends CardImpl { } public InciteWar(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}"); // Choose one - Creatures target player controls attack this turn if able; this.getSpellAbility().addEffect(new InciteWarMustAttackEffect()); @@ -93,7 +93,7 @@ class InciteWarMustAttackEffect extends OneShotEffect { public InciteWarMustAttackEffect() { super(Outcome.Detriment); - staticText = "Creatures target player control attack this turn if able"; + staticText = "Creatures target player controls attack this turn if able"; } public InciteWarMustAttackEffect(final InciteWarMustAttackEffect effect) { diff --git a/Mage.Sets/src/mage/sets/HourOfDevastation.java b/Mage.Sets/src/mage/sets/HourOfDevastation.java index 898350326c2..6a9f72cc026 100644 --- a/Mage.Sets/src/mage/sets/HourOfDevastation.java +++ b/Mage.Sets/src/mage/sets/HourOfDevastation.java @@ -133,6 +133,7 @@ public class HourOfDevastation extends ExpansionSet { cards.add(new SetCardInfo("Hour of Glory", 65, Rarity.RARE, mage.cards.h.HourOfGlory.class)); cards.add(new SetCardInfo("Hour of Promise", 120, Rarity.RARE, mage.cards.h.HourOfPromise.class)); cards.add(new SetCardInfo("Hour of Revelation", 15, Rarity.RARE, mage.cards.h.HourOfRevelation.class)); + cards.add(new SetCardInfo("Imaginary Threats", 37, Rarity.UNCOMMON, mage.cards.i.ImaginaryThreats.class)); cards.add(new SetCardInfo("Inferno Jet", 99, Rarity.UNCOMMON, mage.cards.i.InfernoJet.class)); cards.add(new SetCardInfo("Island", 186, Rarity.LAND, mage.cards.basiclands.Island.class, new CardGraphicInfo(FrameStyle.BFZ_FULL_ART_BASIC, true))); cards.add(new SetCardInfo("Island", 192, Rarity.LAND, mage.cards.basiclands.Island.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java index 81d25066c5e..d3a78b02406 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java @@ -34,7 +34,6 @@ import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.PhaseStep; -import mage.constants.TargetController; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.events.GameEvent; @@ -49,23 +48,23 @@ public class DontUntapInOpponentsNextUntapStepAllEffect extends ContinuousRuleMo private int validForTurnNum; //private String targetName; - TargetController targetController; FilterPermanent filter; /** * Attention: This effect won't work with targets controlled by different * controllers If this is needed, the validForTurnNum has to be saved per * controller. + * + * @param filter */ public DontUntapInOpponentsNextUntapStepAllEffect(FilterPermanent filter) { super(Duration.Custom, Outcome.Detriment, false, true); - this.filter = filter; + this.filter = filter; } public DontUntapInOpponentsNextUntapStepAllEffect(final DontUntapInOpponentsNextUntapStepAllEffect effect) { super(effect); this.validForTurnNum = effect.validForTurnNum; - this.targetController = effect.targetController; this.filter = effect.filter; } @@ -127,7 +126,8 @@ public class DontUntapInOpponentsNextUntapStepAllEffect extends ContinuousRuleMo if (controller != null && !game.isOpponent(controller, permanent.getControllerId())) { return false; } - if (game.getActivePlayerId().equals(permanent.getControllerId()) && // controller's untap step + if (game.getActivePlayerId().equals(permanent.getControllerId()) + && // controller's untap step filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { return true; }