diff --git a/Mage.Sets/src/mage/sets/commander2014/BreachingLeviathan.java b/Mage.Sets/src/mage/sets/commander2014/BreachingLeviathan.java new file mode 100644 index 00000000000..e8f6804e6db --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/BreachingLeviathan.java @@ -0,0 +1,118 @@ +/* + * 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.commander2014; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.CastFromHandCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SkipNextUntapTargetEffect; +import mage.abilities.effects.common.SkipUntapAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; +import mage.watchers.common.CastFromHandWatcher; + +/** + * + * @author LevelX2 + */ +public class BreachingLeviathan extends CardImpl { + + public BreachingLeviathan(UUID ownerId) { + super(ownerId, 12, "Breaching Leviathan", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{7}{U}{U}"); + this.expansionSetCode = "C14"; + this.subtype.add("Leviathan"); + + this.color.setBlue(true); + this.power = new MageInt(9); + this.toughness = new MageInt(9); + + // When Breaching Leviathan enters the battlefield, if you cast it from your hand, tap all nonblue creatures. Those creatures don't untap during their controllers' next untap steps. + Ability ability = new EntersBattlefieldTriggeredAbility( + new ConditionalOneShotEffect(new BreachingLeviathanEffect(), new CastFromHandCondition(), + "if you cast it from your hand, tap all nonblue creatures. Those creatures don't untap during their controllers' next untap steps")); + this.addAbility(ability); + this.addWatcher(new CastFromHandWatcher()); + } + + public BreachingLeviathan(final BreachingLeviathan card) { + super(card); + } + + @Override + public BreachingLeviathan copy() { + return new BreachingLeviathan(this); + } +} + +class BreachingLeviathanEffect extends OneShotEffect { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblue creatures"); + + static { + filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLUE))); + } + + public BreachingLeviathanEffect() { + super(Outcome.Tap); + this.staticText = "tap all nonblue creatures. Those creatures don't untap during their controllers' next untap steps"; + } + + public BreachingLeviathanEffect(final BreachingLeviathanEffect effect) { + super(effect); + } + + @Override + public BreachingLeviathanEffect copy() { + return new BreachingLeviathanEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (Permanent creature: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + creature.tap(game); + ContinuousEffect effect = new SkipNextUntapTargetEffect(); + effect.setTargetPointer(new FixedTarget(creature.getId())); + game.addEffect(effect, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/commander2014/DomineeringWill.java b/Mage.Sets/src/mage/sets/commander2014/DomineeringWill.java new file mode 100644 index 00000000000..147aa03c711 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/DomineeringWill.java @@ -0,0 +1,81 @@ +/* + * 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.commander2014; + +import java.util.UUID; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.combat.BlocksIfAbleTargetEffect; +import mage.abilities.effects.common.continious.GainControlTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class DomineeringWill extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonattacking creatures"); + + static { + filter.add(Predicates.not(new AttackingPredicate())); + } + + public DomineeringWill(UUID ownerId) { + super(ownerId, 13, "Domineering Will", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{3}{U}"); + this.expansionSetCode = "C14"; + + this.color.setBlue(true); + + // Target player gains control of up to three target nonattacking creatures until end of turn. Untap those creatures. They block this turn if able. + this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfTurn)); + Effect effect = new UntapTargetEffect(); + effect.setText("Untap those creatures"); + this.getSpellAbility().addEffect(effect); + effect = new BlocksIfAbleTargetEffect(Duration.EndOfTurn); + effect.setText("They block this turn if able"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(0,3, filter, false)); + } + + public DomineeringWill(final DomineeringWill card) { + super(card); + } + + @Override + public DomineeringWill copy() { + return new DomineeringWill(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2014/FleshCarver.java b/Mage.Sets/src/mage/sets/commander2014/FleshCarver.java index 05fa0c1b86e..ec8bf72e86f 100644 --- a/Mage.Sets/src/mage/sets/commander2014/FleshCarver.java +++ b/Mage.Sets/src/mage/sets/commander2014/FleshCarver.java @@ -163,6 +163,7 @@ class FleshCarverHorrorToken extends Token { public FleshCarverHorrorToken(int xValue) { super("Horror", "X/X black Horror creature token"); + setOriginalExpansionSetCode("C14"); cardType.add(CardType.CREATURE); color.setBlack(true); subtype.add("Horror"); diff --git a/Mage.Sets/src/mage/sets/commander2014/FoolsDemise.java b/Mage.Sets/src/mage/sets/commander2014/FoolsDemise.java new file mode 100644 index 00000000000..712c349f3ce --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/FoolsDemise.java @@ -0,0 +1,80 @@ +/* + * 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.commander2014; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.DiesAttachedTriggeredAbility; +import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlAttachedEffect; +import mage.abilities.effects.common.ReturnToHandSourceEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class FoolsDemise extends CardImpl { + + public FoolsDemise(UUID ownerId) { + super(ownerId, 111, "Fool's Demise", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}"); + this.expansionSetCode = "C14"; + this.subtype.add("Aura"); + + this.color.setBlue(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // When enchanted creature dies, return that card to the battlefield under your control. + this.addAbility(new DiesAttachedTriggeredAbility(new ReturnToBattlefieldUnderYourControlAttachedEffect(), "enchanted creature")); + + // When Fool's Demise is put into a graveyard from the battlefield, return Fool's Demise to its owner's hand. + this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect())); + } + + public FoolsDemise(final FoolsDemise card) { + super(card); + } + + @Override + public FoolsDemise copy() { + return new FoolsDemise(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2014/Ixidron.java b/Mage.Sets/src/mage/sets/commander2014/Ixidron.java new file mode 100644 index 00000000000..83f22149fad --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/Ixidron.java @@ -0,0 +1,88 @@ +/* + * 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.commander2014; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.continious.BecomesFaceDownCreatureAllEffect; +import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.other.FaceDownPredicate; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.TokenPredicate; + +/** + * + * @author LevelX2 + */ +public class Ixidron extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("face-down creatures on the battlefield"); + private static final FilterCreaturePermanent filterTurnFaceDown = new FilterCreaturePermanent("other nontoken creatures"); + + static { + filter.add(new FaceDownPredicate()); + filterTurnFaceDown.add(new AnotherPredicate()); + filterTurnFaceDown.add(Predicates.not(new TokenPredicate())); + } + + public Ixidron(UUID ownerId) { + super(ownerId, 116, "Ixidron", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); + this.expansionSetCode = "C14"; + this.subtype.add("Illusion"); + + this.color.setBlue(true); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // As Ixidron enters the battlefield, turn all other nontoken creatures face down. + this.addAbility(new EntersBattlefieldAbility(new BecomesFaceDownCreatureAllEffect(filterTurnFaceDown))); + + // Ixidron's power and toughness are each equal to the number of face-down creatures on the battlefield. + this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filter), Duration.EndOfGame))); + } + + public Ixidron(final Ixidron card) { + super(card); + } + + @Override + public Ixidron copy() { + return new Ixidron(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2014/ObNixilisOfTheBlackOath.java b/Mage.Sets/src/mage/sets/commander2014/ObNixilisOfTheBlackOath.java index 2f4821a6227..9c20e814676 100644 --- a/Mage.Sets/src/mage/sets/commander2014/ObNixilisOfTheBlackOath.java +++ b/Mage.Sets/src/mage/sets/commander2014/ObNixilisOfTheBlackOath.java @@ -136,6 +136,7 @@ class ObNixilisDemonToken extends Token { ObNixilisDemonToken() { super("Demon", "5/5 black Demon creature token with flying"); + setOriginalExpansionSetCode("C14"); cardType.add(CardType.CREATURE); subtype.add("Demon"); diff --git a/Mage.Sets/src/mage/sets/commander2014/PromiseOfPower.java b/Mage.Sets/src/mage/sets/commander2014/PromiseOfPower.java index ee2c496b0d0..c8741b7a692 100644 --- a/Mage.Sets/src/mage/sets/commander2014/PromiseOfPower.java +++ b/Mage.Sets/src/mage/sets/commander2014/PromiseOfPower.java @@ -120,6 +120,7 @@ class PromiseOfPowerHorrorToken extends Token { public PromiseOfPowerHorrorToken(int xValue) { super("Horror", "X/X black Horror creature token with flying"); + setOriginalExpansionSetCode("C14"); cardType.add(CardType.CREATURE); color.setBlack(true); subtype.add("Horror"); diff --git a/Mage.Sets/src/mage/sets/commander2014/ReefWorm.java b/Mage.Sets/src/mage/sets/commander2014/ReefWorm.java new file mode 100644 index 00000000000..c87d8f6473b --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/ReefWorm.java @@ -0,0 +1,109 @@ +/* + * 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.commander2014; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.game.permanent.token.Token; + +/** + * + * @author LevelX2 + */ +public class ReefWorm extends CardImpl { + + public ReefWorm(UUID ownerId) { + super(ownerId, 16, "Reef Worm", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}"); + this.expansionSetCode = "C14"; + this.subtype.add("Worm"); + + this.color.setBlue(true); + this.power = new MageInt(0); + this.toughness = new MageInt(1); + + // When Reef Worm dies, put a 3/3 blue Fish creature token onto the battlefield with "When this creature dies, put a 6/6 blue Whale creature token onto the battlefield with "When this creature dies, put a 9/9 blue Kraken creature token onto the battlefield."" + addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new ReefWormFishToken()))); + } + + public ReefWorm(final ReefWorm card) { + super(card); + } + + @Override + public ReefWorm copy() { + return new ReefWorm(this); + } +} + +class ReefWormFishToken extends Token { + + ReefWormFishToken() { + super("Fish", "a 3/3 blue Fish creature token onto the battlefield with \"When this creature dies, put a 6/6 blue Whale creature token onto the battlefield with \"When this creature dies, put a 9/9 blue Kraken creature token onto the battlefield.\"\""); + setOriginalExpansionSetCode("C14"); + cardType.add(CardType.CREATURE); + color.setBlue(true); + subtype.add("Fish"); + power = new MageInt(3); + toughness = new MageInt(3); + + addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new ReefWormWhaleToken()))); + } +} + +class ReefWormWhaleToken extends Token { + + ReefWormWhaleToken() { + super("Whale", "a 6/6 blue Whale creature token with \"When this creature dies, put a 9/9 blue Kraken creature token onto the battlefield.\""); + setOriginalExpansionSetCode("C14"); + cardType.add(CardType.CREATURE); + color.setBlue(true); + subtype.add("Whale"); + power = new MageInt(6); + toughness = new MageInt(6); + + addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new ReefWormKrakenToken()))); + } +} + +class ReefWormKrakenToken extends Token { + + ReefWormKrakenToken() { + super("Kraken", "a 9/9 blue Kraken creature token"); + setOriginalExpansionSetCode("C14"); + cardType.add(CardType.CREATURE); + color.setBlue(true); + subtype.add("Kraken"); + power = new MageInt(9); + toughness = new MageInt(9); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2014/SpoilsOfBlood.java b/Mage.Sets/src/mage/sets/commander2014/SpoilsOfBlood.java index 919b9d6aece..d74c42ee96c 100644 --- a/Mage.Sets/src/mage/sets/commander2014/SpoilsOfBlood.java +++ b/Mage.Sets/src/mage/sets/commander2014/SpoilsOfBlood.java @@ -145,6 +145,7 @@ class SpoilsOfBloodHorrorToken extends Token { public SpoilsOfBloodHorrorToken(int xValue) { super("Horror", "X/X black Horror creature token"); + setOriginalExpansionSetCode("C14"); cardType.add(CardType.CREATURE); color.setBlack(true); subtype.add("Horror"); diff --git a/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java b/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java new file mode 100644 index 00000000000..4e362c5f5fc --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java @@ -0,0 +1,145 @@ +/* + * 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.commander2014; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.game.permanent.token.Token; +import mage.players.Player; +import mage.target.TargetCard; + +/** + * + * @author LevelX2 + */ +public class StitcherGeralf extends CardImpl { + + public StitcherGeralf(UUID ownerId) { + super(ownerId, 17, "Stitcher Geralf", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); + this.expansionSetCode = "C14"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Wizard"); + + this.color.setBlue(true); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // {2}{U}, {tap}: Each player puts the top three cards of his or her library into his or her graveyard. Exile up to two creature cards put into graveyards this way. Put an X/X blue Zombie creature token onto the battlefield, where X is the total power of the cards exiled this way. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new StitcherGeralfEffect(), new ManaCostsImpl("{2}{U}")); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + public StitcherGeralf(final StitcherGeralf card) { + super(card); + } + + @Override + public StitcherGeralf copy() { + return new StitcherGeralf(this); + } +} + +class StitcherGeralfEffect extends OneShotEffect { + + public StitcherGeralfEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "Each player puts the top three cards of his or her library into his or her graveyard. Exile up to two creature cards put into graveyards this way. Put an X/X blue Zombie creature token onto the battlefield, where X is the total power of the cards exiled this way"; + } + + public StitcherGeralfEffect(final StitcherGeralfEffect effect) { + super(effect); + } + + @Override + public StitcherGeralfEffect copy() { + return new StitcherGeralfEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Cards cards = new CardsImpl(); + for (UUID playerId: controller.getInRange()) { + Player player = game.getPlayer(playerId); + if (player != null) { + for (int i = 0; i < Math.min(3, player.getLibrary().size()); i++) { + Card card = player.getLibrary().getFromTop(game); + if (player.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY)) { + // add card only if it goes to graveyard + cards.add(card); + } + } + } + } + TargetCard target = new TargetCard(0,2,Zone.GRAVEYARD, new FilterCreatureCard("creature cards to exile")); + controller.chooseTarget(outcome, cards, target, source, game); + int power = 0; + for (UUID cardId: target.getTargets()) { + Card card = game.getCard(cardId); + if (card != null) { + power += card.getPower().getValue(); + controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD); + } + } + return new CreateTokenEffect(new StitcherGeralfZombieToken(power)).apply(game, source); + } + return false; + } +} + +class StitcherGeralfZombieToken extends Token { + + StitcherGeralfZombieToken(int xValue) { + super("Zombie", "an X/X blue Zombie creature token"); + setOriginalExpansionSetCode("C14"); + cardType.add(CardType.CREATURE); + color.setBlue(true); + subtype.add("Zombie"); + power = new MageInt(xValue); + toughness = new MageInt(xValue); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/FoolsDemise.java b/Mage.Sets/src/mage/sets/timespiral/FoolsDemise.java new file mode 100644 index 00000000000..ba80861becf --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/FoolsDemise.java @@ -0,0 +1,52 @@ +/* + * 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.timespiral; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class FoolsDemise extends mage.sets.commander2014.FoolsDemise { + + public FoolsDemise(UUID ownerId) { + super(ownerId); + this.cardNumber = 64; + this.expansionSetCode = "TSP"; + } + + public FoolsDemise(final FoolsDemise card) { + super(card); + } + + @Override + public FoolsDemise copy() { + return new FoolsDemise(this); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/Ixidron.java b/Mage.Sets/src/mage/sets/timespiral/Ixidron.java new file mode 100644 index 00000000000..9839f8a2f6c --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/Ixidron.java @@ -0,0 +1,52 @@ +/* + * 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.timespiral; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class Ixidron extends mage.sets.commander2014.Ixidron { + + public Ixidron(UUID ownerId) { + super(ownerId); + this.cardNumber = 65; + this.expansionSetCode = "TSP"; + } + + public Ixidron(final Ixidron card) { + super(card); + } + + @Override + public Ixidron copy() { + return new Ixidron(this); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ReefWormTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ReefWormTest.java new file mode 100644 index 00000000000..2a8b315b352 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ReefWormTest.java @@ -0,0 +1,71 @@ +/* + * 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.triggers.dies; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * Checks that a dies triggered ability of a Token works + * @author LevelX2 + */ + +public class ReefWormTest extends CardTestPlayerBase { + + @Test + public void testDiesTriggeredAbility() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); + addCard(Zone.HAND, playerA, "Lightning Bolt", 4); + + // When Reef Worm dies, put a 3/3 blue Fish creature token onto the battlefield with + // "When this creature dies, put a 6/6 blue Whale creature token onto the battlefield with + // ‘When this creature dies, put a 9/9 blue Kraken creature token onto the battlefield.'" + addCard(Zone.BATTLEFIELD, playerB, "Reef Worm", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Reef Worm"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Fish"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Whale"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Whale"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 20); + + assertGraveyardCount(playerA, "Lightning Bolt", 4); + + assertPermanentCount(playerB, "Fish", 0); + assertPermanentCount(playerB, "Whale", 0); + assertPermanentCount(playerB, "Kraken", 1); + assertGraveyardCount(playerB, "Reef Worm", 1); + } + +} \ No newline at end of file diff --git a/Mage/src/mage/MageObjectReference.java b/Mage/src/mage/MageObjectReference.java index a110de68cef..8ed2fc4c7f3 100644 --- a/Mage/src/mage/MageObjectReference.java +++ b/Mage/src/mage/MageObjectReference.java @@ -120,4 +120,12 @@ public class MageObjectReference implements Comparable { return mageObject.getId().equals(sourceId); } + public Permanent getPermanent(Game game) { + Permanent permanent = game.getPermanent(sourceId); + if (permanent != null && permanent.getZoneChangeCounter() == zoneChangeCounter) { + return permanent; + } + return null; + } + } diff --git a/Mage/src/mage/abilities/effects/common/combat/BlocksIfAbleTargetEffect.java b/Mage/src/mage/abilities/effects/common/combat/BlocksIfAbleTargetEffect.java index 42bbc012b80..1b42d17cf78 100644 --- a/Mage/src/mage/abilities/effects/common/combat/BlocksIfAbleTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/combat/BlocksIfAbleTargetEffect.java @@ -56,8 +56,7 @@ public class BlocksIfAbleTargetEffect extends RequirementEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { - Permanent creature = game.getPermanent(source.getFirstTarget()); - return creature != null && creature.getId().equals(permanent.getId()); + return getTargetPointer().getTargets(game, source).contains(permanent.getId()); } @Override diff --git a/Mage/src/mage/abilities/effects/common/continious/BecomesFaceDownCreatureAllEffect.java b/Mage/src/mage/abilities/effects/common/continious/BecomesFaceDownCreatureAllEffect.java new file mode 100644 index 00000000000..6e7b76453ce --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/continious/BecomesFaceDownCreatureAllEffect.java @@ -0,0 +1,175 @@ +/* + * 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.continious; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import mage.MageObjectReference; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.TurnFaceUpAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.keyword.MorphAbility; +import mage.cards.Card; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import static mage.constants.Layer.AbilityAddingRemovingEffects_6; +import static mage.constants.Layer.ColorChangingEffects_5; +import static mage.constants.Layer.PTChangingEffects_7; +import static mage.constants.Layer.TypeChangingEffects_4; +import mage.constants.Outcome; +import mage.constants.SubLayer; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ + +public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl implements SourceEffect { + + protected Map turnFaceUpAbilityMap = new HashMap<>(); + protected FilterPermanent filter; + protected ArrayList objectList = new ArrayList<>(); + + public BecomesFaceDownCreatureAllEffect(FilterPermanent filter) { + super(Duration.EndOfGame, Outcome.BecomeCreature); + this.filter = filter; + staticText = "turn all " + filter.getMessage() + " face down. (They're 2/2 creatures.)"; + } + + public BecomesFaceDownCreatureAllEffect(final BecomesFaceDownCreatureAllEffect effect) { + super(effect); + this.objectList.addAll(effect.objectList); + for (Map.Entry entry: effect.turnFaceUpAbilityMap.entrySet()) { + this.turnFaceUpAbilityMap.put(entry.getKey(), entry.getValue()); + } + this.filter = effect.filter.copy(); + } + + @Override + public BecomesFaceDownCreatureAllEffect copy() { + return new BecomesFaceDownCreatureAllEffect(this); + } + + @Override + public void init(Ability source, Game game) { + super.init(source, game); + for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + if (!perm.isFaceDown()) { + objectList.add(new MageObjectReference(perm)); + perm.setFaceDown(true); + // check for Morph + Card card = game.getCard(perm.getId()); + if (card != null) { + for (Ability ability: card.getAbilities()) { + if (ability instanceof MorphAbility) { + this.turnFaceUpAbilityMap.put(card.getId(), new TurnFaceUpAbility(((MorphAbility)ability).getMorphCosts())); + } + } + } + } + } + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + boolean targetExists = false; + for (MageObjectReference mor: objectList) { + Permanent permanent = mor.getPermanent(game); + if (permanent != null && permanent.isFaceDown()) { + targetExists = true; + switch (layer) { + case TypeChangingEffects_4: + permanent.setName(""); + permanent.getSupertype().clear(); + permanent.getCardType().clear(); + permanent.getCardType().add(CardType.CREATURE); + permanent.getSubtype().clear(); + permanent.getManaCost().clear(); + break; + case ColorChangingEffects_5: + permanent.getColor().setColor(new ObjectColor()); + break; + case AbilityAddingRemovingEffects_6: + Card card = game.getCard(permanent.getId()); // + List abilities = new ArrayList<>(); + for (Ability ability : permanent.getAbilities()) { + if (card != null && !card.getAbilities().contains(ability)) { + // gained abilities from other sources won't be removed + continue; + } + // TODO: Add flag "works also face down" to ability and use it to control ability removement instead of instanceof check + if (ability.getWorksFaceDown()) { + ability.setRuleVisible(false); + continue; + } + if (!ability.getRuleVisible() && !ability.getEffects().isEmpty()) { + if (ability.getEffects().get(0) instanceof BecomesFaceDownCreatureAllEffect) { + continue; + } + } + abilities.add(ability); + } + permanent.getAbilities().removeAll(abilities); + if (turnFaceUpAbilityMap.containsKey(permanent.getId())) { + permanent.addAbility(turnFaceUpAbilityMap.get(permanent.getId()), game); + } + break; + case PTChangingEffects_7: + if (sublayer == SubLayer.SetPT_7b) { + permanent.getPower().setValue(2); + permanent.getToughness().setValue(2); + } + + } + } + } + if (!targetExists) { + discard(); + } + return true; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4; + } + +} diff --git a/Mage/src/mage/abilities/effects/common/continious/GainControlTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/GainControlTargetEffect.java index a89903bd059..23634cc7fec 100644 --- a/Mage/src/mage/abilities/effects/common/continious/GainControlTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/GainControlTargetEffect.java @@ -39,6 +39,8 @@ import mage.constants.SubLayer; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import mage.target.Target; +import mage.util.CardUtil; /** * @@ -100,7 +102,7 @@ public class GainControlTargetEffect extends ContinuousEffectImpl { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { boolean targetStillExists = false; - for (UUID permanentId: this.getTargetPointer().getTargets(game, source)) { + for (UUID permanentId: getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { targetStillExists = true; @@ -113,7 +115,7 @@ public class GainControlTargetEffect extends ContinuousEffectImpl { } if (!targetStillExists) { // no valid target exists, effect can be discarded - this.discard(); + discard(); } return true; } @@ -125,9 +127,17 @@ public class GainControlTargetEffect extends ContinuousEffectImpl { if (!staticText.isEmpty()) { return staticText; } + Target target = mode.getTargets().get(0); StringBuilder sb = new StringBuilder("Gain control of "); - if (!mode.getTargets().get(0).getTargetName().startsWith("another")) { - sb.append("target "); + if (target.getMaxNumberOfTargets() > 1){ + if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) { + sb.append("up to "); + } + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target "); + } else { + if (!target.getTargetName().startsWith("another")) { + sb.append("target "); + } } sb.append(mode.getTargets().get(0).getTargetName()); if (!duration.toString().isEmpty()) { diff --git a/Mage/src/mage/abilities/keyword/MorphAbility.java b/Mage/src/mage/abilities/keyword/MorphAbility.java index c383bd70258..53b295cb29f 100644 --- a/Mage/src/mage/abilities/keyword/MorphAbility.java +++ b/Mage/src/mage/abilities/keyword/MorphAbility.java @@ -105,7 +105,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost protected static final String REMINDER_TEXT = "(You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)"; protected String ruleText; protected AlternativeCost2Impl alternateCosts = new AlternativeCost2Impl(ABILITY_KEYWORD, REMINDER_TEXT, new GenericManaCost(3)); - + protected Costs morphCosts; // needed to check activation status, if card changes zone after casting it private int zoneChangeCounter = 0; @@ -115,6 +115,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost public MorphAbility(Card card, Costs morphCosts) { super(Zone.HAND, null); + this.morphCosts = morphCosts; card.setMorphCard(true); this.setWorksFaceDown(true); name = ABILITY_KEYWORD; @@ -141,6 +142,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost this.zoneChangeCounter = ability.zoneChangeCounter; this.ruleText = ability.ruleText; this.alternateCosts = ability.alternateCosts.copy(); + this.morphCosts = ability.morphCosts; // can't be changed } private static Costs createCosts(Cost cost) { @@ -159,6 +161,10 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost zoneChangeCounter = 0; } + public Costs getMorphCosts() { + return morphCosts; + } + @Override public boolean isActivated(Ability ability, Game game) { Card card = game.getCard(sourceId); @@ -267,7 +273,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost /** * This effect lets the creature always be a 2/2 face-down creature, with no text, - * no name, no subtypes, and no mana cost, if it's fac down on the battlefield. + * no name, no subtypes, and no mana cost, if it's face down on the battlefield. * And it adds the MorphTurnFaceUpAbility ability. * TODO: Check if it's better to create this effect always as a creature on the battelfield turns face down or * a creature enters the battlefield face down. Then the effect could be removed as the permanent turns face up.