mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
implement [EOE] Zero Point Ballad
Also properly fix Necromantic Selection; it was lacking processAction between destroy and return.
This commit is contained in:
parent
34db42086a
commit
2d2cc6daa1
3 changed files with 161 additions and 35 deletions
|
|
@ -30,7 +30,6 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class NecromanticSelection extends CardImpl {
|
||||
|
|
@ -73,40 +72,42 @@ class NecromanticSelectionEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source);
|
||||
if (sourceObject != null
|
||||
&& controller != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), source, game)) {
|
||||
permanent.destroy(source, game, false);
|
||||
game.checkStateAndTriggered(); // Meren of the Clan Nel Toth bug #8515
|
||||
if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
|
||||
cards.add(permanent);
|
||||
}
|
||||
}
|
||||
FilterCard filter = new FilterCreatureCard("creature card put into a graveyard with " + sourceObject.getLogName());
|
||||
List<Predicate<MageObject>> cardIdPredicates = new ArrayList<>();
|
||||
for (UUID cardId : cards) {
|
||||
cardIdPredicates.add(new CardIdPredicate(cardId));
|
||||
}
|
||||
filter.add(Predicates.or(cardIdPredicates));
|
||||
Target target = new TargetCardInGraveyard(filter);
|
||||
target.withNotTarget(true);
|
||||
if (controller.chooseTarget(Outcome.Benefit, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
Permanent permanent = CardUtil.getPermanentFromCardPutToBattlefield(card, game);
|
||||
if (permanent != null) {
|
||||
ContinuousEffect effect = new AddCreatureTypeAdditionEffect(SubType.ZOMBIE, true);
|
||||
effect.setText("It's a black Zombie in addition to its other colors and types");
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), source, game)) {
|
||||
permanent.destroy(source, game, false);
|
||||
if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
|
||||
cards.add(permanent);
|
||||
}
|
||||
}
|
||||
game.processAction();
|
||||
|
||||
MageObject sourceObject = game.getObject(source);
|
||||
String sourceName = sourceObject != null ? sourceObject.getLogName() : "";
|
||||
FilterCard filter = new FilterCreatureCard("creature card put into a graveyard with " + sourceName);
|
||||
List<Predicate<MageObject>> cardIdPredicates = new ArrayList<>();
|
||||
for (UUID cardId : cards) {
|
||||
cardIdPredicates.add(new CardIdPredicate(cardId));
|
||||
}
|
||||
filter.add(Predicates.or(cardIdPredicates));
|
||||
Target target = new TargetCardInGraveyard(filter);
|
||||
target.withNotTarget(true);
|
||||
if (controller.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
Permanent permanent = CardUtil.getPermanentFromCardPutToBattlefield(card, game);
|
||||
if (permanent != null) {
|
||||
ContinuousEffect effect = new AddCreatureTypeAdditionEffect(SubType.ZOMBIE, true);
|
||||
effect.setText("It's a black Zombie in addition to its other colors and types");
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
124
Mage.Sets/src/mage/cards/z/ZeroPointBallad.java
Normal file
124
Mage.Sets/src/mage/cards/z/ZeroPointBallad.java
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
package mage.cards.z;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardIdPredicate;
|
||||
import mage.filter.predicate.mageobject.ToughnessPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class ZeroPointBallad extends CardImpl {
|
||||
|
||||
public ZeroPointBallad(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}");
|
||||
|
||||
// Destroy all creatures with toughness X or less. You lose X life. If X is 6 or more, return a creature card put into a graveyard this way to the battlefield under your control.
|
||||
this.getSpellAbility().addEffect(new ZeroPointBalladEffect());
|
||||
}
|
||||
|
||||
private ZeroPointBallad(final ZeroPointBallad card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZeroPointBallad copy() {
|
||||
return new ZeroPointBallad(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ZeroPointBalladEffect extends OneShotEffect {
|
||||
|
||||
ZeroPointBalladEffect() {
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.staticText = "Destroy all creatures with toughness X or less. "
|
||||
+ "You lose X life. "
|
||||
+ "If X is 6 or more, return a creature card put into a graveyard "
|
||||
+ "this way to the battlefield under your control.";
|
||||
}
|
||||
|
||||
private ZeroPointBalladEffect(final ZeroPointBalladEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZeroPointBalladEffect copy() {
|
||||
return new ZeroPointBalladEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int xValue = GetXValue.instance.calculate(game, source, this);
|
||||
|
||||
Cards putIntoGraveyardThisWay = new CardsImpl();
|
||||
|
||||
// Destroy all creatures with toughness X or less.
|
||||
FilterPermanent filterToDestroy = new FilterCreaturePermanent();
|
||||
filterToDestroy.add(new ToughnessPredicate(ComparisonType.OR_LESS, xValue));
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterToDestroy, controller.getId(), source, game)) {
|
||||
permanent.destroy(source, game, false);
|
||||
if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
|
||||
putIntoGraveyardThisWay.add(permanent);
|
||||
}
|
||||
}
|
||||
|
||||
// You lose X life.
|
||||
game.processAction();
|
||||
new LoseLifeSourceControllerEffect(xValue).apply(game, source);
|
||||
|
||||
if (xValue < 6) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If X is 6 or more, return a creature card put into a graveyard
|
||||
// this way to the battlefield under your control.
|
||||
game.processAction();
|
||||
MageObject sourceObject = game.getObject(source);
|
||||
String sourceName = sourceObject != null ? sourceObject.getLogName() : "";
|
||||
FilterCard filter = new FilterCreatureCard("creature card put into a graveyard with " + sourceName);
|
||||
List<Predicate<MageObject>> cardIdPredicates = new ArrayList<>();
|
||||
for (UUID cardId : putIntoGraveyardThisWay) {
|
||||
cardIdPredicates.add(new CardIdPredicate(cardId));
|
||||
}
|
||||
filter.add(Predicates.or(cardIdPredicates));
|
||||
Target target = new TargetCardInGraveyard(filter);
|
||||
target.withNotTarget(true);
|
||||
if (!controller.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
|
||||
return true;
|
||||
}
|
||||
Card cardToReturn = game.getCard(target.getFirstTarget());
|
||||
if (cardToReturn == null) {
|
||||
return true;
|
||||
}
|
||||
controller.moveCards(cardToReturn, Zone.BATTLEFIELD, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -236,6 +236,7 @@ public final class EdgeOfEternities extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Weapons Manufacturing", 311, Rarity.RARE, mage.cards.w.WeaponsManufacturing.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Weftstalker Ardent", 169, Rarity.UNCOMMON, mage.cards.w.WeftstalkerArdent.class));
|
||||
cards.add(new SetCardInfo("Wurmwall Sweeper", 249, Rarity.COMMON, mage.cards.w.WurmwallSweeper.class));
|
||||
cards.add(new SetCardInfo("Zero Point Ballad", 335, Rarity.RARE, mage.cards.z.ZeroPointBallad.class));
|
||||
|
||||
cards.removeIf(setCardInfo -> unfinished.contains(setCardInfo.getName()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue