diff --git a/Mage.Sets/src/mage/cards/b/BindTheMonster.java b/Mage.Sets/src/mage/cards/b/BindTheMonster.java new file mode 100644 index 0000000000..f81a0a1145 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BindTheMonster.java @@ -0,0 +1,90 @@ +package mage.cards.b; + +import java.util.UUID; + +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.abilities.Ability; +import mage.abilities.effects.common.AttachEffect; +import mage.constants.Outcome; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; + +/** + * + * @author weirddan455 + */ +public final class BindTheMonster extends CardImpl { + + public BindTheMonster(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // When Bind the Monster enters the battlefield, tap enchanted creature. It deals damage to you equal to its power. + this.addAbility(new EntersBattlefieldTriggeredAbility(new BindTheMonsterEffect())); + + // Enchanted creature doesn't untap during its controller's untap step. + this.addAbility(new SimpleStaticAbility(new DontUntapInControllersUntapStepEnchantedEffect())); + } + + private BindTheMonster(final BindTheMonster card) { + super(card); + } + + @Override + public BindTheMonster copy() { + return new BindTheMonster(this); + } +} + +class BindTheMonsterEffect extends OneShotEffect { + + public BindTheMonsterEffect() { + super(Outcome.Tap); + staticText = "tap enchanted creature. It deals damage to you equal to its power"; + } + + private BindTheMonsterEffect(final BindTheMonsterEffect effect) { + super(effect); + } + + @Override + public BindTheMonsterEffect copy() { + return new BindTheMonsterEffect(this); + } + + @Override + public boolean apply (Game game, Ability source) { + Permanent attachment = source.getSourcePermanentIfItStillExists(game); + if (attachment != null) { + Permanent creature = game.getPermanent(attachment.getAttachedTo()); + if (creature != null) { + creature.tap(source, game); + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + player.damage(creature.getPower().getValue(), creature.getId(), source, game); + } + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 332e6772c1..de207ed4f2 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -98,6 +98,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Bearded Axe", 388, Rarity.UNCOMMON, mage.cards.b.BeardedAxe.class)); cards.add(new SetCardInfo("Behold the Multiverse", 46, Rarity.COMMON, mage.cards.b.BeholdTheMultiverse.class)); cards.add(new SetCardInfo("Beskir Shieldmate", 4, Rarity.COMMON, mage.cards.b.BeskirShieldmate.class)); + cards.add(new SetCardInfo("Bind the Monster", 48, Rarity.COMMON, mage.cards.b.BindTheMonster.class)); cards.add(new SetCardInfo("Binding the Old Gods", 206, Rarity.UNCOMMON, mage.cards.b.BindingTheOldGods.class)); cards.add(new SetCardInfo("Birgi, God of Storytelling", 123, Rarity.RARE, mage.cards.b.BirgiGodOfStorytelling.class)); cards.add(new SetCardInfo("Blightstep Pathway", 252, Rarity.RARE, mage.cards.b.BlightstepPathway.class));