From 8d76836eb68e43a2f3aa3f6a11d07cbff4ae3699 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 10 Nov 2014 08:29:04 +0100 Subject: [PATCH] Added Profane Command, Hallowed Spiritkeeper, Song of the Dryads, Phantom Centaur, Freyalise Llanowar's Fury. --- .../src/mage/deck/Commander.java | 14 +- .../ajanivsnicolbolas/ProfaneCommand.java | 52 ++++++ .../commander2014/FreyaliseLlanowarsFury.java | 114 +++++++++++++ .../commander2014/HallowedSpiritkeeper.java | 73 ++++++++ .../sets/commander2014/ProfaneCommand.java | 126 ++++++++++++++ .../sets/commander2014/SongOfTheDryads.java | 77 +++++++++ .../mage/sets/judgment/PhantomCentaur.java | 161 ++++++++++++++++++ .../src/mage/sets/lorwyn/ProfaneCommand.java | 52 ++++++ .../mage/sets/planechase/ProfaneCommand.java | 52 ++++++ .../mage/sets/urzassaga/StrokeOfGenius.java | 6 +- Mage/src/mage/abilities/Modes.java | 2 +- .../common/CanBeYourCommanderAbility.java | 61 +++++++ .../BecomesBasicLandEnchantedEffect.java | 34 ++-- 13 files changed, 807 insertions(+), 17 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/ajanivsnicolbolas/ProfaneCommand.java create mode 100644 Mage.Sets/src/mage/sets/commander2014/FreyaliseLlanowarsFury.java create mode 100644 Mage.Sets/src/mage/sets/commander2014/HallowedSpiritkeeper.java create mode 100644 Mage.Sets/src/mage/sets/commander2014/ProfaneCommand.java create mode 100644 Mage.Sets/src/mage/sets/commander2014/SongOfTheDryads.java create mode 100644 Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java create mode 100644 Mage.Sets/src/mage/sets/lorwyn/ProfaneCommand.java create mode 100644 Mage.Sets/src/mage/sets/planechase/ProfaneCommand.java create mode 100644 Mage/src/mage/abilities/common/CanBeYourCommanderAbility.java diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java index d01fbaf59b5..fe958b3d18d 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java @@ -32,6 +32,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import mage.abilities.common.CanBeYourCommanderAbility; import mage.cards.Card; import mage.cards.decks.Deck; import mage.cards.decks.DeckValidator; @@ -130,21 +131,26 @@ public class Commander extends DeckValidator { if (deck.getSideboard().size() == 1) { Card commander = (Card) deck.getSideboard().toArray()[0]; - if (commander != null && commander.getCardType().contains(CardType.CREATURE) && commander.getSupertype().contains("Legendary")) { + if (commander == null) { + invalid.put("Commander", "Commander invalide "); + return false; + } + if ((commander.getCardType().contains(CardType.CREATURE) && commander.getSupertype().contains("Legendary")) || + (commander.getCardType().contains(CardType.PLANESWALKER) && commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) { if (!bannedCommander.contains(commander.getName())) { FilterMana color = getColorIdentity(commander); for (Card card : deck.getCards()) { if (!cardHasValideColor(color, card)) { - invalid.put(card.getName(), "Invalid color"); + invalid.put(card.getName(), "Invalid color (" + commander.getName() +")"); valid = false; } } } else { - invalid.put("Commander", "Commander banned"); + invalid.put("Commander", "Commander banned (" + commander.getName() +")"); valid = false; } } else { - invalid.put("Commander", "Commander invalide"); + invalid.put("Commander", "Commander invalide (" + commander.getName() +")"); valid = false; } } else { diff --git a/Mage.Sets/src/mage/sets/ajanivsnicolbolas/ProfaneCommand.java b/Mage.Sets/src/mage/sets/ajanivsnicolbolas/ProfaneCommand.java new file mode 100644 index 00000000000..99df1f552d9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/ajanivsnicolbolas/ProfaneCommand.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.ajanivsnicolbolas; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class ProfaneCommand extends mage.sets.commander2014.ProfaneCommand { + + public ProfaneCommand(UUID ownerId) { + super(ownerId); + this.cardNumber = 70; + this.expansionSetCode = "DDH"; + } + + public ProfaneCommand(final ProfaneCommand card) { + super(card); + } + + @Override + public ProfaneCommand copy() { + return new ProfaneCommand(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2014/FreyaliseLlanowarsFury.java b/Mage.Sets/src/mage/sets/commander2014/FreyaliseLlanowarsFury.java new file mode 100644 index 00000000000..be5817ace5c --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/FreyaliseLlanowarsFury.java @@ -0,0 +1,114 @@ +/* + * 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.LoyaltyAbility; +import mage.abilities.common.CanBeYourCommanderAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.mana.GreenManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.permanent.token.Token; +import mage.target.TargetPermanent; + +/** + * + * @author LevelX2 + */ +public class FreyaliseLlanowarsFury extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); + private static final FilterControlledCreaturePermanent filterGreen = new FilterControlledCreaturePermanent("green creature you control"); + + static { + filter.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.ENCHANTMENT))); + filterGreen.add(new ColorPredicate(ObjectColor.GREEN)); + } + + public FreyaliseLlanowarsFury(UUID ownerId) { + super(ownerId, 43, "Freyalise, Llanowar's Fury", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{3}{G}{G}"); + this.expansionSetCode = "C14"; + this.subtype.add("Freyalise"); + + this.color.setGreen(true); + + // +2: Put a 1/1 green Elf Druid creature token onto the battlefield with "{tap}: Add {G} to your mana pool." + this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new FreyaliseLlanowarsFuryToken()), 2)); + // -2: Destroy target artifact or enchantment. + LoyaltyAbility loyaltyAbility = new LoyaltyAbility(new DestroyTargetEffect(), -2); + loyaltyAbility.addTarget(new TargetPermanent(filter)); + this.addAbility(loyaltyAbility); + // -6: Draw a card for each green creature you control. + this.addAbility(new LoyaltyAbility(new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)), -6)); + + // Freyalise, Llanowar's Fury can be your commander. + this.addAbility(CanBeYourCommanderAbility.getInstance()); + + } + + public FreyaliseLlanowarsFury(final FreyaliseLlanowarsFury card) { + super(card); + } + + @Override + public FreyaliseLlanowarsFury copy() { + return new FreyaliseLlanowarsFury(this); + } +} + +class FreyaliseLlanowarsFuryToken extends Token { + + FreyaliseLlanowarsFuryToken() { + super("Elf Druid", "1/1 green Elf Druid creature token onto the battlefield with \"{t}: Add {G} to your mana pool.\""); + this.setOriginalExpansionSetCode("C14"); + this.cardType.add(CardType.CREATURE); + this.color = ObjectColor.GREEN; + this.subtype.add("Elf"); + this.subtype.add("Druid"); + + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {T}: Add {G} to your mana pool. + this.addAbility(new GreenManaAbility()); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/commander2014/HallowedSpiritkeeper.java b/Mage.Sets/src/mage/sets/commander2014/HallowedSpiritkeeper.java new file mode 100644 index 00000000000..87519f7efce --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/HallowedSpiritkeeper.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.sets.commander2014; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import static mage.filter.predicate.permanent.ControllerControlsIslandPredicate.filter; +import mage.game.permanent.token.SpiritToken; + +/** + * + * @author LevelX2 + */ +public class HallowedSpiritkeeper extends CardImpl { + + public HallowedSpiritkeeper(UUID ownerId) { + super(ownerId, 8, "Hallowed Spiritkeeper", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W}{W}"); + this.expansionSetCode = "C14"; + this.subtype.add("Avatar"); + + this.color.setWhite(true); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // When Hallowed Spiritkeeper dies, put X 1/1 white Spirit creature tokens with flying onto the battlefield, where X is the number of creature cards in your graveyard. + this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new SpiritToken(), new CardsInControllerGraveyardCount()), false)); + + } + + public HallowedSpiritkeeper(final HallowedSpiritkeeper card) { + super(card); + } + + @Override + public HallowedSpiritkeeper copy() { + return new HallowedSpiritkeeper(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2014/ProfaneCommand.java b/Mage.Sets/src/mage/sets/commander2014/ProfaneCommand.java new file mode 100644 index 00000000000..339b7dec544 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/ProfaneCommand.java @@ -0,0 +1,126 @@ +/* + * 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.Mode; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; +import mage.abilities.effects.common.continious.BoostTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.keyword.FearAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.Filter; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class ProfaneCommand extends CardImpl { + + public ProfaneCommand(UUID ownerId) { + super(ownerId, 156, "Profane Command", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{B}{B}"); + this.expansionSetCode = "C14"; + + this.color.setBlack(true); + + DynamicValue xValue = new ManacostVariableValue(); + // Choose two - + this.getSpellAbility().getModes().setMinModes(2); + this.getSpellAbility().getModes().setMaxModes(2); + // * Target player loses X life. + this.getSpellAbility().addEffect(new LoseLifeTargetEffect(xValue)); + this.getSpellAbility().addTarget(new TargetPlayer()); + + // * Return target creature card with converted mana cost X or less from your graveyard to the battlefield. + Mode mode = new Mode(); + mode.getEffects().add(new ReturnFromGraveyardToBattlefieldTargetEffect()); + mode.getTargets().add(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard"))); + this.getSpellAbility().addMode(mode); + + // * Target creature gets -X/-X until end of turn. + mode = new Mode(); + mode.getEffects().add(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn)); + mode.getTargets().add(new TargetCreaturePermanent()); + this.getSpellAbility().addMode(mode); + + // * Up to X target creatures gain fear until end of turn. + mode = new Mode(); + Effect effect = new GainAbilityTargetEffect(FearAbility.getInstance(), Duration.EndOfTurn); + effect.setText("Up to X target creatures gain fear until end of turn"); + mode.getEffects().add(effect); + mode.getTargets().add(new TargetCreaturePermanent(0,1)); + this.getSpellAbility().addMode(mode); + } + + @Override + public void adjustTargets(Ability ability, Game game) { + for (UUID modeId :ability.getModes().getSelectedModes()) { + Mode mode = ability.getModes().get(modeId); + for (Effect effect :mode.getEffects()) { + if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) { + mode.getTargets().clear(); + int xValue = ability.getManaCostsToPay().getX(); + FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard"); + filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue + 1)); + mode.getTargets().add(new TargetCardInYourGraveyard(filter)); + } + if (effect instanceof GainAbilityTargetEffect) { + mode.getTargets().clear(); + int xValue = ability.getManaCostsToPay().getX(); + FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures gain fear until end of turn"); + mode.getTargets().add(new TargetCreaturePermanent(0, xValue, filter, false)); + } + } + } + } + + public ProfaneCommand(final ProfaneCommand card) { + super(card); + } + + @Override + public ProfaneCommand copy() { + return new ProfaneCommand(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2014/SongOfTheDryads.java b/Mage.Sets/src/mage/sets/commander2014/SongOfTheDryads.java new file mode 100644 index 00000000000..01c8076504f --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/SongOfTheDryads.java @@ -0,0 +1,77 @@ +/* + * 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.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continious.BecomesBasicLandEnchantedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class SongOfTheDryads extends CardImpl { + + public SongOfTheDryads(UUID ownerId) { + super(ownerId, 47, "Song of the Dryads", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); + this.expansionSetCode = "C14"; + this.subtype.add("Aura"); + + this.color.setGreen(true); + + // Enchant permanent + TargetPermanent auraTarget = new TargetPermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted permanent is a colorless Forest land. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandEnchantedEffect("Forest"))); + + } + + public SongOfTheDryads(final SongOfTheDryads card) { + super(card); + } + + @Override + public SongOfTheDryads copy() { + return new SongOfTheDryads(this); + } +} diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java b/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java new file mode 100644 index 00000000000..ed0d4b7915a --- /dev/null +++ b/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java @@ -0,0 +1,161 @@ +/* + * 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.judgment; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.ProtectionAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.PhaseStep; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.turn.Step; + +/** + * + * @author LevelX2 + */ +public class PhantomCentaur extends CardImpl { + + private static final FilterCard filter = new FilterCard("Black"); + + static { + filter.add(new ColorPredicate(ObjectColor.BLACK)); + } + + public PhantomCentaur(UUID ownerId) { + super(ownerId, 127, "Phantom Centaur", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); + this.expansionSetCode = "JUD"; + this.subtype.add("Centaur"); + this.subtype.add("Spirit"); + + this.color.setGreen(true); + this.power = new MageInt(2); + this.toughness = new MageInt(0); + + // Protection from black + this.addAbility(new ProtectionAbility(filter)); + + // Phantom Centaur enters the battlefield with three +1/+1 counters on it. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)), "with three +1/+1 counters on it")); + + // If damage would be dealt to Phantom Centaur, prevent that damage. Remove a +1/+1 counter from Phantom Centaur. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomCentaurPreventionEffect())); + } + + public PhantomCentaur(final PhantomCentaur card) { + super(card); + } + + @Override + public PhantomCentaur copy() { + return new PhantomCentaur(this); + } +} + +class PhantomCentaurPreventionEffect extends PreventionEffectImpl { + + // remember turn and phase step to check if counter in this step was already removed + private int turn = 0; + private Step combatPhaseStep = null; + + public PhantomCentaurPreventionEffect() { + super(Duration.WhileOnBattlefield); + staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; + } + + public PhantomCentaurPreventionEffect(final PhantomCentaurPreventionEffect effect) { + super(effect); + this.turn = effect.turn; + this.combatPhaseStep = effect.combatPhaseStep; + } + + @Override + public PhantomCentaurPreventionEffect copy() { + return new PhantomCentaurPreventionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + preventDamageAction(event, source, game); + + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + boolean removeCounter = true; + // check if in the same combat damage step already a counter was removed + if (game.getTurn().getPhase().getStep().getType().equals(PhaseStep.COMBAT_DAMAGE)) { + if (game.getTurnNum() == turn + && game.getTurn().getStep().equals(combatPhaseStep)) { + removeCounter = false; + } else { + turn = game.getTurnNum(); + combatPhaseStep = game.getTurn().getStep(); + } + } + + if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); + permanent.removeCounters(CounterType.P1P1.createInstance(), game); + sb.append("Removed a +1/+1 counter "); + game.informPlayers(sb.toString()); + } + } + + return false; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (super.applies(event, source, game)) { + if (event.getTargetId().equals(source.getSourceId())) { + return true; + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/lorwyn/ProfaneCommand.java b/Mage.Sets/src/mage/sets/lorwyn/ProfaneCommand.java new file mode 100644 index 00000000000..129c0c58256 --- /dev/null +++ b/Mage.Sets/src/mage/sets/lorwyn/ProfaneCommand.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.lorwyn; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class ProfaneCommand extends mage.sets.commander2014.ProfaneCommand { + + public ProfaneCommand(UUID ownerId) { + super(ownerId); + this.cardNumber = 135; + this.expansionSetCode = "LRW"; + } + + public ProfaneCommand(final ProfaneCommand card) { + super(card); + } + + @Override + public ProfaneCommand copy() { + return new ProfaneCommand(this); + } +} diff --git a/Mage.Sets/src/mage/sets/planechase/ProfaneCommand.java b/Mage.Sets/src/mage/sets/planechase/ProfaneCommand.java new file mode 100644 index 00000000000..5d4621fe1e4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/planechase/ProfaneCommand.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.planechase; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class ProfaneCommand extends mage.sets.commander2014.ProfaneCommand { + + public ProfaneCommand(UUID ownerId) { + super(ownerId); + this.cardNumber = 38; + this.expansionSetCode = "HOP"; + } + + public ProfaneCommand(final ProfaneCommand card) { + super(card); + } + + @Override + public ProfaneCommand copy() { + return new ProfaneCommand(this); + } +} diff --git a/Mage.Sets/src/mage/sets/urzassaga/StrokeOfGenius.java b/Mage.Sets/src/mage/sets/urzassaga/StrokeOfGenius.java index 97ccc7be094..6612b22ee20 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/StrokeOfGenius.java +++ b/Mage.Sets/src/mage/sets/urzassaga/StrokeOfGenius.java @@ -43,9 +43,11 @@ import mage.target.TargetPlayer; public class StrokeOfGenius extends CardImpl { public StrokeOfGenius (UUID ownerId) { - super(ownerId, 100, "Stroke Of Genius", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{X}{2}{U}"); + super(ownerId, 100, "Stroke of Genius", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{X}{2}{U}"); this.expansionSetCode = "USG"; - this.color.setBlue(true); + this.color.setBlue(true); + + // Target player draws X cards. this.getSpellAbility().addEffect(new DrawCardTargetEffect(new ManacostVariableValue())); this.getSpellAbility().addTarget(new TargetPlayer()); } diff --git a/Mage/src/mage/abilities/Modes.java b/Mage/src/mage/abilities/Modes.java index d91b05ae620..c1711cc455b 100644 --- a/Mage/src/mage/abilities/Modes.java +++ b/Mage/src/mage/abilities/Modes.java @@ -47,7 +47,7 @@ import mage.target.common.TargetOpponent; public class Modes extends LinkedHashMap { private UUID modeId; - private final Set selectedModes = new LinkedHashSet(); + private final Set selectedModes = new LinkedHashSet<>(); private int minModes; private int maxModes; private TargetController modeChooser; diff --git a/Mage/src/mage/abilities/common/CanBeYourCommanderAbility.java b/Mage/src/mage/abilities/common/CanBeYourCommanderAbility.java new file mode 100644 index 00000000000..e0b7c73847b --- /dev/null +++ b/Mage/src/mage/abilities/common/CanBeYourCommanderAbility.java @@ -0,0 +1,61 @@ +/* + * 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.common; + +import java.io.ObjectStreamException; +import mage.abilities.MageSingleton; +import mage.abilities.StaticAbility; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ + +public class CanBeYourCommanderAbility extends StaticAbility implements MageSingleton { + + private static final CanBeYourCommanderAbility fINSTANCE = new CanBeYourCommanderAbility(); + + private Object readResolve() throws ObjectStreamException { + return fINSTANCE; + } + + public static CanBeYourCommanderAbility getInstance() { + return fINSTANCE; + } + + private CanBeYourCommanderAbility() { + super(Zone.ALL, new EmptyEffect("{this} can be your commander")); + } + + @Override + public CanBeYourCommanderAbility copy() { + return fINSTANCE; + } + +} diff --git a/Mage/src/mage/abilities/effects/common/continious/BecomesBasicLandEnchantedEffect.java b/Mage/src/mage/abilities/effects/common/continious/BecomesBasicLandEnchantedEffect.java index 6df2b2a4399..9d726f1807d 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BecomesBasicLandEnchantedEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BecomesBasicLandEnchantedEffect.java @@ -30,6 +30,7 @@ package mage.abilities.effects.common.continious; import java.util.ArrayList; import java.util.Arrays; +import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.mana.BlackManaAbility; @@ -83,19 +84,32 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl { Permanent land = game.getPermanent(enchantment.getAttachedTo()); if (land != null) { switch (layer) { + case ColorChangingEffects_5: + land.getColor().setWhite(false); + land.getColor().setGreen(false); + land.getColor().setBlack(false); + land.getColor().setBlue(false); + land.getColor().setRed(false); + break; case AbilityAddingRemovingEffects_6: land.removeAllAbilities(source.getSourceId(), game); for (String landType : landTypes) { - if (landType.equals("Swamp")) { - land.addAbility(new BlackManaAbility(), source.getSourceId(), game); - } else if (landType.equals("Mountain")) { - land.addAbility(new RedManaAbility(), source.getSourceId(), game); - } else if (landType.equals("Forest")) { - land.addAbility(new GreenManaAbility(), source.getSourceId(), game); - } else if (landType.equals("Island")) { - land.addAbility(new BlueManaAbility(), source.getSourceId(), game); - } else if (landType.equals("Plains")) { - land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); + switch (landType) { + case "Swamp": + land.addAbility(new BlackManaAbility(), source.getSourceId(), game); + break; + case "Mountain": + land.addAbility(new RedManaAbility(), source.getSourceId(), game); + break; + case "Forest": + land.addAbility(new GreenManaAbility(), source.getSourceId(), game); + break; + case "Island": + land.addAbility(new BlueManaAbility(), source.getSourceId(), game); + break; + case "Plains": + land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); + break; } } break;