From 89594164844f05672de576a7b1fa3268a205f9aa Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Wed, 13 Jan 2021 19:44:57 -0600 Subject: [PATCH] [KHM] Implemented Bound in Gold (#7386) --- Mage.Sets/src/mage/cards/b/BoundInGold.java | 99 +++++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + 2 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BoundInGold.java diff --git a/Mage.Sets/src/mage/cards/b/BoundInGold.java b/Mage.Sets/src/mage/cards/b/BoundInGold.java new file mode 100644 index 0000000000..b114582c84 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BoundInGold.java @@ -0,0 +1,99 @@ +package mage.cards.b; + +import java.util.Optional; +import java.util.UUID; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.combat.CantAttackBlockAttachedEffect; +import mage.constants.*; +import mage.abilities.Ability; +import mage.abilities.effects.common.AttachEffect; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; + +/** + * + * @author weirddan455 + */ +public final class BoundInGold extends CardImpl { + + public BoundInGold(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); + + this.subtype.add(SubType.AURA); + + // Enchant permanent + TargetPermanent auraTarget = new TargetPermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Removal)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted permanent can't attack, block, or crew Vehicles, + // and its activated abilities can't be activated unless they're mana abilities. + ability = new SimpleStaticAbility(new CantAttackBlockAttachedEffect(AttachmentType.AURA) + .setText("Enchanted permanent can't attack, block")); + ability.addEffect(new BoundInGoldEffect()); + this.addAbility(ability); + } + + private BoundInGold(final BoundInGold card) { + super(card); + } + + @Override + public BoundInGold copy() { + return new BoundInGold(this); + } +} + +class BoundInGoldEffect extends ContinuousRuleModifyingEffectImpl { + + public BoundInGoldEffect() { + super(Duration.WhileOnBattlefield, Outcome.Detriment); + staticText = ", or crew Vehicles, and its activated abilities can't be activated unless they're mana abilities"; + } + + private BoundInGoldEffect(final BoundInGoldEffect effect) { + super(effect); + } + + @Override + public BoundInGoldEffect copy() { + return new BoundInGoldEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + switch (event.getType()) { + case CREW_VEHICLE: + case ACTIVATE_ABILITY: + return true; + default: + return false; + } + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent enchantment = game.getPermanent(source.getSourceId()); + if (enchantment != null) { + switch (event.getType()) { + case CREW_VEHICLE: + return enchantment.isAttachedTo(event.getTargetId()); + case ACTIVATE_ABILITY: + if (enchantment.isAttachedTo(event.getSourceId())) { + Optional ability = game.getAbility(event.getTargetId(), event.getSourceId()); + return ability.isPresent() && ability.get().getAbilityType() != AbilityType.MANA; + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index ef65792f49..4666f7d017 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -71,6 +71,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Blizzard Brawl", 162, Rarity.UNCOMMON, mage.cards.b.BlizzardBrawl.class)); cards.add(new SetCardInfo("Bloodline Pretender", 235, Rarity.UNCOMMON, mage.cards.b.BloodlinePretender.class)); cards.add(new SetCardInfo("Bloodsky Berserker", 80, Rarity.UNCOMMON, mage.cards.b.BloodskyBerserker.class)); + cards.add(new SetCardInfo("Bound in Gold", 5, Rarity.COMMON, mage.cards.b.BoundInGold.class)); cards.add(new SetCardInfo("Bretagard Stronghold", 253, Rarity.UNCOMMON, mage.cards.b.BretagardStronghold.class)); cards.add(new SetCardInfo("Broken Wings", 164, Rarity.COMMON, mage.cards.b.BrokenWings.class)); cards.add(new SetCardInfo("Calamity Bearer", 125, Rarity.RARE, mage.cards.c.CalamityBearer.class));