diff --git a/Mage.Sets/src/mage/cards/w/WylethSoulOfSteel.java b/Mage.Sets/src/mage/cards/w/WylethSoulOfSteel.java new file mode 100644 index 00000000000..831ab58f365 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WylethSoulOfSteel.java @@ -0,0 +1,85 @@ +package mage.cards.w; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WylethSoulOfSteel extends CardImpl { + + public WylethSoulOfSteel(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever Wyleth, Soul of Steel attacks, draw a card for each Aura and Equipment attached to it. + this.addAbility(new AttacksTriggeredAbility(new DrawCardSourceControllerEffect(WylethSoulOfSteelValue.instance), false)); + } + + private WylethSoulOfSteel(final WylethSoulOfSteel card) { + super(card); + } + + @Override + public WylethSoulOfSteel copy() { + return new WylethSoulOfSteel(this); + } +} + +enum WylethSoulOfSteelValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Permanent permanent = sourceAbility.getSourcePermanentOrLKI(game); + if (permanent == null) { + return 0; + } + return permanent + .getAttachments() + .stream() + .map(game::getPermanentOrLKIBattlefield) + .filter(Objects::nonNull) + .map(p -> p.hasSubtype(SubType.EQUIPMENT, game) || p.hasSubtype(SubType.AURA, game)) + .mapToInt(b -> b ? 1 : 0) + .sum(); + } + + @Override + public WylethSoulOfSteelValue copy() { + return instance; + } + + @Override + public String getMessage() { + return "Aura and Equipment attached to it"; + } + + @Override + public String toString() { + return "1"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CommanderLegends.java b/Mage.Sets/src/mage/sets/CommanderLegends.java index 7cfc42ca5ac..32e9230648f 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegends.java +++ b/Mage.Sets/src/mage/sets/CommanderLegends.java @@ -518,6 +518,7 @@ public final class CommanderLegends extends ExpansionSet { cards.add(new SetCardInfo("Word of Seizing", 420, Rarity.RARE, mage.cards.w.WordOfSeizing.class)); cards.add(new SetCardInfo("Workshop Assistant", 348, Rarity.COMMON, mage.cards.w.WorkshopAssistant.class)); cards.add(new SetCardInfo("Wrong Turn", 107, Rarity.RARE, mage.cards.w.WrongTurn.class)); + cards.add(new SetCardInfo("Wyleth, Soul of Steel", 362, Rarity.MYTHIC, mage.cards.w.WylethSoulOfSteel.class)); cards.add(new SetCardInfo("Xenagos, God of Revels", 541, Rarity.MYTHIC, mage.cards.x.XenagosGodOfRevels.class)); cards.add(new SetCardInfo("Yavimaya Elder", 441, Rarity.COMMON, mage.cards.y.YavimayaElder.class)); cards.add(new SetCardInfo("Yuriko, the Tiger's Shadow", 542, Rarity.MYTHIC, mage.cards.y.YurikoTheTigersShadow.class));