@Override public VariableManaCost copy() { return new VariableManaCost(this); }
if (!variableManaCost.isPaid()) { // should only happen for human players if (!noMana) { xValue = controller.announceXMana(variableManaCost.getMinX(), variableManaCost.getMaxX(), "Announce the value for " + variableManaCost.getText(), game, this); int amountMana = xValue * variableManaCost.getMultiplier(); StringBuilder manaString = threadLocalBuilder.get(); if (variableManaCost.getFilter() == null || variableManaCost.getFilter().isGeneric()) { manaString.append('{').append(amountMana).append('}'); } else { String manaSymbol = null; if (variableManaCost.getFilter().isBlack()) { if (variableManaCost.getFilter().isRed()) { manaSymbol = "B/R"; } else { manaSymbol = "B"; } else if (variableManaCost.getFilter().isRed()) { manaSymbol = "R"; } else if (variableManaCost.getFilter().isBlue()) { manaSymbol = "U"; } else if (variableManaCost.getFilter().isGreen()) { manaSymbol = "G"; } else if (variableManaCost.getFilter().isWhite()) { manaSymbol = "W"; manaCostsToPay.setX(amountMana); variableManaCost.setPaid();
int multiplier = variableManaCost.getMultiplier(); for (int mana = variableManaCost.getMinX(); mana <= numAvailable; mana++) { if (mana % multiplier == 0) { // use only values dependant from multiplier int xAmount = mana / multiplier; newAbility.getManaCostsToPay().setX(xAmount); if (varCost != null) { varCost.setPaid();
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { Player player = game.getPlayer(controllerId); int cmc = 0; for (UUID targetId : targets.get(0).getTargets()) { Card card = player.getHand().get(targetId, game); if (card == null) { return false; } cmc += card.getConvertedManaCost(); this.cards.add(card); } Cards cardsToExile = new CardsImpl(); cardsToExile.addAll(cards); player.moveCards(cardsToExile, Zone.EXILED, ability, game); paid = true; if (setXFromCMC) { VariableManaCost vmc = new VariableManaCost(); vmc.setAmount(cmc); vmc.setPaid(); ability.getManaCostsToPay().add(vmc); } } return paid; }
public HelmOfObedience(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); // {X}, {T}: Target opponent puts cards from the top of their library into their graveyard until a creature card or X cards are put into that graveyard this way, whichever comes first. If a creature card is put into that graveyard this way, sacrifice Helm of Obedience and put that card onto the battlefield under your control. X can't be 0. VariableManaCost xCosts = new VariableManaCost(); xCosts.setMinX(1); SimpleActivatedAbility abilitiy = new SimpleActivatedAbility(Zone.BATTLEFIELD, new HelmOfObedienceEffect(), xCosts); abilitiy.addCost(new TapSourceCost()); abilitiy.addTarget(new TargetOpponent()); this.addAbility(abilitiy); }
int xValue = this.getManaCostsToPay().getX(); this.getManaCostsToPay().clear(); VariableManaCost xCosts = new VariableManaCost(); xCosts.setAmount(xValue); this.getManaCostsToPay().add(xCosts); } else { game.informPlayers(controller.getLogName() + " announces a value of " + xValue + " for " + variableManaCost.getText());
private void addKickerCostsToAbility(Cost cost, Ability ability, Game game) { if (cost instanceof ManaCostsImpl) { @SuppressWarnings("unchecked") List<VariableManaCost> varCosts = ((ManaCostsImpl) cost).getVariableCosts(); if (!varCosts.isEmpty()) { // use only first variable cost xManaValue = game.getPlayer(this.controllerId).announceXMana(varCosts.get(0).getMinX(), Integer.MAX_VALUE, "Announce kicker value for " + varCosts.get(0).getText(), game, this); // kicker variable X costs handled internally as multikicker with {1} cost (no multikicker on card) if (!game.isSimulation()) { game.informPlayers(game.getPlayer(this.controllerId).getLogName() + " announced a value of " + xManaValue + " for " + " kicker X "); } ability.getManaCostsToPay().add(new GenericManaCost(xManaValue)); ManaCostsImpl<ManaCost> kickerManaCosts = (ManaCostsImpl) cost; for (ManaCost manaCost : kickerManaCosts) { if (!(manaCost instanceof VariableManaCost)) { ability.getManaCostsToPay().add(manaCost.copy()); } } } else { ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy()); } } else { ability.getCosts().add(cost.copy()); } }
public MindGrind(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{U}{B}"); // Each opponent reveals cards from the top of their library until he or she reveals X land cards, then puts all cards revealed this way into their graveyard. X can't be 0. this.getSpellAbility().addEffect(new MindGrindEffect()); for (VariableCost cost : this.getSpellAbility().getManaCosts().getVariableCosts()) { if (cost instanceof VariableManaCost) { ((VariableManaCost) cost).setMinX(1); break; } } }
public int getConvertedXManaCost(Card card) { int xMultiplier = 0; int amount = 0; if (card == null) { return 0; } for (ManaCost manaCost : card.getManaCost()) { if (manaCost instanceof VariableManaCost) { xMultiplier = ((VariableManaCost) manaCost).getMultiplier(); break; } } boolean hasNonManaXCost = false; for (Cost cost : getCosts()) { if (cost instanceof VariableCost) { hasNonManaXCost = true; amount = ((VariableCost) cost).getAmount(); break; } } if (!hasNonManaXCost) { amount = getManaCostsToPay().getX(); } return amount * xMultiplier; }
this.usesStack = false; if (suspend == Integer.MAX_VALUE) { VariableManaCost xCosts = new VariableManaCost(); xCosts.setMinX(1); this.addManaCost(xCosts); cost = new ManaCostsImpl("{X}" + cost.getText());
((VariableManaCost) cost).setMinX(1); break;
public PerniciousDeed(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{G}"); // {X}, Sacrifice Pernicious Deed: Destroy each artifact, creature, and enchantment with converted mana cost X or less. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PerniciousDeedEffect(), new VariableManaCost()); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); }
public TestamentOfFaith(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{W}"); // {X}: Testament of Faith becomes an X/X Wall creature with defender in addition to its other types until end of turn. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new TestamentOfFaithBecomesCreatureSourceEffect(new TestamentOfFaithToken(), "enchantment", Duration.EndOfTurn), new VariableManaCost())); }
public SandsOfDelirium(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); // {X}, {tap}: Target player puts the top X cards of their library into their graveyard. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(ManacostVariableValue.instance), new VariableManaCost()); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetPlayer()); this.addAbility(ability); }
public ThoughtDissector(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); // {X}, {tap}: Target opponent reveals cards from the top of their library until an artifact card or X cards are revealed, whichever comes first. If an artifact card is revealed this way, put it onto the battlefield under your control and sacrifice Thought Dissector. Put the rest of the revealed cards into that player's graveyard. SimpleActivatedAbility abilitiy = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ThoughtDissectorEffect(), new VariableManaCost()); abilitiy.addCost(new TapSourceCost()); abilitiy.addTarget(new TargetOpponent()); this.addAbility(abilitiy); }
public PanopticMirror(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}"); // Imprint - {X}, {tap}: You may exile an instant or sorcery card with converted mana cost X from your hand. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PanopticMirrorExileEffect(), new VariableManaCost()); ability.addCost(new TapSourceCost()); this.addAbility(ability); // At the beginning of your upkeep, you may copy a card exiled with Panoptic Mirror. If you do, you may cast the copy without paying its mana cost. this.addAbility(new BeginningOfUpkeepTriggeredAbility(new PanopticMirrorCastEffect(), TargetController.YOU, true)); }
public MomirEmblem() { setName("Emblem Momir Vig, Simic Visionary"); setExpansionSetCodeForImage("DIS"); // {X}, Discard a card: Put a token into play as a copy of a random creature card with converted mana cost X. Play this ability only any time you could play a sorcery and only once each turn. LimitedTimesPerTurnActivatedAbility ability = new LimitedTimesPerTurnActivatedAbility(Zone.COMMAND, new MomirEffect(), new VariableManaCost()); ability.addCost(new DiscardCardCost()); ability.setTiming(TimingRule.SORCERY); this.getAbilities().add(ability); } }
this.add(new VariableManaCost(modifierForX));
public MirrorEntity(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}"); this.subtype.add(SubType.SHAPESHIFTER); this.power = new MageInt(1); this.toughness = new MageInt(1); // Changeling this.addAbility(ChangelingAbility.getInstance()); // {X}: Until end of turn, creatures you control have base power and toughness X/X and gain all creature types. DynamicValue variableMana = ManacostVariableValue.instance; Effect effect = new SetPowerToughnessAllEffect(variableMana, variableMana, Duration.EndOfTurn, filter, true); effect.setText("Until end of turn, creatures you control have base power and toughness X/X"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new VariableManaCost()); effect = new GainAbilityAllEffect(ChangelingAbility.getInstance(), Duration.EndOfTurn, filter, false, Layer.TypeChangingEffects_4, SubLayer.NA); effect.setText("and gain all creature types"); ability.addEffect(effect); this.addAbility(ability); }