mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Offering ability - fixed rollback error on usage with lands;
This commit is contained in:
parent
a2c046993d
commit
e02089464f
1 changed files with 17 additions and 18 deletions
|
@ -1,7 +1,5 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.StaticAbility;
|
||||
|
@ -24,6 +22,9 @@ import mage.target.targetpointer.FixedTarget;
|
|||
import mage.util.CardUtil;
|
||||
import mage.util.GameLog;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 702.46. Offering # 702.46a Offering is a static ability of a card that
|
||||
* functions in any zone from which the card can be cast. "[Subtype] offering"
|
||||
|
@ -96,24 +97,22 @@ public class OfferingAbility extends StaticAbility implements AlternateManaPayme
|
|||
// Creatures from the offerd type
|
||||
game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)
|
||||
.stream()
|
||||
.forEach(permanent -> {
|
||||
ManaOptions manaOptionsForThisPermanent = new ManaOptions();
|
||||
for (ManaCost manaCost : permanent.getSpellAbility().getManaCosts()) {
|
||||
if (manaCost instanceof HybridManaCost) {
|
||||
ManaOptions manaOptionsForHybrid = new ManaOptions();
|
||||
for (Mana mana : manaCost.getManaOptions()) {
|
||||
manaOptionsForHybrid.add(mana);
|
||||
.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());
|
||||
}
|
||||
}
|
||||
manaOptionsForThisPermanent.addMana(manaOptionsForHybrid);
|
||||
} else {
|
||||
manaOptionsForThisPermanent.addMana(manaCost.getMana());
|
||||
|
||||
additionalManaOptionsForThisAbility.addAll(manaOptionsForThisPermanent);
|
||||
}
|
||||
}
|
||||
for(Mana mana : manaOptionsForThisPermanent) {
|
||||
additionalManaOptionsForThisAbility.add(mana);
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
additionalManaOptionsForThisAbility.removeDuplicated();
|
||||
|
|
Loading…
Reference in a new issue