[MH2] Implemented Blacksmith's Skill

This commit is contained in:
Evan Kranzler 2021-06-02 07:41:30 -04:00
parent 9da4c491f4
commit 9886dbb442
2 changed files with 75 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));