diff --git a/Mage.Sets/src/mage/cards/s/StoneboundMentor.java b/Mage.Sets/src/mage/cards/s/StoneboundMentor.java new file mode 100644 index 0000000000..a51001f56f --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StoneboundMentor.java @@ -0,0 +1,38 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.common.CardsLeaveGraveyardTriggeredAbility; +import mage.abilities.effects.keyword.ScryEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class StoneboundMentor extends CardImpl { + + public StoneboundMentor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{W}"); + + this.subtype.add(SubType.SPIRIT); + this.subtype.add(SubType.ADVISOR); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever one or more cards leave your graveyard, scry 1. + this.addAbility(new CardsLeaveGraveyardTriggeredAbility(new ScryEffect(1))); + } + + private StoneboundMentor(final StoneboundMentor card) { + super(card); + } + + @Override + public StoneboundMentor copy() { + return new StoneboundMentor(this); + } +} diff --git a/Mage.Sets/src/mage/cards/t/TormodTheDesecrator.java b/Mage.Sets/src/mage/cards/t/TormodTheDesecrator.java index da7cc61e53..aece5ad570 100644 --- a/Mage.Sets/src/mage/cards/t/TormodTheDesecrator.java +++ b/Mage.Sets/src/mage/cards/t/TormodTheDesecrator.java @@ -1,22 +1,16 @@ package mage.cards.t; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.CardsLeaveGraveyardTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.PartnerAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.SuperType; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.ZoneChangeGroupEvent; import mage.game.permanent.token.ZombieToken; -import java.util.Objects; import java.util.UUID; /** @@ -34,7 +28,9 @@ public final class TormodTheDesecrator extends CardImpl { this.toughness = new MageInt(2); // Whenever one or more cards leave your graveyard, create a tapped 2/2 black Zombie creature token. - this.addAbility(new TormodTheDesecratorTriggeredAbility()); + this.addAbility(new CardsLeaveGraveyardTriggeredAbility( + new CreateTokenEffect(new ZombieToken(), 1, true, false) + )); // Partner this.addAbility(PartnerAbility.getInstance()); @@ -49,44 +45,3 @@ public final class TormodTheDesecrator extends CardImpl { return new TormodTheDesecrator(this); } } - -class TormodTheDesecratorTriggeredAbility extends TriggeredAbilityImpl { - - TormodTheDesecratorTriggeredAbility() { - super(Zone.BATTLEFIELD, new CreateTokenEffect(new ZombieToken(), 1, true, false), false); - } - - private TormodTheDesecratorTriggeredAbility(final TormodTheDesecratorTriggeredAbility ability) { - super(ability); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ZONE_CHANGE_GROUP; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; - return zEvent != null - && Zone.GRAVEYARD == zEvent.getFromZone() - && Zone.GRAVEYARD != zEvent.getToZone() - && zEvent.getCards() != null - && zEvent.getCards() - .stream() - .filter(Objects::nonNull) - .map(Card::getOwnerId) - .anyMatch(getControllerId()::equals); - } - - @Override - public TormodTheDesecratorTriggeredAbility copy() { - return new TormodTheDesecratorTriggeredAbility(this); - } - - @Override - public String getRule() { - return "Whenever one or more cards leave your graveyard, " + - "create a tapped 2/2 black Zombie creature token."; - } -} diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index b667dd926d..b61e050036 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -82,6 +82,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { cards.add(new SetCardInfo("Silverquill Command", 232, Rarity.RARE, mage.cards.s.SilverquillCommand.class)); cards.add(new SetCardInfo("Spirit Summoning", 236, Rarity.COMMON, mage.cards.s.SpiritSummoning.class)); cards.add(new SetCardInfo("Star Pupil", 30, Rarity.COMMON, mage.cards.s.StarPupil.class)); + cards.add(new SetCardInfo("Stonebound Mentor", 239, Rarity.COMMON, mage.cards.s.StoneboundMentor.class)); cards.add(new SetCardInfo("Storm-Kiln Artist", 115, Rarity.UNCOMMON, mage.cards.s.StormKilnArtist.class)); cards.add(new SetCardInfo("Study Break", 34, Rarity.COMMON, mage.cards.s.StudyBreak.class)); cards.add(new SetCardInfo("Swamp", 370, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage/src/main/java/mage/abilities/common/CardsLeaveGraveyardTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/CardsLeaveGraveyardTriggeredAbility.java new file mode 100644 index 0000000000..ac04b61a56 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/common/CardsLeaveGraveyardTriggeredAbility.java @@ -0,0 +1,54 @@ +package mage.abilities.common; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.cards.Card; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeGroupEvent; + +import java.util.Objects; + +/** + * @author TheElk801 + */ +public class CardsLeaveGraveyardTriggeredAbility extends TriggeredAbilityImpl { + + public CardsLeaveGraveyardTriggeredAbility(Effect effect) { + super(Zone.BATTLEFIELD, effect, false); + } + + private CardsLeaveGraveyardTriggeredAbility(final CardsLeaveGraveyardTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE_GROUP; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; + return zEvent != null + && Zone.GRAVEYARD == zEvent.getFromZone() + && Zone.GRAVEYARD != zEvent.getToZone() + && zEvent.getCards() != null + && zEvent.getCards() + .stream() + .filter(Objects::nonNull) + .map(Card::getOwnerId) + .anyMatch(this::isControlledBy); + } + + @Override + public CardsLeaveGraveyardTriggeredAbility copy() { + return new CardsLeaveGraveyardTriggeredAbility(this); + } + + @Override + public String getRule() { + return "Whenever one or more cards leave your graveyard, " + super.getRule(); + } +}