[CMR] Implemented Rootweaver Druid

This commit is contained in:
Evan Kranzler 2020-11-07 20:35:05 -05:00
parent ea83757b41
commit f98e1da9a9
2 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,106 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RootweaverDruid extends CardImpl {
public RootweaverDruid(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.DRUID);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// When Rootweaver Druid enters the battlefield, each opponent may search their library for up to three basic land cards. They each put one of those cards onto the battlefield tapped under your control and the rest onto the battlefield tapped under their control. Then each player who searched their library this way shuffles it.
this.addAbility(new EntersBattlefieldTriggeredAbility(new RootweaverDruidEffect()));
}
private RootweaverDruid(final RootweaverDruid card) {
super(card);
}
@Override
public RootweaverDruid copy() {
return new RootweaverDruid(this);
}
}
class RootweaverDruidEffect extends OneShotEffect {
RootweaverDruidEffect() {
super(Outcome.Benefit);
staticText = "each opponent may search their library for up to three basic land cards. " +
"They each put one of those cards onto the battlefield tapped under your control " +
"and the rest onto the battlefield tapped under their control. " +
"Then each player who searched their library this way shuffles it";
}
private RootweaverDruidEffect(final RootweaverDruidEffect effect) {
super(effect);
}
@Override
public RootweaverDruidEffect copy() {
return new RootweaverDruidEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Cards mine = new CardsImpl();
Cards theirs = new CardsImpl();
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player player = game.getPlayer(playerId);
if (player == null || !player.chooseUse(outcome, "Search your library?", source, game)) {
continue;
}
TargetCardInLibrary target = new TargetCardInLibrary(
0, 3, StaticFilters.FILTER_CARD_BASIC_LAND
);
player.searchLibrary(target, source, game);
player.shuffleLibrary(source, game);
Cards cards = new CardsImpl(target.getTargets());
if (cards.isEmpty()) {
continue;
}
target = new TargetCardInLibrary();
player.choose(outcome, cards, target, game);
mine.addAll(target.getTargets());
cards.removeAll(target.getTargets());
theirs.addAll(cards);
}
controller.moveCards(
mine.getCards(game), Zone.BATTLEFIELD, source, game,
true, false, false, null
);
controller.moveCards(
theirs.getCards(game), Zone.BATTLEFIELD, source, game,
true, false, true, null
);
return true;
}
}

View file

@ -382,6 +382,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Ripscale Predator", 196, Rarity.COMMON, mage.cards.r.RipscalePredator.class));
cards.add(new SetCardInfo("Rograkh, Son of Rohgahh", 197, Rarity.UNCOMMON, mage.cards.r.RograkhSonOfRohgahh.class));
cards.add(new SetCardInfo("Rogue's Passage", 489, Rarity.UNCOMMON, mage.cards.r.RoguesPassage.class));
cards.add(new SetCardInfo("Rootweaver Druid", 250, Rarity.RARE, mage.cards.r.RootweaverDruid.class));
cards.add(new SetCardInfo("Rummaging Goblin", 198, Rarity.COMMON, mage.cards.r.RummagingGoblin.class));
cards.add(new SetCardInfo("Run Away Together", 87, Rarity.COMMON, mage.cards.r.RunAwayTogether.class));
cards.add(new SetCardInfo("Rupture Spire", 355, Rarity.COMMON, mage.cards.r.RuptureSpire.class));