mirror of
https://github.com/correl/mage.git
synced 2025-03-17 01:06:26 -09:00
[STX] Implemented Reject
This commit is contained in:
parent
37a4ae27f1
commit
2f50958e53
5 changed files with 98 additions and 148 deletions
44
Mage.Sets/src/mage/cards/r/Reject.java
Normal file
44
Mage.Sets/src/mage/cards/r/Reject.java
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
package mage.cards.r;
|
||||||
|
|
||||||
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
import mage.abilities.effects.common.CounterUnlessPaysEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.filter.FilterSpell;
|
||||||
|
import mage.filter.predicate.Predicates;
|
||||||
|
import mage.target.TargetSpell;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class Reject extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterSpell filter = new FilterSpell("creature or planeswalker spell");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.or(
|
||||||
|
CardType.CREATURE.getPredicate(),
|
||||||
|
CardType.PLANESWALKER.getPredicate()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Reject(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||||
|
|
||||||
|
// Counter target creature or planeswalker spell unless its controller pays {3}. If that spell is countered this way, exile it instead of putting into its owner's graveyard.
|
||||||
|
this.getSpellAbility().addEffect(new CounterUnlessPaysEffect(new GenericManaCost(3), true));
|
||||||
|
this.getSpellAbility().addTarget(new TargetSpell(filter));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Reject(final Reject card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Reject copy() {
|
||||||
|
return new Reject(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,23 +1,12 @@
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.effects.common.CounterUnlessPaysEffect;
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.costs.Cost;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
|
||||||
import mage.abilities.keyword.DevoidAbility;
|
import mage.abilities.keyword.DevoidAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.events.GameEvent;
|
|
||||||
import mage.game.stack.Spell;
|
|
||||||
import mage.game.stack.StackObject;
|
|
||||||
import mage.players.Player;
|
|
||||||
import mage.target.TargetSpell;
|
import mage.target.TargetSpell;
|
||||||
import mage.util.ManaUtil;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -33,7 +22,7 @@ public final class SpellShrivel extends CardImpl {
|
||||||
this.addAbility(new DevoidAbility(this.color));
|
this.addAbility(new DevoidAbility(this.color));
|
||||||
|
|
||||||
// Counter target spell unless its controller pays {4}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard.
|
// Counter target spell unless its controller pays {4}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard.
|
||||||
this.getSpellAbility().addEffect(new SpellShrivelCounterUnlessPaysEffect());
|
this.getSpellAbility().addEffect(new CounterUnlessPaysEffect(new GenericManaCost(4), true));
|
||||||
this.getSpellAbility().addTarget(new TargetSpell());
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,50 +35,3 @@ public final class SpellShrivel extends CardImpl {
|
||||||
return new SpellShrivel(this);
|
return new SpellShrivel(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpellShrivelCounterUnlessPaysEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public SpellShrivelCounterUnlessPaysEffect() {
|
|
||||||
super(Outcome.Detriment);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SpellShrivelCounterUnlessPaysEffect(final SpellShrivelCounterUnlessPaysEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SpellShrivelCounterUnlessPaysEffect copy() {
|
|
||||||
return new SpellShrivelCounterUnlessPaysEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
|
||||||
MageObject sourceObject = source.getSourceObject(game);
|
|
||||||
if ((spell instanceof Spell) && sourceObject != null) {
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null) {
|
|
||||||
Cost cost = ManaUtil.createManaCost(4, false);
|
|
||||||
if (!cost.pay(source, game, source, spell.getControllerId(), false)) {
|
|
||||||
StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
|
|
||||||
if (stackObject != null && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, source.getFirstTarget(), source, stackObject.getControllerId()))) {
|
|
||||||
game.informPlayers(sourceObject.getIdName() + ": cost wasn't payed - countering " + stackObject.getName());
|
|
||||||
game.rememberLKI(source.getFirstTarget(), Zone.STACK, stackObject);
|
|
||||||
controller.moveCards((Spell) spell, Zone.EXILED, source, game);
|
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, source.getFirstTarget(), source, stackObject.getControllerId()));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Mode mode) {
|
|
||||||
return "Counter target spell unless its controller pays {4}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import mage.MageObject;
|
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.costs.Cost;
|
|
||||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.common.CounterUnlessPaysEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.events.GameEvent;
|
|
||||||
import mage.game.stack.Spell;
|
|
||||||
import mage.game.stack.StackObject;
|
|
||||||
import mage.players.Player;
|
|
||||||
import mage.target.TargetSpell;
|
import mage.target.TargetSpell;
|
||||||
import mage.util.ManaUtil;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -30,7 +18,7 @@ public final class Syncopate extends CardImpl {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}");
|
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}");
|
||||||
|
|
||||||
// Counter target spell unless its controller pays {X}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard.
|
// Counter target spell unless its controller pays {X}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard.
|
||||||
this.getSpellAbility().addEffect(new SyncopateCounterUnlessPaysEffect());
|
this.getSpellAbility().addEffect(new CounterUnlessPaysEffect(ManacostVariableValue.instance, true));
|
||||||
this.getSpellAbility().addTarget(new TargetSpell());
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,50 +31,3 @@ public final class Syncopate extends CardImpl {
|
||||||
return new Syncopate(this);
|
return new Syncopate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SyncopateCounterUnlessPaysEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public SyncopateCounterUnlessPaysEffect() {
|
|
||||||
super(Outcome.Detriment);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SyncopateCounterUnlessPaysEffect(final SyncopateCounterUnlessPaysEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SyncopateCounterUnlessPaysEffect copy() {
|
|
||||||
return new SyncopateCounterUnlessPaysEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
|
||||||
MageObject sourceObject = source.getSourceObject(game);
|
|
||||||
if ((spell instanceof Spell) && sourceObject != null) {
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null) {
|
|
||||||
// can be zero cost
|
|
||||||
Cost cost = ManaUtil.createManaCost(ManacostVariableValue.instance, game, source, this);
|
|
||||||
if (!cost.pay(source, game, source, spell.getControllerId(), false)) {
|
|
||||||
StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
|
|
||||||
if (stackObject != null && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, source.getFirstTarget(), source, stackObject.getControllerId()))) {
|
|
||||||
game.informPlayers(sourceObject.getIdName() + ": cost wasn't payed - countering " + stackObject.getName());
|
|
||||||
game.rememberLKI(source.getFirstTarget(), Zone.STACK, stackObject);
|
|
||||||
controller.moveCards((Spell) spell, Zone.EXILED, source, game);
|
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERED, source.getFirstTarget(), source, stackObject.getControllerId()));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Mode mode) {
|
|
||||||
return "Counter target spell unless its controller pays {X}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -194,6 +194,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Reckless Amplimancer", 141, Rarity.COMMON, mage.cards.r.RecklessAmplimancer.class));
|
cards.add(new SetCardInfo("Reckless Amplimancer", 141, Rarity.COMMON, mage.cards.r.RecklessAmplimancer.class));
|
||||||
cards.add(new SetCardInfo("Reconstruct History", 222, Rarity.UNCOMMON, mage.cards.r.ReconstructHistory.class));
|
cards.add(new SetCardInfo("Reconstruct History", 222, Rarity.UNCOMMON, mage.cards.r.ReconstructHistory.class));
|
||||||
cards.add(new SetCardInfo("Reduce to Memory", 25, Rarity.UNCOMMON, mage.cards.r.ReduceToMemory.class));
|
cards.add(new SetCardInfo("Reduce to Memory", 25, Rarity.UNCOMMON, mage.cards.r.ReduceToMemory.class));
|
||||||
|
cards.add(new SetCardInfo("Reject", 50, Rarity.COMMON, mage.cards.r.Reject.class));
|
||||||
cards.add(new SetCardInfo("Relic Sloth", 223, Rarity.COMMON, mage.cards.r.RelicSloth.class));
|
cards.add(new SetCardInfo("Relic Sloth", 223, Rarity.COMMON, mage.cards.r.RelicSloth.class));
|
||||||
cards.add(new SetCardInfo("Resculpt", 51, Rarity.COMMON, mage.cards.r.Resculpt.class));
|
cards.add(new SetCardInfo("Resculpt", 51, Rarity.COMMON, mage.cards.r.Resculpt.class));
|
||||||
cards.add(new SetCardInfo("Returned Pastcaller", 224, Rarity.UNCOMMON, mage.cards.r.ReturnedPastcaller.class));
|
cards.add(new SetCardInfo("Returned Pastcaller", 224, Rarity.UNCOMMON, mage.cards.r.ReturnedPastcaller.class));
|
||||||
|
|
|
@ -7,6 +7,8 @@ import mage.abilities.costs.mana.ManaCost;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.constants.ZoneDetail;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
@ -19,15 +21,26 @@ public class CounterUnlessPaysEffect extends OneShotEffect {
|
||||||
|
|
||||||
protected Cost cost;
|
protected Cost cost;
|
||||||
protected DynamicValue genericMana;
|
protected DynamicValue genericMana;
|
||||||
|
private final boolean exile;
|
||||||
|
|
||||||
public CounterUnlessPaysEffect(Cost cost) {
|
public CounterUnlessPaysEffect(Cost cost) {
|
||||||
|
this(cost, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CounterUnlessPaysEffect(Cost cost, boolean exile) {
|
||||||
super(Outcome.Detriment);
|
super(Outcome.Detriment);
|
||||||
this.cost = cost;
|
this.cost = cost;
|
||||||
|
this.exile = exile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CounterUnlessPaysEffect(DynamicValue genericMana) {
|
public CounterUnlessPaysEffect(DynamicValue genericMana) {
|
||||||
|
this(genericMana, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CounterUnlessPaysEffect(DynamicValue genericMana, boolean exile) {
|
||||||
super(Outcome.Detriment);
|
super(Outcome.Detriment);
|
||||||
this.genericMana = genericMana;
|
this.genericMana = genericMana;
|
||||||
|
this.exile = exile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CounterUnlessPaysEffect(final CounterUnlessPaysEffect effect) {
|
public CounterUnlessPaysEffect(final CounterUnlessPaysEffect effect) {
|
||||||
|
@ -38,6 +51,7 @@ public class CounterUnlessPaysEffect extends OneShotEffect {
|
||||||
if (effect.genericMana != null) {
|
if (effect.genericMana != null) {
|
||||||
this.genericMana = effect.genericMana.copy();
|
this.genericMana = effect.genericMana.copy();
|
||||||
}
|
}
|
||||||
|
this.exile = effect.exile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,9 +62,13 @@ public class CounterUnlessPaysEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
||||||
if (spell != null) {
|
if (spell == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Player player = game.getPlayer(spell.getControllerId());
|
Player player = game.getPlayer(spell.getControllerId());
|
||||||
if (player != null) {
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Cost costToPay;
|
Cost costToPay;
|
||||||
String costValueMessage;
|
String costValueMessage;
|
||||||
if (cost != null) {
|
if (cost != null) {
|
||||||
|
@ -70,14 +88,15 @@ public class CounterUnlessPaysEffect extends OneShotEffect {
|
||||||
if (!(player.chooseUse(Outcome.Benefit, message, source, game)
|
if (!(player.chooseUse(Outcome.Benefit, message, source, game)
|
||||||
&& costToPay.pay(source, game, source, spell.getControllerId(), false, null))) {
|
&& costToPay.pay(source, game, source, spell.getControllerId(), false, null))) {
|
||||||
game.informPlayers(player.getLogName() + " chooses not to pay " + costValueMessage + " to prevent the counter effect");
|
game.informPlayers(player.getLogName() + " chooses not to pay " + costValueMessage + " to prevent the counter effect");
|
||||||
|
if (exile) {
|
||||||
|
game.getStack().counter(spell.getId(), source, game, Zone.EXILED, false, ZoneDetail.NONE);
|
||||||
|
} else {
|
||||||
return game.getStack().counter(spell.getId(), source, game);
|
return game.getStack().counter(spell.getId(), source, game);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
game.informPlayers(player.getLogName() + " chooses to pay " + costValueMessage + " to prevent the counter effect");
|
game.informPlayers(player.getLogName() + " chooses to pay " + costValueMessage + " to prevent the counter effect");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText(Mode mode) {
|
public String getText(Mode mode) {
|
||||||
|
@ -101,6 +120,9 @@ public class CounterUnlessPaysEffect extends OneShotEffect {
|
||||||
sb.append(", where X is ");
|
sb.append(", where X is ");
|
||||||
sb.append(genericMana.getMessage());
|
sb.append(genericMana.getMessage());
|
||||||
}
|
}
|
||||||
|
if (exile) {
|
||||||
|
sb.append(". If that spell is countered this way, exile it instead of putting into its owner's graveyard.");
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue