diff --git a/Mage.Sets/src/mage/sets/alarareborn/VedalkenHeretic.java b/Mage.Sets/src/mage/sets/alarareborn/VedalkenHeretic.java index 5b8f0d526a..0a1d61f212 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/VedalkenHeretic.java +++ b/Mage.Sets/src/mage/sets/alarareborn/VedalkenHeretic.java @@ -29,7 +29,7 @@ package mage.sets.alarareborn; import java.util.UUID; import mage.MageInt; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -54,7 +54,7 @@ public class VedalkenHeretic extends CardImpl { // Whenever Vedalken Heretic deals damage to an opponent, you may draw a card. this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DrawCardSourceControllerEffect(1), true)); - + } public VedalkenHeretic(final VedalkenHeretic card) { diff --git a/Mage.Sets/src/mage/sets/apocalypse/DragonArch.java b/Mage.Sets/src/mage/sets/apocalypse/DragonArch.java index ebf26f8065..60fe65ac0e 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/DragonArch.java +++ b/Mage.Sets/src/mage/sets/apocalypse/DragonArch.java @@ -32,7 +32,7 @@ import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.PutCreatureOnBattlefieldEffect; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; @@ -58,7 +58,7 @@ public class DragonArch extends CardImpl { this.expansionSetCode = "APC"; // {2}, {T}: You may put a multicolored creature card from your hand onto the battlefield. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCreatureOnBattlefieldEffect(filter), + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter), new ManaCostsImpl("{2}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/apocalypse/FungalShambler.java b/Mage.Sets/src/mage/sets/apocalypse/FungalShambler.java index e8f9d48bd5..385de243c2 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/FungalShambler.java +++ b/Mage.Sets/src/mage/sets/apocalypse/FungalShambler.java @@ -30,8 +30,8 @@ package mage.sets.apocalypse; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.keyword.TrampleAbility; diff --git a/Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.java b/Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.java index 5a5cebcb19..c0ac3330e6 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.java +++ b/Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.java @@ -56,7 +56,7 @@ public class MaskOfIntolerance extends CardImpl { // At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, Mask of Intolerance deals 3 damage to him or her. TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), TargetController.ANY, false); this.addAbility(new ConditionalTriggeredAbility(ability, new MaskOfIntoleranceCondition(), - "At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, Mask of Intolerance deals 3 damage to him or her.")); + "At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, {this} deals 3 damage to him or her.")); } public MaskOfIntolerance(final MaskOfIntolerance card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TandemLookout.java b/Mage.Sets/src/mage/sets/avacynrestored/TandemLookout.java index 255339d384..a2cec673f6 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/TandemLookout.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/TandemLookout.java @@ -30,8 +30,8 @@ package mage.sets.avacynrestored; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.continuous.GainAbilityPairedEffect; import mage.abilities.keyword.SoulbondAbility; diff --git a/Mage.Sets/src/mage/sets/commander/HydraOmnivore.java b/Mage.Sets/src/mage/sets/commander/HydraOmnivore.java index dd8d6c6eb6..fea88abc3d 100644 --- a/Mage.Sets/src/mage/sets/commander/HydraOmnivore.java +++ b/Mage.Sets/src/mage/sets/commander/HydraOmnivore.java @@ -31,8 +31,8 @@ import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; diff --git a/Mage.Sets/src/mage/sets/commander2013/LuXunScholarGeneral.java b/Mage.Sets/src/mage/sets/commander2013/LuXunScholarGeneral.java index 32ea1712b7..e8e4489d91 100644 --- a/Mage.Sets/src/mage/sets/commander2013/LuXunScholarGeneral.java +++ b/Mage.Sets/src/mage/sets/commander2013/LuXunScholarGeneral.java @@ -29,7 +29,7 @@ package mage.sets.commander2013; import java.util.UUID; import mage.MageInt; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.keyword.HorsemanshipAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/sets/conflux/CharnelhoardWurm.java b/Mage.Sets/src/mage/sets/conflux/CharnelhoardWurm.java index 983fccfc74..7356e7d86a 100644 --- a/Mage.Sets/src/mage/sets/conflux/CharnelhoardWurm.java +++ b/Mage.Sets/src/mage/sets/conflux/CharnelhoardWurm.java @@ -28,14 +28,14 @@ package mage.sets.conflux; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.target.common.TargetCardInYourGraveyard; /** diff --git a/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java b/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java index 98fb20c1ff..fcae2dcac5 100644 --- a/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java +++ b/Mage.Sets/src/mage/sets/conflux/MasterTransmuter.java @@ -28,25 +28,19 @@ package mage.sets.conflux; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.ReturnToHandTargetPermanentCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterArtifactCard; import mage.filter.common.FilterControlledArtifactPermanent; -import mage.game.Game; -import mage.players.Player; -import mage.target.Target; -import mage.target.common.TargetCardInHand; import mage.target.common.TargetControlledPermanent; /** @@ -65,7 +59,7 @@ public class MasterTransmuter extends CardImpl { this.toughness = new MageInt(2); // {U}, {tap}, Return an artifact you control to its owner's hand: You may put an artifact card from your hand onto the battlefield. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MasterTransmuterEffect(), new ManaCostsImpl("{U}")); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(new FilterArtifactCard("an artifact card")), new ManaCostsImpl("{U}")); ability.addCost(new TapSourceCost()); ability.addCost(new ReturnToHandTargetPermanentCost(new TargetControlledPermanent(new FilterControlledArtifactPermanent("an artifact")))); this.addAbility(ability); @@ -81,38 +75,3 @@ public class MasterTransmuter extends CardImpl { return new MasterTransmuter(this); } } - -class MasterTransmuterEffect extends OneShotEffect { - - public MasterTransmuterEffect() { - super(Outcome.Benefit); - this.staticText = "You may put an artifact card from your hand onto the battlefield"; - } - - public MasterTransmuterEffect(final MasterTransmuterEffect effect) { - super(effect); - } - - @Override - public MasterTransmuterEffect copy() { - return new MasterTransmuterEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Target target = new TargetCardInHand(new FilterArtifactCard("an artifact card from your hand")); - if (target.canChoose(source.getSourceId(), source.getControllerId(), game) - && controller.chooseUse(outcome, "Put an artifact from your hand to battlefield?", source, game) - && controller.chooseTarget(outcome, target, source, game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); - } - } - } - - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/eventide/MindwrackLiege.java b/Mage.Sets/src/mage/sets/eventide/MindwrackLiege.java index eda9db6234..f0d5714b77 100644 --- a/Mage.Sets/src/mage/sets/eventide/MindwrackLiege.java +++ b/Mage.Sets/src/mage/sets/eventide/MindwrackLiege.java @@ -30,17 +30,14 @@ package mage.sets.eventide; import java.util.UUID; import mage.MageInt; import mage.ObjectColor; -import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.abilities.effects.common.continuous.BoostAllEffect; -import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; @@ -49,9 +46,6 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.ControllerPredicate; -import mage.game.Game; -import mage.players.Player; -import mage.target.common.TargetCardInHand; /** * @@ -59,15 +53,17 @@ import mage.target.common.TargetCardInHand; */ public class MindwrackLiege extends CardImpl { - + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blue creatures you control"); private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("red creatures you control"); + private static final FilterCreatureCard filter3 = new FilterCreatureCard("a blue or red creature card"); + static { filter.add(new ColorPredicate(ObjectColor.BLUE)); filter.add(new ControllerPredicate(TargetController.YOU)); - filter2.add(new ColorPredicate(ObjectColor.RED)); filter2.add(new ControllerPredicate(TargetController.YOU)); + filter3.add(Predicates.or(new ColorPredicate(ObjectColor.BLUE), new ColorPredicate(ObjectColor.RED))); } public MindwrackLiege(UUID ownerId) { @@ -80,13 +76,12 @@ public class MindwrackLiege extends CardImpl { // Other blue creatures you control get +1/+1. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true))); - + // Other red creatures you control get +1/+1. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter2, true))); - + // {UR}{UR}{UR}{UR}: You may put a blue or red creature card from your hand onto the battlefield. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new MindwrackLiegeEffect(), new ManaCostsImpl("{U/R}{U/R}{U/R}{U/R}"))); - + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter3), new ManaCostsImpl("{U/R}{U/R}{U/R}{U/R}"))); } public MindwrackLiege(final MindwrackLiege card) { @@ -98,48 +93,3 @@ public class MindwrackLiege extends CardImpl { return new MindwrackLiege(this); } } - -class MindwrackLiegeEffect extends OneShotEffect { - - private static final String choiceText = "Put a blue or red creature card from your hand onto the battlefield?"; - - private static final FilterCreatureCard filter = new FilterCreatureCard("a blue or red creature card"); - - static { - filter.add(Predicates.or( - new ColorPredicate(ObjectColor.BLUE), - new ColorPredicate(ObjectColor.RED))); - } - - public MindwrackLiegeEffect() { - super(Outcome.PutCreatureInPlay); - this.staticText = "You may put a blue or red creature card from your hand onto the battlefield"; - } - - public MindwrackLiegeEffect(final MindwrackLiegeEffect effect) { - super(effect); - } - - @Override - public MindwrackLiegeEffect copy() { - return new MindwrackLiegeEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null || !player.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) { - return false; - } - - TargetCardInHand target = new TargetCardInHand(filter); - if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId()); - return true; - } - } - return false; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/fatereforged/MindscourDragon.java b/Mage.Sets/src/mage/sets/fatereforged/MindscourDragon.java index 6e4002d870..919fef0d1c 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/MindscourDragon.java +++ b/Mage.Sets/src/mage/sets/fatereforged/MindscourDragon.java @@ -30,7 +30,7 @@ package mage.sets.fatereforged; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; @@ -53,7 +53,7 @@ public class MindscourDragon extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - + // Whenever Mindscour Dragon deals combat damage to an opponent, target player puts the top four cards of his or her library into his or her graveyard. Ability ability = new DealsDamageToOpponentTriggeredAbility(new PutLibraryIntoGraveTargetEffect(4), false, true); ability.addTarget(new TargetPlayer()); diff --git a/Mage.Sets/src/mage/sets/homelands/AnabaAncestor.java b/Mage.Sets/src/mage/sets/homelands/AnabaAncestor.java new file mode 100644 index 0000000000..5074961e95 --- /dev/null +++ b/Mage.Sets/src/mage/sets/homelands/AnabaAncestor.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.homelands; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class AnabaAncestor extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Another target Minotaur creature"); + + static { + filter.add(new SubtypePredicate("Minotaur")); + filter.add(new AnotherPredicate()); + } + + public AnabaAncestor(UUID ownerId) { + super(ownerId, 81, "Anaba Ancestor", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{R}"); + this.expansionSetCode = "HML"; + this.subtype.add("Minotaur"); + this.subtype.add("Spirit"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {T}: Another target Minotaur creature gets +1/+1 until end of turn. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(1, 1, Duration.EndOfTurn), new TapSourceCost()); + ability.addTarget(new TargetCreaturePermanent(filter)); + this.addAbility(ability); + } + + public AnabaAncestor(final AnabaAncestor card) { + super(card); + } + + @Override + public AnabaAncestor copy() { + return new AnabaAncestor(this); + } +} diff --git a/Mage.Sets/src/mage/sets/homelands/AnabaSpiritCrafter.java b/Mage.Sets/src/mage/sets/homelands/AnabaSpiritCrafter.java new file mode 100644 index 0000000000..53536b0590 --- /dev/null +++ b/Mage.Sets/src/mage/sets/homelands/AnabaSpiritCrafter.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.homelands; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +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.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author LoneFox + */ +public class AnabaSpiritCrafter extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Minotaur creatures"); + + static { + filter.add(new SubtypePredicate("Minotaur")); + } + + public AnabaSpiritCrafter(UUID ownerId) { + super(ownerId, 86, "Anaba Spirit Crafter", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); + this.expansionSetCode = "HML"; + this.subtype.add("Minotaur"); + this.subtype.add("Shaman"); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Minotaur creatures get +1/+0. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 0, Duration.WhileOnBattlefield, filter, false))); + } + + public AnabaSpiritCrafter(final AnabaSpiritCrafter card) { + super(card); + } + + @Override + public AnabaSpiritCrafter copy() { + return new AnabaSpiritCrafter(this); + } +} diff --git a/Mage.Sets/src/mage/sets/homelands/Didgeridoo.java b/Mage.Sets/src/mage/sets/homelands/Didgeridoo.java new file mode 100644 index 0000000000..96609bf2e0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/homelands/Didgeridoo.java @@ -0,0 +1,69 @@ +/* + * 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.homelands; + +import java.util.UUID; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterPermanentCard; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author LoneFox + */ +public class Didgeridoo extends CardImpl { + + private static final FilterPermanentCard filter = new FilterPermanentCard("a Minotaur permanent card"); + + static { + filter.add(new SubtypePredicate("Minotaur")); + } + + public Didgeridoo(UUID ownerId) { + super(ownerId, 130, "Didgeridoo", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{1}"); + this.expansionSetCode = "HML"; + + // {3}: You may put a Minotaur permanent card from your hand onto the battlefield. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter), new ManaCostsImpl("{3}"))); + } + + public Didgeridoo(final Didgeridoo card) { + super(card); + } + + @Override + public Didgeridoo copy() { + return new Didgeridoo(this); + } +} diff --git a/Mage.Sets/src/mage/sets/legends/NicolBolas.java b/Mage.Sets/src/mage/sets/legends/NicolBolas.java index 55a7c2b4ab..8bf534631e 100644 --- a/Mage.Sets/src/mage/sets/legends/NicolBolas.java +++ b/Mage.Sets/src/mage/sets/legends/NicolBolas.java @@ -30,8 +30,8 @@ package mage.sets.legends; import java.util.UUID; import mage.MageInt; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; import mage.abilities.effects.common.discard.DiscardHandTargetEffect; import mage.abilities.keyword.FlyingAbility; @@ -60,7 +60,7 @@ public class NicolBolas extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // At the beginning of your upkeep, sacrifice Nicol Bolas unless you pay {U}{B}{R}. this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ManaCostsImpl("{U}{B}{R}")), TargetController.YOU, false)); - + // Whenever Nicol Bolas deals damage to an opponent, that player discards his or her hand. this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardHandTargetEffect("that player"), false)); } diff --git a/Mage.Sets/src/mage/sets/magic2010/ElvishPiper.java b/Mage.Sets/src/mage/sets/magic2010/ElvishPiper.java index c29ae7ffdd..2ce8555a73 100644 --- a/Mage.Sets/src/mage/sets/magic2010/ElvishPiper.java +++ b/Mage.Sets/src/mage/sets/magic2010/ElvishPiper.java @@ -27,17 +27,18 @@ */ package mage.sets.magic2010; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; + +import java.util.UUID; import mage.MageInt; -import mage.abilities.effects.common.PutCreatureOnBattlefieldEffect; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.cards.CardImpl; - -import java.util.UUID; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; /** * @@ -56,7 +57,7 @@ public class ElvishPiper extends CardImpl { // {G}, {tap}: You may put a creature card from your hand onto the battlefield. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, - new PutCreatureOnBattlefieldEffect(), + new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")), new ManaCostsImpl("{G}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/magic2010/HypnoticSpecter.java b/Mage.Sets/src/mage/sets/magic2010/HypnoticSpecter.java index c72c755c85..e120011e38 100644 --- a/Mage.Sets/src/mage/sets/magic2010/HypnoticSpecter.java +++ b/Mage.Sets/src/mage/sets/magic2010/HypnoticSpecter.java @@ -27,13 +27,13 @@ */ package mage.sets.magic2010; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import java.util.UUID; @@ -65,4 +65,4 @@ public class HypnoticSpecter extends CardImpl { public HypnoticSpecter copy() { return new HypnoticSpecter(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/magic2012/QuicksilverAmulet.java b/Mage.Sets/src/mage/sets/magic2012/QuicksilverAmulet.java index c220e08f28..5789dcd340 100644 --- a/Mage.Sets/src/mage/sets/magic2012/QuicksilverAmulet.java +++ b/Mage.Sets/src/mage/sets/magic2012/QuicksilverAmulet.java @@ -30,11 +30,12 @@ package mage.sets.magic2012; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; -import mage.abilities.effects.common.PutCreatureOnBattlefieldEffect; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.cards.CardImpl; +import mage.filter.common.FilterCreatureCard; import java.util.UUID; @@ -50,7 +51,7 @@ public class QuicksilverAmulet extends CardImpl { // {4}, {tap}: You may put a creature card from your hand onto the battlefield. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, - new PutCreatureOnBattlefieldEffect(), + new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")), new ManaCostsImpl("{4}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/magic2014/GarrukCallerOfBeasts.java b/Mage.Sets/src/mage/sets/magic2014/GarrukCallerOfBeasts.java index a4fc59d7c9..6cf8ee79c4 100644 --- a/Mage.Sets/src/mage/sets/magic2014/GarrukCallerOfBeasts.java +++ b/Mage.Sets/src/mage/sets/magic2014/GarrukCallerOfBeasts.java @@ -34,12 +34,11 @@ import mage.abilities.LoyaltyAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.GetEmblemEffect; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; -import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; @@ -50,11 +49,7 @@ import mage.filter.FilterSpell; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.game.Game; import mage.game.command.Emblem; -import mage.players.Player; -import mage.target.Target; -import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInLibrary; /** @@ -63,7 +58,8 @@ import mage.target.common.TargetCardInLibrary; */ public class GarrukCallerOfBeasts extends CardImpl { - private static final FilterCreatureCard filterGreenCreature = new FilterCreatureCard("a green creature card from your hand"); + private static final FilterCreatureCard filterGreenCreature = new FilterCreatureCard("a green creature card"); + static { filterGreenCreature.add(new ColorPredicate(ObjectColor.GREEN)); } @@ -80,7 +76,7 @@ public class GarrukCallerOfBeasts extends CardImpl { this.addAbility(new LoyaltyAbility(new RevealLibraryPutIntoHandEffect(5, new FilterCreatureCard("all creature cards"),true), 1)); // -3: You may put a green creature card from your hand onto the battlefield. - this.addAbility(new LoyaltyAbility(new GarrukCallerOfBeastsPutOntoBattlefieldEffect(), -3)); + this.addAbility(new LoyaltyAbility(new PutPermanentOnBattlefieldEffect(filterGreenCreature), -3)); // -7: You get an emblem with "Whenever you cast a creature spell, you may search your library for a creature card, put it onto the battlefield, then shuffle your library."); this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new GarrukCallerOfBeastsEmblem()), -7)); @@ -96,6 +92,7 @@ public class GarrukCallerOfBeasts extends CardImpl { return new GarrukCallerOfBeasts(this); } } + /** * Emblem: "Whenever you cast a creature spell, you may search your library for a creature card, put it onto the battlefield, then shuffle your library." */ @@ -113,48 +110,3 @@ class GarrukCallerOfBeastsEmblem extends Emblem { this.getAbilities().add(ability); } } - -class GarrukCallerOfBeastsPutOntoBattlefieldEffect extends OneShotEffect { - - private static final FilterCreatureCard filterGreenCreature = new FilterCreatureCard("a green creature card from your hand"); - - static { - filterGreenCreature.add(new ColorPredicate(ObjectColor.GREEN)); - } - - public GarrukCallerOfBeastsPutOntoBattlefieldEffect() { - super(Outcome.PutCreatureInPlay); - this.staticText = "You may put a green creature card from your hand onto the battlefield"; - } - - public GarrukCallerOfBeastsPutOntoBattlefieldEffect(final GarrukCallerOfBeastsPutOntoBattlefieldEffect effect) { - super(effect); - } - - @Override - public GarrukCallerOfBeastsPutOntoBattlefieldEffect copy() { - return new GarrukCallerOfBeastsPutOntoBattlefieldEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (controller.getHand().count(filterGreenCreature, game) > 0) { - - if (controller.chooseUse(Outcome.PutCreatureInPlay, - "Put a green creature card onto the battlefield?", source, game)) { - Target target = new TargetCardInHand(filterGreenCreature); - if (controller.chooseTarget(outcome, target, source, game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); - } - } - } - } - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/masterseditioniii/AnabaAncestor.java b/Mage.Sets/src/mage/sets/masterseditioniii/AnabaAncestor.java new file mode 100644 index 0000000000..be8739bea4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditioniii/AnabaAncestor.java @@ -0,0 +1,54 @@ +/* + * 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.masterseditioniii; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + */ +public class AnabaAncestor extends mage.sets.homelands.AnabaAncestor { + + public AnabaAncestor(UUID ownerId) { + super(ownerId); + this.cardNumber = 86; + this.expansionSetCode = "ME3"; + this.rarity = Rarity.COMMON; + } + + public AnabaAncestor(final AnabaAncestor card) { + super(card); + } + + @Override + public AnabaAncestor copy() { + return new AnabaAncestor(this); + } +} diff --git a/Mage.Sets/src/mage/sets/masterseditioniii/AnabaSpiritCrafter.java b/Mage.Sets/src/mage/sets/masterseditioniii/AnabaSpiritCrafter.java new file mode 100644 index 0000000000..c4168cb5a3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditioniii/AnabaSpiritCrafter.java @@ -0,0 +1,54 @@ +/* + * 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.masterseditioniii; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + */ +public class AnabaSpiritCrafter extends mage.sets.homelands.AnabaSpiritCrafter { + + public AnabaSpiritCrafter(UUID ownerId) { + super(ownerId); + this.cardNumber = 87; + this.expansionSetCode = "ME3"; + this.rarity = Rarity.COMMON; + } + + public AnabaSpiritCrafter(final AnabaSpiritCrafter card) { + super(card); + } + + @Override + public AnabaSpiritCrafter copy() { + return new AnabaSpiritCrafter(this); + } +} diff --git a/Mage.Sets/src/mage/sets/masterseditioniii/Didgeridoo.java b/Mage.Sets/src/mage/sets/masterseditioniii/Didgeridoo.java new file mode 100644 index 0000000000..21531411cb --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditioniii/Didgeridoo.java @@ -0,0 +1,54 @@ +/* + * 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.masterseditioniii; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + */ +public class Didgeridoo extends mage.sets.homelands.Didgeridoo { + + public Didgeridoo(UUID ownerId) { + super(ownerId); + this.cardNumber = 194; + this.expansionSetCode = "ME3"; + this.rarity = Rarity.UNCOMMON; + } + + public Didgeridoo(final Didgeridoo card) { + super(card); + } + + @Override + public Didgeridoo copy() { + return new Didgeridoo(this); + } +} diff --git a/Mage.Sets/src/mage/sets/nemesis/BelbesPortal.java b/Mage.Sets/src/mage/sets/nemesis/BelbesPortal.java index 5b3e8c7cb7..8a6bd9a80f 100644 --- a/Mage.Sets/src/mage/sets/nemesis/BelbesPortal.java +++ b/Mage.Sets/src/mage/sets/nemesis/BelbesPortal.java @@ -34,24 +34,15 @@ import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.ContinuousEffectImpl; -import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ChooseCreatureTypeEffect; -import mage.abilities.effects.common.PutCreatureOnBattlefieldEffect; -import mage.cards.Card; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.cards.CardImpl; -import mage.cards.repository.CardRepository; -import mage.choices.Choice; -import mage.choices.ChoiceImpl; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.target.common.TargetCardInHand; +import mage.filter.predicate.mageobject.ChosenSubtypePredicate; /** * @@ -66,8 +57,10 @@ public class BelbesPortal extends CardImpl { // As Belbe's Portal enters the battlefield, choose a creature type. this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.PutCreatureInPlay))); // {3}, {tap}: You may put a creature card of the chosen type from your hand onto the battlefield. - SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, - new BelbesPortalPutCreatureOnBattlefieldEffect(), + FilterCreatureCard filter = new FilterCreatureCard("a creature card of the chosen type"); + filter.add(new ChosenSubtypePredicate(this.getId())); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new PutPermanentOnBattlefieldEffect(filter), new ManaCostsImpl("{3}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); @@ -82,48 +75,3 @@ public class BelbesPortal extends CardImpl { return new BelbesPortal(this); } } - -class BelbesPortalPutCreatureOnBattlefieldEffect extends OneShotEffect { - BelbesPortalPutCreatureOnBattlefieldEffect() { - super(Outcome.PutCreatureInPlay); - staticText = "You may put a creature card of the chosen type from your hand onto the battlefield"; - } - - BelbesPortalPutCreatureOnBattlefieldEffect(final BelbesPortalPutCreatureOnBattlefieldEffect effect) { - super(effect); - } - - @Override - public BelbesPortalPutCreatureOnBattlefieldEffect copy() { - return new BelbesPortalPutCreatureOnBattlefieldEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - String subtype = (String) game.getState().getValue(permanent.getId() + "_type"); - if (subtype != null) { - Player player = game.getPlayer(source.getControllerId()); - String choiceText = "Put a " + subtype.toLowerCase() + " creature card from your hand onto the battlefield?"; - - if (player != null) { - if (player.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) { - FilterCreatureCard creatureTypeFilter = new FilterCreatureCard(); - creatureTypeFilter.add(new SubtypePredicate(subtype)); - - TargetCardInHand target = new TargetCardInHand(creatureTypeFilter); - if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); - } - } - } - return true; - } - } - } - return false; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ninthedition/ThievingMagpie.java b/Mage.Sets/src/mage/sets/ninthedition/ThievingMagpie.java index e77fb51111..7f6ac26f06 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/ThievingMagpie.java +++ b/Mage.Sets/src/mage/sets/ninthedition/ThievingMagpie.java @@ -28,13 +28,13 @@ package mage.sets.ninthedition; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; /** * diff --git a/Mage.Sets/src/mage/sets/odyssey/RepentantVampire.java b/Mage.Sets/src/mage/sets/odyssey/RepentantVampire.java index 33480b005c..c2062edc5e 100644 --- a/Mage.Sets/src/mage/sets/odyssey/RepentantVampire.java +++ b/Mage.Sets/src/mage/sets/odyssey/RepentantVampire.java @@ -38,8 +38,8 @@ import mage.abilities.condition.common.CardsInControllerGraveCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.continuous.BecomesColorSourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; -import mage.abilities.effects.common.continuous.SetCardColorSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; @@ -77,7 +77,7 @@ public class RepentantVampire extends CardImpl { this.addAbility(new DiesAndDealtDamageThisTurnTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); // Threshold - As long as seven or more cards are in your graveyard, Repentant Vampire is white and has "{tap}: Destroy target black creature." Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( - new SetCardColorSourceEffect(ObjectColor.WHITE, Duration.WhileOnBattlefield), + new BecomesColorSourceEffect(ObjectColor.WHITE, Duration.WhileOnBattlefield), new CardsInControllerGraveCondition(7), "Threshold - As long as seven or more cards are in your graveyard, {this} is white")); Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new TapSourceCost()); diff --git a/Mage.Sets/src/mage/sets/odyssey/WaywardAngel.java b/Mage.Sets/src/mage/sets/odyssey/WaywardAngel.java index f73fe6f3e3..0c65b84dda 100644 --- a/Mage.Sets/src/mage/sets/odyssey/WaywardAngel.java +++ b/Mage.Sets/src/mage/sets/odyssey/WaywardAngel.java @@ -36,9 +36,9 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.CardsInControllerGraveCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.SacrificeControllerEffect; +import mage.abilities.effects.common.continuous.BecomesColorSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; -import mage.abilities.effects.common.continuous.SetCardColorSourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.VigilanceAbility; @@ -75,21 +75,21 @@ public class WaywardAngel extends CardImpl { new CardsInControllerGraveCondition(7), "Threshold - As long as seven or more cards are in your graveyard, {this} gets +3/+3,")); ability.addEffect(new ConditionalContinuousEffect( - new SetCardColorSourceEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield), + new BecomesColorSourceEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield), new CardsInControllerGraveCondition(7), " is black,")); ability.addEffect(new ConditionalContinuousEffect( new GainAbilitySourceEffect(TrampleAbility.getInstance()), new CardsInControllerGraveCondition(7), " has trample,")); - + Ability gainedAbility = new BeginningOfUpkeepTriggeredAbility(new SacrificeControllerEffect(new FilterControlledCreaturePermanent(), 1, ""), TargetController.YOU, false); - + ability.addEffect(new ConditionalContinuousEffect( new GainAbilitySourceEffect(gainedAbility), new CardsInControllerGraveCondition(7), " and has \"At the beginning of your upkeep, sacrifice a creature.\" ")); - + this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.java b/Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.java index 9633c1f419..a08dc49ceb 100644 --- a/Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.java +++ b/Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.java @@ -67,9 +67,6 @@ public class MaliciousAdvice extends CardImpl { effect.setText("Tap X target artifacts, creatures, and/or lands"); this.getSpellAbility().addEffect(effect); this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(new ManacostVariableValue())); - // Correct number of targets will be set in adjustTargets - // I'm not sure if/why this needs to be here, but other such cards do have it... - this.getSpellAbility().addTarget(new TargetPermanent(filter)); } @Override diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SnakeUmbra.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SnakeUmbra.java index 5daad05f23..2c50e5be6e 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SnakeUmbra.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SnakeUmbra.java @@ -29,18 +29,18 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; -import mage.constants.*; import mage.abilities.Ability; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.continuous.BoostEnchantedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.TotemArmorAbility; import mage.cards.CardImpl; +import mage.constants.*; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -61,17 +61,17 @@ public class SnakeUmbra extends CardImpl { this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); - + // Enchanted creature gets +1/+1 ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield)); - + // and has "Whenever this creature deals damage to an opponent, you may draw a card." Ability gainedAbility = new DealsDamageToOpponentTriggeredAbility(new DrawCardSourceControllerEffect(1), true); Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA); effect.setText("and has \"Whenever this creature deals damage to an opponent, you may draw a card.\""); ability.addEffect(effect); this.addAbility(ability); - + // Totem armor this.addAbility(new TotemArmorAbility()); } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/DramaticEntrance.java b/Mage.Sets/src/mage/sets/shadowmoor/DramaticEntrance.java index c3c0846ab5..cf1822e48d 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/DramaticEntrance.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/DramaticEntrance.java @@ -29,20 +29,12 @@ package mage.sets.shadowmoor; import java.util.UUID; import mage.ObjectColor; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.game.Game; -import mage.players.Player; -import mage.target.Target; -import mage.target.common.TargetCardInHand; /** * @@ -50,13 +42,18 @@ import mage.target.common.TargetCardInHand; */ public class DramaticEntrance extends CardImpl { + private static final FilterCreatureCard filter = new FilterCreatureCard("a green creature card"); + + static { + filter.add(new ColorPredicate(ObjectColor.GREEN)); + } + public DramaticEntrance(UUID ownerId) { super(ownerId, 111, "Dramatic Entrance", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{3}{G}{G}"); this.expansionSetCode = "SHM"; - // You may put a green creature card from your hand onto the battlefield. - this.getSpellAbility().addEffect(new DramaticEntranceEffect()); + this.getSpellAbility().addEffect(new PutPermanentOnBattlefieldEffect(filter)); } @@ -69,47 +66,3 @@ public class DramaticEntrance extends CardImpl { return new DramaticEntrance(this); } } - -class DramaticEntranceEffect extends OneShotEffect { - - private static final FilterCreatureCard filter = new FilterCreatureCard("a green creature card from your hand"); - - static { - filter.add(new ColorPredicate(ObjectColor.GREEN)); - } - - public DramaticEntranceEffect() { - super(Outcome.PutCreatureInPlay); - this.staticText = "You may put a green creature card from your hand onto the battlefield"; - } - - public DramaticEntranceEffect(final DramaticEntranceEffect effect) { - super(effect); - } - - @Override - public DramaticEntranceEffect copy() { - return new DramaticEntranceEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (controller.getHand().count(filter, game) > 0) { - if (controller.chooseUse(Outcome.PutCreatureInPlay, - "Put a green creature card onto the battlefield?", source, game)) { - Target target = new TargetCardInHand(filter); - if (controller.chooseTarget(outcome, target, source, game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); - } - } - } - } - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/WitherscaleWurm.java b/Mage.Sets/src/mage/sets/shadowmoor/WitherscaleWurm.java index 505fab6939..bc3e1f3d06 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/WitherscaleWurm.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/WitherscaleWurm.java @@ -31,9 +31,9 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BlocksOrBecomesBlockedByCreatureTriggeredAbility; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.WitherAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/sets/timespiral/BlazingBladeAskari.java b/Mage.Sets/src/mage/sets/timespiral/BlazingBladeAskari.java index de158ab259..d20676a6e5 100644 --- a/Mage.Sets/src/mage/sets/timespiral/BlazingBladeAskari.java +++ b/Mage.Sets/src/mage/sets/timespiral/BlazingBladeAskari.java @@ -29,16 +29,16 @@ package mage.sets.timespiral; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.continuous.SetCardColorSourceEffect; +import mage.abilities.effects.common.continuous.BecomesColorSourceEffect; import mage.abilities.keyword.FlankingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; /** @@ -59,7 +59,7 @@ public class BlazingBladeAskari extends CardImpl { // Flanking this.addAbility(new FlankingAbility()); // {2}: Blazing Blade Askari becomes colorless until end of turn. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SetCardColorSourceEffect(new ObjectColor(""), Duration.EndOfTurn), new ManaCostsImpl("{2}"))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorSourceEffect(new ObjectColor(), Duration.EndOfTurn), new ManaCostsImpl("{2}"))); } public BlazingBladeAskari(final BlazingBladeAskari card) { diff --git a/Mage.Sets/src/mage/sets/timespiral/LooterIlKor.java b/Mage.Sets/src/mage/sets/timespiral/LooterIlKor.java index 50d92657ba..967e8f78d3 100644 --- a/Mage.Sets/src/mage/sets/timespiral/LooterIlKor.java +++ b/Mage.Sets/src/mage/sets/timespiral/LooterIlKor.java @@ -28,13 +28,13 @@ package mage.sets.timespiral; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; -import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; import mage.abilities.effects.common.DrawDiscardControllerEffect; import mage.abilities.keyword.ShadowAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; /** * diff --git a/Mage.Sets/src/mage/sets/urzassaga/GoblinLackey.java b/Mage.Sets/src/mage/sets/urzassaga/GoblinLackey.java index f4f44011f6..282a878891 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/GoblinLackey.java +++ b/Mage.Sets/src/mage/sets/urzassaga/GoblinLackey.java @@ -29,22 +29,13 @@ package mage.sets.urzassaga; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; +import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.Zone; import mage.filter.common.FilterPermanentCard; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.players.Player; -import mage.target.common.TargetCardInHand; /** * @@ -52,6 +43,12 @@ import mage.target.common.TargetCardInHand; */ public class GoblinLackey extends CardImpl { + private static final FilterPermanentCard filter = new FilterPermanentCard("a Goblin permanent card"); + + static { + filter.add(new SubtypePredicate("Goblin")); + } + public GoblinLackey(UUID ownerId) { super(ownerId, 190, "Goblin Lackey", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}"); this.expansionSetCode = "USG"; @@ -61,7 +58,7 @@ public class GoblinLackey extends CardImpl { this.toughness = new MageInt(1); // Whenever Goblin Lackey deals damage to a player, you may put a Goblin permanent card from your hand onto the battlefield. - this.addAbility(new GoblinLackeyTriggeredAbility()); + this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new PutPermanentOnBattlefieldEffect(filter), false)); } public GoblinLackey(final GoblinLackey card) { @@ -73,72 +70,3 @@ public class GoblinLackey extends CardImpl { return new GoblinLackey(this); } } - -class GoblinLackeyTriggeredAbility extends TriggeredAbilityImpl { - - public GoblinLackeyTriggeredAbility() { - super(Zone.BATTLEFIELD, new GoblinLackeyEffect(), true); - } - - public GoblinLackeyTriggeredAbility(final GoblinLackeyTriggeredAbility ability) { - super(ability); - } - - @Override - public GoblinLackeyTriggeredAbility copy() { - return new GoblinLackeyTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - return event.getSourceId().equals(this.sourceId) - && game.getOpponents(this.getControllerId()).contains(event.getTargetId()); - } - - @Override - public String getRule() { - return "Whenever {this} deals damage to an opponent, you may put a Goblin permanent card from your hand onto the battlefield."; - } -} - -class GoblinLackeyEffect extends OneShotEffect { - - public GoblinLackeyEffect() { - super(Outcome.PutCreatureInPlay); - this.staticText = "you may put a Goblin permanent card from your hand onto the battlefield"; - } - - public GoblinLackeyEffect(final GoblinLackeyEffect effect) { - super(effect); - } - - @Override - public GoblinLackeyEffect copy() { - return new GoblinLackeyEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller == null) { - return false; - } - FilterPermanentCard filter = new FilterPermanentCard("Goblin permanent card from your hand"); - filter.add(new SubtypePredicate("Goblin")); - TargetCardInHand target = new TargetCardInHand(filter); - if (controller.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); - } else { - return false; - } - } - return true; - } -} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/Addle.java b/Mage.Sets/src/mage/sets/vintagemasters/Addle.java index baa462bbf4..3ce4e067d5 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/Addle.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/Addle.java @@ -95,7 +95,7 @@ class AddleEffect extends OneShotEffect { controller.choose(outcome, choice, game); ObjectColor color = choice.getColor(); if(color != null) { - game.informPlayers(new StringBuilder(controller.getLogName()).append(" chooses ").append(color).toString()); + game.informPlayers(controller.getLogName() + " chooses " + color + "."); FilterCard filter = new FilterCard(); filter.add(new ColorPredicate(color)); Effect effect = new DiscardCardYouChooseTargetEffect(filter); diff --git a/Mage.Sets/src/mage/sets/worldwake/StoneforgeMystic.java b/Mage.Sets/src/mage/sets/worldwake/StoneforgeMystic.java index 6d1f9a9bae..3a87eb36ce 100644 --- a/Mage.Sets/src/mage/sets/worldwake/StoneforgeMystic.java +++ b/Mage.Sets/src/mage/sets/worldwake/StoneforgeMystic.java @@ -1,16 +1,16 @@ /* * 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 @@ -20,7 +20,7 @@ * 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. @@ -35,26 +35,16 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; -import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterCard; -import mage.filter.common.FilterArtifactCard; -import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.players.Player; -import mage.target.Target; -import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInLibrary; - - /** * * @author BetaSteward_at_googlemail.com @@ -64,7 +54,6 @@ public class StoneforgeMystic extends CardImpl { private static final FilterCard filter = new FilterCard("an Equipment card"); static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); filter.add(new SubtypePredicate("Equipment")); } @@ -82,7 +71,7 @@ public class StoneforgeMystic extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), true)); // {1}{W}, {T}: You may put an Equipment card from your hand onto the battlefield. - SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new StoneforgeMysticEffect(), new ManaCostsImpl("{1}{W}")); + SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter), new ManaCostsImpl("{1}{W}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); } @@ -97,44 +86,3 @@ public class StoneforgeMystic extends CardImpl { } } - -class StoneforgeMysticEffect extends OneShotEffect { - - private static final FilterArtifactCard filter = new FilterArtifactCard("an Equipment card from your hand"); - - static { - filter.add(new SubtypePredicate("Equipment")); - } - - public StoneforgeMysticEffect() { - super(Outcome.Benefit); - this.staticText = "You may put an Equipment card from your hand onto the battlefield"; - } - - public StoneforgeMysticEffect(final StoneforgeMysticEffect effect) { - super(effect); - } - - @Override - public StoneforgeMysticEffect copy() { - return new StoneforgeMysticEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Target target = new TargetCardInHand(filter); - if (target.canChoose(source.getSourceId(), source.getControllerId(), game) - && controller.chooseUse(outcome, "Put an Equipment from your hand to battlefield?", source, game) - && controller.chooseTarget(outcome, target, source, game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); - } - } - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/zendikar/WarrenInstigator.java b/Mage.Sets/src/mage/sets/zendikar/WarrenInstigator.java index 8179345ad2..7cbe253967 100644 --- a/Mage.Sets/src/mage/sets/zendikar/WarrenInstigator.java +++ b/Mage.Sets/src/mage/sets/zendikar/WarrenInstigator.java @@ -29,23 +29,14 @@ package mage.sets.zendikar; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.common.DealsDamageToOpponentTriggeredAbility; +import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; import mage.abilities.keyword.DoubleStrikeAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.players.Player; -import mage.target.common.TargetCardInHand; /** * @@ -53,6 +44,12 @@ import mage.target.common.TargetCardInHand; */ public class WarrenInstigator extends CardImpl { + private static final FilterCreatureCard filter = new FilterCreatureCard("a Goblin creature card"); + + static { + filter.add(new SubtypePredicate("Goblin")); + } + public WarrenInstigator(UUID ownerId) { super(ownerId, 154, "Warren Instigator", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{R}{R}"); this.expansionSetCode = "ZEN"; @@ -63,7 +60,9 @@ public class WarrenInstigator extends CardImpl { this.toughness = new MageInt(1); this.addAbility(DoubleStrikeAbility.getInstance()); - this.addAbility(new WarrenInstigatorTriggeredAbility()); + + // Whenever Warren Instigator deals damage to an opponent, you may put a Goblin creature card from your hand onto the battlefield. + this.addAbility(new DealsDamageToOpponentTriggeredAbility(new PutPermanentOnBattlefieldEffect(filter), false)); } public WarrenInstigator(final WarrenInstigator card) { @@ -75,72 +74,3 @@ public class WarrenInstigator extends CardImpl { return new WarrenInstigator(this); } } - -class WarrenInstigatorTriggeredAbility extends TriggeredAbilityImpl { - - public WarrenInstigatorTriggeredAbility() { - super(Zone.BATTLEFIELD, new WarrenInstigatorEffect(), true); - } - - public WarrenInstigatorTriggeredAbility(final WarrenInstigatorTriggeredAbility ability) { - super(ability); - } - - @Override - public WarrenInstigatorTriggeredAbility copy() { - return new WarrenInstigatorTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.DAMAGED_PLAYER; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - return event.getSourceId().equals(this.sourceId) - && game.getOpponents(this.getControllerId()).contains(event.getTargetId()); - } - - @Override - public String getRule() { - return "Whenever {this} deals damage to an opponent, you may put a Goblin creature card from your hand onto the battlefield."; - } -} - -class WarrenInstigatorEffect extends OneShotEffect { - - public WarrenInstigatorEffect() { - super(Outcome.PutCreatureInPlay); - this.staticText = "you may put a Goblin creature card from your hand onto the battlefield"; - } - - public WarrenInstigatorEffect(final WarrenInstigatorEffect effect) { - super(effect); - } - - @Override - public WarrenInstigatorEffect copy() { - return new WarrenInstigatorEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - - FilterCreatureCard filter = new FilterCreatureCard("Goblin creature card from your hand"); - filter.add(new SubtypePredicate("Goblin")); - TargetCardInHand target = new TargetCardInHand(filter); - if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId()); - return true; - } - } - return false; - } -} diff --git a/Mage/src/mage/abilities/effects/common/DealsDamageToOpponentTriggeredAbility.java b/Mage/src/mage/abilities/common/DealsDamageToOpponentTriggeredAbility.java similarity index 98% rename from Mage/src/mage/abilities/effects/common/DealsDamageToOpponentTriggeredAbility.java rename to Mage/src/mage/abilities/common/DealsDamageToOpponentTriggeredAbility.java index aa25f2b6e8..2641d757ed 100644 --- a/Mage/src/mage/abilities/effects/common/DealsDamageToOpponentTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/DealsDamageToOpponentTriggeredAbility.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ -package mage.abilities.effects.common; +package mage.abilities.common; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -46,7 +46,7 @@ public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl public DealsDamageToOpponentTriggeredAbility(Effect effect) { this(effect, false, false); } - + public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional) { this(effect, optional, false); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java index 9d02189166..06c0efeef4 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java @@ -15,7 +15,7 @@ public class DomainValue implements DynamicValue { private Integer amount; private boolean countTargetPlayer; - private UUID player; + private UUID playerId; public DomainValue() { this(1); @@ -34,15 +34,15 @@ public class DomainValue implements DynamicValue { this.countTargetPlayer = countTargetPlayer; } - public DomainValue(Integer amount, UUID player) { + public DomainValue(Integer amount, UUID playerId) { this(amount, false); - this.player = player; + this.playerId = playerId; } public DomainValue(final DomainValue dynamicValue) { this.amount = dynamicValue.amount; this.countTargetPlayer = dynamicValue.countTargetPlayer; - this.player = dynamicValue.player; + this.playerId = dynamicValue.playerId; } @Override @@ -53,8 +53,8 @@ public class DomainValue implements DynamicValue { int haveSwamps = 0; int haveForests = 0; UUID targetPlayer; - if(player != null) { - targetPlayer = player; + if(playerId != null) { + targetPlayer = playerId; } else if(countTargetPlayer) { targetPlayer = sourceAbility.getTargets().getFirstTarget(); diff --git a/Mage/src/mage/abilities/effects/common/DamageAttachedControllerEffect.java b/Mage/src/mage/abilities/effects/common/DamageAttachedControllerEffect.java index 59d67607b1..b248481aad 100644 --- a/Mage/src/mage/abilities/effects/common/DamageAttachedControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/DamageAttachedControllerEffect.java @@ -82,7 +82,7 @@ public class DamageAttachedControllerEffect extends OneShotEffect { if (staticText != null && !staticText.isEmpty()) { return staticText; } - return "{this} deals " + amount + " to that creature's controller"; + return "{this} deals " + amount + " damage to that creature's controller"; } } diff --git a/Mage/src/mage/abilities/effects/common/PutCreatureOnBattlefieldEffect.java b/Mage/src/mage/abilities/effects/common/PutPermanentOnBattlefieldEffect.java similarity index 65% rename from Mage/src/mage/abilities/effects/common/PutCreatureOnBattlefieldEffect.java rename to Mage/src/mage/abilities/effects/common/PutPermanentOnBattlefieldEffect.java index 822c21199b..09a89be195 100644 --- a/Mage/src/mage/abilities/effects/common/PutCreatureOnBattlefieldEffect.java +++ b/Mage/src/mage/abilities/effects/common/PutPermanentOnBattlefieldEffect.java @@ -6,7 +6,8 @@ import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.constants.Outcome; import mage.constants.Zone; -import mage.filter.common.FilterCreatureCard; +import mage.filter.FilterCard; +import mage.filter.common.FilterPermanentCard; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInHand; @@ -14,34 +15,34 @@ import mage.target.common.TargetCardInHand; /** * @author magenoxx_at_gmail.com */ -public class PutCreatureOnBattlefieldEffect extends OneShotEffect { +public class PutPermanentOnBattlefieldEffect extends OneShotEffect { - private final FilterCreatureCard filter; + private final FilterCard filter; - public PutCreatureOnBattlefieldEffect() { - this(new FilterCreatureCard("a creature card")); + public PutPermanentOnBattlefieldEffect() { + this(new FilterPermanentCard("a permanent card")); } - public PutCreatureOnBattlefieldEffect(FilterCreatureCard filter) { - super(Outcome.PutCreatureInPlay); + public PutPermanentOnBattlefieldEffect(FilterCard filter) { + super(Outcome.PutCardInPlay); this.filter = filter; } - public PutCreatureOnBattlefieldEffect(final PutCreatureOnBattlefieldEffect effect) { + public PutPermanentOnBattlefieldEffect(final PutPermanentOnBattlefieldEffect effect) { super(effect); this.filter = effect.filter.copy(); } @Override - public PutCreatureOnBattlefieldEffect copy() { - return new PutCreatureOnBattlefieldEffect(this); + public PutPermanentOnBattlefieldEffect copy() { + return new PutPermanentOnBattlefieldEffect(this); } @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); String choiceText = "Put " + filter.getMessage() + " from your hand onto the battlefield?"; - if (player == null || !player.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) { + if (player == null || !player.chooseUse(Outcome.PutCardInPlay, choiceText, source, game)) { return false; } @@ -62,6 +63,6 @@ public class PutCreatureOnBattlefieldEffect extends OneShotEffect { return staticText; } - return "You may put " + filter.getMessage() + " from your hand onto the battlefield"; + return "you may put " + filter.getMessage() + " from your hand onto the battlefield"; } } diff --git a/Mage/src/mage/abilities/effects/common/continuous/SetCardColorSourceEffect.java b/Mage/src/mage/abilities/effects/common/continuous/SetCardColorSourceEffect.java deleted file mode 100644 index e45ed9f9a4..0000000000 --- a/Mage/src/mage/abilities/effects/common/continuous/SetCardColorSourceEffect.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * - * 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.continuous; - -import mage.MageObject; -import mage.ObjectColor; -import mage.abilities.Ability; -import mage.abilities.Mode; -import mage.abilities.effects.ContinuousEffectImpl; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.game.stack.StackObject; - - -/** - * - * @author nicolas.perrenou - */ - - -public class SetCardColorSourceEffect extends ContinuousEffectImpl { - - private ObjectColor setColor; - - public SetCardColorSourceEffect(ObjectColor setColor, Duration duration, String text) { - super(duration, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit); - this.setColor = setColor; - staticText = text; - } - - public SetCardColorSourceEffect(ObjectColor setColor, Duration duration) { - super(duration, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit); - this.setColor = setColor; - } - - public SetCardColorSourceEffect(final SetCardColorSourceEffect effect) { - super(effect); - this.setColor = effect.setColor; - } - - @Override - public boolean apply(Game game, Ability source) { - MageObject o = game.getObject(source.getSourceId()); - if (o != null) { - if (o instanceof Permanent || o instanceof StackObject) { - o.getColor(game).setColor(setColor); - } - } - - return false; - } - - @Override - public SetCardColorSourceEffect copy() { - return new SetCardColorSourceEffect(this); - } - - @Override - public String getText(Mode mode) { - StringBuilder sb = new StringBuilder(); - sb.append("{this} "); - if (mode.getTargets().size() > 0) { - sb.append(mode.getTargets().get(0).getTargetName()); - } - sb.append(" becomes ").append(setColor.getDescription()); - sb.append(" ").append(duration.toString()); - return sb.toString(); - } -}