diff --git a/Mage.Sets/src/mage/cards/m/MonstrousStep.java b/Mage.Sets/src/mage/cards/m/MonstrousStep.java new file mode 100644 index 00000000000..8adde7371be --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MonstrousStep.java @@ -0,0 +1,116 @@ +package mage.cards.m; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.RequirementEffect; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.keyword.CyclingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; +import mage.watchers.common.BlockedAttackerWatcher; + +/** + * + * @author drowinternet + */ +public final class MonstrousStep extends CardImpl { + + private static final FilterCreaturePermanent filterMustBlock = new FilterCreaturePermanent("Target creature that must block"); + private static final FilterCreaturePermanent filterToBeBlocked = new FilterCreaturePermanent("Creature that will be block"); + + public MonstrousStep(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}"); + + + // Target creature gets +7/+7 until end of turn. + this.getSpellAbility().addEffect(new BoostTargetEffect(7,7, Duration.EndOfTurn) + .setText("Target creature gets +7/+7 until end of turn.")); + + //Up to one target creature blocks it this turn if able. + this.getSpellAbility().addEffect(new MonstrousStepEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterMustBlock)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterToBeBlocked)); + this.getSpellAbility().addWatcher(new BlockedAttackerWatcher()); + + + // Cycling {2} + this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); + + } + + private MonstrousStep(final MonstrousStep card) { + super(card); + } + + @Override + public MonstrousStep copy() { + return new MonstrousStep(this); + } +} + +class MonstrousStepEffect extends RequirementEffect { + + public MonstrousStepEffect() { + this(Duration.EndOfTurn); + } + + public MonstrousStepEffect(Duration duration) { + super(duration); + staticText = "Up to one target creature blocks it this turn if able."; + } + + public MonstrousStepEffect(final MonstrousStepEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getId().equals(source.getTargets().get(0).getFirstTarget())) { + Permanent blocker = game.getPermanent(source.getTargets().get(0).getFirstTarget()); + if (blocker != null + && blocker.canBlock(source.getTargets().get(1).getFirstTarget(), game)) { + Permanent attacker = game.getPermanent(source.getTargets().get(1).getFirstTarget()); + if (attacker != null) { + BlockedAttackerWatcher blockedAttackerWatcher = game.getState().getWatcher(BlockedAttackerWatcher.class); + if (blockedAttackerWatcher != null + && blockedAttackerWatcher.creatureHasBlockedAttacker(attacker, blocker, game)) { + // has already blocked this turn, so no need to do again + return false; + } + return true; + } else { + discard(); + } + } + } + return false; + } + + @Override + public boolean mustAttack(Game game) { + return false; + } + + @Override + public boolean mustBlock(Game game) { + return true; + } + + @Override + public UUID mustBlockAttacker(Ability source, Game game) { + return source.getTargets().get(1).getFirstTarget(); + } + + @Override + public MonstrousStepEffect copy() { + return new MonstrousStepEffect(this); + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java index 37ae8a41264..6f35f468f70 100644 --- a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java +++ b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java @@ -202,6 +202,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet { cards.add(new SetCardInfo("Migration Path", 164, Rarity.UNCOMMON, mage.cards.m.MigrationPath.class)); cards.add(new SetCardInfo("Migratory Greathorn", 165, Rarity.COMMON, mage.cards.m.MigratoryGreathorn.class)); cards.add(new SetCardInfo("Momentum Rumbler", 126, Rarity.UNCOMMON, mage.cards.m.MomentumRumbler.class)); + cards.add(new SetCardInfo("Monstrous Step", 166, Rarity.UNCOMMON, mage.cards.m.MonstrousStep.class)); cards.add(new SetCardInfo("Mosscoat Goriak", 167, Rarity.COMMON, mage.cards.m.MosscoatGoriak.class)); cards.add(new SetCardInfo("Mountain", 269, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Mountain", 270, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));