Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DSK] Implement Ghost Vacuum #13072

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions Mage.Sets/src/mage/cards/g/GhostVacuum.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
2 changes: 2 additions & 0 deletions Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ private DuskmournHouseOfHorror() {
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("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("Glimmer Seeker", 14, Rarity.UNCOMMON, mage.cards.g.GlimmerSeeker.class));
cards.add(new SetCardInfo("Glimmerburst", 62, Rarity.COMMON, mage.cards.g.Glimmerburst.class));
Expand Down