public ManaCostsImpl(final ManaCostsImpl<T> costs) { this.id = costs.id; for (T cost : costs) { this.add(cost.copy()); } }
ManaCosts<ManaCost> savedCosts = costs.get(mana); for (ManaCost cost : savedCosts) { this.add(cost.copy());
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); }
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()); } }
newManaCosts.add(new ColoredManaCost(((MonoHybridManaCost) manaCost).getManaColor())); } else { newManaCosts.add(manaCost.copy());
private void copyFromToken(Token token, Game game, boolean reset) { this.name = token.getName(); this.abilities.clear(); if (reset) { this.abilities.addAll(token.getAbilities()); } else { // first time -> create ContinuousEffects only once for (Ability ability : token.getAbilities()) { this.addAbility(ability, game); } } this.abilities.setControllerId(this.controllerId); this.manaCost.clear(); for (ManaCost cost : token.getManaCost()) { this.getManaCost().add(cost.copy()); } this.cardType.clear(); this.cardType.addAll(token.getCardType()); this.color = token.getColor(game).copy(); this.frameColor = token.getFrameColor(game); this.frameStyle = token.getFrameStyle(); this.supertype.clear(); this.supertype.addAll(token.getSuperType()); this.subtype.clear(); this.subtype.addAll(token.getSubtype(game)); this.isAllCreatureTypes = token.isAllCreatureTypes(); this.tokenDescriptor = token.getTokenDescriptor(); }