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(); } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller == null || permanent == null) { return false; } 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(); int manaPoolTotal = blackMana + whiteMana + blueMana + greenMana + redMana + colorlessMana; if (permanent.getConvertedManaCost() == manaPoolTotal) { return permanent.destroy(source.getSourceId(), game, false); } return false; } }
@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); }
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)))