From 9886dbb442df38e3ae951be4006be1477935e17c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 2 Jun 2021 07:41:30 -0400 Subject: [PATCH] [MH2] Implemented Blacksmith's Skill --- .../src/mage/cards/b/BlacksmithsSkill.java | 74 +++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons2.java | 1 + 2 files changed, 75 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BlacksmithsSkill.java diff --git a/Mage.Sets/src/mage/cards/b/BlacksmithsSkill.java b/Mage.Sets/src/mage/cards/b/BlacksmithsSkill.java new file mode 100644 index 0000000000..ad83eeceac --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BlacksmithsSkill.java @@ -0,0 +1,74 @@ +package mage.cards.b; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.HexproofAbility; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BlacksmithsSkill extends CardImpl { + + public BlacksmithsSkill(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}"); + + // Target permanent gains hexproof and indestructible until end of turn. If it's an artifact creature, it gets +2/+2 until end of turn. + this.getSpellAbility().addEffect(new GainAbilityTargetEffect( + HexproofAbility.getInstance(), Duration.EndOfTurn + ).setText("target permanent gains hexproof")); + this.getSpellAbility().addEffect(new GainAbilityTargetEffect( + IndestructibleAbility.getInstance(), Duration.EndOfTurn + ).setText("and indestructible until end of turn.")); + this.getSpellAbility().addEffect(new BlacksmithsSkillEffect()); + this.getSpellAbility().addTarget(new TargetPermanent()); + } + + private BlacksmithsSkill(final BlacksmithsSkill card) { + super(card); + } + + @Override + public BlacksmithsSkill copy() { + return new BlacksmithsSkill(this); + } +} + +class BlacksmithsSkillEffect extends OneShotEffect { + + BlacksmithsSkillEffect() { + super(Outcome.Benefit); + staticText = "If it's an artifact creature, it gets +2/+2 until end of turn"; + } + + private BlacksmithsSkillEffect(final BlacksmithsSkillEffect effect) { + super(effect); + } + + @Override + public BlacksmithsSkillEffect copy() { + return new BlacksmithsSkillEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent != null && permanent.isArtifact() && permanent.isCreature()) { + game.addEffect(new BoostTargetEffect(2, 2), source); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons2.java b/Mage.Sets/src/mage/sets/ModernHorizons2.java index f38b0e5161..d81fbbb216 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons2.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons2.java @@ -45,6 +45,7 @@ public final class ModernHorizons2 extends ExpansionSet { cards.add(new SetCardInfo("Barbed Spike", 5, Rarity.UNCOMMON, mage.cards.b.BarbedSpike.class)); cards.add(new SetCardInfo("Batterbone", 221, Rarity.UNCOMMON, mage.cards.b.Batterbone.class)); cards.add(new SetCardInfo("Battle Plan", 114, Rarity.COMMON, mage.cards.b.BattlePlan.class)); + cards.add(new SetCardInfo("Blacksmith's Skill", 6, Rarity.COMMON, mage.cards.b.BlacksmithsSkill.class)); cards.add(new SetCardInfo("Bloodbraid Marauder", 116, Rarity.RARE, mage.cards.b.BloodbraidMarauder.class)); cards.add(new SetCardInfo("Bone Shards", 76, Rarity.COMMON, mage.cards.b.BoneShards.class)); cards.add(new SetCardInfo("Bone Shredder", 272, Rarity.UNCOMMON, mage.cards.b.BoneShredder.class));