mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
[MIC] Implemented Wall of Mourning
This commit is contained in:
parent
f47aea4fba
commit
7b1e3fae7b
3 changed files with 127 additions and 2 deletions
125
Mage.Sets/src/mage/cards/w/WallOfMourning.java
Normal file
125
Mage.Sets/src/mage/cards/w/WallOfMourning.java
Normal file
|
@ -0,0 +1,125 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.common.CovenCondition;
|
||||
import mage.abilities.dynamicvalue.common.OpponentsCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.hint.common.CovenHint;
|
||||
import mage.abilities.keyword.DefenderAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class WallOfMourning extends CardImpl {
|
||||
|
||||
public WallOfMourning(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
|
||||
|
||||
this.subtype.add(SubType.WALL);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Defender
|
||||
this.addAbility(DefenderAbility.getInstance());
|
||||
|
||||
// When Wall of Mourning enters the battlefield, exile a card from the top of your library face down for each opponent you have.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new WallOfMourningExileEffect()));
|
||||
|
||||
// Coven — At the beginning of your end step, if you control three or more creatures with different powers, put a card exiled with Wall of Mourning into its owner's hand.
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new WallOfMourningReturnEffect(),
|
||||
TargetController.YOU, CovenCondition.instance, false
|
||||
).addHint(CovenHint.instance).setAbilityWord(AbilityWord.COVEN));
|
||||
}
|
||||
|
||||
private WallOfMourning(final WallOfMourning card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WallOfMourning copy() {
|
||||
return new WallOfMourning(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WallOfMourningExileEffect extends OneShotEffect {
|
||||
|
||||
WallOfMourningExileEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "exile a card from the top of your library face down for each opponent you have";
|
||||
}
|
||||
|
||||
private WallOfMourningExileEffect(final WallOfMourningExileEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WallOfMourningExileEffect copy() {
|
||||
return new WallOfMourningExileEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
int opponents = OpponentsCount.instance.calculate(game, source, this);
|
||||
Set<Card> cards = player.getLibrary().getTopCards(game, opponents);
|
||||
cards.removeIf(Objects::isNull);
|
||||
player.moveCardsToExile(
|
||||
cards, source, game, false,
|
||||
CardUtil.getExileZoneId(game, source),
|
||||
CardUtil.getSourceLogName(game, source)
|
||||
);
|
||||
for (Card card : cards) {
|
||||
card.setFaceDown(true, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class WallOfMourningReturnEffect extends OneShotEffect {
|
||||
|
||||
WallOfMourningReturnEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "put a card exiled with {this} into its owner's hand";
|
||||
}
|
||||
|
||||
private WallOfMourningReturnEffect(final WallOfMourningReturnEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WallOfMourningReturnEffect copy() {
|
||||
return new WallOfMourningReturnEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source));
|
||||
if (exileZone == null || exileZone.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return player.moveCards(exileZone.getRandom(game), Zone.HAND, source, game);
|
||||
}
|
||||
}
|
|
@ -159,6 +159,7 @@ public final class MidnightHuntCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Visions of Duplicity", 33, Rarity.RARE, mage.cards.v.VisionsOfDuplicity.class));
|
||||
cards.add(new SetCardInfo("Visions of Glory", 32, Rarity.RARE, mage.cards.v.VisionsOfGlory.class));
|
||||
cards.add(new SetCardInfo("Visions of Ruin", 36, Rarity.RARE, mage.cards.v.VisionsOfRuin.class));
|
||||
cards.add(new SetCardInfo("Wall of Mourning", 10, Rarity.RARE, mage.cards.w.WallOfMourning.class));
|
||||
cards.add(new SetCardInfo("Wild Beastmaster", 146, Rarity.RARE, mage.cards.w.WildBeastmaster.class));
|
||||
cards.add(new SetCardInfo("Wilhelt, the Rotcleaver", 2, Rarity.MYTHIC, mage.cards.w.WilheltTheRotcleaver.class));
|
||||
cards.add(new SetCardInfo("Yavimaya Elder", 147, Rarity.COMMON, mage.cards.y.YavimayaElder.class));
|
||||
|
|
|
@ -91,8 +91,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
if (this.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
UUID[] cards = this.toArray(new UUID[this.size()]);
|
||||
MageObject object = game.getObject(cards[RandomUtil.nextInt(cards.length)]); // neccessary if permanent tokens are in the collection
|
||||
MageObject object = game.getObject(RandomUtil.randomFromCollection(this)); // neccessary if permanent tokens are in the collection
|
||||
if (object instanceof Card) {
|
||||
return (Card) object;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue