mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
[NCC] Implemented Protection Racket
This commit is contained in:
parent
6ea50d8de1
commit
8ff9a221be
2 changed files with 89 additions and 0 deletions
88
Mage.Sets/src/mage/cards/p/ProtectionRacket.java
Normal file
88
Mage.Sets/src/mage/cards/p/ProtectionRacket.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
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 java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ProtectionRacket extends CardImpl {
|
||||
|
||||
public ProtectionRacket(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
|
||||
|
||||
// At the beginning of your upkeep, repeat the following process for each opponent in turn order. Reveal the top card of your library. That player pay pay life equal to that card's mana value. If they do, exile that card. Otherwise, put it into your hand.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
new ProtectionRacketEffect(), TargetController.YOU, false
|
||||
));
|
||||
}
|
||||
|
||||
private ProtectionRacket(final ProtectionRacket card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtectionRacket copy() {
|
||||
return new ProtectionRacket(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ProtectionRacketEffect extends OneShotEffect {
|
||||
|
||||
ProtectionRacketEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "repeat the following process for each opponent in turn order. " +
|
||||
"Reveal the top card of your library. That player pay pay life equal to that card's mana value. " +
|
||||
"If they do, exile that card. Otherwise, put it into your hand";
|
||||
}
|
||||
|
||||
private ProtectionRacketEffect(final ProtectionRacketEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtectionRacketEffect copy() {
|
||||
return new ProtectionRacketEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (player == null || card == null) {
|
||||
continue;
|
||||
}
|
||||
controller.revealCards(source, new CardsImpl(card), game);
|
||||
int mv = card.getManaValue();
|
||||
Cost cost = new PayLifeCost(mv);
|
||||
if (cost.canPay(source, source, playerId, game) && player.chooseUse(
|
||||
Outcome.Detriment, "Pay " + mv + " life to exile " + card.getName() + '?', source, game
|
||||
)) {
|
||||
cost.pay(source, game, source, playerId, true);
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
}
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -217,6 +217,7 @@ public final class NewCapennaCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Primal Empathy", 348, Rarity.UNCOMMON, mage.cards.p.PrimalEmpathy.class));
|
||||
cards.add(new SetCardInfo("Profane Command", 256, Rarity.RARE, mage.cards.p.ProfaneCommand.class));
|
||||
cards.add(new SetCardInfo("Prosperous Partnership", 78, Rarity.RARE, mage.cards.p.ProsperousPartnership.class));
|
||||
cards.add(new SetCardInfo("Protection Racket", 39, Rarity.RARE, mage.cards.p.ProtectionRacket.class));
|
||||
cards.add(new SetCardInfo("Puppeteer Clique", 257, Rarity.RARE, mage.cards.p.PuppeteerClique.class));
|
||||
cards.add(new SetCardInfo("Quietus Spike", 377, Rarity.RARE, mage.cards.q.QuietusSpike.class));
|
||||
cards.add(new SetCardInfo("Rakdos Signet", 378, Rarity.UNCOMMON, mage.cards.r.RakdosSignet.class));
|
||||
|
|
Loading…
Reference in a new issue