use of mage.abilities.costs.mana.HybridManaCost in project mage by magefree.
the class OfferingCostReductionEffect method getManaOptions.
@Override
public ManaOptions getManaOptions(Ability source, Game game, ManaCost unpaid) {
ManaOptions additionalManaOptionsForThisAbility = new ManaOptions();
// Creatures from the offerd type
game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game).stream().map(Card::getSpellAbility).filter(Objects::nonNull).forEach(spellAbility -> {
ManaOptions manaOptionsForThisPermanent = new ManaOptions();
for (ManaCost manaCost : spellAbility.getManaCosts()) {
if (manaCost instanceof HybridManaCost) {
ManaOptions manaOptionsForHybrid = new ManaOptions();
manaOptionsForHybrid.addAll(manaCost.getManaOptions());
manaOptionsForThisPermanent.addMana(manaOptionsForHybrid);
} else {
manaOptionsForThisPermanent.addMana(manaCost.getMana());
}
}
additionalManaOptionsForThisAbility.addAll(manaOptionsForThisPermanent);
});
additionalManaOptionsForThisAbility.removeDuplicated();
return additionalManaOptionsForThisAbility;
}
Aggregations