[DSK] Implement Ghost Vacuum (#13072)

This commit is contained in:
Cameron Merkel 2024-11-30 11:45:57 -06:00 committed by GitHub
parent 52c4675d97
commit ecb5dccfae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 116 additions and 0 deletions

View file

@ -0,0 +1,114 @@
package mage.cards.g;
import java.util.Objects;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.continuous.AddCreatureTypeAdditionEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessTargetEffect;
import mage.cards.*;
import mage.constants.*;
import mage.counters.CounterType;
import mage.counters.Counters;
import mage.filter.StaticFilters;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
/**
* @author Cguy7777
*/
public final class GhostVacuum extends CardImpl {
public GhostVacuum(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
// {T}: Exile target card from a graveyard.
Ability exileAbility
= new SimpleActivatedAbility(new ExileTargetEffect().setToSourceExileZone(true), new TapSourceCost());
exileAbility.addTarget(new TargetCardInGraveyard());
this.addAbility(exileAbility);
// {6}, {T}, Sacrifice Ghost Vacuum:
// Put each creature card exiled with Ghost Vacuum onto the battlefield under your control with a flying counter on it.
// Each of them is a 1/1 Spirit in addition to its other types. Activate only as a sorcery.
Ability putOntoBattlefieldAbility
= new ActivateAsSorceryActivatedAbility(new GhostVacuumEffect(), new GenericManaCost(6));
putOntoBattlefieldAbility.addCost(new TapSourceCost());
putOntoBattlefieldAbility.addCost(new SacrificeSourceCost());
this.addAbility(putOntoBattlefieldAbility);
}
private GhostVacuum(final GhostVacuum card) {
super(card);
}
@Override
public GhostVacuum copy() {
return new GhostVacuum(this);
}
}
class GhostVacuumEffect extends OneShotEffect {
GhostVacuumEffect() {
super(Outcome.Benefit);
staticText = "Put each creature card exiled with {this} onto the battlefield under your control " +
"with a flying counter on it. Each of them is a 1/1 Spirit in addition to its other types.";
}
private GhostVacuumEffect(final GhostVacuumEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source));
if (player == null || exileZone == null || exileZone.isEmpty()) {
return false;
}
// Put each creature card exiled with Ghost Vacuum
// onto the battlefield under your control with a flying counter on it.
Cards creatureCards = new CardsImpl(exileZone.getCards(StaticFilters.FILTER_CARD_CREATURE, game));
Counters countersToAdd = new Counters();
countersToAdd.addCounter(CounterType.FLYING.createInstance());
for (Card card : creatureCards.getCards(game)) {
game.setEnterWithCounters(card.getId(), countersToAdd.copy());
}
player.moveCards(creatureCards, Zone.BATTLEFIELD, source, game);
creatureCards.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.forEach(permanent -> {
// Each of them is a 1/1 Spirit in addition to its other types.
ContinuousEffect effect = new SetBasePowerToughnessTargetEffect(1, 1, Duration.EndOfGame);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
effect = new AddCreatureTypeAdditionEffect(SubType.SPIRIT, false);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
});
return true;
}
@Override
public GhostVacuumEffect copy() {
return new GhostVacuumEffect(this);
}
}

View file

@ -103,6 +103,8 @@ public final class DuskmournHouseOfHorror extends ExpansionSet {
cards.add(new SetCardInfo("Friendly Ghost", 12, Rarity.COMMON, mage.cards.f.FriendlyGhost.class)); cards.add(new SetCardInfo("Friendly Ghost", 12, Rarity.COMMON, mage.cards.f.FriendlyGhost.class));
cards.add(new SetCardInfo("Friendly Teddy", 247, Rarity.COMMON, mage.cards.f.FriendlyTeddy.class)); cards.add(new SetCardInfo("Friendly Teddy", 247, Rarity.COMMON, mage.cards.f.FriendlyTeddy.class));
cards.add(new SetCardInfo("Get Out", 60, Rarity.UNCOMMON, mage.cards.g.GetOut.class)); cards.add(new SetCardInfo("Get Out", 60, Rarity.UNCOMMON, mage.cards.g.GetOut.class));
cards.add(new SetCardInfo("Ghost Vacuum", 248, Rarity.RARE, mage.cards.g.GhostVacuum.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ghost Vacuum", 326, Rarity.RARE, mage.cards.g.GhostVacuum.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Give In to Violence", 101, Rarity.COMMON, mage.cards.g.GiveInToViolence.class)); cards.add(new SetCardInfo("Give In to Violence", 101, Rarity.COMMON, mage.cards.g.GiveInToViolence.class));
cards.add(new SetCardInfo("Glimmer Seeker", 14, Rarity.UNCOMMON, mage.cards.g.GlimmerSeeker.class)); cards.add(new SetCardInfo("Glimmer Seeker", 14, Rarity.UNCOMMON, mage.cards.g.GlimmerSeeker.class));
cards.add(new SetCardInfo("Glimmerburst", 62, Rarity.COMMON, mage.cards.g.Glimmerburst.class)); cards.add(new SetCardInfo("Glimmerburst", 62, Rarity.COMMON, mage.cards.g.Glimmerburst.class));