[NEC] Implemented Rampant Rejuvenator

This commit is contained in:
Evan Kranzler 2022-02-08 21:29:08 -05:00
parent 9b77b0edbd
commit b9eb8c8309
2 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,99 @@
package mage.cards.r;
import mage.MageInt;
import mage.MageItem;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
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.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RampantRejuvenator extends CardImpl {
public RampantRejuvenator(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.PLANT);
this.subtype.add(SubType.HYDRA);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Rampant Rejuvenator enters the battlefield with two +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(
CounterType.P1P1.createInstance(2)
), "with two +1/+1 counters on it"));
// When Rampant Rejuvenator dies, search your library for up to X basic land cards, where X is Rampant Rejuvenator's power, put them onto the battlefield, then shuffle.
this.addAbility(new DiesSourceTriggeredAbility(new RampantRejuvenatorEffect()));
}
private RampantRejuvenator(final RampantRejuvenator card) {
super(card);
}
@Override
public RampantRejuvenator copy() {
return new RampantRejuvenator(this);
}
}
class RampantRejuvenatorEffect extends OneShotEffect {
RampantRejuvenatorEffect() {
super(Outcome.Benefit);
staticText = "search your library for up to X basic land cards, " +
"where X is {this}'s power, put them onto the battlefield, then shuffle";
}
private RampantRejuvenatorEffect(final RampantRejuvenatorEffect effect) {
super(effect);
}
@Override
public RampantRejuvenatorEffect copy() {
return new RampantRejuvenatorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = source.getSourcePermanentOrLKI(game);
if (player == null || permanent == null) {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(
0, permanent.getPower().getValue(),
StaticFilters.FILTER_CARD_BASIC_LANDS
);
player.searchLibrary(target, source, game);
Cards cards = new CardsImpl();
player.getLibrary()
.getCards(game)
.stream()
.map(MageItem::getId)
.filter(target.getTargets()::contains)
.forEach(cards::add);
player.moveCards(cards, Zone.BATTLEFIELD, source, game);
player.shuffleLibrary(source, game);
return true;
}
}

View file

@ -95,6 +95,7 @@ public final class NeonDynastyCommander extends ExpansionSet {
cards.add(new SetCardInfo("Raging Ravine", 176, Rarity.RARE, mage.cards.r.RagingRavine.class));
cards.add(new SetCardInfo("Raiders' Karve", 156, Rarity.COMMON, mage.cards.r.RaidersKarve.class));
cards.add(new SetCardInfo("Rampant Growth", 125, Rarity.COMMON, mage.cards.r.RampantGrowth.class));
cards.add(new SetCardInfo("Rampant Rejuvenator", 28, Rarity.RARE, mage.cards.r.RampantRejuvenator.class));
cards.add(new SetCardInfo("Reality Shift", 95, Rarity.UNCOMMON, mage.cards.r.RealityShift.class));
cards.add(new SetCardInfo("Release to Memory", 9, Rarity.RARE, mage.cards.r.ReleaseToMemory.class));
cards.add(new SetCardInfo("Research Thief", 16, Rarity.RARE, mage.cards.r.ResearchThief.class));