[DSK] Implement Doomsday Excruciator

This commit is contained in:
theelk801 2024-06-28 15:38:37 -04:00
parent f53fb22916
commit 04e3172d14
2 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,98 @@
package mage.cards.d;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class DoomsdayExcruciator extends CardImpl {
public DoomsdayExcruciator(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{B}{B}{B}{B}{B}");
this.subtype.add(SubType.DEMON);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Doomsday Excruciator enters, if it was cast, each player exiles all but the bottom six cards of their library face down.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new DoomsdayExcruciatorEffect()),
CastFromEverywhereSourceCondition.instance, "When {this} enters, if it was cast, " +
"each player exiles all but the bottom six cards of their library face down."
));
// At the beginning of your upkeep, draw a card.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new DrawCardSourceControllerEffect(1), TargetController.YOU, false
));
}
private DoomsdayExcruciator(final DoomsdayExcruciator card) {
super(card);
}
@Override
public DoomsdayExcruciator copy() {
return new DoomsdayExcruciator(this);
}
}
class DoomsdayExcruciatorEffect extends OneShotEffect {
DoomsdayExcruciatorEffect() {
super(Outcome.Benefit);
}
private DoomsdayExcruciatorEffect(final DoomsdayExcruciatorEffect effect) {
super(effect);
}
@Override
public DoomsdayExcruciatorEffect copy() {
return new DoomsdayExcruciatorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Cards cards = new CardsImpl();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player == null) {
continue;
}
int amount = player.getLibrary().size() - 6;
if (amount > 0) {
player.getLibrary().getTopCards(game, amount);
}
}
controller.moveCards(cards, Zone.EXILED, source, game);
cards.getCards(game)
.stream()
.forEach(card -> card.setFaceDown(true, game));
return true;
}
}

View file

@ -22,6 +22,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet {
this.hasBoosters = false; // temporary
cards.add(new SetCardInfo("Cursed Recording", 131, Rarity.RARE, mage.cards.c.CursedRecording.class));
cards.add(new SetCardInfo("Doomsday Excruciator", 346, Rarity.RARE, mage.cards.d.DoomsdayExcruciator.class));
cards.add(new SetCardInfo("Enduring Tenacity", 95, Rarity.RARE, mage.cards.e.EnduringTenacity.class));
cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Island", 273, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));