diff --git a/Mage.Sets/src/mage/cards/c/CrucibleOfWorlds.java b/Mage.Sets/src/mage/cards/c/CrucibleOfWorlds.java index 225c14bc19d..a08b4ba8cab 100644 --- a/Mage.Sets/src/mage/cards/c/CrucibleOfWorlds.java +++ b/Mage.Sets/src/mage/cards/c/CrucibleOfWorlds.java @@ -27,16 +27,12 @@ */ package mage.cards.c; -import mage.abilities.Ability; -import mage.abilities.PlayLandAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; -import mage.cards.Card; +import mage.abilities.effects.common.ruleModifying.PlayLandsFromGraveyardEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; -import mage.game.Game; -import mage.players.Player; +import mage.constants.CardType; +import mage.constants.Zone; import java.util.UUID; @@ -50,7 +46,7 @@ public class CrucibleOfWorlds extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); // You may play land cards from your graveyard. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CrucibleOfWorldsEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayLandsFromGraveyardEffect())); } public CrucibleOfWorlds(final CrucibleOfWorlds card) { @@ -62,45 +58,3 @@ public class CrucibleOfWorlds extends CardImpl { return new CrucibleOfWorlds(this); } } - -class CrucibleOfWorldsEffect extends ContinuousEffectImpl { - - public CrucibleOfWorldsEffect() { - super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); - this.staticText = "You may play land cards from your graveyard"; - } - - public CrucibleOfWorldsEffect(final CrucibleOfWorldsEffect effect) { - super(effect); - } - - @Override - public CrucibleOfWorldsEffect copy() { - return new CrucibleOfWorldsEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player != null) { - for (UUID cardId: player.getGraveyard()) { - Card card = game.getCard(cardId); - if(card != null && card.isLand()){ - PlayLandFromGraveyardAbility ability = new PlayLandFromGraveyardAbility(card.getName()); - ability.setSourceId(cardId); - ability.setControllerId(card.getOwnerId()); - game.getState().addOtherAbility(card, ability); - } - } - return true; - } - return false; - } -} - -class PlayLandFromGraveyardAbility extends PlayLandAbility{ - PlayLandFromGraveyardAbility(String name){ - super(name); - zone = Zone.GRAVEYARD; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/r/RamunapExcavator.java b/Mage.Sets/src/mage/cards/r/RamunapExcavator.java index eada850b492..f6e23184370 100644 --- a/Mage.Sets/src/mage/cards/r/RamunapExcavator.java +++ b/Mage.Sets/src/mage/cards/r/RamunapExcavator.java @@ -27,26 +27,17 @@ */ package mage.cards.r; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.PlayLandAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; -import mage.cards.Card; +import mage.abilities.effects.common.ruleModifying.PlayLandsFromGraveyardEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; import mage.constants.Zone; -import mage.game.Game; -import mage.players.Player; + +import java.util.UUID; /** - * * @author fireshoes */ public class RamunapExcavator extends CardImpl { @@ -60,7 +51,7 @@ public class RamunapExcavator extends CardImpl { this.toughness = new MageInt(3); // You may play land cards from your graveyard. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RamunapExcavatorEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayLandsFromGraveyardEffect())); } public RamunapExcavator(final RamunapExcavator card) { @@ -71,46 +62,4 @@ public class RamunapExcavator extends CardImpl { public RamunapExcavator copy() { return new RamunapExcavator(this); } -} - -class RamunapExcavatorEffect extends ContinuousEffectImpl { - - public RamunapExcavatorEffect() { - super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); - this.staticText = "You may play land cards from your graveyard"; - } - - public RamunapExcavatorEffect(final RamunapExcavatorEffect effect) { - super(effect); - } - - @Override - public RamunapExcavatorEffect copy() { - return new RamunapExcavatorEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player != null) { - for (UUID cardId: player.getGraveyard()) { - Card card = game.getCard(cardId); - if(card != null && card.isLand()){ - PlayLandFromGraveyardAbility ability = new PlayLandFromGraveyardAbility(card.getName()); - ability.setSourceId(cardId); - ability.setControllerId(card.getOwnerId()); - game.getState().addOtherAbility(card, ability); - } - } - return true; - } - return false; - } -} - -class PlayLandFromGraveyardAbility extends PlayLandAbility{ - PlayLandFromGraveyardAbility(String name){ - super(name); - zone = Zone.GRAVEYARD; - } } \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/common/PlayLandFromGraveyardAbility.java b/Mage/src/main/java/mage/abilities/common/PlayLandFromGraveyardAbility.java new file mode 100644 index 00000000000..b4c2aefa592 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/common/PlayLandFromGraveyardAbility.java @@ -0,0 +1,11 @@ +package mage.abilities.common; + +import mage.abilities.PlayLandAbility; +import mage.constants.Zone; + +public class PlayLandFromGraveyardAbility extends PlayLandAbility { + public PlayLandFromGraveyardAbility(String name){ + super(name); + zone = Zone.GRAVEYARD; + } +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/PlayLandsFromGraveyardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/PlayLandsFromGraveyardEffect.java new file mode 100644 index 00000000000..cb1000ed732 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/PlayLandsFromGraveyardEffect.java @@ -0,0 +1,49 @@ +package mage.abilities.effects.common.ruleModifying; + +import mage.abilities.Ability; +import mage.abilities.common.PlayLandFromGraveyardAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.cards.Card; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.SubLayer; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +public class PlayLandsFromGraveyardEffect extends ContinuousEffectImpl { + + public PlayLandsFromGraveyardEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); + this.staticText = "You may play land cards from your graveyard"; + } + + public PlayLandsFromGraveyardEffect(final PlayLandsFromGraveyardEffect effect) { + super(effect); + } + + @Override + public PlayLandsFromGraveyardEffect copy() { + return new PlayLandsFromGraveyardEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + for (UUID cardId: player.getGraveyard()) { + Card card = game.getCard(cardId); + if(card != null && card.isLand()){ + PlayLandFromGraveyardAbility ability = new PlayLandFromGraveyardAbility(card.getName()); + ability.setSourceId(cardId); + ability.setControllerId(card.getOwnerId()); + game.getState().addOtherAbility(card, ability); + } + } + return true; + } + return false; + } +}