[LTR] Implement Witch-king, Bringer of Ruin

This commit is contained in:
theelk801 2023-06-10 18:26:10 -04:00
parent 4de62d3f5a
commit c5d3bd3d29
2 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,88 @@
package mage.cards.w;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WitchKingBringerOfRuin extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledCreaturePermanent("creature with the least power among creatures you control");
static {
filter.add(WitchKingBringerOfRuinPredicate.instance);
}
public WitchKingBringerOfRuin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.WRAITH);
this.subtype.add(SubType.NOBLE);
this.power = new MageInt(5);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Witch-king, Bringer of Ruin attacks, defending player sacrifices a creature with the least power among creatures they control.
this.addAbility(new AttacksTriggeredAbility(
new SacrificeEffect(filter, 1, "")
.setText("defending player sacrifices a creature " +
"with the least power among creatures they control"),
false, null, SetTargetPointer.PLAYER
));
}
private WitchKingBringerOfRuin(final WitchKingBringerOfRuin card) {
super(card);
}
@Override
public WitchKingBringerOfRuin copy() {
return new WitchKingBringerOfRuin(this);
}
}
enum WitchKingBringerOfRuinPredicate implements ObjectSourcePlayerPredicate<Permanent> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
return input
.getObject()
.getPower()
.getValue()
<= game
.getBattlefield()
.getActivePermanents(
StaticFilters.FILTER_CONTROLLED_CREATURE,
input.getPlayerId(), input.getSource(), game
)
.stream()
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.min()
.orElse(0);
}
}

View file

@ -215,6 +215,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
cards.add(new SetCardInfo("Warbeast of Gorgoroth", 152, Rarity.COMMON, mage.cards.w.WarbeastOfGorgoroth.class));
cards.add(new SetCardInfo("Westfold Rider", 37, Rarity.COMMON, mage.cards.w.WestfoldRider.class));
cards.add(new SetCardInfo("Willow-Wind", 76, Rarity.COMMON, mage.cards.w.WillowWind.class));
cards.add(new SetCardInfo("Witch-king, Bringer of Ruin", 293, Rarity.RARE, mage.cards.w.WitchKingBringerOfRuin.class));
cards.add(new SetCardInfo("Wizard's Rockets", 252, Rarity.COMMON, mage.cards.w.WizardsRockets.class));
cards.add(new SetCardInfo("Wose Pathfinder", 190, Rarity.COMMON, mage.cards.w.WosePathfinder.class));
cards.add(new SetCardInfo("You Cannot Pass!", 38, Rarity.UNCOMMON, mage.cards.y.YouCannotPass.class));