@Override public Mana getMana() { Mana mana = new Mana(); for (ManaCost cost : this) { mana.add(cost.getMana()); } return mana; }
@Override public boolean containsColor(ColoredManaSymbol coloredManaSymbol) { for (ManaCost manaCost : this) { if (manaCost.containsColor(coloredManaSymbol)) { return true; } } return false; } }
public ManaCostsImpl(final ManaCostsImpl<T> costs) { this.id = costs.id; for (T cost : costs) { this.add(cost.copy()); } }
if (unpaid.containsColor(ColoredManaSymbol.W) && choice.getChoices().contains("White")) { colorToAutoPay = "White"; if (unpaid.containsColor(ColoredManaSymbol.R) && choice.getChoices().contains("Red")) { if (colorToAutoPay != null) { return false; if (unpaid.containsColor(ColoredManaSymbol.G) && choice.getChoices().contains("Green")) { if (colorToAutoPay != null) { return false; if (unpaid.containsColor(ColoredManaSymbol.U) && choice.getChoices().contains("Blue")) { if (colorToAutoPay != null) { return false; if (unpaid.containsColor(ColoredManaSymbol.B) && choice.getChoices().contains("Black")) { if (colorToAutoPay != null) { return false; if (unpaid.getMana().getDifferentColors() == 0) { colorToAutoPay = choice.getChoices().iterator().next();
if (!cost.isPaid() && cost instanceof ColorlessManaCost) { cost.assignPayment(game, ability, pool, costToPay); if (pool.isEmpty()) { return; if (!cost.isPaid() && cost instanceof ColoredManaCost) { cost.assignPayment(game, ability, pool, costToPay); if (pool.isEmpty()) { return; if (!cost.isPaid() && cost instanceof HybridManaCost) { cost.assignPayment(game, ability, pool, costToPay); if (pool.isEmpty()) { return; if (!cost.isPaid() && cost instanceof MonoHybridManaCost) { if (((cost.containsColor(ColoredManaSymbol.W)) && (pool.getWhite() > 0 || pool.ConditionalManaHasManaType(ManaType.WHITE))) || ((cost.containsColor(ColoredManaSymbol.B)) && (pool.getBlack() > 0 || pool.ConditionalManaHasManaType(ManaType.BLACK))) || ((cost.containsColor(ColoredManaSymbol.R)) && (pool.getRed() > 0 || pool.ConditionalManaHasManaType(ManaType.RED))) || ((cost.containsColor(ColoredManaSymbol.G)) && (pool.getGreen() > 0 || pool.ConditionalManaHasManaType(ManaType.GREEN))) || ((cost.containsColor(ColoredManaSymbol.U)) && (pool.getBlue() > 0) || pool.ConditionalManaHasManaType(ManaType.BLUE))) { cost.assignPayment(game, ability, pool, costToPay); if (pool.isEmpty() && pool.getConditionalMana().isEmpty()) { return; if (!cost.isPaid() && cost instanceof MonoHybridManaCost) { cost.assignPayment(game, ability, pool, costToPay); if (pool.isEmpty()) { return;
int colored = 0; for (Mana mana : manaAbility.getNetMana(game)) { if (!unpaid.getMana().includesMana(mana)) { continue ManaAbility; if (cost.testPay(netMana)) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) { continue; if (cost instanceof ColoredManaCost) { for (Mana netMana : manaAbility.getNetMana(game)) { if (cost.testPay(netMana) || permittingObject != null) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) { continue; if (cost instanceof SnowManaCost) { for (Mana netMana : manaAbility.getNetMana(game)) { if (cost.testPay(netMana) || permittingObject != null) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) { continue; if (cost instanceof HybridManaCost) { for (Mana netMana : manaAbility.getNetMana(game)) { if (cost.testPay(netMana) || permittingObject != null) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) { continue; if (cost instanceof MonoHybridManaCost) { for (Mana netMana : manaAbility.getNetMana(game)) {
LicidEffect(ManaCost specialActionCost) { super(Outcome.Neutral); this.specialActionCost = specialActionCost; this.staticText = "{this} loses this ability and becomes an Aura enchantment with enchant creature. Attach it to target creature. You may pay " + specialActionCost.getText() + " to end this effect"; }
@Override public void setPaid() { for (T cost : this) { cost.setPaid(); } }
@Override public boolean isPaid() { for (T cost : this) { if (!(cost instanceof VariableManaCost) && !cost.isPaid()) { return false; } } return true; }
@Override public boolean testPay(Mana testMana) { for (ManaCost cost : this) { if (cost.testPay(testMana)) { return true; } } return false; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { for (T cost : this) { if (!cost.canPay(ability, sourceId, controllerId, game)) { return false; } } return true; }
if (currentUnpaidMana.containsColor(ColoredManaSymbol.W) && choice.getChoices().contains("White")) { choice.setChoice("White"); return true; if (currentUnpaidMana.containsColor(ColoredManaSymbol.R) && choice.getChoices().contains("Red")) { choice.setChoice("Red"); return true; if (currentUnpaidMana.containsColor(ColoredManaSymbol.G) && choice.getChoices().contains("Green")) { choice.setChoice("Green"); return true; if (currentUnpaidMana.containsColor(ColoredManaSymbol.U) && choice.getChoices().contains("Blue")) { choice.setChoice("Blue"); return true; if (currentUnpaidMana.containsColor(ColoredManaSymbol.B) && choice.getChoices().contains("Black")) { choice.setChoice("Black"); return true; if (currentUnpaidMana.getMana().getColorless() > 0 && choice.getChoices().contains("Colorless")) { choice.setChoice("Colorless"); return true;
@Override public List<String> getSymbols() { List<String> symbols = new ArrayList<>(); for (ManaCost cost : this) { symbols.add(cost.getText()); } return symbols; }
@Override public void adjustCosts(Ability ability, Game game) { Permanent card = game.getPermanent(ability.getSourceId()); if (card != null) { if (!card.getImprinted().isEmpty()) { Card imprinted = game.getCard(card.getImprinted().get(0)); if (imprinted != null) { ability.getManaCostsToPay().add(0, new GenericManaCost(imprinted.getConvertedManaCost())); } } } // no {X} anymore as we already have imprinted the card with defined manacost for (ManaCost cost : ability.getManaCostsToPay()) { if (cost instanceof VariableCost) { cost.setPaid(); } } }
if (cost instanceof VariableManaCost && !cost.isPaid()) { variableManaCost = (VariableManaCost) cost; break; // only one VariableManCost per spell (or is it possible to have more?) VariableManaCost varCost = null; for (ManaCost cost : newAbility.getManaCostsToPay()) { if (cost instanceof VariableManaCost && !cost.isPaid()) { varCost = (VariableManaCost) cost; break; // only one VariableManCost per spell (or is it possible to have more?)
for (ActivatedManaAbilityImpl ability : mageObject.getAbilities().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, game)) { for (Mana netMana : ability.getNetMana(game)) { if (cost.testPay(netMana)) { score++; break Abilities;
@Override public ActivationStatus canActivate(UUID playerId, Game game) { if (super.canActivate(playerId, game).canActivate()) { Player controller = game.getPlayer(this.getControllerId()); if (controller != null) { for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), this.getControllerId(), this.getSourceId(), game)) { ManaCost costToPay = CardUtil.reduceCost(emergeCost.copy(), creature.getConvertedManaCost()); if (costToPay.canPay(this, this.getSourceId(), this.getControllerId(), game)) { return ActivationStatus.getTrue(); } } } } return ActivationStatus.getFalse(); }
@Override public void adjustCosts(Ability ability, Game game) { super.adjustCosts(ability, game); int reductionAmount = game.getBattlefield().count(filter, ability.getSourceId(), ability.getControllerId(), game); Iterator<ManaCost> iter = ability.getManaCostsToPay().iterator(); while ( reductionAmount > 0 && iter.hasNext() ) { ManaCost manaCost = iter.next(); if (manaCost.getMana().getGreen() > 0) { // in case another effect adds additional mana cost iter.remove(); reductionAmount--; } } }