From 34d604fe4b8485b7bb8dbc1732d99bb937d2881e Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 9 Sep 2015 12:14:54 +0300 Subject: [PATCH 1/7] Rename BecomesChosenNonWallCreatureTypeTargetEffect -> BecomesChosenCreatureTypeTargetEffect and make the non-Wall part a parameter. Clean up the cards that use it. Fix Standardize, which was using wrong effect. --- .../sets/apocalypse/UnnaturalSelection.java | 18 +--- .../src/mage/sets/onslaught/Imagecrafter.java | 20 +---- .../mage/sets/onslaught/MistformMutant.java | 18 +--- .../src/mage/sets/onslaught/Standardize.java | 42 +++++---- ...BecomesChosenCreatureTypeTargetEffect.java | 85 +++++++++++++++++++ ...ChosenNonWallCreatureTypeTargetEffect.java | 66 -------------- 6 files changed, 115 insertions(+), 134 deletions(-) create mode 100644 Mage/src/mage/abilities/effects/common/continuous/BecomesChosenCreatureTypeTargetEffect.java delete mode 100644 Mage/src/mage/abilities/effects/common/continuous/BecomesChosenNonWallCreatureTypeTargetEffect.java diff --git a/Mage.Sets/src/mage/sets/apocalypse/UnnaturalSelection.java b/Mage.Sets/src/mage/sets/apocalypse/UnnaturalSelection.java index 57e913f07b4..0106d3ca2fc 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/UnnaturalSelection.java +++ b/Mage.Sets/src/mage/sets/apocalypse/UnnaturalSelection.java @@ -33,25 +33,13 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.ContinuousEffect; -import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.continuous.BecomesChosenNonWallCreatureTypeTargetEffect; -import mage.abilities.effects.common.continuous.BecomesSubtypeTargetEffect; +import mage.abilities.effects.common.continuous.BecomesChosenCreatureTypeTargetEffect; import mage.cards.CardImpl; -import mage.cards.repository.CardRepository; -import mage.choices.Choice; -import mage.choices.ChoiceImpl; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; import mage.target.common.TargetCreaturePermanent; -import mage.target.targetpointer.FixedTarget; /** * @@ -64,7 +52,7 @@ public class UnnaturalSelection extends CardImpl { this.expansionSetCode = "APC"; // {1}: Choose a creature type other than Wall. Target creature becomes that type until end of turn. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesChosenNonWallCreatureTypeTargetEffect(), new GenericManaCost(1)); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesChosenCreatureTypeTargetEffect(true), new GenericManaCost(1)); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } @@ -77,4 +65,4 @@ public class UnnaturalSelection extends CardImpl { public UnnaturalSelection copy() { return new UnnaturalSelection(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/onslaught/Imagecrafter.java b/Mage.Sets/src/mage/sets/onslaught/Imagecrafter.java index cb3db6bc1dd..543086215f0 100644 --- a/Mage.Sets/src/mage/sets/onslaught/Imagecrafter.java +++ b/Mage.Sets/src/mage/sets/onslaught/Imagecrafter.java @@ -34,25 +34,13 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.ContinuousEffect; -import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.continuous.BecomesChosenNonWallCreatureTypeTargetEffect; -import mage.abilities.effects.common.continuous.BecomesSubtypeTargetEffect; +import mage.abilities.effects.common.continuous.BecomesChosenCreatureTypeTargetEffect; import mage.cards.CardImpl; -import mage.cards.repository.CardRepository; -import mage.choices.Choice; -import mage.choices.ChoiceImpl; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; import mage.target.common.TargetCreaturePermanent; -import mage.target.targetpointer.FixedTarget; /** * @@ -69,7 +57,7 @@ public class Imagecrafter extends CardImpl { this.toughness = new MageInt(1); // {tap}: Choose a creature type other than Wall. Target creature becomes that type until end of turn. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesChosenNonWallCreatureTypeTargetEffect(), new TapSourceCost()); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesChosenCreatureTypeTargetEffect(true), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } @@ -82,5 +70,5 @@ public class Imagecrafter extends CardImpl { public Imagecrafter copy() { return new Imagecrafter(this); } - -} \ No newline at end of file + +} diff --git a/Mage.Sets/src/mage/sets/onslaught/MistformMutant.java b/Mage.Sets/src/mage/sets/onslaught/MistformMutant.java index 1573178e3aa..c9ce8287761 100644 --- a/Mage.Sets/src/mage/sets/onslaught/MistformMutant.java +++ b/Mage.Sets/src/mage/sets/onslaught/MistformMutant.java @@ -34,25 +34,13 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.ContinuousEffect; -import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.continuous.BecomesChosenNonWallCreatureTypeTargetEffect; -import mage.abilities.effects.common.continuous.BecomesSubtypeTargetEffect; +import mage.abilities.effects.common.continuous.BecomesChosenCreatureTypeTargetEffect; import mage.cards.CardImpl; -import mage.cards.repository.CardRepository; -import mage.choices.Choice; -import mage.choices.ChoiceImpl; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; import mage.target.common.TargetCreaturePermanent; -import mage.target.targetpointer.FixedTarget; /** * @@ -69,7 +57,7 @@ public class MistformMutant extends CardImpl { this.toughness = new MageInt(4); // {1}{U}: Choose a creature type other than Wall. Target creature becomes that type until end of turn. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesChosenNonWallCreatureTypeTargetEffect(), new ManaCostsImpl<>("{1}{U}")); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesChosenCreatureTypeTargetEffect(true), new ManaCostsImpl<>("{1}{U}")); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } @@ -82,4 +70,4 @@ public class MistformMutant extends CardImpl { public MistformMutant copy() { return new MistformMutant(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/onslaught/Standardize.java b/Mage.Sets/src/mage/sets/onslaught/Standardize.java index 760ae76aead..c2c6f8624d0 100644 --- a/Mage.Sets/src/mage/sets/onslaught/Standardize.java +++ b/Mage.Sets/src/mage/sets/onslaught/Standardize.java @@ -34,7 +34,6 @@ import mage.abilities.Ability; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.continuous.BecomesChosenNonWallCreatureTypeTargetEffect; import mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect; import mage.cards.CardImpl; import mage.cards.repository.CardRepository; @@ -59,8 +58,8 @@ public class Standardize extends CardImpl { this.expansionSetCode = "ONS"; // Choose a creature type other than Wall. Each creature becomes that type until end of turn. - - this.getSpellAbility().addEffect(new BecomesChosenNonWallCreatureTypeTargetEffect()); + + this.getSpellAbility().addEffect(new StandardizeEffect()); } public Standardize(final Standardize card) { @@ -77,19 +76,19 @@ public class Standardize extends CardImpl { class StandardizeEffect extends OneShotEffect { - public StandardizeEffect() { - super(Outcome.BoostCreature); - staticText = "choose a creature type other than wall, each creature's type becomes that type until end of turn"; - - } - - public StandardizeEffect(final StandardizeEffect effect) { - super(effect); - } + public StandardizeEffect() { + super(Outcome.BoostCreature); + staticText = "choose a creature type other than wall, each creature's type becomes that type until end of turn"; - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); + } + + public StandardizeEffect(final StandardizeEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); String chosenType = ""; if (player != null && permanent != null) { @@ -111,14 +110,13 @@ class StandardizeEffect extends OneShotEffect { game.addEffect(effect, source); return true; } - + } return false; - } - - @Override - public Effect copy() { - return new StandardizeEffect(this); - } + } + @Override + public Effect copy() { + return new StandardizeEffect(this); + } } diff --git a/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenCreatureTypeTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenCreatureTypeTargetEffect.java new file mode 100644 index 00000000000..67c07ee1c0e --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenCreatureTypeTargetEffect.java @@ -0,0 +1,85 @@ +package mage.abilities.effects.common.continuous; + +import java.util.Set; + +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.repository.CardRepository; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +public class BecomesChosenCreatureTypeTargetEffect extends OneShotEffect { + + private final boolean nonWall; + + public BecomesChosenCreatureTypeTargetEffect() { + this(false); + } + + public BecomesChosenCreatureTypeTargetEffect(boolean nonWall) { + super(Outcome.BoostCreature); + this.nonWall = nonWall; + if(nonWall) { + staticText = "choose a creature type other than wall, target creature's type becomes that type until end of turn"; + } + else { + staticText = "target creature becomes the creature type of your choice until end of turn"; + } + + } + + public BecomesChosenCreatureTypeTargetEffect(final BecomesChosenCreatureTypeTargetEffect effect) { + super(effect); + this.nonWall = effect.nonWall; + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Card card = game.getCard(source.getSourceId()); + String chosenType = ""; + if (player != null && card != null) { + Choice typeChoice = new ChoiceImpl(true); + String msg = "Choose a creature type"; + if(nonWall) { + msg += " other than Wall"; + } + typeChoice.setMessage(msg); + Set types = CardRepository.instance.getCreatureTypes(); + if(nonWall) { + types.remove("Wall"); + } + typeChoice.setChoices(types); + while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { + if (!player.canRespond()) { + return false; + } + } + game.informPlayers(card.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice()); + chosenType = typeChoice.getChoice(); + if (chosenType != null && !chosenType.isEmpty()) { + // ADD TYPE TO TARGET + ContinuousEffect effect = new BecomesSubtypeTargetEffect(Duration.EndOfTurn, chosenType); + effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source))); + game.addEffect(effect, source); + return true; + } + + } + return false; + } + + @Override + public Effect copy() { + return new BecomesChosenCreatureTypeTargetEffect(this); + } + +} diff --git a/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenNonWallCreatureTypeTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenNonWallCreatureTypeTargetEffect.java deleted file mode 100644 index 316ef45e413..00000000000 --- a/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenNonWallCreatureTypeTargetEffect.java +++ /dev/null @@ -1,66 +0,0 @@ -package mage.abilities.effects.common.continuous; - -import java.util.Set; - -import mage.abilities.Ability; -import mage.abilities.effects.ContinuousEffect; -import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; -import mage.cards.repository.CardRepository; -import mage.choices.Choice; -import mage.choices.ChoiceImpl; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.target.targetpointer.FixedTarget; - -public class BecomesChosenNonWallCreatureTypeTargetEffect extends OneShotEffect { - - public BecomesChosenNonWallCreatureTypeTargetEffect() { - super(Outcome.BoostCreature); - staticText = "choose a creature type other than wall, target creature's type becomes that type until end of turn"; - - } - - public BecomesChosenNonWallCreatureTypeTargetEffect(final BecomesChosenNonWallCreatureTypeTargetEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - Permanent permanent = game.getPermanent(source.getSourceId()); - String chosenType = ""; - if (player != null && permanent != null) { - Choice typeChoice = new ChoiceImpl(true); - typeChoice.setMessage("Choose creature type other than Wall"); - Set types = CardRepository.instance.getCreatureTypes(); - types.remove("Wall"); - typeChoice.setChoices(types); - while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!player.canRespond()) { - return false; - } - } - game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice()); - chosenType = typeChoice.getChoice(); - if (chosenType != null && !chosenType.isEmpty()) { - // ADD TYPE TO TARGET - ContinuousEffect effect = new BecomesSubtypeTargetEffect(Duration.EndOfTurn, chosenType); - effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source))); - game.addEffect(effect, source); - return true; - } - - } - return false; - } - - @Override - public Effect copy() { - return new BecomesChosenNonWallCreatureTypeTargetEffect(this); - } - -} From 45862acaee8e8f1907009e1f8a8901afbec77dee Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 9 Sep 2015 12:16:56 +0300 Subject: [PATCH 2/7] Implement the Charm cycle from Onslaught --- .../src/mage/sets/onslaught/FeverCharm.java | 83 +++++++++++++++++ .../src/mage/sets/onslaught/MiseryCharm.java | 86 ++++++++++++++++++ .../src/mage/sets/onslaught/PietyCharm.java | 89 ++++++++++++++++++ .../mage/sets/onslaught/TrickeryCharm.java | 74 +++++++++++++++ .../mage/sets/onslaught/VitalityCharm.java | 91 +++++++++++++++++++ .../permanent/AttachedToPredicate.java | 59 ++++++++++++ 6 files changed, 482 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/onslaught/FeverCharm.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/MiseryCharm.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/PietyCharm.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/TrickeryCharm.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/VitalityCharm.java create mode 100644 Mage/src/mage/filter/predicate/permanent/AttachedToPredicate.java diff --git a/Mage.Sets/src/mage/sets/onslaught/FeverCharm.java b/Mage.Sets/src/mage/sets/onslaught/FeverCharm.java new file mode 100644 index 00000000000..69737911466 --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/FeverCharm.java @@ -0,0 +1,83 @@ +/* + * 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.onslaught; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.HasteAbility; +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.mageobject.SubtypePredicate; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class FeverCharm extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Wizard creature"); + + static { + filter.add(new SubtypePredicate("Wizard")); + } + + public FeverCharm(UUID ownerId) { + super(ownerId, 202, "Fever Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{R}"); + this.expansionSetCode = "ONS"; + + // Choose one - Target creature gains haste until end of turn + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + // or target creature gets +2/+0 until end of turn + Mode mode = new Mode(); + mode.getEffects().add(new BoostTargetEffect(2, 0, Duration.EndOfTurn)); + mode.getTargets().add(new TargetCreaturePermanent()); + this.getSpellAbility().addMode(mode); + // or Fever Charm deals 3 damage to target Wizard creature. + mode = new Mode(); + mode.getEffects().add(new DamageTargetEffect(3)); + mode.getTargets().add(new TargetCreaturePermanent(filter)); + this.getSpellAbility().addMode(mode); + } + + public FeverCharm(final FeverCharm card) { + super(card); + } + + @Override + public FeverCharm copy() { + return new FeverCharm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/MiseryCharm.java b/Mage.Sets/src/mage/sets/onslaught/MiseryCharm.java new file mode 100644 index 00000000000..d3cbf5e1a78 --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/MiseryCharm.java @@ -0,0 +1,86 @@ +/* + * 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.onslaught; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.TargetPermanent; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author LoneFox + */ +public class MiseryCharm extends CardImpl { + + private static final FilterPermanent filter1 = new FilterPermanent("Cleric"); + private static final FilterCard filter2 = new FilterCard("Cleric card from your graveyard"); + + static { + filter1.add(new SubtypePredicate("Cleric")); + filter2.add(new SubtypePredicate("Cleric")); + } + + public MiseryCharm(UUID ownerId) { + super(ownerId, 158, "Misery Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}"); + this.expansionSetCode = "ONS"; + + // Choose one - Destroy target Cleric + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filter1)); + // or return target Cleric card from your graveyard to your hand + Mode mode = new Mode(); + mode.getEffects().add(new ReturnToHandTargetEffect()); + mode.getTargets().add(new TargetCardInYourGraveyard(filter2)); + this.getSpellAbility().addMode(mode); + // or target player loses 2 life. + mode = new Mode(); + mode.getEffects().add(new LoseLifeTargetEffect(2)); + mode.getTargets().add(new TargetPlayer()); + this.getSpellAbility().addMode(mode); + } + + public MiseryCharm(final MiseryCharm card) { + super(card); + } + + @Override + public MiseryCharm copy() { + return new MiseryCharm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/PietyCharm.java b/Mage.Sets/src/mage/sets/onslaught/PietyCharm.java new file mode 100644 index 00000000000..6a0ab78137b --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/PietyCharm.java @@ -0,0 +1,89 @@ +/* + * 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.onslaught; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityAllEffect; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AttachedToPredicate; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class PietyCharm extends CardImpl { + + private static final FilterPermanent filter1 = new FilterPermanent("Aura attached to a creature"); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("Soldier creature"); + + static { + filter1.add(new SubtypePredicate("Aura")); + filter1.add(new AttachedToPredicate(new FilterCreaturePermanent())); + filter2.add(new SubtypePredicate("Soldier")); + } + + public PietyCharm(UUID ownerId) { + super(ownerId, 49, "Piety Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{W}"); + this.expansionSetCode = "ONS"; + + // Choose one - Destroy target Aura attached to a creature + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filter1)); + // or target Soldier creature gets +2/+2 until end of turn + Mode mode = new Mode(); + mode.getEffects().add(new BoostTargetEffect(2, 2, Duration.EndOfTurn)); + mode.getTargets().add(new TargetCreaturePermanent(filter2)); + this.getSpellAbility().addMode(mode); + // or creatures you control gain vigilance until end of turn. + mode = new Mode(); + mode.getEffects().add(new GainAbilityAllEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn, new FilterControlledCreaturePermanent("creatures you control"))); + this.getSpellAbility().addMode(mode); + } + + public PietyCharm(final PietyCharm card) { + super(card); + } + + @Override + public PietyCharm copy() { + return new PietyCharm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/TrickeryCharm.java b/Mage.Sets/src/mage/sets/onslaught/TrickeryCharm.java new file mode 100644 index 00000000000..5e2251ae6f1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/TrickeryCharm.java @@ -0,0 +1,74 @@ +/* + * 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.onslaught; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.common.LookLibraryControllerEffect; +import mage.abilities.effects.common.continuous.BecomesChosenCreatureTypeTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class TrickeryCharm extends CardImpl { + + public TrickeryCharm(UUID ownerId) { + super(ownerId, 119, "Trickery Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}"); + this.expansionSetCode = "ONS"; + + // Choose one - Target creature gains flying until end of turn + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + // or target creature becomes the creature type of your choice until end of turn + Mode mode = new Mode(); + mode.getEffects().add(new BecomesChosenCreatureTypeTargetEffect()); + mode.getTargets().add(new TargetCreaturePermanent()); + this.getSpellAbility().addMode(mode); + // or look at the top four cards of your library, then put them back in any order. + mode = new Mode(); + mode.getEffects().add(new LookLibraryControllerEffect(4)); + this.getSpellAbility().addMode(mode); + } + + public TrickeryCharm(final TrickeryCharm card) { + super(card); + } + + @Override + public TrickeryCharm copy() { + return new TrickeryCharm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/VitalityCharm.java b/Mage.Sets/src/mage/sets/onslaught/VitalityCharm.java new file mode 100644 index 00000000000..eee200ea12c --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/VitalityCharm.java @@ -0,0 +1,91 @@ +/* + * 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.onslaught; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.RegenerateTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.permanent.token.InsectToken; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class VitalityCharm extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("Beast"); + + static { + filter.add(new SubtypePredicate("Beast")); + } + + public VitalityCharm(UUID ownerId) { + super(ownerId, 296, "Vitality Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{G}"); + this.expansionSetCode = "ONS"; + + // Choose one - Put a 1/1 green Insect creature token onto the battlefield + this.getSpellAbility().addEffect(new CreateTokenEffect(new InsectToken())); + // or target creature gets +1/+1 and gains trample until end of turn + Mode mode = new Mode(); + Effect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn); + effect.setText("target creature gets +1/+1"); + mode.getEffects().add(effect); + effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn); + effect.setText("and gains trample until end of turn"); + mode.getEffects().add(effect); + mode.getTargets().add(new TargetCreaturePermanent()); + this.getSpellAbility().addMode(mode); + // or regenerate target Beast. + mode = new Mode(); + mode.getEffects().add(new RegenerateTargetEffect()); + mode.getTargets().add(new TargetPermanent(filter)); + this.getSpellAbility().addMode(mode); + } + + public VitalityCharm(final VitalityCharm card) { + super(card); + } + + @Override + public VitalityCharm copy() { + return new VitalityCharm(this); + } +} diff --git a/Mage/src/mage/filter/predicate/permanent/AttachedToPredicate.java b/Mage/src/mage/filter/predicate/permanent/AttachedToPredicate.java new file mode 100644 index 00000000000..7d155ffa14e --- /dev/null +++ b/Mage/src/mage/filter/predicate/permanent/AttachedToPredicate.java @@ -0,0 +1,59 @@ +/* + * 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.filter.predicate.permanent; + +import java.util.UUID; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LoneFox + */ +public class AttachedToPredicate implements Predicate { + + private FilterPermanent filter; + + public AttachedToPredicate(FilterPermanent filter) { + this.filter = filter; + } + + @Override + public boolean apply(Permanent input, Game game) { + UUID attachedTo = input.getAttachedTo(); + return attachedTo != null && filter.match(game.getPermanent(attachedTo), game); + } + + @Override + public String toString() { + return "attached to " + filter.getMessage(); + } + +} From 6125b85be3782576b237a3131443ec722a407106 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 9 Sep 2015 13:38:21 +0300 Subject: [PATCH 3/7] Implement more Charms from Mirage and Visions --- .../src/mage/sets/mirage/ChaosCharm.java | 84 +++++++++++++++++ .../src/mage/sets/mirage/IvoryCharm.java | 74 +++++++++++++++ .../src/mage/sets/mirage/SeedlingCharm.java | 92 +++++++++++++++++++ .../src/mage/sets/visions/HearthCharm.java | 87 ++++++++++++++++++ .../src/mage/sets/visions/HopeCharm.java | 85 +++++++++++++++++ 5 files changed, 422 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/mirage/ChaosCharm.java create mode 100644 Mage.Sets/src/mage/sets/mirage/IvoryCharm.java create mode 100644 Mage.Sets/src/mage/sets/mirage/SeedlingCharm.java create mode 100644 Mage.Sets/src/mage/sets/visions/HearthCharm.java create mode 100644 Mage.Sets/src/mage/sets/visions/HopeCharm.java diff --git a/Mage.Sets/src/mage/sets/mirage/ChaosCharm.java b/Mage.Sets/src/mage/sets/mirage/ChaosCharm.java new file mode 100644 index 00000000000..5f99b6cd5f6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/ChaosCharm.java @@ -0,0 +1,84 @@ +/* + * 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.mirage; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class ChaosCharm extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("Wall"); + + static { + filter.add(new SubtypePredicate("Wall")); + } + + public ChaosCharm(UUID ownerId) { + super(ownerId, 163, "Chaos Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{R}"); + this.expansionSetCode = "MIR"; + + // Choose one - Destroy target Wall + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + // or Chaos Charm deals 1 damage to target creature + Mode mode = new Mode(); + mode.getEffects().add(new DamageTargetEffect(1)); + mode.getTargets().add(new TargetCreaturePermanent()); + this.getSpellAbility().addMode(mode); + // or target creature gains haste until end of turn. + mode = new Mode(); + mode.getEffects().add(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn)); + mode.getTargets().add(new TargetCreaturePermanent()); + this.getSpellAbility().addMode(mode); + } + + public ChaosCharm(final ChaosCharm card) { + super(card); + } + + @Override + public ChaosCharm copy() { + return new ChaosCharm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirage/IvoryCharm.java b/Mage.Sets/src/mage/sets/mirage/IvoryCharm.java new file mode 100644 index 00000000000..50d7e9be957 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/IvoryCharm.java @@ -0,0 +1,74 @@ +/* + * 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.mirage; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.common.PreventDamageToTargetEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.continuous.BoostAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class IvoryCharm extends CardImpl { + + public IvoryCharm(UUID ownerId) { + super(ownerId, 227, "Ivory Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{W}"); + this.expansionSetCode = "MIR"; + + // Choose one - All creatures get -2/-0 until end of turn + this.getSpellAbility().addEffect(new BoostAllEffect(-2, 0, Duration.EndOfTurn)); + // or tap target creature + Mode mode = new Mode(); + mode.getEffects().add(new TapTargetEffect()); + mode.getTargets().add(new TargetCreaturePermanent()); + this.getSpellAbility().addMode(mode); + // or prevent the next 1 damage that would be dealt to target creature or player this turn. + mode = new Mode(); + mode.getEffects().add(new PreventDamageToTargetEffect(Duration.EndOfTurn, 1)); + mode.getTargets().add(new TargetCreatureOrPlayer()); + this.getSpellAbility().addMode(mode); + } + + public IvoryCharm(final IvoryCharm card) { + super(card); + } + + @Override + public IvoryCharm copy() { + return new IvoryCharm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirage/SeedlingCharm.java b/Mage.Sets/src/mage/sets/mirage/SeedlingCharm.java new file mode 100644 index 00000000000..8b22af98f7f --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/SeedlingCharm.java @@ -0,0 +1,92 @@ +/* + * 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.mirage; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Mode; +import mage.abilities.effects.common.RegenerateTargetEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AttachedToPredicate; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class SeedlingCharm extends CardImpl { + + private static final FilterPermanent filter1 = new FilterPermanent("Aura attached to a creature"); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("green creature"); + + static { + filter1.add(new SubtypePredicate("Aura")); + filter1.add(new AttachedToPredicate(new FilterCreaturePermanent())); + filter2.add(new ColorPredicate(ObjectColor.GREEN)); + } + + public SeedlingCharm(UUID ownerId) { + super(ownerId, 138, "Seedling Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{G}"); + this.expansionSetCode = "MIR"; + + // Choose one - Return target Aura attached to a creature to its owner's hand + this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filter1)); + // or regenerate target green creature + Mode mode = new Mode(); + mode.getEffects().add(new RegenerateTargetEffect()); + mode.getTargets().add(new TargetPermanent(filter2)); + this.getSpellAbility().addMode(mode); + // or target creature gains trample until end of turn. + mode = new Mode(); + mode.getEffects().add(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn)); + mode.getTargets().add(new TargetCreaturePermanent()); + this.getSpellAbility().addMode(mode); + } + + public SeedlingCharm(final SeedlingCharm card) { + super(card); + } + + @Override + public SeedlingCharm copy() { + return new SeedlingCharm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/visions/HearthCharm.java b/Mage.Sets/src/mage/sets/visions/HearthCharm.java new file mode 100644 index 00000000000..43443a8296d --- /dev/null +++ b/Mage.Sets/src/mage/sets/visions/HearthCharm.java @@ -0,0 +1,87 @@ +/* + * 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.visions; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect; +import mage.abilities.effects.common.continuous.BoostAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.Filter; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class HearthCharm extends CardImpl { + + private static final FilterCreaturePermanent filter1 = new FilterCreaturePermanent("artifact creature"); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("attacking creatures"); + private static final FilterCreaturePermanent filter3 = new FilterCreaturePermanent("creature with power 2 or less"); + static { + filter1.add(new CardTypePredicate(CardType.ARTIFACT)); + filter2.add(new AttackingPredicate()); + filter3.add(new PowerPredicate(Filter.ComparisonType.LessThan, 3)); + } + + public HearthCharm(UUID ownerId) { + super(ownerId, 82, "Hearth Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{R}"); + this.expansionSetCode = "VIS"; + + // Choose one - Destroy target artifact creature + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter1)); + // or attacking creatures get +1/+0 until end of turn + Mode mode = new Mode(); + mode.getEffects().add(new BoostAllEffect(1, 0, Duration.EndOfTurn, filter2, false)); + this.getSpellAbility().addMode(mode); + // or target creature with power 2 or less is unblockable this turn. + mode = new Mode(); + mode.getEffects().add(new CantBeBlockedTargetEffect()); + mode.getTargets().add(new TargetCreaturePermanent(filter3)); + this.getSpellAbility().addMode(mode); + } + + public HearthCharm(final HearthCharm card) { + super(card); + } + + @Override + public HearthCharm copy() { + return new HearthCharm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/visions/HopeCharm.java b/Mage.Sets/src/mage/sets/visions/HopeCharm.java new file mode 100644 index 00000000000..bddab599788 --- /dev/null +++ b/Mage.Sets/src/mage/sets/visions/HopeCharm.java @@ -0,0 +1,85 @@ +/* + * 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.visions; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.GainLifeTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.TargetPermanent; +import mage.target.TargetPlayer; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class HopeCharm extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("Aura"); + + static { + filter.add(new SubtypePredicate("Aura")); + } + + public HopeCharm(UUID ownerId) { + super(ownerId, 108, "Hope Charm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{W}"); + this.expansionSetCode = "VIS"; + + // Choose one - Target creature gains first strike until end of turn + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + // or target player gains 2 life + Mode mode = new Mode(); + mode.getEffects().add(new GainLifeTargetEffect(2)); + mode.getTargets().add(new TargetPlayer()); + this.getSpellAbility().addMode(mode); + // or destroy target Aura. + mode = new Mode(); + mode.getEffects().add(new DestroyTargetEffect()); + mode.getTargets().add(new TargetPermanent(filter)); + this.getSpellAbility().addMode(mode); + } + + public HopeCharm(final HopeCharm card) { + super(card); + } + + @Override + public HopeCharm copy() { + return new HopeCharm(this); + } +} From cb3408432115f3690136a19dd05164f1d521251a Mon Sep 17 00:00:00 2001 From: LoneFox Date: Fri, 11 Sep 2015 08:43:41 +0300 Subject: [PATCH 4/7] Add DestroyattachedEffect and use it for existing cards. Implement cards: Frozen Solid, Mortal Wound, and Parallax Dementia --- .../src/mage/sets/coldsnap/FrozenSolid.java | 77 ++++++++++++++++++ .../mage/sets/conflux/YokeOfTheDamned.java | 48 ++--------- .../mage/sets/nemesis/ParallaxDementia.java | 81 +++++++++++++++++++ .../sets/planechase2012/QuietDisrepair.java | 52 +++--------- .../src/mage/sets/scourge/FrozenSolid.java | 52 ++++++++++++ .../src/mage/sets/visions/MortalWound.java | 73 +++++++++++++++++ .../src/mage/sets/zendikar/MireBlight.java | 50 +----------- .../effects/common/DestroyAttachedEffect.java | 78 ++++++++++++++++++ 8 files changed, 380 insertions(+), 131 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/coldsnap/FrozenSolid.java create mode 100644 Mage.Sets/src/mage/sets/nemesis/ParallaxDementia.java create mode 100644 Mage.Sets/src/mage/sets/scourge/FrozenSolid.java create mode 100644 Mage.Sets/src/mage/sets/visions/MortalWound.java create mode 100644 Mage/src/mage/abilities/effects/common/DestroyAttachedEffect.java diff --git a/Mage.Sets/src/mage/sets/coldsnap/FrozenSolid.java b/Mage.Sets/src/mage/sets/coldsnap/FrozenSolid.java new file mode 100644 index 00000000000..750dcca0a40 --- /dev/null +++ b/Mage.Sets/src/mage/sets/coldsnap/FrozenSolid.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.coldsnap; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.DamageDealtToAttachedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DestroyAttachedEffect; +import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect; +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 LoneFox + */ +public class FrozenSolid extends CardImpl { + + public FrozenSolid(UUID ownerId) { + super(ownerId, 35, "Frozen Solid", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}{U}"); + this.expansionSetCode = "CSP"; + this.subtype.add("Aura"); + + // 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); + // Enchanted creature doesn't untap during its controller's untap step. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepEnchantedEffect())); + // When enchanted creature is dealt damage, destroy it. + this.addAbility(new DamageDealtToAttachedTriggeredAbility(new DestroyAttachedEffect("it"), false)); + } + + public FrozenSolid(final FrozenSolid card) { + super(card); + } + + @Override + public FrozenSolid copy() { + return new FrozenSolid(this); + } +} diff --git a/Mage.Sets/src/mage/sets/conflux/YokeOfTheDamned.java b/Mage.Sets/src/mage/sets/conflux/YokeOfTheDamned.java index 3858801fa31..b26829d9e4e 100644 --- a/Mage.Sets/src/mage/sets/conflux/YokeOfTheDamned.java +++ b/Mage.Sets/src/mage/sets/conflux/YokeOfTheDamned.java @@ -30,16 +30,14 @@ package mage.sets.conflux; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.DiesCreatureTriggeredAbility; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DestroyAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; import mage.filter.common.FilterCreaturePermanent; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -48,7 +46,7 @@ import mage.target.common.TargetCreaturePermanent; * @author jeffwadsworth */ public class YokeOfTheDamned extends CardImpl { - + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature"); public YokeOfTheDamned(UUID ownerId) { @@ -60,13 +58,13 @@ public class YokeOfTheDamned extends CardImpl { // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); - this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); - + // When a creature dies, destroy enchanted creature. - this.addAbility(new DiesCreatureTriggeredAbility(new DestroyEnchantedEffect(), false, filter)); - + this.addAbility(new DiesCreatureTriggeredAbility(new DestroyAttachedEffect("enchanted creature"), false, filter)); + } public YokeOfTheDamned(final YokeOfTheDamned card) { @@ -78,37 +76,3 @@ public class YokeOfTheDamned extends CardImpl { return new YokeOfTheDamned(this); } } - -class DestroyEnchantedEffect extends OneShotEffect { - - public DestroyEnchantedEffect() { - super(Outcome.Detriment); - staticText = "destroy enchanted creature"; - } - - public DestroyEnchantedEffect(final DestroyEnchantedEffect effect) { - super(effect); - } - - @Override - public DestroyEnchantedEffect copy() { - return new DestroyEnchantedEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent enchantment = game.getPermanent(source.getSourceId()); - if (enchantment != null && enchantment.getAttachedTo() != null) { - UUID uuid = getTargetPointer().getFirst(game, source); - Permanent creature = game.getPermanent(uuid); - if (creature == null) { - creature = game.getPermanent(enchantment.getAttachedTo()); - } - if (creature != null) { - return creature.destroy(source.getSourceId(), game, false); - } - } - return false; - } - -} diff --git a/Mage.Sets/src/mage/sets/nemesis/ParallaxDementia.java b/Mage.Sets/src/mage/sets/nemesis/ParallaxDementia.java new file mode 100644 index 00000000000..4eb75225eb2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/nemesis/ParallaxDementia.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.nemesis; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DestroyAttachedEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.FadingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class ParallaxDementia extends CardImpl { + + public ParallaxDementia(UUID ownerId) { + super(ownerId, 62, "Parallax Dementia", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}"); + this.expansionSetCode = "NMS"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + // Fading 1 + this.addAbility(new FadingAbility(1, this)); + // Enchanted creature gets +3/+2. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 2, Duration.WhileOnBattlefield))); + // When Parallax Dementia leaves the battlefield, destroy enchanted creature. That creature can't be regenerated. + this.addAbility(new LeavesBattlefieldTriggeredAbility(new DestroyAttachedEffect("enchanted creature", true), false)); + } + + public ParallaxDementia(final ParallaxDementia card) { + super(card); + } + + @Override + public ParallaxDementia copy() { + return new ParallaxDementia(this); + } +} diff --git a/Mage.Sets/src/mage/sets/planechase2012/QuietDisrepair.java b/Mage.Sets/src/mage/sets/planechase2012/QuietDisrepair.java index fd4fde99256..9257307fd9c 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/QuietDisrepair.java +++ b/Mage.Sets/src/mage/sets/planechase2012/QuietDisrepair.java @@ -29,24 +29,22 @@ package mage.sets.planechase2012; import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DestroyAttachedEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; -import mage.abilities.Ability; -import mage.abilities.Mode; -import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.GainLifeEffect; -import mage.abilities.keyword.EnchantAbility; -import mage.cards.CardImpl; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; /** @@ -76,7 +74,7 @@ public class QuietDisrepair extends CardImpl { this.addAbility(ability); // At the beginning of your upkeep, choose one - Destroy enchanted permanent; or you gain 2 life. - ability = new BeginningOfUpkeepTriggeredAbility(new QuietDisrepairDestroyEffect(), TargetController.YOU, false); + ability = new BeginningOfUpkeepTriggeredAbility(new DestroyAttachedEffect("enchanted permanent"), TargetController.YOU, false); Mode mode = new Mode(); mode.getEffects().add(new GainLifeEffect(2)); ability.addMode(mode); @@ -92,35 +90,3 @@ public class QuietDisrepair extends CardImpl { return new QuietDisrepair(this); } } - -class QuietDisrepairDestroyEffect extends OneShotEffect { - - public QuietDisrepairDestroyEffect() { - super(Outcome.DestroyPermanent); - this.staticText = "Destroy enchanted permanent"; - } - - public QuietDisrepairDestroyEffect(final QuietDisrepairDestroyEffect effect) { - super(effect); - } - - @Override - public QuietDisrepairDestroyEffect copy() { - return new QuietDisrepairDestroyEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent enchantment = game.getPermanent(source.getSourceId()); - if (enchantment == null) { - enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); - } - if (enchantment != null) { - Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); - if (enchanted != null) { - return enchanted.destroy(source.getSourceId(), game, false); - } - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/scourge/FrozenSolid.java b/Mage.Sets/src/mage/sets/scourge/FrozenSolid.java new file mode 100644 index 00000000000..b90cf27b90b --- /dev/null +++ b/Mage.Sets/src/mage/sets/scourge/FrozenSolid.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.scourge; + +import java.util.UUID; + +/** + * + * @author LoneFox + */ +public class FrozenSolid extends mage.sets.coldsnap.FrozenSolid { + + public FrozenSolid(UUID ownerId) { + super(ownerId); + this.cardNumber = 36; + this.expansionSetCode = "SCG"; + } + + public FrozenSolid(final FrozenSolid card) { + super(card); + } + + @Override + public FrozenSolid copy() { + return new FrozenSolid(this); + } +} diff --git a/Mage.Sets/src/mage/sets/visions/MortalWound.java b/Mage.Sets/src/mage/sets/visions/MortalWound.java new file mode 100644 index 00000000000..93b030b87c5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/visions/MortalWound.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.visions; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.DamageDealtToAttachedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DestroyAttachedEffect; +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 LoneFox + */ +public class MortalWound extends CardImpl { + + public MortalWound(UUID ownerId) { + super(ownerId, 63, "Mortal Wound", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{G}"); + this.expansionSetCode = "VIS"; + this.subtype.add("Aura"); + + // 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 is dealt damage, destroy it. + this.addAbility(new DamageDealtToAttachedTriggeredAbility(new DestroyAttachedEffect("it"), false)); + } + + public MortalWound(final MortalWound card) { + super(card); + } + + @Override + public MortalWound copy() { + return new MortalWound(this); + } +} diff --git a/Mage.Sets/src/mage/sets/zendikar/MireBlight.java b/Mage.Sets/src/mage/sets/zendikar/MireBlight.java index 9a6b87ebc59..f40db77d1ec 100644 --- a/Mage.Sets/src/mage/sets/zendikar/MireBlight.java +++ b/Mage.Sets/src/mage/sets/zendikar/MireBlight.java @@ -29,22 +29,17 @@ package mage.sets.zendikar; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.DamageDealtToAttachedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.DestroyAttachedEffect; 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.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; -import mage.target.targetpointer.FixedTarget; /** * @@ -65,7 +60,7 @@ public class MireBlight extends CardImpl { Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // When enchanted creature is dealt damage, destroy it. - this.addAbility(new MireBlightTriggeredAbility()); + this.addAbility(new DamageDealtToAttachedTriggeredAbility(new DestroyAttachedEffect("it"), false)); } public MireBlight(final MireBlight card) { @@ -77,40 +72,3 @@ public class MireBlight extends CardImpl { return new MireBlight(this); } } - -class MireBlightTriggeredAbility extends TriggeredAbilityImpl { - - public MireBlightTriggeredAbility() { - super(Zone.BATTLEFIELD, new DestroyTargetEffect()); - } - - public MireBlightTriggeredAbility(final MireBlightTriggeredAbility ability) { - super(ability); - } - - @Override - public MireBlightTriggeredAbility copy() { - return new MireBlightTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_CREATURE; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(sourceId); - UUID targetId = event.getTargetId(); - if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId)); - return true; - } - return false; - } - - @Override - public String getRule() { - return "When enchanted creature is dealt damage, destroy it."; - } -} diff --git a/Mage/src/mage/abilities/effects/common/DestroyAttachedEffect.java b/Mage/src/mage/abilities/effects/common/DestroyAttachedEffect.java new file mode 100644 index 00000000000..68d51f9ad2f --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/DestroyAttachedEffect.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.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LoneFox + */ +public class DestroyAttachedEffect extends OneShotEffect { + + private final boolean noRegen; + + public DestroyAttachedEffect(String description) { + this(description, false); + } + + public DestroyAttachedEffect(String description, boolean noRegen) { + super(Outcome.DestroyPermanent); + this.noRegen = noRegen; + this.staticText = "destroy " + description; + if(noRegen) { + this.staticText += ". It can't be regenerated"; + } + } + + public DestroyAttachedEffect(final DestroyAttachedEffect effect) { + super(effect); + this.noRegen = effect.noRegen; + } + + @Override + public DestroyAttachedEffect copy() { + return new DestroyAttachedEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if(enchantment != null) { + Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); + if(enchanted != null) { + return enchanted.destroy(source.getSourceId(), game, noRegen); + } + } + return false; + } +} From dfb70e07a353e994e4eef1c7a5bdfe5398ef90fa Mon Sep 17 00:00:00 2001 From: LoneFox Date: Fri, 11 Sep 2015 09:24:40 +0300 Subject: [PATCH 5/7] Add description parameter to DontUntapInControllersUntapStepEnchantedEffect. This fixes a lot of tooltip texts that had "enchanted permanent" instead of "enchanted creature" in them. --- Mage.Sets/src/mage/sets/magic2013/Encrust.java | 8 ++++---- Mage.Sets/src/mage/sets/newphyrexia/NumbingDose.java | 2 +- Mage.Sets/src/mage/sets/planeshift/SleepingPotion.java | 5 +---- Mage.Sets/src/mage/sets/shardsofalara/ComaVeil.java | 4 ++-- ...DontUntapInControllersUntapStepEnchantedEffect.java | 10 +++++++--- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Mage.Sets/src/mage/sets/magic2013/Encrust.java b/Mage.Sets/src/mage/sets/magic2013/Encrust.java index 42e2c085d83..8eb28f4fb20 100644 --- a/Mage.Sets/src/mage/sets/magic2013/Encrust.java +++ b/Mage.Sets/src/mage/sets/magic2013/Encrust.java @@ -50,9 +50,9 @@ import mage.target.TargetPermanent; * @author jeffwadsworth */ public class Encrust extends CardImpl { - + private static final FilterPermanent filter = new FilterPermanent("artifact or creature"); - + static { filter.add(Predicates.or( new CardTypePredicate(CardType.CREATURE), @@ -71,9 +71,9 @@ public class Encrust extends CardImpl { this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); - + // Enchanted permanent doesn't untap during its controller's untap step and its activated abilities can't be activated. - ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepEnchantedEffect()); + ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepEnchantedEffect("permanent")); Effect effect = new CantActivateAbilitiesAttachedEffect(); effect.setText("and its activated abilities can't be activated"); ability.addEffect(effect); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/NumbingDose.java b/Mage.Sets/src/mage/sets/newphyrexia/NumbingDose.java index b4aad1e5299..ad3c61a53e2 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/NumbingDose.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/NumbingDose.java @@ -76,7 +76,7 @@ public class NumbingDose extends CardImpl { this.addAbility(new EnchantAbility(auraTarget.getTargetName())); // Enchanted permanent doesn't untap during its controller's untap step. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepEnchantedEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepEnchantedEffect("permanent"))); // At the beginning of the upkeep of enchanted permanent's controller, that player loses 1 life. this.addAbility(new NumbingDoseTriggeredAbility()); diff --git a/Mage.Sets/src/mage/sets/planeshift/SleepingPotion.java b/Mage.Sets/src/mage/sets/planeshift/SleepingPotion.java index ad0cacc5e64..3f794c585de 100644 --- a/Mage.Sets/src/mage/sets/planeshift/SleepingPotion.java +++ b/Mage.Sets/src/mage/sets/planeshift/SleepingPotion.java @@ -32,7 +32,6 @@ import mage.abilities.Ability; import mage.abilities.common.BecomesTargetAttachedTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect; import mage.abilities.effects.common.SacrificeSourceEffect; @@ -66,9 +65,7 @@ public class SleepingPotion extends CardImpl { // When Sleeping Potion enters the battlefield, tap enchanted creature. this.addAbility(new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect())); // Enchanted creature doesn't untap during its controller's untap step. - Effect effect = new DontUntapInControllersUntapStepEnchantedEffect(); - effect.setText("Enchanted creature doesn't untap during its controller's untap step"); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepEnchantedEffect())); // When enchanted creature becomes the target of a spell or ability, sacrifice Sleeping Potion. this.addAbility(new BecomesTargetAttachedTriggeredAbility(new SacrificeSourceEffect())); } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/ComaVeil.java b/Mage.Sets/src/mage/sets/shardsofalara/ComaVeil.java index bfbf3aacebe..9aea990c51f 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/ComaVeil.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/ComaVeil.java @@ -53,7 +53,7 @@ public class ComaVeil extends CardImpl { new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE))); } - + public ComaVeil(UUID ownerId) { super(ownerId, 36, "Coma Veil", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}"); this.expansionSetCode = "ALA"; @@ -66,7 +66,7 @@ public class ComaVeil extends CardImpl { this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); // Enchanted permanent doesn't untap during its controller's untap step. EnchantAbility ability = new EnchantAbility(auraTarget.getTargetName()); - ability.addEffect(new DontUntapInControllersUntapStepEnchantedEffect()); + ability.addEffect(new DontUntapInControllersUntapStepEnchantedEffect("permanent")); this.addAbility(ability); } diff --git a/Mage/src/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java b/Mage/src/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java index 7818cc0d242..a15aa089b8d 100644 --- a/Mage/src/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java +++ b/Mage/src/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java @@ -15,8 +15,12 @@ import mage.game.permanent.Permanent; public class DontUntapInControllersUntapStepEnchantedEffect extends ContinuousRuleModifyingEffectImpl { public DontUntapInControllersUntapStepEnchantedEffect() { + this("creature"); + } + + public DontUntapInControllersUntapStepEnchantedEffect(String description) { super(Duration.WhileOnBattlefield, Outcome.Detriment, false, true); - staticText = "Enchanted permanent doesn't untap during its controller's untap step"; + staticText = "Enchanted " + description + " doesn't untap during its controller's untap step"; } public DontUntapInControllersUntapStepEnchantedEffect(final DontUntapInControllersUntapStepEnchantedEffect effect) { @@ -40,7 +44,7 @@ public class DontUntapInControllersUntapStepEnchantedEffect extends ContinuousRu Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); if (enchanted != null) { return enchanted.getLogName() + " doesn't untap during its controller's untap step (" + enchantment.getLogName() + ")"; - } + } } return null; } @@ -49,7 +53,7 @@ public class DontUntapInControllersUntapStepEnchantedEffect extends ContinuousRu public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.UNTAP; } - + @Override public boolean applies(GameEvent event, Ability source, Game game) { if (PhaseStep.UNTAP.equals(game.getTurn().getStepType())) { From f74558f94acb3458924ec056f6627fa40db198da Mon Sep 17 00:00:00 2001 From: LoneFox Date: Fri, 11 Sep 2015 10:50:55 +0300 Subject: [PATCH 6/7] Implement cards: Lightning Cloud, Serene Heart, Tranquil Domain, and Unfulfilled Desires --- .../src/mage/sets/mirage/SereneHeart.java | 66 +++++++++++++++++ .../src/mage/sets/mirage/TranquilDomain.java | 67 +++++++++++++++++ .../mage/sets/mirage/UnfulfilledDesires.java | 65 ++++++++++++++++ .../src/mage/sets/visions/LightningCloud.java | 74 +++++++++++++++++++ 4 files changed, 272 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/mirage/SereneHeart.java create mode 100644 Mage.Sets/src/mage/sets/mirage/TranquilDomain.java create mode 100644 Mage.Sets/src/mage/sets/mirage/UnfulfilledDesires.java create mode 100644 Mage.Sets/src/mage/sets/visions/LightningCloud.java diff --git a/Mage.Sets/src/mage/sets/mirage/SereneHeart.java b/Mage.Sets/src/mage/sets/mirage/SereneHeart.java new file mode 100644 index 00000000000..bc493242d18 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/SereneHeart.java @@ -0,0 +1,66 @@ +/* + * 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.mirage; + +import java.util.UUID; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author LoneFox + */ +public class SereneHeart extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("Auras"); + + static { + filter.add(new SubtypePredicate("Aura")); + } + + public SereneHeart(UUID ownerId) { + super(ownerId, 140, "Serene Heart", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{G}"); + this.expansionSetCode = "MIR"; + + // Destroy all Auras. + this.getSpellAbility().addEffect(new DestroyAllEffect(filter)); + } + + public SereneHeart(final SereneHeart card) { + super(card); + } + + @Override + public SereneHeart copy() { + return new SereneHeart(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirage/TranquilDomain.java b/Mage.Sets/src/mage/sets/mirage/TranquilDomain.java new file mode 100644 index 00000000000..0e3bdd114fb --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/TranquilDomain.java @@ -0,0 +1,67 @@ +/* + * 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.mirage; + +import java.util.UUID; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterEnchantmentPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author LoneFox + */ +public class TranquilDomain extends CardImpl { + + private static final FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("non-Aura enchantments"); + + static { + filter.add(Predicates.not(new SubtypePredicate("Aura"))); + } + + public TranquilDomain(UUID ownerId) { + super(ownerId, 143, "Tranquil Domain", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{G}"); + this.expansionSetCode = "MIR"; + + // Destroy all non-Aura enchantments. + this.getSpellAbility().addEffect(new DestroyAllEffect(filter)); + } + + public TranquilDomain(final TranquilDomain card) { + super(card); + } + + @Override + public TranquilDomain copy() { + return new TranquilDomain(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirage/UnfulfilledDesires.java b/Mage.Sets/src/mage/sets/mirage/UnfulfilledDesires.java new file mode 100644 index 00000000000..7d122a642e2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/UnfulfilledDesires.java @@ -0,0 +1,65 @@ +/* + * 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.mirage; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DrawDiscardControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LoneFox + */ +public class UnfulfilledDesires extends CardImpl { + + public UnfulfilledDesires(UUID ownerId) { + super(ownerId, 345, "Unfulfilled Desires", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}{B}"); + this.expansionSetCode = "MIR"; + + // {1}, Pay 1 life: Draw a card, then discard a card. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawDiscardControllerEffect(), new ManaCostsImpl("{1}")); + ability.addCost(new PayLifeCost(1)); + this.addAbility(ability); + } + + public UnfulfilledDesires(final UnfulfilledDesires card) { + super(card); + } + + @Override + public UnfulfilledDesires copy() { + return new UnfulfilledDesires(this); + } +} diff --git a/Mage.Sets/src/mage/sets/visions/LightningCloud.java b/Mage.Sets/src/mage/sets/visions/LightningCloud.java new file mode 100644 index 00000000000..1f4309a4d81 --- /dev/null +++ b/Mage.Sets/src/mage/sets/visions/LightningCloud.java @@ -0,0 +1,74 @@ +/* + * 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.visions; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastAllTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterSpell; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.common.TargetCreatureOrPlayer; + +/** + * + * @author LoneFox + */ +public class LightningCloud extends CardImpl { + + private final static FilterSpell filter = new FilterSpell("a red spell"); + + static { + filter.add(new ColorPredicate(ObjectColor.RED)); + } + + public LightningCloud(UUID ownerId) { + super(ownerId, 87, "Lightning Cloud", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}"); + this.expansionSetCode = "VIS"; + + // Whenever a player casts a red spell, you may pay {R}. If you do, Lightning Cloud deals 1 damage to target creature or player. + Ability ability = new SpellCastAllTriggeredAbility(new DoIfCostPaid(new DamageTargetEffect(1), new ManaCostsImpl("{R}")), filter, false); + ability.addTarget(new TargetCreatureOrPlayer()); + this.addAbility(ability); + } + + public LightningCloud(final LightningCloud card) { + super(card); + } + + @Override + public LightningCloud copy() { + return new LightningCloud(this); + } +} From d54e27a91719afb14648b896b7fda4a6f6436dfe Mon Sep 17 00:00:00 2001 From: LoneFox Date: Fri, 11 Sep 2015 11:40:14 +0300 Subject: [PATCH 7/7] Implement cards: Goblin Swine-Rider, Raging Gorilla, Unyaro Bee Sting, and Vitalizing Cascade --- .../src/mage/sets/mirage/UnyaroBeeSting.java | 60 ++++++++++++++ .../mage/sets/mirage/VitalizingCascade.java | 81 +++++++++++++++++++ .../mage/sets/visions/GoblinSwineRider.java | 64 +++++++++++++++ .../src/mage/sets/visions/RagingGorilla.java | 64 +++++++++++++++ 4 files changed, 269 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/mirage/UnyaroBeeSting.java create mode 100644 Mage.Sets/src/mage/sets/mirage/VitalizingCascade.java create mode 100644 Mage.Sets/src/mage/sets/visions/GoblinSwineRider.java create mode 100644 Mage.Sets/src/mage/sets/visions/RagingGorilla.java diff --git a/Mage.Sets/src/mage/sets/mirage/UnyaroBeeSting.java b/Mage.Sets/src/mage/sets/mirage/UnyaroBeeSting.java new file mode 100644 index 00000000000..1203dbd3163 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/UnyaroBeeSting.java @@ -0,0 +1,60 @@ +/* + * 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.mirage; + +import java.util.UUID; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.common.TargetCreatureOrPlayer; + +/** + * + * @author LoneFox + */ +public class UnyaroBeeSting extends CardImpl { + + public UnyaroBeeSting(UUID ownerId) { + super(ownerId, 148, "Unyaro Bee Sting", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{G}"); + this.expansionSetCode = "MIR"; + + // Unyaro Bee Sting deals 2 damage to target creature or player. + this.getSpellAbility().addEffect(new DamageTargetEffect(2)); + this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); + } + + public UnyaroBeeSting(final UnyaroBeeSting card) { + super(card); + } + + @Override + public UnyaroBeeSting copy() { + return new UnyaroBeeSting(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirage/VitalizingCascade.java b/Mage.Sets/src/mage/sets/mirage/VitalizingCascade.java new file mode 100644 index 00000000000..13cb72b880e --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/VitalizingCascade.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.mirage; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.game.Game; + +/** + * + * @author LoneFox + */ +public class VitalizingCascade extends CardImpl { + + public VitalizingCascade(UUID ownerId) { + super(ownerId, 346, "Vitalizing Cascade", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{X}{G}{W}"); + this.expansionSetCode = "MIR"; + + // You gain X plus 3 life. + this.getSpellAbility().addEffect(new GainLifeEffect(new VitalizingCascadeValue())); + } + + public VitalizingCascade(final VitalizingCascade card) { + super(card); + } + + @Override + public VitalizingCascade copy() { + return new VitalizingCascade(this); + } +} + +class VitalizingCascadeValue extends ManacostVariableValue { + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return super.calculate(game, sourceAbility, effect) + 3; + } + + @Override + public VitalizingCascadeValue copy() { + return new VitalizingCascadeValue(); + } + + @Override + public String toString() { + return "X plus 3"; + } +} + diff --git a/Mage.Sets/src/mage/sets/visions/GoblinSwineRider.java b/Mage.Sets/src/mage/sets/visions/GoblinSwineRider.java new file mode 100644 index 00000000000..34a515481e6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/visions/GoblinSwineRider.java @@ -0,0 +1,64 @@ +/* + * 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.visions; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BecomesBlockedTriggeredAbility; +import mage.abilities.effects.common.DamageAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterAttackingOrBlockingCreature; + +/** + * + * @author LoneFox + */ +public class GoblinSwineRider extends CardImpl { + + public GoblinSwineRider(UUID ownerId) { + super(ownerId, 81, "Goblin Swine-Rider", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}"); + this.expansionSetCode = "VIS"; + this.subtype.add("Goblin"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever Goblin Swine-Rider becomes blocked, it deals 2 damage to each attacking creature and each blocking creature. + this.addAbility(new BecomesBlockedTriggeredAbility(new DamageAllEffect(2, new FilterAttackingOrBlockingCreature("attacking creature and each blocking creature")), false)); + } + + public GoblinSwineRider(final GoblinSwineRider card) { + super(card); + } + + @Override + public GoblinSwineRider copy() { + return new GoblinSwineRider(this); + } +} diff --git a/Mage.Sets/src/mage/sets/visions/RagingGorilla.java b/Mage.Sets/src/mage/sets/visions/RagingGorilla.java new file mode 100644 index 00000000000..2f86b3c49bf --- /dev/null +++ b/Mage.Sets/src/mage/sets/visions/RagingGorilla.java @@ -0,0 +1,64 @@ +/* + * 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.visions; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + */ +public class RagingGorilla extends CardImpl { + + public RagingGorilla(UUID ownerId) { + super(ownerId, 90, "Raging Gorilla", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{R}"); + this.expansionSetCode = "VIS"; + this.subtype.add("Ape"); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Whenever Raging Gorilla blocks or becomes blocked, it gets +2/-2 until end of turn. + this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new BoostSourceEffect(2, -2, Duration.EndOfTurn), false)); + } + + public RagingGorilla(final RagingGorilla card) { + super(card); + } + + @Override + public RagingGorilla copy() { + return new RagingGorilla(this); + } +}