Implemented Patient Rebuilding

This commit is contained in:
Evan Kranzler 2018-06-13 08:42:16 -04:00
parent 977d4bdc50
commit 88dd1a8a33
2 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,85 @@
package mage.cards.p;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponent;
/**
*
* @author TheElk801
*/
public final class PatientRebuilding extends CardImpl {
public PatientRebuilding(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}{U}");
// At the beginning of your upkeep, target opponent puts the top three cards of their library into their graveyard, then you draw a card for each land card put into that graveyard this way.
Ability ability = new BeginningOfUpkeepTriggeredAbility(
new PatientRebuildingEffect(),
TargetController.YOU,
false
);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
public PatientRebuilding(final PatientRebuilding card) {
super(card);
}
@Override
public PatientRebuilding copy() {
return new PatientRebuilding(this);
}
}
class PatientRebuildingEffect extends OneShotEffect {
public PatientRebuildingEffect() {
super(Outcome.DrawCard);
this.staticText = "target opponent puts the top three cards of their library into their graveyard, "
+ "then you draw a card for each land card put into that graveyard this way";
}
public PatientRebuildingEffect(final PatientRebuildingEffect effect) {
super(effect);
}
@Override
public PatientRebuildingEffect copy() {
return new PatientRebuildingEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || player == null) {
return false;
}
int numberOfLandCards = 0;
Set<Card> movedCards = player.moveCardsToGraveyardWithInfo(player.getLibrary().getTopCards(game, 3), source, game, Zone.LIBRARY);
for (Card card : movedCards) {
if (card.isLand()) {
numberOfLandCards++;
}
}
if (numberOfLandCards > 0) {
return controller.drawCards(numberOfLandCards, game) > 0;
}
return true;
}
}

View file

@ -87,6 +87,7 @@ public final class CoreSet2019 extends ExpansionSet {
cards.add(new SetCardInfo("Omenspeaker", 64, Rarity.COMMON, mage.cards.o.Omenspeaker.class)); cards.add(new SetCardInfo("Omenspeaker", 64, Rarity.COMMON, mage.cards.o.Omenspeaker.class));
cards.add(new SetCardInfo("Onakke Ogre", 153, Rarity.COMMON, mage.cards.o.OnakkeOgre.class)); cards.add(new SetCardInfo("Onakke Ogre", 153, Rarity.COMMON, mage.cards.o.OnakkeOgre.class));
cards.add(new SetCardInfo("Oreskos Swiftclaw", 31, Rarity.COMMON, mage.cards.o.OreskosSwiftclaw.class)); cards.add(new SetCardInfo("Oreskos Swiftclaw", 31, Rarity.COMMON, mage.cards.o.OreskosSwiftclaw.class));
cards.add(new SetCardInfo("Patient Rebuilding", 67, Rarity.RARE, mage.cards.p.PatientRebuilding.class));
cards.add(new SetCardInfo("Pegasus Courser", 32, Rarity.COMMON, mage.cards.p.PegasusCourser.class)); cards.add(new SetCardInfo("Pegasus Courser", 32, Rarity.COMMON, mage.cards.p.PegasusCourser.class));
cards.add(new SetCardInfo("Plummet", 193, Rarity.COMMON, mage.cards.p.Plummet.class)); cards.add(new SetCardInfo("Plummet", 193, Rarity.COMMON, mage.cards.p.Plummet.class));
cards.add(new SetCardInfo("Rabid Bite", 195, Rarity.COMMON, mage.cards.r.RabidBite.class)); cards.add(new SetCardInfo("Rabid Bite", 195, Rarity.COMMON, mage.cards.r.RabidBite.class));