mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 05:09:16 -08:00
* Reworked non mana costs with variable amount. The values have now to be announced before targeting. Fixed some wrong implementations (Firestorm, Myr Battlesphere, Skeletal Scrying).
This commit is contained in:
parent
2d9f260b1e
commit
7ebb8a9cbe
46 changed files with 1176 additions and 1187 deletions
|
|
@ -28,24 +28,20 @@
|
|||
package mage.sets.avacynrestored;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.common.TapVariableTargetCost;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
||||
/**
|
||||
|
|
@ -54,6 +50,12 @@ import mage.target.common.TargetCreatureOrPlayer;
|
|||
*/
|
||||
public class BurnAtTheStake extends CardImpl<BurnAtTheStake> {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new TappedPredicate()));
|
||||
}
|
||||
|
||||
public BurnAtTheStake(UUID ownerId) {
|
||||
super(ownerId, 130, "Burn at the Stake", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{R}{R}{R}");
|
||||
this.expansionSetCode = "AVR";
|
||||
|
|
@ -61,10 +63,10 @@ public class BurnAtTheStake extends CardImpl<BurnAtTheStake> {
|
|||
this.color.setRed(true);
|
||||
|
||||
// As an additional cost to cast Burn at the Stake, tap any number of untapped creatures you control.
|
||||
this.getSpellAbility().addCost(new BurnAtTheStakeCost());
|
||||
this.getSpellAbility().addCost(new TapVariableTargetCost(filter, true, "any number of"));
|
||||
// Burn at the Stake deals damage to target creature or player equal to three times the number of creatures tapped this way.
|
||||
this.getSpellAbility().addEffect(new BurnAtTheStakeEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer(true));
|
||||
}
|
||||
|
||||
public BurnAtTheStake(final BurnAtTheStake card) {
|
||||
|
|
@ -77,81 +79,6 @@ public class BurnAtTheStake extends CardImpl<BurnAtTheStake> {
|
|||
}
|
||||
}
|
||||
|
||||
class BurnAtTheStakeCost extends CostImpl<BurnAtTheStakeCost> implements VariableCost {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new TappedPredicate()));
|
||||
}
|
||||
private int amountPaid = 0;
|
||||
|
||||
public BurnAtTheStakeCost() {
|
||||
this.text = "As an additional cost to cast {this}, tap any number of untapped creatures you control";
|
||||
}
|
||||
|
||||
public BurnAtTheStakeCost(final BurnAtTheStakeCost cost) {
|
||||
super(cost);
|
||||
this.amountPaid = cost.amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BurnAtTheStakeCost copy() {
|
||||
return new BurnAtTheStakeCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
this.amountPaid = 0;
|
||||
|
||||
Target target = new TargetControlledCreaturePermanent(1, 1, filter, false);
|
||||
while (target.canChoose(controllerId, game) && target.choose(Outcome.Tap, controllerId, sourceId, game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.tap(game);
|
||||
amountPaid++;
|
||||
}
|
||||
|
||||
target.clearChosen();
|
||||
}
|
||||
|
||||
paid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return this.amountPaid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not Supported
|
||||
* @param filter
|
||||
*/
|
||||
@Override
|
||||
public void setFilter(FilterMana filter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public FilterMana getFilter() {
|
||||
return new FilterMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(int amount) {
|
||||
this.amountPaid = amount;
|
||||
}
|
||||
}
|
||||
|
||||
class BurnAtTheStakeEffect extends OneShotEffect<BurnAtTheStakeEffect> {
|
||||
|
||||
public BurnAtTheStakeEffect() {
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@
|
|||
package mage.sets.betrayersofkamigawa;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
|
@ -43,8 +39,12 @@ import mage.abilities.costs.common.TapSourceCost;
|
|||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
|
@ -77,10 +77,27 @@ public class QuillmaneBaku extends CardImpl<QuillmaneBaku> {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new QuillmaneBakuReturnEffect(), new GenericManaCost(1));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance(1)));
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.addTarget(new TargetCreaturePermanent(true));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SimpleActivatedAbility) {
|
||||
int maxConvManaCost = 0;
|
||||
for (Cost cost : ability.getCosts()) {
|
||||
if (cost instanceof RemoveVariableCountersSourceCost) {
|
||||
maxConvManaCost = ((RemoveVariableCountersSourceCost)cost).getAmount();
|
||||
}
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent newFilter = new FilterCreaturePermanent("creature with converted mana cost " + maxConvManaCost + " or less");
|
||||
newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, maxConvManaCost + 1));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(newFilter, true);
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
|
||||
public QuillmaneBaku(final QuillmaneBaku card) {
|
||||
super(card);
|
||||
}
|
||||
|
|
@ -112,23 +129,12 @@ public class QuillmaneBaku extends CardImpl<QuillmaneBaku> {
|
|||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int maxConvManaCost = 0;
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof RemoveVariableCountersSourceCost) {
|
||||
maxConvManaCost = ((RemoveVariableCountersSourceCost)cost).getAmount();
|
||||
}
|
||||
}
|
||||
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost " + maxConvManaCost + " or less");
|
||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, maxConvManaCost + 1));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
|
||||
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
return permanent.moveToZone(Zone.HAND, source.getId(), game, false);
|
||||
player.moveCardToHandWithInfo((Card) permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,33 +27,26 @@
|
|||
*/
|
||||
package mage.sets.bornofthegods;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.common.SacrificeXTargetCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.PutOnLibrarySourceEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -61,6 +54,12 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class ChampionOfStraySouls extends CardImpl<ChampionOfStraySouls> {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other creatures");
|
||||
|
||||
static {
|
||||
filter.add(new AnotherPredicate());
|
||||
}
|
||||
|
||||
public ChampionOfStraySouls(UUID ownerId) {
|
||||
super(ownerId, 63, "Champion of Stray Souls", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
|
||||
this.expansionSetCode = "BNG";
|
||||
|
|
@ -80,8 +79,8 @@ public class ChampionOfStraySouls extends CardImpl<ChampionOfStraySouls> {
|
|||
effect.setText("Return X target creatures from your graveyard to the battlefield");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{3}{B}{B}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new ChampionOfStraySoulsSacrificeCost());
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0,Integer.MAX_VALUE, new FilterCreatureCard()));
|
||||
ability.addCost(new SacrificeXTargetCost(filter));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0,Integer.MAX_VALUE, new FilterCreatureCard("creature cards from your graveyard")));
|
||||
this.addAbility(ability);
|
||||
|
||||
// {5}{B}{B}: Put Champion of Stray Souls on top of your library from your graveyard.
|
||||
|
|
@ -91,6 +90,19 @@ public class ChampionOfStraySouls extends CardImpl<ChampionOfStraySouls> {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SimpleActivatedAbility) {
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) {
|
||||
int xValue = new GetXValue().calculate(game, ability);
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(xValue,xValue, new FilterCreatureCard("creature cards from your graveyard")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ChampionOfStraySouls(final ChampionOfStraySouls card) {
|
||||
super(card);
|
||||
}
|
||||
|
|
@ -100,74 +112,3 @@ public class ChampionOfStraySouls extends CardImpl<ChampionOfStraySouls> {
|
|||
return new ChampionOfStraySouls(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ChampionOfStraySoulsSacrificeCost extends CostImpl<ChampionOfStraySoulsSacrificeCost> implements VariableCost {
|
||||
|
||||
protected int amountPaid = 0;
|
||||
|
||||
public ChampionOfStraySoulsSacrificeCost() {
|
||||
this.text = "Sacrifice X other creatures";
|
||||
}
|
||||
|
||||
public ChampionOfStraySoulsSacrificeCost(final ChampionOfStraySoulsSacrificeCost cost) {
|
||||
super(cost);
|
||||
this.amountPaid = cost.amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
amountPaid = 0;
|
||||
int creaturesToSacrifice = ability.getTargets().get(0).getTargets().size();
|
||||
this.text = new StringBuilder(creaturesToSacrifice).append(" other creatures you control").toString();
|
||||
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent(this.text);
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
filter.add(new AnotherPredicate());
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(creaturesToSacrifice, creaturesToSacrifice, filter, true);
|
||||
|
||||
if (target.canChoose(controllerId, game) && target.choose(Outcome.Sacrifice, controllerId, sourceId, game)) {
|
||||
for (UUID creatureId: (List<UUID>) target.getTargets()) {
|
||||
Permanent creature = game.getPermanent(creatureId);
|
||||
if (creature != null) {
|
||||
creature.sacrifice(sourceId, game);
|
||||
amountPaid++;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
paid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilter(FilterMana filter) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterMana getFilter() {
|
||||
return new FilterMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChampionOfStraySoulsSacrificeCost copy() {
|
||||
return new ChampionOfStraySoulsSacrificeCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(int amount) {
|
||||
amountPaid = amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
|
|
@ -33,29 +33,25 @@ import mage.Mana;
|
|||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.common.SacrificeXTargetCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -64,6 +60,12 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class SpringjackPasture extends CardImpl<SpringjackPasture> {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Goats");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Goat"));
|
||||
}
|
||||
|
||||
public SpringjackPasture(UUID ownerId) {
|
||||
super(ownerId, 326, "Springjack Pasture", Rarity.RARE, new CardType[]{CardType.LAND}, "");
|
||||
this.expansionSetCode = "C13";
|
||||
|
|
@ -77,10 +79,11 @@ public class SpringjackPasture extends CardImpl<SpringjackPasture> {
|
|||
this.addAbility(ability);
|
||||
|
||||
// {tap}, Sacrifice X Goats: Add X mana of any one color to your mana pool. You gain X life.
|
||||
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SpringjackPastureEffect(), new TapSourceCost());
|
||||
ability2.addChoice(new ChoiceColor());
|
||||
ability2.addCost(new SpringjackPastureCost());
|
||||
this.addAbility(ability2);
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SpringjackPastureEffect(), new TapSourceCost());
|
||||
ability.addChoice(new ChoiceColor());
|
||||
ability.addCost(new SacrificeXTargetCost(filter));
|
||||
ability.addEffect(new GainLifeEffect(new GetXValue()));
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +101,7 @@ class SpringjackPastureEffect extends OneShotEffect<SpringjackPastureEffect> {
|
|||
|
||||
public SpringjackPastureEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Add X mana of any one color to your mana pool. You gain X life";
|
||||
staticText = "Add X mana of any one color to your mana pool";
|
||||
}
|
||||
|
||||
public SpringjackPastureEffect(final SpringjackPastureEffect effect) {
|
||||
|
|
@ -110,22 +113,17 @@ class SpringjackPastureEffect extends OneShotEffect<SpringjackPastureEffect> {
|
|||
Player you = game.getPlayer(source.getControllerId());
|
||||
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||
if (you != null && choice != null) {
|
||||
int count = source.getManaCostsToPay().getX();
|
||||
int count = new GetXValue().calculate(game, source);
|
||||
if (choice.getColor().isBlack()) {
|
||||
you.getManaPool().addMana(new Mana(0, 0, 0, 0, count, 0, 0), game, source);
|
||||
you.gainLife(count, game);
|
||||
} else if (choice.getColor().isBlue()) {
|
||||
you.getManaPool().addMana(new Mana(0, 0, count, 0, 0, 0, 0), game, source);
|
||||
you.gainLife(count, game);
|
||||
} else if (choice.getColor().isRed()) {
|
||||
you.getManaPool().addMana(new Mana(count, 0, 0, 0, 0, 0, 0), game, source);
|
||||
you.gainLife(count, game);
|
||||
} else if (choice.getColor().isGreen()) {
|
||||
you.getManaPool().addMana(new Mana(0, count, 0, 0, 0, 0, 0), game, source);
|
||||
you.gainLife(count, game);
|
||||
} else if (choice.getColor().isWhite()) {
|
||||
you.getManaPool().addMana(new Mana(0, 0, 0, count, 0, 0, 0), game, source);
|
||||
you.gainLife(count, game);
|
||||
}
|
||||
return true;
|
||||
|
||||
|
|
@ -139,80 +137,15 @@ class SpringjackPastureEffect extends OneShotEffect<SpringjackPastureEffect> {
|
|||
}
|
||||
}
|
||||
|
||||
class SpringjackPastureCost extends CostImpl<SpringjackPastureCost> implements VariableCost {
|
||||
|
||||
protected int amountPaid = 0;
|
||||
|
||||
public SpringjackPastureCost() {
|
||||
this.text = "sacrifice X Goats";
|
||||
}
|
||||
|
||||
public SpringjackPastureCost(final SpringjackPastureCost cost) {
|
||||
super(cost);
|
||||
this.amountPaid = cost.amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
amountPaid = 0;
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("X number of goats you control.");
|
||||
filter.add(new SubtypePredicate("Goat"));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
|
||||
while (true) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(controllerId, game) && target.choose(Outcome.Sacrifice, controllerId, sourceId, game)) {
|
||||
UUID goat = target.getFirstTarget();
|
||||
if (goat != null) {
|
||||
game.getPermanent(goat).sacrifice(sourceId, game);
|
||||
amountPaid++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
paid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilter(FilterMana filter) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterMana getFilter() {
|
||||
return new FilterMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpringjackPastureCost copy() {
|
||||
return new SpringjackPastureCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(int amount) {
|
||||
amountPaid = amount;
|
||||
}
|
||||
}
|
||||
|
||||
class GoatToken extends Token {
|
||||
|
||||
public GoatToken() {
|
||||
super("Goat", "0/1 white Goat creature token");
|
||||
setOriginalExpansionSetCode("EVE");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color = ObjectColor.WHITE;
|
||||
subtype.add("Goat");
|
||||
power = new MageInt(0);
|
||||
toughness = new MageInt(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class ToxicDeluge extends CardImpl<ToxicDeluge> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// As an additional cost to cast Toxic Deluge, pay X life.
|
||||
this.getSpellAbility().addCost(new PayVariableLifeCost());
|
||||
this.getSpellAbility().addCost(new PayVariableLifeCost(true));
|
||||
// All creatures get -X/-X until end of turn.
|
||||
DynamicValue xValue = new SignInversionDynamicValue(new GetXValue());
|
||||
this.getSpellAbility().addEffect(new BoostAllEffect(xValue, xValue, Duration.EndOfTurn));
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class Quillspike extends CardImpl<Quillspike> {
|
|||
|
||||
// {BG}, Remove a -1/-1 counter from a creature you control: Quillspike gets +3/+3 until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(3, 3, Duration.EndOfTurn), new ManaCostsImpl("{B/G}"));
|
||||
TargetPermanent target = new TargetPermanent(1, 1, new FilterControlledCreaturePermanent(), true);
|
||||
TargetPermanent target = new TargetPermanent(1, 1, new FilterControlledCreaturePermanent("creature you control"), true);
|
||||
ability.addCost(new RemoveCounterCost(target, CounterType.M1M1));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,7 @@ public class OozeFlux extends CardImpl<OozeFlux> {
|
|||
|
||||
// {1}{G}, Remove one or more +1/+1 counters from among creatures you control: Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new OozeFluxCreateTokenEffect(new OozeToken()),new ManaCostsImpl("{1}{G}"));
|
||||
ability.addCost(new RemoveVariableCountersTargetCost(
|
||||
new TargetControlledCreaturePermanent(1,Integer.MAX_VALUE,new FilterControlledCreaturePermanent(), true), CounterType.P1P1));
|
||||
ability.addCost(new RemoveVariableCountersTargetCost(new FilterControlledCreaturePermanent("creatures you control"), CounterType.P1P1, "one or more", 1));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class DelverOfSecrets extends CardImpl<DelverOfSecrets> {
|
|||
class DelverOfSecretsAbility extends TriggeredAbilityImpl<DelverOfSecretsAbility> {
|
||||
|
||||
public DelverOfSecretsAbility() {
|
||||
super(Zone.BATTLEFIELD, new TransformSourceEffect(true), false);
|
||||
super(Zone.BATTLEFIELD, new TransformSourceEffect(true, false), false);
|
||||
}
|
||||
|
||||
public DelverOfSecretsAbility(DelverOfSecretsAbility ability) {
|
||||
|
|
|
|||
|
|
@ -28,21 +28,13 @@
|
|||
package mage.sets.innistrad;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.common.ExileXFromYourGraveCost;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
|
@ -58,7 +50,7 @@ public class HarvestPyre extends CardImpl<HarvestPyre> {
|
|||
this.color.setRed(true);
|
||||
|
||||
// As an additional cost to cast Harvest Pyre, exile X cards from your graveyard.
|
||||
this.getSpellAbility().addCost(new HarvestPyreCost());
|
||||
this.getSpellAbility().addCost(new ExileXFromYourGraveCost(new FilterCard("cards from your graveyard")));
|
||||
|
||||
// Harvest Pyre deals X damage to target creature.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
|
@ -74,77 +66,3 @@ public class HarvestPyre extends CardImpl<HarvestPyre> {
|
|||
return new HarvestPyre(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HarvestPyreCost extends CostImpl<HarvestPyreCost> implements VariableCost {
|
||||
|
||||
protected int amountPaid = 0;
|
||||
|
||||
public HarvestPyreCost() {
|
||||
this.text = "As an additional cost to cast Harvest Pyre, exile X cards from your graveyard";
|
||||
}
|
||||
|
||||
public HarvestPyreCost(final HarvestPyreCost cost) {
|
||||
super(cost);
|
||||
this.amountPaid = cost.amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
amountPaid = 0;
|
||||
Target target = new TargetCardInYourGraveyard();
|
||||
Player player = game.getPlayer(controllerId);
|
||||
while (true) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(controllerId, game) && target.choose(Outcome.Exile, controllerId, sourceId, game)) {
|
||||
Card card = player.getGraveyard().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
player.getGraveyard().remove(card);
|
||||
card.moveToExile(null, "", sourceId, game);
|
||||
amountPaid++;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
paid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return amountPaid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not Supported
|
||||
* @param filter
|
||||
*/
|
||||
@Override
|
||||
public void setFilter(FilterMana filter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public FilterMana getFilter() {
|
||||
return new FilterMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HarvestPyreCost copy() {
|
||||
return new HarvestPyreCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(int amount) {
|
||||
amountPaid = amount;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ package mage.sets.limitedalpha;
|
|||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.mana.VariableManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
|
@ -65,7 +67,10 @@ public class DrainLife extends CardImpl<DrainLife> {
|
|||
// Drain Life deals X damage to target creature or player. You gain life equal to the damage dealt, but not more life than the player's life total before Drain Life dealt damage or the creature's toughness.
|
||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
||||
this.getSpellAbility().addEffect(new DrainLifeEffect());
|
||||
this.getSpellAbility().getManaCostsToPay().getVariableCosts().get(0).setFilter(filterBlack);
|
||||
VariableCost variableCost = this.getSpellAbility().getManaCostsToPay().getVariableCosts().get(0);
|
||||
if (variableCost instanceof VariableManaCost) {
|
||||
((VariableManaCost) variableCost).setFilter(filterBlack);
|
||||
}
|
||||
}
|
||||
|
||||
public DrainLife(final DrainLife card) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.mana.VariableManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterMana;
|
||||
|
|
@ -63,7 +65,10 @@ public class ConsumeSpirit extends CardImpl<ConsumeSpirit> {
|
|||
// Consume Spirit deals X damage to target creature or player and you gain X life.
|
||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
||||
this.getSpellAbility().addEffect(new ConsumeSpiritEffect());
|
||||
this.getSpellAbility().getManaCostsToPay().getVariableCosts().get(0).setFilter(filterBlack);
|
||||
VariableCost variableCost = this.getSpellAbility().getManaCostsToPay().getVariableCosts().get(0);
|
||||
if (variableCost instanceof VariableManaCost) {
|
||||
((VariableManaCost) variableCost).setFilter(filterBlack);
|
||||
}
|
||||
}
|
||||
|
||||
public ConsumeSpirit(final ConsumeSpirit card) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.sets.magic2014;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -39,6 +42,7 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.AngelToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
|
|
@ -87,23 +91,35 @@ class DevoutInvocationEffect extends OneShotEffect<DevoutInvocationEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int tappedAmount = 0;
|
||||
TargetPermanent target = new TargetPermanent(filter);
|
||||
while (true) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getId(), game)) {
|
||||
UUID creature = target.getFirstTarget();
|
||||
if (creature != null) {
|
||||
game.getPermanent(creature).tap(game);
|
||||
tappedAmount++;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int tappedAmount = 0;
|
||||
TargetPermanent target = new TargetPermanent(0,1,filter, false);
|
||||
while (true && controller.isInGame()) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(source.getControllerId(), game)) {
|
||||
Map<String, Serializable> options = new HashMap<>();
|
||||
options.put("UI.right.btn.text", "Tapping complete");
|
||||
controller.choose(outcome, target, source.getControllerId(), game, options);
|
||||
if (target.getTargets().size() > 0) {
|
||||
UUID creature = target.getFirstTarget();
|
||||
if (creature != null) {
|
||||
game.getPermanent(creature).tap(game);
|
||||
tappedAmount++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (tappedAmount > 0) {
|
||||
AngelToken angelToken = new AngelToken();
|
||||
angelToken.putOntoBattlefield(tappedAmount, game, source.getId(), source.getControllerId());
|
||||
if (tappedAmount > 0) {
|
||||
AngelToken angelToken = new AngelToken();
|
||||
angelToken.putOntoBattlefield(tappedAmount, game, source.getSourceId(), source.getControllerId());
|
||||
game.informPlayers(new StringBuilder(controller.getName()).append(" puts ").append(tappedAmount).append(" token").append(tappedAmount != 1 ?"s":"").append(" onto the battlefield").toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class ParasiticImplant extends CardImpl<ParasiticImplant> {
|
|||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
ability = new BeginningOfUpkeepTriggeredAbility(new ParasiticImplantEffect(), TargetController.YOU, false);
|
||||
ability.addEffect(new CreateTokenEffect(new MyrToken()));
|
||||
ability.addEffect(new CreateTokenEffect(new MyrToken("NPH")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class ShrineOfLoyalLegions extends CardImpl<ShrineOfLoyalLegions> {
|
|||
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), filter, false));
|
||||
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new CreateTokenEffect(new MyrToken(), new CountersCount(CounterType.CHARGE)),
|
||||
new CreateTokenEffect(new MyrToken("NPH"), new CountersCount(CounterType.CHARGE)),
|
||||
new GenericManaCost(3));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
|
|
|
|||
|
|
@ -28,23 +28,22 @@
|
|||
package mage.sets.odyssey;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.ExileFromGraveCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
/**
|
||||
|
|
@ -60,10 +59,11 @@ public class SkeletalScrying extends CardImpl<SkeletalScrying> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// As an additional cost to cast Skeletal Scrying, exile X cards from your graveyard.
|
||||
this.getSpellAbility().addCost(new ExileXFromGraveyardCost());
|
||||
|
||||
Ability ability = new SimpleStaticAbility(Zone.ALL,new SkeletalScryingRuleEffect());
|
||||
ability.setRuleAtTheTop(true);
|
||||
this.addAbility(ability);
|
||||
// You draw X cards and you lose X life.
|
||||
this.getSpellAbility().addEffect(new SkeletalScryingEffect(new GetXValue()));
|
||||
this.getSpellAbility().addEffect(new SkeletalScryingEffect(new ManacostVariableValue()));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -71,86 +71,41 @@ public class SkeletalScrying extends CardImpl<SkeletalScrying> {
|
|||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
if (xValue > 0) {
|
||||
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(xValue, xValue, new FilterCard("cards from your graveyard"))));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SkeletalScrying copy() {
|
||||
return new SkeletalScrying(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ExileXFromGraveyardCost extends CostImpl<ExileXFromGraveyardCost> implements VariableCost {
|
||||
class SkeletalScryingRuleEffect extends OneShotEffect<SkeletalScryingRuleEffect> {
|
||||
|
||||
protected int amountPaid = 0;
|
||||
|
||||
public ExileXFromGraveyardCost() {
|
||||
this.text = "As an additional cost to cast Skeletal Scrying, exile X cards from your graveyard";
|
||||
public SkeletalScryingRuleEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "As an additional cost to cast Skeletal Scrying, exile X cards from your graveyard";
|
||||
}
|
||||
|
||||
public ExileXFromGraveyardCost(final ExileXFromGraveyardCost cost) {
|
||||
super(cost);
|
||||
this.amountPaid = cost.amountPaid;
|
||||
public SkeletalScryingRuleEffect(final SkeletalScryingRuleEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
public SkeletalScryingRuleEffect copy() {
|
||||
return new SkeletalScryingRuleEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
amountPaid = 0;
|
||||
Target target = new TargetCardInYourGraveyard();
|
||||
Player player = game.getPlayer(controllerId);
|
||||
while (true) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(controllerId, game) && target.choose(Outcome.Exile, controllerId, sourceId, game)) {
|
||||
Card card = player.getGraveyard().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
player.getGraveyard().remove(card);
|
||||
card.moveToExile(null, "", sourceId, game);
|
||||
amountPaid++;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
paid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return amountPaid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not Supported
|
||||
* @param filter
|
||||
*/
|
||||
@Override
|
||||
public void setFilter(FilterMana filter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public FilterMana getFilter() {
|
||||
return new FilterMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExileXFromGraveyardCost copy() {
|
||||
return new ExileXFromGraveyardCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(int amount) {
|
||||
amountPaid = amount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SkeletalScryingEffect extends OneShotEffect<SkeletalScryingEffect> {
|
||||
|
||||
protected DynamicValue amount;
|
||||
|
|
|
|||
|
|
@ -28,22 +28,18 @@
|
|||
package mage.sets.riseoftheeldrazi;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.common.SacrificeXTargetCost;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -58,7 +54,7 @@ public class DevastatingSummons extends CardImpl<DevastatingSummons> {
|
|||
this.color.setRed(true);
|
||||
|
||||
// As an additional cost to cast Devastating Summons, sacrifice X lands.
|
||||
this.getSpellAbility().addCost(new DevastatingSummonsCost());
|
||||
this.getSpellAbility().addCost(new SacrificeXTargetCost(new FilterControlledLandPermanent("lands"), true));
|
||||
|
||||
// Put two X/X red Elemental creature tokens onto the battlefield.
|
||||
this.getSpellAbility().addEffect(new DevastatingSummonsEffect());
|
||||
|
|
@ -74,78 +70,6 @@ public class DevastatingSummons extends CardImpl<DevastatingSummons> {
|
|||
}
|
||||
}
|
||||
|
||||
class DevastatingSummonsCost extends CostImpl<DevastatingSummonsCost> implements VariableCost {
|
||||
|
||||
protected int amountPaid = 0;
|
||||
|
||||
public DevastatingSummonsCost() {
|
||||
this.text = "sacrifice X lands";
|
||||
}
|
||||
|
||||
public DevastatingSummonsCost(final DevastatingSummonsCost cost) {
|
||||
super(cost);
|
||||
this.amountPaid = cost.amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
amountPaid = 0;
|
||||
FilterLandPermanent filter = new FilterLandPermanent("X number of lands you control.");
|
||||
TargetLandPermanent target = new TargetLandPermanent(filter);
|
||||
while (true) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(controllerId, game) && target.choose(Outcome.Sacrifice, controllerId, sourceId, game)) {
|
||||
UUID land = target.getFirstTarget();
|
||||
if (land != null) {
|
||||
game.getPermanent(land).sacrifice(sourceId, game);
|
||||
amountPaid++;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
paid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return amountPaid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not Supported
|
||||
* @param filter
|
||||
*/
|
||||
@Override
|
||||
public void setFilter(FilterMana filter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public FilterMana getFilter() {
|
||||
return new FilterMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevastatingSummonsCost copy() {
|
||||
return new DevastatingSummonsCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(int amount) {
|
||||
amountPaid = amount;
|
||||
}
|
||||
}
|
||||
|
||||
class DevastatingSummonsEffect extends OneShotEffect<DevastatingSummonsEffect> {
|
||||
|
||||
public DevastatingSummonsEffect() {
|
||||
|
|
|
|||
|
|
@ -28,33 +28,30 @@
|
|||
|
||||
package mage.sets.scarsofmirrodin;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.common.TapVariableTargetCost;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.token.MyrToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -74,7 +71,7 @@ public class MyrBattlesphere extends CardImpl<MyrBattlesphere> {
|
|||
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new MyrToken(), 4), false));
|
||||
|
||||
// Whenever Myr Battlesphere attacks, you may tap X untapped Myr you control. If you do, Myr Battlesphere gets +X/+0 until end of turn and deals X damage to defending player.
|
||||
this.addAbility(new MyrBattlesphereAbility());
|
||||
this.addAbility(new AttacksTriggeredAbility(new MyrBattlesphereEffect(), true));
|
||||
}
|
||||
|
||||
public MyrBattlesphere(final MyrBattlesphere card) {
|
||||
|
|
@ -88,77 +85,63 @@ public class MyrBattlesphere extends CardImpl<MyrBattlesphere> {
|
|||
|
||||
}
|
||||
|
||||
class MyrBattlesphereAbility extends TriggeredAbilityImpl<MyrBattlesphereAbility> {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Myr");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Myr"));
|
||||
filter.add(Predicates.not(new TappedPredicate()));
|
||||
}
|
||||
|
||||
public MyrBattlesphereAbility() {
|
||||
super(Zone.BATTLEFIELD, new BoostSourceEffect(new GetXValue(), new StaticValue(0), Duration.EndOfTurn), true);
|
||||
this.addEffect(new MyrBattlesphereEffect());
|
||||
this.addCost(new TapVariableTargetCost(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, false)));
|
||||
}
|
||||
|
||||
public MyrBattlesphereAbility(final MyrBattlesphereAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
if (costs.isPaid()) {
|
||||
return true;
|
||||
}
|
||||
if (costs.canPay(this.getId(), this.getControllerId(), game)) {
|
||||
return costs.pay(this, game, this.getId(), this.getControllerId(), false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) {
|
||||
costs.clearPaid();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever {this} attacks, " + super.getRule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MyrBattlesphereAbility copy() {
|
||||
return new MyrBattlesphereAbility(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MyrBattlesphereEffect extends OneShotEffect<MyrBattlesphereEffect> {
|
||||
|
||||
private GetXValue amount = new GetXValue();
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Myr you control");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new TappedPredicate()));
|
||||
filter.add(new SubtypePredicate("Myr"));
|
||||
}
|
||||
|
||||
public MyrBattlesphereEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "{source} deals X damage to defending player";
|
||||
staticText = "tap X untapped Myr you control. If you do, {source} gets +X/+0 until end of turn and deals X damage to defending player";
|
||||
}
|
||||
|
||||
public MyrBattlesphereEffect(final MyrBattlesphereEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID defenderId = game.getCombat().getDefenderId(source.getSourceId());
|
||||
Player defender = game.getPlayer(defenderId);
|
||||
if (defender != null) {
|
||||
defender.damage(amount.calculate(game, source), source.getSourceId(), game, false, false);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int tappedAmount = 0;
|
||||
TargetPermanent target = new TargetPermanent(0,1,filter, false);
|
||||
while (true && controller.isInGame()) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(source.getControllerId(), game)) {
|
||||
Map<String, Serializable> options = new HashMap<>();
|
||||
options.put("UI.right.btn.text", "Myr tapping complete");
|
||||
controller.choose(outcome, target, source.getControllerId(), game, options);
|
||||
if (target.getTargets().size() > 0) {
|
||||
UUID creature = target.getFirstTarget();
|
||||
if (creature != null) {
|
||||
game.getPermanent(creature).tap(game);
|
||||
tappedAmount++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tappedAmount > 0) {
|
||||
game.informPlayers(new StringBuilder(controller.getName()).append(" taps ").append(tappedAmount).append(" Myrs").toString());
|
||||
// boost effect
|
||||
game.addEffect(new BoostSourceEffect(tappedAmount, 0, Duration.EndOfTurn), source);
|
||||
// damage to defender
|
||||
UUID defenderId = game.getCombat().getDefenderId(source.getSourceId());
|
||||
Player defender = game.getPlayer(defenderId);
|
||||
if (defender != null) {
|
||||
defender.damage(tappedAmount, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,10 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.costs.mana.VariableManaCost;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
|
@ -69,7 +71,10 @@ public class CrimsonHellkite extends CardImpl<CrimsonHellkite> {
|
|||
// {X}, {tap}: Crimson Hellkite deals X damage to target creature. Spend only red mana this way.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new ManacostVariableValue()), new ManaCostsImpl("{X}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.getManaCostsToPay().getVariableCosts().get(0).setFilter(filterRedMana);
|
||||
VariableCost variableCost = ability.getManaCostsToPay().getVariableCosts().get(0);
|
||||
if (variableCost instanceof VariableManaCost) {
|
||||
((VariableManaCost) variableCost).setFilter(filterRedMana);
|
||||
}
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,16 +28,19 @@
|
|||
package mage.sets.visions;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.costs.mana.VariableManaCost;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DamageEverythingEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.filter.FilterPermanent;
|
||||
|
||||
|
|
@ -48,6 +51,7 @@ import mage.filter.FilterPermanent;
|
|||
public class CryptRats extends CardImpl<CryptRats> {
|
||||
|
||||
public static final FilterMana filterBlack = new FilterMana();
|
||||
|
||||
static {
|
||||
filterBlack.setBlack(true);
|
||||
}
|
||||
|
|
@ -61,10 +65,14 @@ public class CryptRats extends CardImpl<CryptRats> {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// {X}: Crypt Rats deals X damage to each creature and each player. Spend only black mana this way.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageEverythingEffect(new ManacostVariableValue(), new FilterPermanent()), new ManaCostsImpl("{X}"));
|
||||
ability.getManaCostsToPay().getVariableCosts().get(0).setFilter(filterBlack);
|
||||
Effect effect = new DamageEverythingEffect(new ManacostVariableValue(), new FilterPermanent());
|
||||
effect.setText("{this} deals X damage to each creature and each player. Spend only black mana this way");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect,new ManaCostsImpl("{X}"));
|
||||
VariableCost variableCost = ability.getManaCostsToPay().getVariableCosts().get(0);
|
||||
if (variableCost instanceof VariableManaCost) {
|
||||
((VariableManaCost) variableCost).setFilter(filterBlack);
|
||||
}
|
||||
this.addAbility(ability);
|
||||
this.addInfo("01", "Spend only black mana this way.");
|
||||
}
|
||||
|
||||
public CryptRats(final CryptRats card) {
|
||||
|
|
|
|||
|
|
@ -29,24 +29,19 @@ package mage.sets.weatherlight;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.common.DiscardXTargetCost;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
||||
/**
|
||||
|
|
@ -62,16 +57,25 @@ public class Firestorm extends CardImpl<Firestorm> {
|
|||
this.color.setRed(true);
|
||||
|
||||
// As an additional cost to cast Firestorm, discard X cards.
|
||||
this.getSpellAbility().addCost(new DiscardXTargetCost(new FilterCard("cards"), true));
|
||||
// Firestorm deals X damage to each of X target creatures and/or players.
|
||||
this.getSpellAbility().addEffect(new FirestormEffect());
|
||||
this.getSpellAbility().addCost(new FirestormCost());
|
||||
|
||||
}
|
||||
|
||||
public Firestorm(final Firestorm card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = new GetXValue().calculate(game, ability);
|
||||
if (xValue > 0) {
|
||||
Target target = new TargetCreatureOrPlayer(xValue);
|
||||
target.setRequired(true);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Firestorm copy() {
|
||||
return new Firestorm(this);
|
||||
|
|
@ -93,105 +97,30 @@ class FirestormEffect extends OneShotEffect<FirestormEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
int amount = (new GetXValue()).calculate(game, source);
|
||||
TargetCreatureOrPlayer target = new TargetCreatureOrPlayer(amount);
|
||||
if (you != null) {
|
||||
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Neutral, source.getControllerId(), source.getId(), game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
List<UUID> targets = target.getTargets();
|
||||
for (UUID targetId : targets) {
|
||||
Permanent creature = game.getPermanent(targetId);
|
||||
if (creature != null) {
|
||||
creature.damage(amount, source.getSourceId(), game, true, false);
|
||||
} else {
|
||||
Player player = game.getPlayer(targetId);
|
||||
if (player != null) {
|
||||
player.damage(amount, source.getSourceId(), game, true, false);
|
||||
}
|
||||
if (source.getTargets().size() > 0) {
|
||||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent creature = game.getPermanent(targetId);
|
||||
if (creature != null) {
|
||||
creature.damage(amount, source.getSourceId(), game, true, false);
|
||||
} else {
|
||||
Player player = game.getPlayer(targetId);
|
||||
if (player != null) {
|
||||
player.damage(amount, source.getSourceId(), game, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public FirestormEffect copy() {
|
||||
return new FirestormEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FirestormCost extends CostImpl<FirestormCost> implements VariableCost {
|
||||
|
||||
protected int amountPaid = 0;
|
||||
|
||||
public FirestormCost() {
|
||||
this.text = "discard X cards";
|
||||
}
|
||||
|
||||
public FirestormCost(final FirestormCost cost) {
|
||||
super(cost);
|
||||
this.amountPaid = cost.amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
amountPaid = 0;
|
||||
Target target = new TargetCardInHand();
|
||||
Player you = game.getPlayer(controllerId);
|
||||
while (true) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(controllerId, game) && target.choose(Outcome.Discard, controllerId, sourceId, game)) {
|
||||
Card card = you.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
you.getHand().remove(card);
|
||||
card.moveToZone(Zone.GRAVEYARD, sourceId, game, false);
|
||||
amountPaid++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
paid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return amountPaid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not Supported
|
||||
* @param filter
|
||||
*/
|
||||
@Override
|
||||
public void setFilter(FilterMana filter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public FilterMana getFilter() {
|
||||
return new FilterMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FirestormCost copy() {
|
||||
return new FirestormCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(int amount) {
|
||||
amountPaid = amount;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue