From 40d6c904386f3b6e3c3e11530811fc83511f718c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 4 Jul 2014 01:11:17 +0200 Subject: [PATCH] * M15 - Added 3 white cards and Leyline of Singularity. --- .../sets/guildpact/LeylineOfSingularity.java | 133 ++++++++++++++++++ .../mage/sets/magic2015/HeliodsPilgrim.java | 78 ++++++++++ .../mage/sets/magic2015/MeditationPuzzle.java | 63 +++++++++ .../sets/magic2015/SeraphOfTheMasses.java | 79 +++++++++++ .../abilities/keyword/ConvokeAbility.java | 5 +- .../target/targetpointer/FixedTarget.java | 6 +- 6 files changed, 359 insertions(+), 5 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/guildpact/LeylineOfSingularity.java create mode 100644 Mage.Sets/src/mage/sets/magic2015/HeliodsPilgrim.java create mode 100644 Mage.Sets/src/mage/sets/magic2015/MeditationPuzzle.java create mode 100644 Mage.Sets/src/mage/sets/magic2015/SeraphOfTheMasses.java diff --git a/Mage.Sets/src/mage/sets/guildpact/LeylineOfSingularity.java b/Mage.Sets/src/mage/sets/guildpact/LeylineOfSingularity.java new file mode 100644 index 0000000000..e91430e15f --- /dev/null +++ b/Mage.Sets/src/mage/sets/guildpact/LeylineOfSingularity.java @@ -0,0 +1,133 @@ +/* + * 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.guildpact; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.keyword.LeylineAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class LeylineOfSingularity extends CardImpl { + + public LeylineOfSingularity(UUID ownerId) { + super(ownerId, 29, "Leyline of Singularity", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}"); + this.expansionSetCode = "GPT"; + + this.color.setBlue(true); + + // If Leyline of Singularity is in your opening hand, you may begin the game with it on the battlefield. + this.addAbility(LeylineAbility.getInstance()); + // All nonland permanents are legendary. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetSupertypeAllEffect(Duration.WhileOnBattlefield, new FilterControlledPermanent()))); + + } + + public LeylineOfSingularity(final LeylineOfSingularity card) { + super(card); + } + + @Override + public LeylineOfSingularity copy() { + return new LeylineOfSingularity(this); + } +} + + +class SetSupertypeAllEffect extends ContinuousEffectImpl { + + private final FilterPermanent filter; + + public SetSupertypeAllEffect(Duration duration, FilterPermanent filter) { + super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment); + this.filter = filter; + } + + public SetSupertypeAllEffect(final SetSupertypeAllEffect effect) { + super(effect); + this.filter = effect.filter; + } + + @Override + public SetSupertypeAllEffect copy() { + return new SetSupertypeAllEffect(this); + } + + @Override + public void init(Ability source, Game game) { + super.init(source, game); + if (affectedObjectsSet) { + for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + objects.add(perm.getId()); + } + } + } + + @Override + public boolean apply(Game game, Ability source) { + if (affectedObjectsSet) { + for (UUID permanentId :objects) { + Permanent permanent = game.getPermanent(permanentId); + if (permanent != null) { + if (!permanent.getSupertype().contains("Legendary")) { + permanent.getSupertype().add("Legendary"); + } + } + } + } else { + for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + if (!permanent.getSupertype().contains("Legendary")) { + permanent.getSupertype().add("Legendary"); + } + } + } + return true; + } + + @Override + public String getText(Mode mode) { + return "All nonland permanents are legendary"; + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/HeliodsPilgrim.java b/Mage.Sets/src/mage/sets/magic2015/HeliodsPilgrim.java new file mode 100644 index 0000000000..32773a4ae4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/HeliodsPilgrim.java @@ -0,0 +1,78 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magic2015; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author LevelX2 + */ +public class HeliodsPilgrim extends CardImpl { + + private static final FilterCard filter = new FilterCard("Aura card"); + + static { + filter.add(new CardTypePredicate(CardType.ENCHANTMENT)); + filter.add(new SubtypePredicate("Aura")); + } + + public HeliodsPilgrim(UUID ownerId) { + super(ownerId, 9925, "Heliod's Pilgrim", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{W}"); + this.expansionSetCode = "M15"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + + this.color.setWhite(true); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // When Heliod's Pilgrim enters the battlefield, you may search your library for an Aura card, reveal it, put it into your hand, then shuffle your library. + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, false), true)); + + } + + public HeliodsPilgrim(final HeliodsPilgrim card) { + super(card); + } + + @Override + public HeliodsPilgrim copy() { + return new HeliodsPilgrim(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/MeditationPuzzle.java b/Mage.Sets/src/mage/sets/magic2015/MeditationPuzzle.java new file mode 100644 index 0000000000..f7f0e1c931 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/MeditationPuzzle.java @@ -0,0 +1,63 @@ +/* + * 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.magic2015; + +import java.util.UUID; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.keyword.ConvokeAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class MeditationPuzzle extends CardImpl { + + public MeditationPuzzle(UUID ownerId) { + super(ownerId, 19, "Meditation Puzzle", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{W}{W}"); + this.expansionSetCode = "M15"; + + this.color.setWhite(true); + + // Convoke + this.addAbility(new ConvokeAbility()); + // You gain 8 life. + this.getSpellAbility().addEffect(new GainLifeEffect(8)); + } + + public MeditationPuzzle(final MeditationPuzzle card) { + super(card); + } + + @Override + public MeditationPuzzle copy() { + return new MeditationPuzzle(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/SeraphOfTheMasses.java b/Mage.Sets/src/mage/sets/magic2015/SeraphOfTheMasses.java new file mode 100644 index 0000000000..41d84fcebe --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/SeraphOfTheMasses.java @@ -0,0 +1,79 @@ +/* + * 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.magic2015; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; +import mage.abilities.keyword.ConvokeAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class SeraphOfTheMasses extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creatures you control"); + + public SeraphOfTheMasses(UUID ownerId) { + super(ownerId, 9927, "Seraph of the Masses", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{W}{W}"); + this.expansionSetCode = "M15"; + this.subtype.add("Angel"); + + this.color.setWhite(true); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Convoke + this.addAbility(new ConvokeAbility()); + // Flying + this.addAbility(FlyingAbility.getInstance()); + // Seraph of the Masses's power and toughness are each equal to the number of creatures you control. + this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filter), Duration.EndOfGame))); + + + } + + public SeraphOfTheMasses(final SeraphOfTheMasses card) { + super(card); + } + + @Override + public SeraphOfTheMasses copy() { + return new SeraphOfTheMasses(this); + } +} diff --git a/Mage/src/mage/abilities/keyword/ConvokeAbility.java b/Mage/src/mage/abilities/keyword/ConvokeAbility.java index 7db7d0654b..564a5b1cd0 100644 --- a/Mage/src/mage/abilities/keyword/ConvokeAbility.java +++ b/Mage/src/mage/abilities/keyword/ConvokeAbility.java @@ -30,8 +30,6 @@ package mage.abilities.keyword; import java.util.UUID; import mage.ObjectColor; -import mage.constants.Outcome; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.common.SimpleStaticAbility; @@ -40,6 +38,8 @@ import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCostsImpl; import mage.choices.Choice; import mage.choices.ChoiceImpl; +import mage.constants.Outcome; +import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.permanent.TappedPredicate; @@ -86,6 +86,7 @@ import mage.util.CardUtil; public class ConvokeAbility extends SimpleStaticAbility implements AdjustingSourceCosts { private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); + static { filter.add(Predicates.not(new TappedPredicate())); } diff --git a/Mage/src/mage/target/targetpointer/FixedTarget.java b/Mage/src/mage/target/targetpointer/FixedTarget.java index 371d70595c..e34bd9a7e6 100644 --- a/Mage/src/mage/target/targetpointer/FixedTarget.java +++ b/Mage/src/mage/target/targetpointer/FixedTarget.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.UUID; public class FixedTarget implements TargetPointer { - private UUID target; + private final UUID target; private int zoneChangeCounter; public FixedTarget(UUID target) { @@ -35,11 +35,11 @@ public class FixedTarget implements TargetPointer { if (this.zoneChangeCounter > 0) { // will be zero if not defined in init Card card = game.getCard(target); if (card != null && card.getZoneChangeCounter() != this.zoneChangeCounter) { - return new ArrayList(); // return empty + return new ArrayList<>(); // return empty } } - ArrayList list = new ArrayList(1); + ArrayList list = new ArrayList<>(1); list.add(target); return list; }