diff --git a/Mage.Sets/src/mage/cards/s/Sporocyst.java b/Mage.Sets/src/mage/cards/s/Sporocyst.java new file mode 100644 index 0000000000..a7bf8d9e51 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/Sporocyst.java @@ -0,0 +1,78 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.abilities.keyword.DefenderAbility; +import mage.abilities.keyword.RavenousAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Sporocyst extends CardImpl { + + public Sporocyst(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}{X}{G}"); + + this.subtype.add(SubType.TYRANID); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Ravenous + this.addAbility(new RavenousAbility()); + + // Defender + this.addAbility(DefenderAbility.getInstance()); + + // Spore Chimney -- When Sporocyst enters the battlefield, search your library for up to X basic land cards, put them onto the battlefield tapped, then shuffle. + this.addAbility(new EntersBattlefieldTriggeredAbility(new SporocystEffect()).withFlavorWord("Spore Chimney")); + } + + private Sporocyst(final Sporocyst card) { + super(card); + } + + @Override + public Sporocyst copy() { + return new Sporocyst(this); + } +} + +class SporocystEffect extends OneShotEffect { + + SporocystEffect() { + super(Outcome.Benefit); + staticText = "search your library for up to X basic land cards, " + + "put them onto the battlefield tapped, then shuffle"; + } + + private SporocystEffect(final SporocystEffect effect) { + super(effect); + } + + @Override + public SporocystEffect copy() { + return new SporocystEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int xValue = ManacostVariableValue.ETB.calculate(game, source, this); + return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary( + 0, xValue, StaticFilters.FILTER_CARD_BASIC_LANDS + ), true, true).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index 41548b09b5..d3d1a7bd08 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -174,6 +174,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Skycloud Expanse", 294, Rarity.RARE, mage.cards.s.SkycloudExpanse.class)); cards.add(new SetCardInfo("Sol Ring", 249, Rarity.UNCOMMON, mage.cards.s.SolRing.class)); cards.add(new SetCardInfo("Space Marine Devastator", 14, Rarity.RARE, mage.cards.s.SpaceMarineDevastator.class)); + cards.add(new SetCardInfo("Sporocyst", 98, Rarity.RARE, mage.cards.s.Sporocyst.class)); cards.add(new SetCardInfo("Starstorm", 208, Rarity.RARE, mage.cards.s.Starstorm.class)); cards.add(new SetCardInfo("Sunken Hollow", 295, Rarity.RARE, mage.cards.s.SunkenHollow.class)); cards.add(new SetCardInfo("Swamp", 310, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage/src/main/java/mage/abilities/keyword/RavenousAbility.java b/Mage/src/main/java/mage/abilities/keyword/RavenousAbility.java index a7b82c37b0..2c79a0474c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/RavenousAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/RavenousAbility.java @@ -18,11 +18,13 @@ public class RavenousAbility extends EntersBattlefieldAbility { public RavenousAbility() { super(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance())); - this.addSubAbility(new ConditionalInterveningIfTriggeredAbility( + Ability ability = new ConditionalInterveningIfTriggeredAbility( new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)), RavenousAbilityCondition.instance, "When this creature enters the battlefield, " + "if X is 5 or more, draw a card" - )); + ); + ability.setRuleVisible(false); + this.addSubAbility(ability); } private RavenousAbility(final RavenousAbility ability) {