mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[40K] Implemented The War in Heaven
This commit is contained in:
parent
c742b17bbc
commit
6857641428
4 changed files with 151 additions and 1 deletions
148
Mage.Sets/src/mage/cards/t/TheWarInHeaven.java
Normal file
148
Mage.Sets/src/mage/cards/t/TheWarInHeaven.java
Normal file
|
@ -0,0 +1,148 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SagaAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
|
||||
import mage.abilities.effects.common.MillCardsControllerEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldWithCounterTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.AddCardTypeTargetEffect;
|
||||
import mage.cards.*;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetpointer.FixedTargets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TheWarInHeaven extends CardImpl {
|
||||
|
||||
public TheWarInHeaven(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}{B}");
|
||||
|
||||
this.subtype.add(SubType.SAGA);
|
||||
|
||||
// (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)
|
||||
SagaAbility sagaAbility = new SagaAbility(this);
|
||||
|
||||
// I -- You draw three cards and you lose 3 life.
|
||||
sagaAbility.addChapterEffect(
|
||||
this, SagaChapter.CHAPTER_I,
|
||||
new DrawCardSourceControllerEffect(3)
|
||||
.setText("you draw three cards"),
|
||||
new LoseLifeSourceControllerEffect(3)
|
||||
.concatBy("and")
|
||||
);
|
||||
|
||||
// II -- Mill three cards.
|
||||
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new MillCardsControllerEffect(3));
|
||||
|
||||
// III -- Choose up to three target creature cards with total mana value 8 or less in your graveyard. Return each of them to the battlefield with a necrodermis counter on it. They're artifacts in addition to their other types.
|
||||
sagaAbility.addChapterEffect(
|
||||
this, SagaChapter.CHAPTER_III, SagaChapter.CHAPTER_III,
|
||||
new TheWarInHeavenEffect(), new TheWarInHeavenTarget()
|
||||
);
|
||||
this.addAbility(sagaAbility);
|
||||
}
|
||||
|
||||
private TheWarInHeaven(final TheWarInHeaven card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheWarInHeaven copy() {
|
||||
return new TheWarInHeaven(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TheWarInHeavenEffect extends OneShotEffect {
|
||||
|
||||
TheWarInHeavenEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "choose up to three target creature cards with total mana value 8 or less in your graveyard. " +
|
||||
"Return each of them to the battlefield with a necrodermis counter on it. " +
|
||||
"They're artifacts in addition to their other types";
|
||||
}
|
||||
|
||||
private TheWarInHeavenEffect(final TheWarInHeavenEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheWarInHeavenEffect copy() {
|
||||
return new TheWarInHeavenEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source));
|
||||
new ReturnFromGraveyardToBattlefieldWithCounterTargetEffect(
|
||||
CounterType.NECRODERMIS.createInstance()
|
||||
).apply(game, source);
|
||||
List<Permanent> permanents = cards
|
||||
.stream()
|
||||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
if (!permanents.isEmpty()) {
|
||||
game.addEffect(new AddCardTypeTargetEffect(
|
||||
Duration.Custom, CardType.ARTIFACT
|
||||
).setTargetPointer(new FixedTargets(permanents, game)), source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class TheWarInHeavenTarget extends TargetCardInYourGraveyard {
|
||||
|
||||
private static final FilterCard filter
|
||||
= new FilterCreatureCard("creature cards with total mana value 8 or less from your graveyard");
|
||||
|
||||
static {
|
||||
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 9));
|
||||
}
|
||||
|
||||
TheWarInHeavenTarget() {
|
||||
super(0, 3, filter, false);
|
||||
}
|
||||
|
||||
private TheWarInHeavenTarget(final TheWarInHeavenTarget target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheWarInHeavenTarget copy() {
|
||||
return new TheWarInHeavenTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
||||
if (!super.canTarget(controllerId, id, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(id);
|
||||
return card != null &&
|
||||
this.getTargets()
|
||||
.stream()
|
||||
.map(game::getCard)
|
||||
.mapToInt(Card::getManaValue)
|
||||
.sum() + card.getManaValue() <= 8;
|
||||
}
|
||||
}
|
|
@ -234,6 +234,7 @@ public final class Warhammer40000 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Tervigon", 100, Rarity.RARE, mage.cards.t.Tervigon.class));
|
||||
cards.add(new SetCardInfo("The Flesh Is Weak", 122, Rarity.RARE, mage.cards.t.TheFleshIsWeak.class));
|
||||
cards.add(new SetCardInfo("The Swarmlord", 4, Rarity.MYTHIC, mage.cards.t.TheSwarmlord.class));
|
||||
cards.add(new SetCardInfo("The War in Heaven", 69, Rarity.RARE, mage.cards.t.TheWarInHeaven.class));
|
||||
cards.add(new SetCardInfo("Their Name Is Death", 62, Rarity.RARE, mage.cards.t.TheirNameIsDeath.class));
|
||||
cards.add(new SetCardInfo("Their Number Is Legion", 63, Rarity.RARE, mage.cards.t.TheirNumberIsLegion.class));
|
||||
cards.add(new SetCardInfo("Thornwood Falls", 302, Rarity.COMMON, mage.cards.t.ThornwoodFalls.class));
|
||||
|
|
|
@ -100,7 +100,7 @@ class AddCounterTargetReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return event.getTargetId().equals(getTargetPointer().getFirst(game, source));
|
||||
return getTargetPointer().getTargets(game, source).contains(event.getTargetId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -125,6 +125,7 @@ public enum CounterType {
|
|||
MIRE("mire"),
|
||||
MUSIC("music"),
|
||||
MUSTER("muster"),
|
||||
NECRODERMIS("necrodermis"),
|
||||
NET("net"),
|
||||
NIGHT("night"),
|
||||
OMEN("omen"),
|
||||
|
|
Loading…
Reference in a new issue