[DSK] Implement Cursed Windbreaker

This commit is contained in:
theelk801 2024-09-05 10:24:09 -04:00
parent 3e14a122da
commit 0127d52f24
3 changed files with 97 additions and 5 deletions

View file

@ -0,0 +1,83 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.effects.keyword.ManifestDreadEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CursedWindbreaker extends CardImpl {
public CursedWindbreaker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{U}");
this.subtype.add(SubType.EQUIPMENT);
// When Cursed Windbreaker enters, manifest dread, then attach Cursed Windbreaker to that creature.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CursedWindbreakerEffect()));
// Equipped creature has flying.
this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect(
FlyingAbility.getInstance(), AttachmentType.EQUIPMENT
)));
// Equip {3}
this.addAbility(new EquipAbility(3));
}
private CursedWindbreaker(final CursedWindbreaker card) {
super(card);
}
@Override
public CursedWindbreaker copy() {
return new CursedWindbreaker(this);
}
}
class CursedWindbreakerEffect extends OneShotEffect {
CursedWindbreakerEffect() {
super(Outcome.Benefit);
staticText = "manifest dread, then attach {this} to that creature";
}
private CursedWindbreakerEffect(final CursedWindbreakerEffect effect) {
super(effect);
}
@Override
public CursedWindbreakerEffect copy() {
return new CursedWindbreakerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Permanent creature = ManifestDreadEffect.doManifestDread(player, source, game);
Permanent equipment = source.getSourcePermanentIfItStillExists(game);
return creature != null
&& equipment != null
&& creature.addAttachment(equipment.getId(), source, game);
}
}

View file

@ -27,6 +27,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet {
cards.add(new SetCardInfo("Chainsaw", 128, Rarity.RARE, mage.cards.c.Chainsaw.class));
cards.add(new SetCardInfo("Clockwork Percussionist", 130, Rarity.COMMON, mage.cards.c.ClockworkPercussionist.class));
cards.add(new SetCardInfo("Cursed Recording", 131, Rarity.RARE, mage.cards.c.CursedRecording.class));
cards.add(new SetCardInfo("Cursed Windbreaker", 47, Rarity.UNCOMMON, mage.cards.c.CursedWindbreaker.class));
cards.add(new SetCardInfo("Demonic Counsel", 92, Rarity.RARE, mage.cards.d.DemonicCounsel.class));
cards.add(new SetCardInfo("Disturbing Mirth", 212, Rarity.UNCOMMON, mage.cards.d.DisturbingMirth.class));
cards.add(new SetCardInfo("Doomsday Excruciator", 94, Rarity.RARE, mage.cards.d.DoomsdayExcruciator.class));

View file

@ -8,6 +8,7 @@ import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
@ -34,15 +35,15 @@ public class ManifestDreadEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
return player != null && doManifestDread(player, source, game);
return player != null && doManifestDread(player, source, game) != null;
}
public static boolean doManifestDread(Player player, Ability source, Game game) {
public static Permanent doManifestDread(Player player, Ability source, Game game) {
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 2));
Card card;
switch (cards.size()) {
case 0:
return false;
return null;
case 1:
card = cards.getRandom(game);
break;
@ -52,11 +53,18 @@ public class ManifestDreadEffect extends OneShotEffect {
player.choose(Outcome.PutCreatureInPlay, target, source, game);
card = cards.get(target.getFirstTarget(), game);
}
Permanent permanent;
if (card != null) {
ManifestEffect.doManifestCards(game, source, player, new CardsImpl(card).getCards(game));
permanent = ManifestEffect
.doManifestCards(game, source, player, new CardsImpl(card).getCards(game))
.stream()
.findFirst()
.orElse(null);
} else {
permanent = null;
}
cards.retainZone(Zone.LIBRARY, game);
player.moveCards(cards, Zone.GRAVEYARD, source, game);
return true;
return permanent;
}
}