[BRO] Implement Mishra's Research Desk

This commit is contained in:
Evan Kranzler 2022-11-06 16:17:13 -05:00
parent 8e0d1f504c
commit cadb0c6186
2 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,98 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.UnearthAbility;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInExile;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MishrasResearchDesk extends CardImpl {
public MishrasResearchDesk(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
// {1}, {T}, Sacrifice Mishra's Research Desk: Exile the top two cards of your library. Choose one of them. Until the end of your next turn, you may play that card.
Ability ability = new SimpleActivatedAbility(new MishrasResearchDeskEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
// Unearth {1}{R}
this.addAbility(new UnearthAbility(new ManaCostsImpl<>("{1}{R}")));
}
private MishrasResearchDesk(final MishrasResearchDesk card) {
super(card);
}
@Override
public MishrasResearchDesk copy() {
return new MishrasResearchDesk(this);
}
}
class MishrasResearchDeskEffect extends OneShotEffect {
MishrasResearchDeskEffect() {
super(Outcome.Benefit);
staticText = "exile the top two cards of your library. Choose one of them. " +
"Until the end of your next turn, you may play that card";
}
private MishrasResearchDeskEffect(final MishrasResearchDeskEffect effect) {
super(effect);
}
@Override
public MishrasResearchDeskEffect copy() {
return new MishrasResearchDeskEffect(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, 2));
player.moveCards(cards, Zone.EXILED, source, game);
cards.retainZone(Zone.EXILED, game);
Card card;
switch (cards.size()) {
case 0:
return false;
case 1:
card = cards.getRandom(game);
break;
default:
TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD);
target.setNotTarget(true);
player.choose(outcome, cards, target, game);
card = game.getCard(target.getFirstTarget());
}
if (card == null) {
return false;
}
CardUtil.makeCardPlayable(game, source, card, Duration.UntilEndOfYourNextTurn, false);
return true;
}
}

View file

@ -170,6 +170,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Mishra's Foundry", 265, Rarity.RARE, mage.cards.m.MishrasFoundry.class)); cards.add(new SetCardInfo("Mishra's Foundry", 265, Rarity.RARE, mage.cards.m.MishrasFoundry.class));
cards.add(new SetCardInfo("Mishra's Juggernaut", 161, Rarity.COMMON, mage.cards.m.MishrasJuggernaut.class)); cards.add(new SetCardInfo("Mishra's Juggernaut", 161, Rarity.COMMON, mage.cards.m.MishrasJuggernaut.class));
cards.add(new SetCardInfo("Mishra's Onslaught", 143, Rarity.COMMON, mage.cards.m.MishrasOnslaught.class)); cards.add(new SetCardInfo("Mishra's Onslaught", 143, Rarity.COMMON, mage.cards.m.MishrasOnslaught.class));
cards.add(new SetCardInfo("Mishra's Research Desk", 162, Rarity.UNCOMMON, mage.cards.m.MishrasResearchDesk.class));
cards.add(new SetCardInfo("Mishra, Claimed by Gix", 216, Rarity.MYTHIC, mage.cards.m.MishraClaimedByGix.class)); cards.add(new SetCardInfo("Mishra, Claimed by Gix", 216, Rarity.MYTHIC, mage.cards.m.MishraClaimedByGix.class));
cards.add(new SetCardInfo("Mishra, Excavation Prodigy", 140, Rarity.UNCOMMON, mage.cards.m.MishraExcavationProdigy.class)); cards.add(new SetCardInfo("Mishra, Excavation Prodigy", 140, Rarity.UNCOMMON, mage.cards.m.MishraExcavationProdigy.class));
cards.add(new SetCardInfo("Mishra, Lost to Phyrexia", "163b", Rarity.MYTHIC, mage.cards.m.MishraLostToPhyrexia.class)); cards.add(new SetCardInfo("Mishra, Lost to Phyrexia", "163b", Rarity.MYTHIC, mage.cards.m.MishraLostToPhyrexia.class));