mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
[ONE] Implement Cruel Grimnarch
This commit is contained in:
parent
f985e15459
commit
c671a48efa
2 changed files with 102 additions and 0 deletions
101
Mage.Sets/src/mage/cards/c/CruelGrimnarch.java
Normal file
101
Mage.Sets/src/mage/cards/c/CruelGrimnarch.java
Normal file
|
@ -0,0 +1,101 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
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.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetDiscard;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author PurpleCrowbar
|
||||
*/
|
||||
public final class CruelGrimnarch extends CardImpl {
|
||||
|
||||
public CruelGrimnarch(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}");
|
||||
this.subtype.add(SubType.PHYREXIAN, SubType.CLERIC);
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
// Deathtouch
|
||||
this.addAbility(DeathtouchAbility.getInstance());
|
||||
|
||||
// When Cruel Grimnarch enters the battlefield, each opponent discards a card. For each opponent who can't, you gain 4 life.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new CruelGrimnarchEffect()));
|
||||
}
|
||||
|
||||
private CruelGrimnarch(final CruelGrimnarch card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CruelGrimnarch copy() {
|
||||
return new CruelGrimnarch(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CruelGrimnarchEffect extends OneShotEffect {
|
||||
|
||||
CruelGrimnarchEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "each opponent discards a card. For each opponent who can't, you gain 4 life";
|
||||
}
|
||||
|
||||
private CruelGrimnarchEffect(final CruelGrimnarchEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CruelGrimnarchEffect copy() {
|
||||
return new CruelGrimnarchEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Map<UUID, Cards> cardsToDiscard = new HashMap<>();
|
||||
|
||||
// choose cards to discard
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId(), true)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
int numberOfCardsToDiscard = Math.min(1, player.getHand().size());
|
||||
Cards cards = new CardsImpl();
|
||||
Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, StaticFilters.FILTER_CARD, playerId);
|
||||
player.chooseTarget(outcome, target, source, game);
|
||||
cards.addAll(target.getTargets());
|
||||
cardsToDiscard.put(playerId, cards);
|
||||
}
|
||||
|
||||
// discard all chosen cards
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId(), true)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
int amountDiscarded = player.discard(cardsToDiscard.get(playerId), false, source, game).size();
|
||||
if (amountDiscarded == 0 && controller != null) {
|
||||
controller.gainLife(4, game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -57,6 +57,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Copper Longlegs", 165, Rarity.COMMON, mage.cards.c.CopperLonglegs.class));
|
||||
cards.add(new SetCardInfo("Copperline Gorge", 249, Rarity.RARE, mage.cards.c.CopperlineGorge.class));
|
||||
cards.add(new SetCardInfo("Crawling Chorus", 8, Rarity.COMMON, mage.cards.c.CrawlingChorus.class));
|
||||
cards.add(new SetCardInfo("Cruel Grimnarch", 88, Rarity.COMMON, mage.cards.c.CruelGrimnarch.class));
|
||||
cards.add(new SetCardInfo("Cutthroat Centurion", 89, Rarity.COMMON, mage.cards.c.CutthroatCenturion.class));
|
||||
cards.add(new SetCardInfo("Darkslick Shores", 250, Rarity.RARE, mage.cards.d.DarkslickShores.class));
|
||||
cards.add(new SetCardInfo("Distorted Curiosity", 46, Rarity.UNCOMMON, mage.cards.d.DistortedCuriosity.class));
|
||||
|
|
Loading…
Reference in a new issue