From 7c8188997206acfb114442c1f1bbe879e962f94e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 6 Sep 2019 21:55:40 -0400 Subject: [PATCH] Implemented Smitten Swordmaster --- .../src/mage/cards/s/SmittenSwordmaster.java | 77 +++++++++++++++++++ Mage.Sets/src/mage/sets/ThroneOfEldraine.java | 1 + 2 files changed, 78 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SmittenSwordmaster.java diff --git a/Mage.Sets/src/mage/cards/s/SmittenSwordmaster.java b/Mage.Sets/src/mage/cards/s/SmittenSwordmaster.java new file mode 100644 index 0000000000..6b8641545e --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SmittenSwordmaster.java @@ -0,0 +1,77 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.LoseLifeOpponentsEffect; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.AdventureCard; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SmittenSwordmaster extends AdventureCard { + + public SmittenSwordmaster(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, new CardType[]{CardType.SORCERY}, "{1}{B}", "Curry Favor", "{B}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.KNIGHT); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + + // Curry Favor + // You gain X life and each opponent loses X life, where X is the number of Knights you control. + this.getAdventureSpellAbility().addEffect(new CurryFavorEffect()); + } + + private SmittenSwordmaster(final SmittenSwordmaster card) { + super(card); + } + + @Override + public SmittenSwordmaster copy() { + return new SmittenSwordmaster(this); + } +} + +class CurryFavorEffect extends OneShotEffect { + + CurryFavorEffect() { + super(Outcome.Benefit); + staticText = "you gain X life and each opponent loses X life, where X is the number of Knights you control"; + } + + private CurryFavorEffect(final CurryFavorEffect effect) { + super(effect); + } + + @Override + public CurryFavorEffect copy() { + return new CurryFavorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int xValue = game.getBattlefield() + .getAllActivePermanents(source.getControllerId()) + .stream() + .filter(permanent -> permanent != null && permanent.hasSubtype(SubType.KNIGHT, game)) + .mapToInt(p -> 1) + .sum(); + new GainLifeEffect(xValue).apply(game, source); + new LoseLifeOpponentsEffect(xValue).apply(game, source); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index af77c028db..3b5aab37dc 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -69,6 +69,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Shining Armor", 29, Rarity.COMMON, mage.cards.s.ShiningArmor.class)); cards.add(new SetCardInfo("Silverflame Ritual", 30, Rarity.COMMON, mage.cards.s.SilverflameRitual.class)); cards.add(new SetCardInfo("Slaying Fire", 143, Rarity.UNCOMMON, mage.cards.s.SlayingFire.class)); + cards.add(new SetCardInfo("Smitten Swordmaster", 105, Rarity.COMMON, mage.cards.s.SmittenSwordmaster.class)); cards.add(new SetCardInfo("Steelbane Hydra", 322, Rarity.RARE, mage.cards.s.SteelbaneHydra.class)); cards.add(new SetCardInfo("Steelclaw Lance", 202, Rarity.UNCOMMON, mage.cards.s.SteelclawLance.class)); cards.add(new SetCardInfo("Syr Gwyn, Hero of Ashenvale", 330, Rarity.MYTHIC, mage.cards.s.SyrGwynHeroOfAshenvale.class));