mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
add otherwise effect to LookLibraryAndPickControllerEffect
This commit is contained in:
parent
cdf23ac18a
commit
76e1b60c32
6 changed files with 71 additions and 231 deletions
|
|
@ -1,16 +1,12 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.PutCards;
|
import mage.constants.PutCards;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -24,7 +20,9 @@ public final class AdventureAwaits extends CardImpl {
|
||||||
|
|
||||||
// Look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand.
|
// Look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand.
|
||||||
// Put the rest on the bottom of your library in a random order. If you don't put a card into your hand this way, draw a card.
|
// Put the rest on the bottom of your library in a random order. If you don't put a card into your hand this way, draw a card.
|
||||||
this.getSpellAbility().addEffect(new AdventureAwaitsEffect());
|
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(
|
||||||
|
5, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_RANDOM
|
||||||
|
).withOtherwiseEffect(new DrawCardSourceControllerEffect(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private AdventureAwaits(final AdventureAwaits card) {
|
private AdventureAwaits(final AdventureAwaits card) {
|
||||||
|
|
@ -36,33 +34,3 @@ public final class AdventureAwaits extends CardImpl {
|
||||||
return new AdventureAwaits(this);
|
return new AdventureAwaits(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AdventureAwaitsEffect extends LookLibraryAndPickControllerEffect {
|
|
||||||
|
|
||||||
AdventureAwaitsEffect() {
|
|
||||||
super(5, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_RANDOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
private AdventureAwaitsEffect(final AdventureAwaitsEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AdventureAwaitsEffect copy() {
|
|
||||||
return new AdventureAwaitsEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
|
|
||||||
super.actionWithPickedCards(game, source, player, pickedCards, otherCards);
|
|
||||||
if (pickedCards.isEmpty()) {
|
|
||||||
player.drawCards(1, source, game);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Mode mode) {
|
|
||||||
return super.getText(mode).concat(". If you didn't put a card into your hand this way, draw a card");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.GainLifeEffect;
|
||||||
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
||||||
import mage.abilities.keyword.ReachAbility;
|
import mage.abilities.keyword.ReachAbility;
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
|
@ -14,8 +12,6 @@ import mage.constants.PutCards;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -24,6 +20,15 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
public final class BlossomPrancer extends CardImpl {
|
public final class BlossomPrancer extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterCard filter = new FilterCard("creature or enchantment card");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.or(
|
||||||
|
CardType.CREATURE.getPredicate(),
|
||||||
|
CardType.ENCHANTMENT.getPredicate()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public BlossomPrancer(UUID ownerId, CardSetInfo setInfo) {
|
public BlossomPrancer(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
|
||||||
|
|
||||||
|
|
@ -38,7 +43,9 @@ public final class BlossomPrancer extends CardImpl {
|
||||||
// You may reveal a creature or enchantment card from among them and put it into your hand.
|
// You may reveal a creature or enchantment card from among them and put it into your hand.
|
||||||
// Put the rest on the bottom of your library in a random order.
|
// Put the rest on the bottom of your library in a random order.
|
||||||
// If you didn't put a card into your hand this way, you gain 4 life.
|
// If you didn't put a card into your hand this way, you gain 4 life.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new BlossomPrancerEffect()));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
|
||||||
|
5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM
|
||||||
|
).withOtherwiseEffect(new GainLifeEffect(4))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlossomPrancer(final BlossomPrancer card) {
|
private BlossomPrancer(final BlossomPrancer card) {
|
||||||
|
|
@ -50,42 +57,3 @@ public final class BlossomPrancer extends CardImpl {
|
||||||
return new BlossomPrancer(this);
|
return new BlossomPrancer(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlossomPrancerEffect extends LookLibraryAndPickControllerEffect {
|
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterCard("creature or enchantment card");
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(Predicates.or(
|
|
||||||
CardType.CREATURE.getPredicate(),
|
|
||||||
CardType.ENCHANTMENT.getPredicate()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
BlossomPrancerEffect() {
|
|
||||||
super(5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BlossomPrancerEffect(final BlossomPrancerEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlossomPrancerEffect copy() {
|
|
||||||
return new BlossomPrancerEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
|
|
||||||
super.actionWithPickedCards(game, source, player, pickedCards, otherCards);
|
|
||||||
if (pickedCards.isEmpty()) {
|
|
||||||
player.gainLife(4, game, source);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Mode mode) {
|
|
||||||
return super.getText(mode).concat(". If you didn't put a card into your hand this way, you gain 4 life");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,15 @@
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
||||||
import mage.abilities.effects.common.counter.ProliferateEffect;
|
import mage.abilities.effects.common.counter.ProliferateEffect;
|
||||||
import mage.cards.*;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.PutCards;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
import mage.target.TargetCard;
|
|
||||||
import mage.target.common.TargetCardInLibrary;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -33,7 +28,9 @@ public final class ContagiousVorrac extends CardImpl {
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
// When Contagious Vorrac enters the battlefield, look at the top four cards of your library. You may reveal a land card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. If you didn't put a card into your hand this way, proliferate.
|
// When Contagious Vorrac enters the battlefield, look at the top four cards of your library. You may reveal a land card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. If you didn't put a card into your hand this way, proliferate.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new ContagiousVorracEffect()));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
|
||||||
|
4, 1, StaticFilters.FILTER_CARD_LAND_A, PutCards.HAND, PutCards.BOTTOM_RANDOM
|
||||||
|
).withOtherwiseEffect(new ProliferateEffect())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContagiousVorrac(final ContagiousVorrac card) {
|
private ContagiousVorrac(final ContagiousVorrac card) {
|
||||||
|
|
@ -45,42 +42,3 @@ public final class ContagiousVorrac extends CardImpl {
|
||||||
return new ContagiousVorrac(this);
|
return new ContagiousVorrac(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ContagiousVorracEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
ContagiousVorracEffect() {
|
|
||||||
super(Outcome.Benefit);
|
|
||||||
staticText = "look at the top four cards of your library. You may reveal a land card from among them " +
|
|
||||||
"and put it into your hand. Put the rest on the bottom of your library in a random order. " +
|
|
||||||
"If you didn't put a card into your hand this way, proliferate. " +
|
|
||||||
"<i>(Choose any number of permanents and/or players, then give each another counter of each kind already there.)</i>";
|
|
||||||
}
|
|
||||||
|
|
||||||
private ContagiousVorracEffect(final ContagiousVorracEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ContagiousVorracEffect copy() {
|
|
||||||
return new ContagiousVorracEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
|
||||||
if (player == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 4));
|
|
||||||
TargetCard target = new TargetCardInLibrary(0, 1, StaticFilters.FILTER_CARD_LAND);
|
|
||||||
player.choose(Outcome.DrawCard, cards, target, source, game);
|
|
||||||
Card card = game.getCard(target.getFirstTarget());
|
|
||||||
if (card != null) {
|
|
||||||
player.revealCards(source, new CardsImpl(card), game);
|
|
||||||
player.moveCards(card, Zone.HAND, source, game);
|
|
||||||
}
|
|
||||||
cards.retainZone(Zone.LIBRARY, game);
|
|
||||||
player.putCardsOnBottomOfLibrary(cards, game, source, false);
|
|
||||||
return card != null || new ProliferateEffect().apply(game, source);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,18 @@
|
||||||
package mage.cards.p;
|
package mage.cards.p;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
||||||
import mage.cards.*;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.PutCards;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterBySubtypeCard;
|
import mage.filter.common.FilterBySubtypeCard;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
import mage.target.TargetCard;
|
|
||||||
import mage.target.common.TargetCardInLibrary;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -25,6 +20,8 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
public final class PulsarSquadronAce extends CardImpl {
|
public final class PulsarSquadronAce extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterCard filter = new FilterBySubtypeCard(SubType.SPACECRAFT);
|
||||||
|
|
||||||
public PulsarSquadronAce(UUID ownerId, CardSetInfo setInfo) {
|
public PulsarSquadronAce(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
|
||||||
|
|
||||||
|
|
@ -34,7 +31,9 @@ public final class PulsarSquadronAce extends CardImpl {
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
// When this creature enters, look at the top five cards of your library. You may reveal a Spacecraft card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. If you didn't put a card into your hand this way, put a +1/+1 counter on this creature.
|
// When this creature enters, look at the top five cards of your library. You may reveal a Spacecraft card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. If you didn't put a card into your hand this way, put a +1/+1 counter on this creature.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new PulsarSquadronAceEffect()));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
|
||||||
|
5, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM
|
||||||
|
).withOtherwiseEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private PulsarSquadronAce(final PulsarSquadronAce card) {
|
private PulsarSquadronAce(final PulsarSquadronAce card) {
|
||||||
|
|
@ -46,48 +45,3 @@ public final class PulsarSquadronAce extends CardImpl {
|
||||||
return new PulsarSquadronAce(this);
|
return new PulsarSquadronAce(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PulsarSquadronAceEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterBySubtypeCard(SubType.SPACECRAFT);
|
|
||||||
|
|
||||||
PulsarSquadronAceEffect() {
|
|
||||||
super(Outcome.Benefit);
|
|
||||||
staticText = "look at the top five cards of your library. You may reveal a Spacecraft card from among them " +
|
|
||||||
"and put it into your hand. Put the rest on the bottom of your library in a random order. " +
|
|
||||||
"If you didn't put a card into your hand this way, put a +1/+1 counter on {this}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private PulsarSquadronAceEffect(final PulsarSquadronAceEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PulsarSquadronAceEffect copy() {
|
|
||||||
return new PulsarSquadronAceEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
|
||||||
if (player == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 5));
|
|
||||||
TargetCard target = new TargetCardInLibrary(0, 1, filter);
|
|
||||||
player.choose(outcome, cards, target, source, game);
|
|
||||||
Card card = game.getCard(target.getFirstTarget());
|
|
||||||
if (card == null) {
|
|
||||||
player.putCardsOnBottomOfLibrary(cards, game, source, false);
|
|
||||||
Optional.ofNullable(source.getSourcePermanentIfItStillExists(game))
|
|
||||||
.filter(permanent -> permanent.addCounters(CounterType.P1P1.createInstance(), source, game))
|
|
||||||
.isPresent();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
player.revealCards(source, new CardsImpl(card), game);
|
|
||||||
player.moveCards(card, Zone.HAND, source, game);
|
|
||||||
cards.retainZone(Zone.LIBRARY, game);
|
|
||||||
player.putCardsOnBottomOfLibrary(cards, game, source, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,18 @@
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.abilities.keyword.VigilanceAbility;
|
import mage.abilities.keyword.VigilanceAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.PutCards;
|
import mage.constants.PutCards;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -27,6 +21,15 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
public final class RosecotKnight extends CardImpl {
|
public final class RosecotKnight extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterCard filter = new FilterCard("artifact or enchantment card");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.or(
|
||||||
|
CardType.ARTIFACT.getPredicate(),
|
||||||
|
CardType.ENCHANTMENT.getPredicate()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public RosecotKnight(UUID ownerId, CardSetInfo setInfo) {
|
public RosecotKnight(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}");
|
||||||
|
|
||||||
|
|
@ -39,7 +42,9 @@ public final class RosecotKnight extends CardImpl {
|
||||||
this.addAbility(VigilanceAbility.getInstance());
|
this.addAbility(VigilanceAbility.getInstance());
|
||||||
|
|
||||||
// When Rosecot Knight enters the battlefield, look at the top six cards of your library. You may reveal an artifact or enchantment card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. If you didn't put a card into your hand this way, put a +1/+1 counter on Rosecot Knight.
|
// When Rosecot Knight enters the battlefield, look at the top six cards of your library. You may reveal an artifact or enchantment card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. If you didn't put a card into your hand this way, put a +1/+1 counter on Rosecot Knight.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new RosecotKnightEffect()));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
|
||||||
|
6, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM
|
||||||
|
).withOtherwiseEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private RosecotKnight(final RosecotKnight card) {
|
private RosecotKnight(final RosecotKnight card) {
|
||||||
|
|
@ -51,41 +56,3 @@ public final class RosecotKnight extends CardImpl {
|
||||||
return new RosecotKnight(this);
|
return new RosecotKnight(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class RosecotKnightEffect extends LookLibraryAndPickControllerEffect {
|
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterCard("artifact or enchantment card");
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(Predicates.or(CardType.ARTIFACT.getPredicate(), CardType.ENCHANTMENT.getPredicate()));
|
|
||||||
}
|
|
||||||
|
|
||||||
RosecotKnightEffect() {
|
|
||||||
super(6, 1, filter, PutCards.HAND, PutCards.BOTTOM_RANDOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
private RosecotKnightEffect(final RosecotKnightEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RosecotKnightEffect copy() {
|
|
||||||
return new RosecotKnightEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
|
|
||||||
super.actionWithPickedCards(game, source, player, pickedCards, otherCards);
|
|
||||||
game.processAction();
|
|
||||||
pickedCards.retainZone(Zone.HAND, game);
|
|
||||||
if (pickedCards.isEmpty()) {
|
|
||||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Mode mode) {
|
|
||||||
return super.getText(mode).concat(". If you didn't put a card into your hand this way, put a +1/+1 counter on {this}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
import mage.constants.PutCards;
|
import mage.constants.PutCards;
|
||||||
|
|
@ -26,6 +29,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
||||||
protected boolean revealPickedCards;
|
protected boolean revealPickedCards;
|
||||||
protected boolean optional;
|
protected boolean optional;
|
||||||
protected boolean upTo;
|
protected boolean upTo;
|
||||||
|
protected Effect otherwiseEffect = null;
|
||||||
|
|
||||||
public LookLibraryAndPickControllerEffect(int numberOfCards, int numberToPick,
|
public LookLibraryAndPickControllerEffect(int numberOfCards, int numberToPick,
|
||||||
PutCards putPickedCards, PutCards putLookedCards) {
|
PutCards putPickedCards, PutCards putLookedCards) {
|
||||||
|
|
@ -87,6 +91,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
||||||
this.revealPickedCards = effect.revealPickedCards;
|
this.revealPickedCards = effect.revealPickedCards;
|
||||||
this.optional = effect.optional;
|
this.optional = effect.optional;
|
||||||
this.upTo = effect.upTo;
|
this.upTo = effect.upTo;
|
||||||
|
this.otherwiseEffect = effect.otherwiseEffect != null ? effect.otherwiseEffect.copy() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -94,6 +99,11 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
||||||
return new LookLibraryAndPickControllerEffect(this);
|
return new LookLibraryAndPickControllerEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LookLibraryAndPickControllerEffect withOtherwiseEffect(Effect otherwiseEffect) {
|
||||||
|
this.otherwiseEffect = otherwiseEffect;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean actionWithLookedCards(Game game, Ability source, Player player, Cards cards) {
|
protected boolean actionWithLookedCards(Game game, Ability source, Player player, Cards cards) {
|
||||||
int number = Math.min(numberToPick, cards.count(filter, source.getControllerId(), source, game));
|
int number = Math.min(numberToPick, cards.count(filter, source.getControllerId(), source, game));
|
||||||
|
|
@ -120,6 +130,15 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
||||||
protected boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
|
protected boolean actionWithPickedCards(Game game, Ability source, Player player, Cards pickedCards, Cards otherCards) {
|
||||||
boolean result = putPickedCards.moveCards(player, pickedCards, source, game);
|
boolean result = putPickedCards.moveCards(player, pickedCards, source, game);
|
||||||
result |= putLookedCards.moveCards(player, otherCards, source, game);
|
result |= putLookedCards.moveCards(player, otherCards, source, game);
|
||||||
|
if (!pickedCards.isEmpty() || otherwiseEffect == null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
game.processAction();
|
||||||
|
if (otherwiseEffect instanceof OneShotEffect) {
|
||||||
|
otherwiseEffect.apply(game, source);
|
||||||
|
} else if (otherwiseEffect instanceof ContinuousEffect) {
|
||||||
|
game.addEffect((ContinuousEffect) otherwiseEffect, source);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,6 +215,12 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
||||||
sb.append("back ");
|
sb.append("back ");
|
||||||
}
|
}
|
||||||
sb.append(putLookedCards.getMessage(false, plural));
|
sb.append(putLookedCards.getMessage(false, plural));
|
||||||
|
if (otherwiseEffect != null) {
|
||||||
|
sb.append(". If you didn't put a card ");
|
||||||
|
sb.append(putPickedCards.getMessage(false, false));
|
||||||
|
sb.append(" this way, ");
|
||||||
|
sb.append(otherwiseEffect.getText(mode));
|
||||||
|
}
|
||||||
|
|
||||||
// get text frame from super class and inject action text
|
// get text frame from super class and inject action text
|
||||||
return setText(mode, sb.toString());
|
return setText(mode, sb.toString());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue