From ee422e8289b95f690b494eb27f8c8d1c7abca906 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 29 Sep 2017 16:44:25 -0400 Subject: [PATCH] Implemented Skirk Alarmist --- Mage.Sets/src/mage/cards/b/BreakOpen.java | 35 +---- .../mage/cards/i/IxidorRealitySculptor.java | 41 +----- Mage.Sets/src/mage/cards/s/SkirkAlarmist.java | 124 ++++++++++++++++++ Mage.Sets/src/mage/sets/Legions.java | 1 + .../common/TurnFaceUpTargetEffect.java | 73 +++++++++++ 5 files changed, 204 insertions(+), 70 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/s/SkirkAlarmist.java create mode 100644 Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java diff --git a/Mage.Sets/src/mage/cards/b/BreakOpen.java b/Mage.Sets/src/mage/cards/b/BreakOpen.java index 44cda67427b..4d166c1ad62 100644 --- a/Mage.Sets/src/mage/cards/b/BreakOpen.java +++ b/Mage.Sets/src/mage/cards/b/BreakOpen.java @@ -28,18 +28,14 @@ package mage.cards.b; import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TurnFaceUpTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.TargetController; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.other.FaceDownPredicate; import mage.filter.predicate.permanent.ControllerPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; /** @@ -72,32 +68,3 @@ public class BreakOpen extends CardImpl { return new BreakOpen(this); } } - -class TurnFaceUpTargetEffect extends OneShotEffect { - - public TurnFaceUpTargetEffect() { - super(Outcome.Benefit); - this.staticText = "Turn target face-down creature an opponen controls face up."; - } - - public TurnFaceUpTargetEffect(final TurnFaceUpTargetEffect effect) { - super(effect); - } - - @Override - public TurnFaceUpTargetEffect copy() { - return new TurnFaceUpTargetEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - UUID target = targetPointer.getFirst(game, source); - if (target != null) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - return permanent.turnFaceUp(game, source.getControllerId()); - } - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/i/IxidorRealitySculptor.java b/Mage.Sets/src/mage/cards/i/IxidorRealitySculptor.java index 63414ade854..dc7f4e618b3 100644 --- a/Mage.Sets/src/mage/cards/i/IxidorRealitySculptor.java +++ b/Mage.Sets/src/mage/cards/i/IxidorRealitySculptor.java @@ -33,15 +33,13 @@ import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TurnFaceUpTargetEffect; import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.other.FaceDownPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; /** @@ -51,16 +49,16 @@ import mage.target.common.TargetCreaturePermanent; public class IxidorRealitySculptor extends CardImpl { private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Face-down creatures"); - private static final FilterCreaturePermanent filterTarget = new FilterCreaturePermanent("Face-down creature"); + private static final FilterCreaturePermanent filterTarget = new FilterCreaturePermanent("face-down creature"); static { filter.add(new FaceDownPredicate()); filterTarget.add(new FaceDownPredicate()); } - + public IxidorRealitySculptor(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); - + addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WIZARD); @@ -69,7 +67,7 @@ public class IxidorRealitySculptor extends CardImpl { // Face-down creatures get +1/+1. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false))); - + // {2}{U}: Turn target face-down creature face up. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TurnFaceUpTargetEffect(), new ManaCostsImpl("{2}{U}")); ability.addTarget(new TargetCreaturePermanent(filterTarget)); @@ -85,32 +83,3 @@ public class IxidorRealitySculptor extends CardImpl { return new IxidorRealitySculptor(this); } } - -class TurnFaceUpTargetEffect extends OneShotEffect { - - public TurnFaceUpTargetEffect() { - super(Outcome.Benefit); - this.staticText = "Turn target face-down creature face up."; - } - - public TurnFaceUpTargetEffect(final TurnFaceUpTargetEffect effect) { - super(effect); - } - - @Override - public TurnFaceUpTargetEffect copy() { - return new TurnFaceUpTargetEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - UUID target = targetPointer.getFirst(game, source); - if (target != null) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - return permanent.turnFaceUp(game, source.getControllerId()); - } - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/s/SkirkAlarmist.java b/Mage.Sets/src/mage/cards/s/SkirkAlarmist.java new file mode 100644 index 00000000000..800e42a89d8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SkirkAlarmist.java @@ -0,0 +1,124 @@ +/* + * 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.s; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SacrificeTargetEffect; +import mage.abilities.effects.common.TurnFaceUpTargetEffect; +import mage.constants.SubType; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.other.FaceDownPredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author TheElk801 + */ +public class SkirkAlarmist extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("face-down creature you control"); + + static { + filter.add(new FaceDownPredicate()); + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + public SkirkAlarmist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // {tap}: Turn target face-down creature you control face up. At the beginning of the next end step, sacrifice it. + Ability ability = new SimpleActivatedAbility(new TurnFaceUpTargetEffect(), new TapSourceCost()); + ability.addEffect(new SkirkAlarmistEffect()); + ability.addTarget(new TargetCreaturePermanent(filter)); + this.addAbility(ability); + } + + public SkirkAlarmist(final SkirkAlarmist card) { + super(card); + } + + @Override + public SkirkAlarmist copy() { + return new SkirkAlarmist(this); + } +} + +class SkirkAlarmistEffect extends OneShotEffect { + + public SkirkAlarmistEffect() { + super(Outcome.Sacrifice); + staticText = "At the beginning of the next end step, sacrifice it"; + } + + public SkirkAlarmistEffect(final SkirkAlarmistEffect effect) { + super(effect); + } + + @Override + public SkirkAlarmistEffect copy() { + return new SkirkAlarmistEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent != null) { + SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice this", source.getControllerId()); + sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game)); + DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect); + game.addDelayedTriggeredAbility(delayedAbility, source); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Legions.java b/Mage.Sets/src/mage/sets/Legions.java index 2217485a40b..fd035637207 100644 --- a/Mage.Sets/src/mage/sets/Legions.java +++ b/Mage.Sets/src/mage/sets/Legions.java @@ -159,6 +159,7 @@ public class Legions extends ExpansionSet { cards.add(new SetCardInfo("Shaleskin Plower", 110, Rarity.COMMON, mage.cards.s.ShaleskinPlower.class)); cards.add(new SetCardInfo("Shifting Sliver", 52, Rarity.UNCOMMON, mage.cards.s.ShiftingSliver.class)); cards.add(new SetCardInfo("Skinthinner", 80, Rarity.COMMON, mage.cards.s.Skinthinner.class)); + cards.add(new SetCardInfo("Skirk Alarmist", 111, Rarity.RARE, mage.cards.s.SkirkAlarmist.class)); cards.add(new SetCardInfo("Skirk Drill Sergeant", 112, Rarity.UNCOMMON, mage.cards.s.SkirkDrillSergeant.class)); cards.add(new SetCardInfo("Skirk Marauder", 113, Rarity.COMMON, mage.cards.s.SkirkMarauder.class)); cards.add(new SetCardInfo("Skirk Outrider", 114, Rarity.COMMON, mage.cards.s.SkirkOutrider.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java new file mode 100644 index 00000000000..2270370e17a --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/TurnFaceUpTargetEffect.java @@ -0,0 +1,73 @@ +/* +* 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.Mode; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author cg5 + */ +public class TurnFaceUpTargetEffect extends OneShotEffect { + + public TurnFaceUpTargetEffect() { + super(Outcome.Benefit); + } + + public TurnFaceUpTargetEffect(final TurnFaceUpTargetEffect effect) { + super(effect); + } + + @Override + public TurnFaceUpTargetEffect copy() { + return new TurnFaceUpTargetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID target = targetPointer.getFirst(game, source); + if (target != null) { + Permanent permanent = game.getPermanent(target); + if (permanent != null) { + return permanent.turnFaceUp(game, source.getControllerId()); + } + } + return false; + } + + @Override + public String getText(Mode mode) { + return "turn target " + mode.getTargets().toString() + " face-up"; + } +}