Update Ureni of the Unwritten

replace custom effect with LookLibraryAndPickControllerEffect
This commit is contained in:
jmlundeen 2025-04-06 15:27:06 -05:00
parent 95d5d373ce
commit fd1e814427

View file

@ -1,24 +1,18 @@
package mage.cards.u;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility;
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.PutCards;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID;
@ -27,6 +21,12 @@ import java.util.UUID;
*/
public final class UreniOfTheUnwritten extends CardImpl {
static final FilterCreatureCard filter = new FilterCreatureCard("Dragon creature card");
static {
filter.add(SubType.DRAGON.getPredicate());
}
public UreniOfTheUnwritten(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{U}{R}");
@ -43,7 +43,8 @@ public final class UreniOfTheUnwritten extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// Whenever Ureni enters or attacks, look at the top eight cards of your library. You may put a Dragon creature card from among them onto the battlefield. Put the rest on the bottom of your library in a random order.
this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new UreniOfTheUnwrittenEffect(), false));
Effect effect = new LookLibraryAndPickControllerEffect(8, 1, filter, PutCards.BATTLEFIELD, PutCards.BOTTOM_RANDOM);
this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(effect, false));
}
private UreniOfTheUnwritten(final UreniOfTheUnwritten card) {
@ -54,41 +55,4 @@ public final class UreniOfTheUnwritten extends CardImpl {
public UreniOfTheUnwritten copy() {
return new UreniOfTheUnwritten(this);
}
}
class UreniOfTheUnwrittenEffect extends OneShotEffect {
UreniOfTheUnwrittenEffect() {
super(Outcome.Benefit);
this.staticText = "look at the top eight cards of your library. You may put a Dragon creature card from among them onto the battlefield. Put the rest on the bottom of your library in a random order.";
}
private UreniOfTheUnwrittenEffect(final mage.cards.u.UreniOfTheUnwrittenEffect effect) {
super(effect);
}
@Override
public mage.cards.u.UreniOfTheUnwrittenEffect copy() {
return new mage.cards.u.UreniOfTheUnwrittenEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 8));
if (!cards.isEmpty()) {
FilterCreatureCard filter = new FilterCreatureCard("Dragon creature cards");
filter.add(SubType.DRAGON.getPredicate());
TargetCard targetCard = new TargetCard(0, 1, Zone.LIBRARY, filter);
targetCard.withNotTarget(true);
controller.choose(Outcome.PutCreatureInPlay, cards, targetCard, source, game);
controller.moveCards(game.getCard(targetCard.getFirstTarget()), Zone.BATTLEFIELD, source, game);
cards.retainZone(Zone.LIBRARY, game);
controller.putCardsOnBottomOfLibrary(cards, game, source, false);
}
return true;
}
}