public int getConditionalCount(Ability ability, Game game, FilterMana filter, Cost costToPay) { if (ability == null || getConditionalMana().isEmpty()) { return 0; } int count = 0; for (ConditionalMana mana : getConditionalMana()) { if (mana.apply(ability, game, mana.getManaProducerId(), costToPay)) { count += mana.count(filter); } } return count; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; Player player = game.getPlayer(sourceAbility.getControllerId()); if (player != null) { amount = player.getManaPool().get(manaType); for (ConditionalMana mana : player.getManaPool().getConditionalMana()) { amount += mana.get(manaType); } } return amount; }
private int getConditional(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay) { if (ability == null || getConditionalMana().isEmpty()) { return 0; } for (ManaPoolItem mana : manaItems) { if (mana.isConditional() && mana.getConditionalMana().get(manaType) > 0 && mana.getConditionalMana().apply(ability, game, mana.getSourceId(), costToPay)) { if (filter == null || filter.match(mana.getSourceObject(), game)) { return mana.getConditionalMana().get(manaType); } } } return 0; }
private void removeConditional(ManaType manaType, Ability ability, Game game, Cost costToPay, Mana usedManaToPay) { for (ConditionalMana mana : getConditionalMana()) { if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) { mana.set(manaType, mana.get(manaType) - 1); usedManaToPay.increase(manaType); GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAID, ability.getId(), mana.getManaProducerId(), ability.getControllerId(), 0, mana.getFlag()); event.setData(mana.getManaProducerOriginalId().toString()); game.fireEvent(event); break; } } }
public ManaPoolView(ManaPool pool) { this.red = pool.getRed(); this.green = pool.getGreen(); this.blue = pool.getBlue(); this.white = pool.getWhite(); this.black = pool.getBlack(); this.colorless = pool.getColorless(); for (ConditionalMana mana : pool.getConditionalMana()) { this.red += mana.getRed(); this.green += mana.getGreen(); this.blue += mana.getBlue(); this.white += mana.getWhite(); this.black += mana.getBlack(); this.colorless += mana.getColorless(); } }
for (ConditionalMana conditionalMana : manaPool.getConditionalMana()) { availableMana.addMana(conditionalMana);
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return null; } ManaPool pool = controller.getManaPool(); int blackMana = pool.getBlack(); int whiteMana = pool.getWhite(); int blueMana = pool.getBlue(); int greenMana = pool.getGreen(); int redMana = pool.getRed(); int colorlessMana = pool.getColorless(); for (ConditionalMana conditionalMana : pool.getConditionalMana()) { blackMana += conditionalMana.getBlack(); whiteMana += conditionalMana.getWhite(); blueMana += conditionalMana.getBlue(); greenMana += conditionalMana.getGreen(); redMana += conditionalMana.getRed(); colorlessMana += conditionalMana.getColorless(); } return new Mana(redMana, greenMana, blueMana, whiteMana, blackMana, 0, 0, colorlessMana); }
|| ((cost.containsColor(ColoredManaSymbol.U)) && (pool.getBlue() > 0) || pool.ConditionalManaHasManaType(ManaType.BLUE))) { cost.assignPayment(game, ability, pool, costToPay); if (pool.isEmpty() && pool.getConditionalMana().isEmpty()) { return;