[CMR] Implemented Wyleth, Soul of Steel

This commit is contained in:
Evan Kranzler 2020-11-06 18:31:07 -05:00
parent 4beeac9e6a
commit b4c0a504b5
2 changed files with 86 additions and 0 deletions

View file

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

View file

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