@Override public void setPayment(Mana mana) { this.payment.add(mana); }
private void addManaCombination(Mana mana, Mana existingMana, List<Mana> payCombinations, List<String> payCombinationsStrings) { Mana newMana = existingMana.copy(); newMana.add(mana); payCombinations.add(newMana); payCombinationsStrings.add(newMana.toString()); }
@Override public Mana getPayment() { Mana manaTotal = new Mana(); for (ManaCost cost : this) { manaTotal.add(cost.getPayment()); } return manaTotal; }
@Override public Mana getUsedManaToPay() { Mana manaTotal = new Mana(); for (ManaCost cost : this) { manaTotal.add(cost.getUsedManaToPay()); } return manaTotal; }
@Override public Mana getMana() { Mana mana = new Mana(); for (ManaCost cost : this) { mana.add(cost.getMana()); } return mana; }
public Mana getMana() { Mana m = new Mana(); for (ManaPoolItem item : manaItems) { m.add(item.getMana()); } return m; }
public void addMana(Mana addMana) { if (isEmpty()) { this.add(new Mana()); } for (Mana mana : this) { mana.add(addMana); } }
public HybridManaCost(ColoredManaSymbol mana1, ColoredManaSymbol mana2) { this.mana1 = mana1; this.mana2 = mana2; this.cost = new Mana(mana1); this.cost.add(new Mana(mana2)); addColoredOption(mana1); addColoredOption(mana2); }
private Mana getManaTypes(Game game, Ability source) { List<Permanent> controlledPermanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); Mana types = new Mana(); for (Permanent permanent : controlledPermanents) { ObjectColor color = permanent.getColor(game); if (color.isBlack()) { types.add(Mana.BlackMana(1)); } if (color.isBlue()) { types.add(Mana.BlueMana(1)); } if (color.isGreen()) { types.add(Mana.GreenMana(1)); } if (color.isRed()) { types.add(Mana.RedMana(1)); } if (color.isWhite()) { types.add(Mana.WhiteMana(1)); } } return types; }
private Mana getManaTypes(Game game, Ability source) { Mana types = new Mana(); for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { Permanent land = ((SacrificeTargetCost) cost).getPermanents().get(0); if (land != null) { Abilities<ActivatedManaAbilityImpl> manaAbilities = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); for (ActivatedManaAbilityImpl ability : manaAbilities) { if (!ability.equals(source) && ability.definesMana(game)) { for (Mana netMana : ability.getNetMana(game)) { types.add(netMana); } } } } } } return types; }
public MonoHybridManaCost(ColoredManaSymbol mana) { this.mana = mana; this.cost = new Mana(mana); this.cost.add(Mana.GenericMana(2)); addColoredOption(mana); options.add(Mana.GenericMana(2)); }
private Mana getManaTypes(Game game, Ability source) { List<Permanent> lands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); Mana types = new Mana(); for (Permanent land : lands) { Abilities<ActivatedManaAbilityImpl> manaAbilities = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); for (ActivatedManaAbilityImpl ability : manaAbilities) { if (!ability.equals(source) && ability.definesMana(game)) { for (Mana netMana : ability.getNetMana(game)) { types.add(netMana); } } } } return types; }
public void addMana(ManaOptions options) { if (isEmpty()) { this.add(new Mana()); } if (!options.isEmpty()) { if (options.size() == 1) { //if there is only one mana option available add it to all the existing options addMana(options.get(0)); } else { //perform a union of all existing options and the new options List<Mana> copy = copy(); this.clear(); for (Mana addMana : options) { for (Mana mana : copy) { Mana newMana = new Mana(); newMana.add(mana); newMana.add(addMana); this.add(newMana); } } } } }
private Mana getManaTypes(Game game, Ability source) { Mana types = new Mana(); if (game == null || game.getPhase() == null) { return types; } if (inManaTypeCalculation) { return types; } inManaTypeCalculation = true; ObjectColor permanentColor; List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { permanentColor = permanent.getColor(game); if (permanentColor.isColorless()) { types.add(Mana.ColorlessMana(1)); } else { List<ObjectColor> permanentColors = permanent.getColor(game).getColors(); for (ObjectColor color : permanentColors) { types.add(new Mana(color.getOneColoredManaSymbol())); } } } inManaTypeCalculation = false; return types; }
private Mana getManaTypes(Game game, Ability source) { Mana types = new Mana(); if (game == null || game.getPhase() == null) { return types; } if (inManaTypeCalculation) { return types; } inManaTypeCalculation = true; List<Permanent> lands = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), source.getSourceId(), game); for (Permanent land : lands) { Abilities<ActivatedManaAbilityImpl> mana = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); for (ActivatedManaAbilityImpl ability : mana) { if (!ability.equals(source) && ability.definesMana(game)) { for (Mana netMana : ability.getNetMana(game)) { types.add(netMana); } } } } inManaTypeCalculation = false; return types; } }
private Mana getManaTypes(Game game, Ability source) { Mana types = new Mana(); if (game == null || game.getPhase() == null) { return types; } if (inManaTypeCalculation) { return types; } inManaTypeCalculation = true; List<Permanent> lands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent land : lands) { Abilities<ActivatedManaAbilityImpl> mana = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); for (ActivatedManaAbilityImpl ability : mana) { if (!ability.equals(source) && ability.definesMana(game)) { for (Mana netMana : ability.getNetMana(game)) { types.add(netMana); } } } } inManaTypeCalculation = false; return types; }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { Mana mana = new Mana(); int amountOfManaLeft = amount.calculate(game, source, this); int maxAmount = amountOfManaLeft; while (amountOfManaLeft > 0 && player.canRespond()) { for (ColoredManaSymbol coloredManaSymbol : manaSymbols) { int number = player.getAmount(0, amountOfManaLeft, "Distribute mana by color (done " + mana.count() + " of " + maxAmount + "). How many mana add to <b>" + coloredManaSymbol.getColorHtmlName() + "</b> (enter 0 for pass to next color)?", game); if (number > 0) { for (int i = 0; i < number; i++) { mana.add(new Mana(coloredManaSymbol)); } amountOfManaLeft -= number; } if (amountOfManaLeft == 0) { break; } } } return mana; } return null; }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { Mana mana = new Mana(); if (condition.apply(game, source)) { mana = effect.getManaTemplate().copy(); } else if (otherwiseEffect != null) { mana = otherwiseEffect.getManaTemplate().copy(); } if (mana.getAny() > 0) { int amount = mana.getAny(); Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return mana; } ChoiceColor choice = new ChoiceColor(true); if (controller.choose(outcome, choice, game)) { mana.setAny(0); mana.add(choice.getMana(amount)); } } return mana; } }