@Override public int getConvertedManaCost() { if (manaCost != null) { return manaCost.convertedManaCost(); } return 0; }
protected void simulateVariableCosts(Ability ability, List<Ability> options, Game game) { int numAvailable = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost(); int start = 0; if (!(ability instanceof SpellAbility)) { //only use x=0 on spell abilities if (numAvailable == 0) return; else start = 1; } for (int i = start; i < numAvailable; i++) { Ability newAbility = ability.copy(); newAbility.getManaCostsToPay().add(new GenericManaCost(i)); options.add(newAbility); } }
@Override public List<VariableCost> getVariableCosts() { List<VariableCost> variableCosts = new ArrayList<>(); for (T cost : this) { if (cost instanceof VariableCost) { variableCosts.add((VariableCost) cost); } if (cost instanceof ManaCosts) { variableCosts.addAll(((ManaCosts) cost).getVariableCosts()); } } return variableCosts; }
public static void increaseCost(SpellAbility spellAbility, ManaCosts<ManaCost> manaCostsToIncrease) { ManaCosts<ManaCost> increasedCost = spellAbility.getManaCostsToPay().copy(); for (ManaCost manaCost : manaCostsToIncrease) { increasedCost.add(manaCost.copy()); } spellAbility.getManaCostsToPay().clear(); spellAbility.getManaCostsToPay().addAll(increasedCost); }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { ManaCosts manaCosts = sourceAbility.getManaCostsToPay(); if (manaCosts.getVariableCosts().isEmpty()) { return 2; } return sourceAbility.getManaCostsToPay().getX(); }
private int getManaCostScore(Card card, List<ColoredManaSymbol> allowedColors) { int converted = card.getManaCost().convertedManaCost(); final Map<String, Integer> singleCount = new HashMap<>(); int maxSingleCount = 0; int multicolor = 0; Set<String> colors = new HashSet<>(); for (String symbol : card.getManaCost().getSymbols()) { int count = 0; symbol = symbol.replace("{", "").replace("}", "");
@Override public boolean apply(Game game, Ability source, Ability abilityToModify) { SpellAbility spellAbility = (SpellAbility) abilityToModify; Mana mana = spellAbility.getManaCostsToPay().getMana(); if (mana.getGeneric() > 0) { int newCount = mana.getGeneric() - 6; if (newCount < 0) { newCount = 0; } mana.setGeneric(newCount); spellAbility.getManaCostsToPay().load(mana.toString()); return true; } return false; }
public SpellCostReductionSourceEffect(ManaCosts<ManaCost> manaCostsToReduce, Condition condition) { super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST); this.amount = 0; this.manaCostsToReduce = manaCostsToReduce; this.condition = condition; StringBuilder sb = new StringBuilder(); sb.append("{this} costs "); for (String manaSymbol : manaCostsToReduce.getSymbols()) { sb.append(manaSymbol); } sb.append(" less to if ").append(this.condition.toString()); this.staticText = sb.toString(); }
newManaCosts.add(new ColoredManaCost(((MonoHybridManaCost) manaCost).getManaColor())); } else { newManaCosts.add(manaCost.copy()); ManaOptions manaOptions = newManaCosts.getOptions(); if (manaOptions.size() == 1) { mana = newManaCosts.getMana(); } else { Choice manaChoice = new ChoiceImpl(true);
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int chroma = 0; chroma += permanent.getManaCost().getMana().getWhite(); return chroma; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { ManaCosts<ManaCost> cost = new ManaCostsImpl<>("{X}"); int xValue = controller.announceXMana(0, Integer.MAX_VALUE, "Choose the amount of mana to pay", game, source); cost.add(new GenericManaCost(xValue)); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false) && xValue > 0) { new RevealLibraryPutIntoHandEffect(xValue, filter, Zone.LIBRARY, false).apply(game, source); } return true; } return false; } }
public MadnessCastEffect(ManaCosts<ManaCost> madnessCost) { super(Outcome.Benefit); this.madnessCost = madnessCost; staticText = "you may cast it by paying " + madnessCost.getText() + " instead of putting it into your graveyard"; }
ManaOptions options = card.getManaCost().getOptions(); if (!card.getManaCost().getVariableCosts().isEmpty()) { continue; ManaOptions abilityOptions = ability.getManaCosts().getOptions(); if (!ability.getManaCosts().getVariableCosts().isEmpty()) { for (ActivatedAbility ability : card.getAbilities().getActivatedAbilities(Zone.GRAVEYARD)) { if (ability.canActivate(playerId, game).canActivate()) { ManaOptions abilityOptions = ability.getManaCosts().getOptions(); if (abilityOptions.isEmpty()) { playableAbilities.add(ability);
@Override public void adjustCosts(Ability ability, Game game) { if (ability instanceof SimpleActivatedAbility) { Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); if (sourcePermanent != null) { int pin = sourcePermanent.getCounters(game).getCount(CounterType.PIN); ability.getManaCostsToPay().clear(); ability.getManaCostsToPay().add(0, new GenericManaCost(pin * 2)); } } }
@Override public ManaOptions getMinimumCostToActivate(UUID playerId, Game game) { return getManaCostsToPay().getOptions(); }
int converted = card.getManaCost().convertedManaCost(); if (allowedColors == null) { int colorPenalty = 0; for (String symbol : card.getManaCost().getSymbols()) { if (isColoredMana(symbol)) { colorPenalty++; for (String symbol : card.getManaCost().getSymbols()) { int count = 0; symbol = symbol.replace("{", "").replace("}", "");
@Override public boolean apply(Game game, Ability source, Ability abilityToModify) { SpellAbility spellAbility = (SpellAbility) abilityToModify; spellAbility.getManaCostsToPay().add(new GenericManaCost(1)); return true; }
@Override public boolean apply(Game game, Ability source, Ability abilityToModify) { SpellAbility spellAbility = (SpellAbility) abilityToModify; Mana mana = spellAbility.getManaCostsToPay().getMana(); if (mana.getGeneric() > 0) { int newCount = mana.getGeneric() - 6; if (newCount < 0) { newCount = 0; } mana.setGeneric(newCount); spellAbility.getManaCostsToPay().load(mana.toString()); return true; } return false; }
public SpellsCostIncreasementControllerEffect(FilterCard filter, ManaCosts<ManaCost> manaCostsToReduce) { super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.INCREASE_COST); this.filter = filter; this.amount = 0; this.manaCostsToIncrease = manaCostsToReduce; StringBuilder sb = new StringBuilder(); sb.append(filter.getMessage()).append(" you cast cost "); for (String manaSymbol : manaCostsToReduce.getSymbols()) { sb.append(manaSymbol); } sb.append(" more to cast"); this.staticText = sb.toString(); }