diff --git a/Mage.Sets/src/mage/cards/s/SigilOfMyrkul.java b/Mage.Sets/src/mage/cards/s/SigilOfMyrkul.java new file mode 100644 index 00000000000..beb0ad1e1e2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SigilOfMyrkul.java @@ -0,0 +1,93 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfCombatTriggeredAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.CardsInControllerGraveyardCondition; +import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.DeathtouchAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SigilOfMyrkul extends CardImpl { + + private static final Hint hint = new ValueHint( + "Creature cards in your graveyard", + new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE) + ); + + public SigilOfMyrkul(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}"); + + // At the beginning of combat on your turn, mill a card. When you do, if there are four or more creature cards in your graveyard, put a +1/+1 counter on target creature you control and it gains deathtouch until end of turn. + this.addAbility(new BeginningOfCombatTriggeredAbility( + new SigilOfMyrkulEffect(), TargetController.YOU, false + ).addHint(hint)); + } + + private SigilOfMyrkul(final SigilOfMyrkul card) { + super(card); + } + + @Override + public SigilOfMyrkul copy() { + return new SigilOfMyrkul(this); + } +} + +class SigilOfMyrkulEffect extends OneShotEffect { + + private static final Condition condition + = new CardsInControllerGraveyardCondition(4, StaticFilters.FILTER_CARD_CREATURE); + + SigilOfMyrkulEffect() { + super(Outcome.Benefit); + staticText = "mill a card. When you do, if there are four or more creature cards in your graveyard, " + + "put a +1/+1 counter on target creature you control and it gains deathtouch until end of turn"; + } + + private SigilOfMyrkulEffect(final SigilOfMyrkulEffect effect) { + super(effect); + } + + @Override + public SigilOfMyrkulEffect copy() { + return new SigilOfMyrkulEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null || player.millCards(1, source, game).isEmpty()) { + return false; + } + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( + new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false, "if there " + + "are four or more creature cards in your graveyard, put a +1/+1 counter on " + + "target creature you control and it gains deathtouch until end of turn", condition + ); + ability.addEffect(new GainAbilityTargetEffect(DeathtouchAbility.getInstance())); + ability.addTarget(new TargetControlledCreaturePermanent()); + game.fireReflexiveTriggeredAbility(ability, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 61560515ae7..32127d2490e 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -493,6 +493,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Shameless Charlatan", 96, Rarity.RARE, mage.cards.s.ShamelessCharlatan.class)); cards.add(new SetCardInfo("Sharpshooter Elf", 253, Rarity.UNCOMMON, mage.cards.s.SharpshooterElf.class)); cards.add(new SetCardInfo("Shiny Impetus", 194, Rarity.COMMON, mage.cards.s.ShinyImpetus.class)); + cards.add(new SetCardInfo("Sigil of Myrkul", 147, Rarity.UNCOMMON, mage.cards.s.SigilOfMyrkul.class)); cards.add(new SetCardInfo("Silvanus's Invoker", 254, Rarity.COMMON, mage.cards.s.SilvanussInvoker.class)); cards.add(new SetCardInfo("Sivriss, Nightmare Speaker", 148, Rarity.UNCOMMON, mage.cards.s.SivrissNightmareSpeaker.class)); cards.add(new SetCardInfo("Skanos Dragonheart", 255, Rarity.UNCOMMON, mage.cards.s.SkanosDragonheart.class)); diff --git a/Mage/src/main/java/mage/abilities/common/delayed/ReflexiveTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/ReflexiveTriggeredAbility.java index baa7c6049e5..6ec2831bc58 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/ReflexiveTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/ReflexiveTriggeredAbility.java @@ -1,6 +1,7 @@ package mage.abilities.common.delayed; import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.condition.Condition; import mage.abilities.effects.Effect; import mage.constants.Duration; import mage.game.Game; @@ -14,19 +15,26 @@ import java.util.Locale; public class ReflexiveTriggeredAbility extends DelayedTriggeredAbility { private final String text; + private final Condition condition; public ReflexiveTriggeredAbility(Effect effect, boolean optional) { this(effect, optional, null); } public ReflexiveTriggeredAbility(Effect effect, boolean optional, String text) { + this(effect, optional, text, null); + } + + public ReflexiveTriggeredAbility(Effect effect, boolean optional, String text, Condition condition) { super(effect, Duration.EndOfTurn, true, optional); this.text = text; + this.condition = condition; } protected ReflexiveTriggeredAbility(final ReflexiveTriggeredAbility ability) { super(ability); this.text = ability.text; + this.condition = ability.condition; } @Override @@ -48,6 +56,11 @@ public class ReflexiveTriggeredAbility extends DelayedTriggeredAbility { return text.substring(0, 1).toUpperCase(Locale.ENGLISH) + text.substring(1) + '.'; } + @Override + public boolean checkInterveningIfClause(Game game) { + return condition == null || condition.apply(game, this); + } + @Override public ReflexiveTriggeredAbility copy() { return new ReflexiveTriggeredAbility(this);