forked from External/mage
Some cards changed to new alternate cost handling.
This commit is contained in:
parent
624fde3d8b
commit
0ac75c82d3
4 changed files with 38 additions and 120 deletions
|
|
@ -33,10 +33,7 @@ import mage.abilities.Ability;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.CompositeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.ReturnToHandTargetCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.mana.BlueManaAbility;
|
||||
|
|
|
|||
|
|
@ -28,28 +28,33 @@
|
|||
|
||||
package mage.sets.magic2011;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class DemonOfDeathsGate extends CardImpl<DemonOfDeathsGate> {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("black creature");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
}
|
||||
|
||||
public DemonOfDeathsGate(UUID ownerId) {
|
||||
super(ownerId, 92, "Demon of Death's Gate", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{6}{B}{B}{B}");
|
||||
this.expansionSetCode = "M11";
|
||||
|
|
@ -57,7 +62,11 @@ public class DemonOfDeathsGate extends CardImpl<DemonOfDeathsGate> {
|
|||
this.color.setBlack(true);
|
||||
this.power = new MageInt(9);
|
||||
this.toughness = new MageInt(9);
|
||||
this.getSpellAbility().addAlternativeCost(new DemonOfDeathsGateAlternativeCost());
|
||||
|
||||
// You may pay 6 life and sacrifice three black creatures rather than pay Demon of Death's Gate's mana cost
|
||||
AlternativeCostSourceAbility alternateCosts = new AlternativeCostSourceAbility(new PayLifeCost(6));
|
||||
alternateCosts.addCost(new SacrificeTargetCost(new TargetControlledPermanent(3, 3, filter, false)));
|
||||
this.addAbility(alternateCosts);
|
||||
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
|
@ -73,32 +82,3 @@ public class DemonOfDeathsGate extends CardImpl<DemonOfDeathsGate> {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class DemonOfDeathsGateAlternativeCost extends AlternativeCostImpl<DemonOfDeathsGateAlternativeCost> {
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("black creature");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
}
|
||||
|
||||
public DemonOfDeathsGateAlternativeCost() {
|
||||
super("pay 6 life and sacrifice three black creatures");
|
||||
this.add(new PayLifeCost(6));
|
||||
this.add(new SacrificeTargetCost(new TargetControlledPermanent(3, 3, filter, false)));
|
||||
}
|
||||
|
||||
public DemonOfDeathsGateAlternativeCost(final DemonOfDeathsGateAlternativeCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DemonOfDeathsGateAlternativeCost copy() {
|
||||
return new DemonOfDeathsGateAlternativeCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "You may pay 6 life and sacrifice three black creatures rather than pay Demon of Death's Gate's mana cost";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -31,8 +31,7 @@ import java.util.UUID;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -40,7 +39,6 @@ import mage.filter.FilterPermanent;
|
|||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
||||
|
|
@ -54,9 +52,7 @@ public class Fireblast extends CardImpl<Fireblast> {
|
|||
private static final FilterPermanent filter = new FilterPermanent("Mountain");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.LAND));
|
||||
filter.add(new SubtypePredicate("Mountain"));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
public Fireblast(UUID ownerId) {
|
||||
|
|
@ -64,9 +60,9 @@ public class Fireblast extends CardImpl<Fireblast> {
|
|||
this.expansionSetCode = "VIS";
|
||||
|
||||
this.color.setRed(true);
|
||||
|
||||
|
||||
// You may sacrifice two Mountains rather than pay Fireblast's mana cost.
|
||||
this.getSpellAbility().addAlternativeCost(new FireblastAlternativeCost());
|
||||
this.addAbility(new AlternativeCostSourceAbility(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true))));
|
||||
|
||||
// Fireblast deals 4 damage to target creature or player.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(4));
|
||||
|
|
@ -83,37 +79,3 @@ public class Fireblast extends CardImpl<Fireblast> {
|
|||
return new Fireblast(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FireblastAlternativeCost extends AlternativeCostImpl<FireblastAlternativeCost> {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("Mountain");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.LAND));
|
||||
filter.add(new SubtypePredicate("Mountain"));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
public FireblastAlternativeCost() {
|
||||
super("You may sacrifice two Mountains rather than pay Fireblast's mana cost");
|
||||
this.add(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true)));
|
||||
}
|
||||
|
||||
public FireblastAlternativeCost(final FireblastAlternativeCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FireblastAlternativeCost copy() {
|
||||
return new FireblastAlternativeCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "You may sacrifice two Mountains rather than pay Fireblast's mana cost";
|
||||
}
|
||||
}
|
||||
|
|
@ -29,21 +29,28 @@ package mage.sets.worldwake;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility;
|
||||
import mage.abilities.condition.common.ControlsPermanentCondition;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ExileSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.permanent.AttackingPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.EmptyToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetAttackingCreature;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
|
|
@ -53,6 +60,14 @@ import mage.util.CardUtil;
|
|||
*/
|
||||
public class NemesisTrap extends CardImpl<NemesisTrap> {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("If a white creature is attacking");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
filter.add(new AttackingPredicate());
|
||||
}
|
||||
|
||||
|
||||
public NemesisTrap(UUID ownerId) {
|
||||
super(ownerId, 61, "Nemesis Trap", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{B}{B}");
|
||||
this.expansionSetCode = "WWK";
|
||||
|
|
@ -61,7 +76,7 @@ public class NemesisTrap extends CardImpl<NemesisTrap> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// If a white creature is attacking, you may pay {B}{B} rather than pay Nemesis Trap's mana cost.
|
||||
this.getSpellAbility().addAlternativeCost(new NemesisTrapAlternativeCost());
|
||||
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{B}{B}"), new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0, false)));
|
||||
|
||||
// Exile target attacking creature. Put a token that's a copy of that creature onto the battlefield. Exile it at the beginning of the next end step.
|
||||
this.getSpellAbility().addEffect(new NemesisTrapEffect());
|
||||
|
|
@ -78,40 +93,6 @@ public class NemesisTrap extends CardImpl<NemesisTrap> {
|
|||
}
|
||||
}
|
||||
|
||||
class NemesisTrapAlternativeCost extends AlternativeCostImpl<NemesisTrapAlternativeCost> {
|
||||
|
||||
public NemesisTrapAlternativeCost() {
|
||||
super("you may pay {B}{B} rather than pay {this}'s mana cost");
|
||||
this.add(new ManaCostsImpl("{B}{B}"));
|
||||
}
|
||||
|
||||
public NemesisTrapAlternativeCost(final NemesisTrapAlternativeCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NemesisTrapAlternativeCost copy() {
|
||||
return new NemesisTrapAlternativeCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(Game game, Ability source) {
|
||||
List<UUID> attackers = game.getCombat().getAttackers();
|
||||
for (UUID creatureId : attackers) {
|
||||
Permanent creature = game.getPermanent(creatureId);
|
||||
if (creature.getColor().isWhite()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "If a white creature is attacking, you may pay {B}{B} rather than pay Nemesis Trap's mana cost";
|
||||
}
|
||||
}
|
||||
|
||||
class NemesisTrapEffect extends OneShotEffect<NemesisTrapEffect> {
|
||||
|
||||
public NemesisTrapEffect() {
|
||||
|
|
@ -130,12 +111,10 @@ class NemesisTrapEffect extends OneShotEffect<NemesisTrapEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent targetedCreature = game.getPermanent(source.getFirstTarget());
|
||||
if (targetedCreature == null) {
|
||||
targetedCreature = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
|
||||
}
|
||||
if (targetedCreature != null) {
|
||||
targetedCreature.moveToExile(id, "Nemesis Trap Exile", id, game);
|
||||
Permanent targetedCreature = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && targetedCreature != null) {
|
||||
controller.moveCardToExileWithInfo(targetedCreature, null, null, source.getSourceId(), game, Zone.BATTLEFIELD);
|
||||
EmptyToken token = new EmptyToken();
|
||||
CardUtil.copyTo(token).from(targetedCreature);
|
||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue