mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Merge pull request #5140 from NoahGleason/dicotomancy
Implement Dichotomancy
This commit is contained in:
commit
cc584a1393
2 changed files with 99 additions and 0 deletions
98
Mage.Sets/src/mage/cards/d/Dichotomancy.java
Normal file
98
Mage.Sets/src/mage/cards/d/Dichotomancy.java
Normal file
|
@ -0,0 +1,98 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.SuspendAbility;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.common.FilterNonlandPermanent;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noahg
|
||||
*/
|
||||
public final class Dichotomancy extends CardImpl {
|
||||
|
||||
public Dichotomancy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{7}{U}{U}");
|
||||
|
||||
|
||||
// For each tapped nonland permanent target opponent controls, search that player’s library for a card with the same name as that permanent and put it onto the battlefield under your control. Then that player shuffles their library.
|
||||
this.getSpellAbility().addEffect(new DichotomancyEffect());
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
|
||||
// Suspend 3-{1}{U}{U}
|
||||
this.addAbility(new SuspendAbility(3, new ManaCostsImpl("{1}{U}{U}"), this));
|
||||
}
|
||||
|
||||
public Dichotomancy(final Dichotomancy card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dichotomancy copy() {
|
||||
return new Dichotomancy(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DichotomancyEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterNonlandPermanent filter = new FilterNonlandPermanent();
|
||||
|
||||
static {
|
||||
filter.add(new TappedPredicate());
|
||||
}
|
||||
|
||||
public DichotomancyEffect() {
|
||||
super(Outcome.PutCardInPlay);
|
||||
this.staticText = "For each tapped nonland permanent target opponent controls, search that player’s library for a card with the same name as that permanent and put it onto the battlefield under your control. Then that player shuffles their library";
|
||||
}
|
||||
|
||||
public DichotomancyEffect(DichotomancyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && opponent != null) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, opponent.getId(), game)) {
|
||||
String name = permanent.getName();
|
||||
FilterCard filterCard = new FilterCard("card named \""+name+'"');
|
||||
filterCard.add(new NamePredicate(name));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filterCard);
|
||||
if (controller.searchLibrary(target, game, opponent.getId())) {
|
||||
controller.moveCards(opponent.getLibrary().getCard(target.getFirstTarget(), game), Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
opponent.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DichotomancyEffect copy() {
|
||||
return new DichotomancyEffect(this);
|
||||
}
|
||||
}
|
|
@ -61,6 +61,7 @@ public final class PlanarChaos extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Deadly Grub", 69, Rarity.COMMON, mage.cards.d.DeadlyGrub.class));
|
||||
cards.add(new SetCardInfo("Deadwood Treefolk", 126, Rarity.UNCOMMON, mage.cards.d.DeadwoodTreefolk.class));
|
||||
cards.add(new SetCardInfo("Detritivore", 96, Rarity.RARE, mage.cards.d.Detritivore.class));
|
||||
cards.add(new SetCardInfo("Dichotomancy", 38, Rarity.RARE, mage.cards.d.Dichotomancy.class));
|
||||
cards.add(new SetCardInfo("Dismal Failure", 39, Rarity.UNCOMMON, mage.cards.d.DismalFailure.class));
|
||||
cards.add(new SetCardInfo("Dormant Sliver", 156, Rarity.UNCOMMON, mage.cards.d.DormantSliver.class));
|
||||
cards.add(new SetCardInfo("Dreamscape Artist", 40, Rarity.COMMON, mage.cards.d.DreamscapeArtist.class));
|
||||
|
|
Loading…
Reference in a new issue