public Imperiosaur(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); this.subtype.add(SubType.DINOSAUR); this.power = new MageInt(5); this.toughness = new MageInt(5); // Spend only mana produced by basic lands to cast Imperiosaur. this.addAbility(new ImperiosaurStaticAbility()); this.getSpellAbility().getManaCostsToPay().setSourceFilter(filter); this.getSpellAbility().getManaCosts().setSourceFilter(filter); }
public MyrSuperion(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{2}"); this.subtype.add(SubType.MYR); this.power = new MageInt(5); this.toughness = new MageInt(6); // Spend only mana produced by creatures to cast Myr Superion. this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("Spend only mana produced by creatures to cast {this}"))); this.getSpellAbility().getManaCostsToPay().setSourceFilter(StaticFilters.FILTER_PERMANENT_CREATURES); this.getSpellAbility().getManaCosts().setSourceFilter(StaticFilters.FILTER_PERMANENT_CREATURES); }
private static ManaCosts<ManaCost> adjustCost(ManaCosts<ManaCost> manaCosts, int reduceCount) { int restToReduce = reduceCount; ManaCosts<ManaCost> adjustedCost = new ManaCostsImpl<>(); boolean updated = false; for (ManaCost manaCost : manaCosts) { Mana mana = manaCost.getOptions().get(0); int colorless = mana != null ? mana.getGeneric() : 0; if (restToReduce != 0 && colorless > 0) { if ((colorless - restToReduce) > 0) { int newColorless = colorless - restToReduce; adjustedCost.add(new GenericManaCost(newColorless)); restToReduce = 0; } else { restToReduce -= colorless; } updated = true; } else { adjustedCost.add(manaCost); } } // for increasing spell cost effects if (!updated && reduceCount < 0) { adjustedCost.add(new GenericManaCost(-reduceCount)); } adjustedCost.setSourceFilter(manaCosts.getSourceFilter()); return adjustedCost; }
adjustedCost.add(new GenericManaCost(0)); // neede to check if cost was reduced to 0 adjustedCost.setSourceFilter(previousCost.getSourceFilter()); // keep mana source restrictions spellAbility.getManaCostsToPay().clear(); spellAbility.getManaCostsToPay().addAll(adjustedCost);