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/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/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/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/src/mage/abilities/effects/common/PutCreatureOnBattlefieldEffect.java b/Mage/src/mage/abilities/effects/common/PutPermanentOnBattlefieldEffect.java similarity index 67% rename from Mage/src/mage/abilities/effects/common/PutCreatureOnBattlefieldEffect.java rename to Mage/src/mage/abilities/effects/common/PutPermanentOnBattlefieldEffect.java index 822c21199b..254566a4cd 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; }