public ConditionalAnyColorManaAbility(Cost cost, DynamicValue amount, ConditionalManaBuilder manaBuilder, boolean oneChoice) { super(Zone.BATTLEFIELD, new AddConditionalManaOfAnyColorEffect(amount, manaBuilder, oneChoice), cost); this.amount = amount; }
@Override public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getConvertedManaCost() + 1; break; } } if (amount > 0) { new AddConditionalManaOfAnyColorEffect(amount, new MetamorphosisManaBuilder()).apply(game, source); } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Mana mana = getMana(game, source); if (mana != null) { checkToFirePossibleEvents(mana, game, source); controller.getManaPool().addMana(mana, game, source); } else { logger.error("There was no mana created: " + source.getSourceObject(game).getName() + " - Ability: " + source.getRule()); } return true; } return false; }
@Override public AddConditionalManaOfAnyColorEffect copy() { return new AddConditionalManaOfAnyColorEffect(this); }
public SarkhanFireblood(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{R}{R}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.SARKHAN); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(3)); // +1: You may discard a card. If you do, draw a card. this.addAbility(new LoyaltyAbility(new DoIfCostPaid( new DrawCardSourceControllerEffect(1), new DiscardCardCost() ), 1)); // +1: Add two mana of any combination of colors. Spend this mana only to cast Dragon spells. this.addAbility(new LoyaltyAbility( new AddConditionalManaOfAnyColorEffect( new StaticValue(2), new ConditionalSpellManaBuilder(filter), false ), 1 )); // -7: Create four 5/5 red Dragon creature tokens with flying. this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new DragonToken2(), 4), -7)); }