Fix CMC for flashbacked cards.

This should fix Conflagate/Chalice of the Void interaction.
This commit is contained in:
Nathaniel Brandes 2017-03-09 23:32:42 -08:00
parent 368dd9a5be
commit 900d68f77d
4 changed files with 77 additions and 23 deletions

View file

@ -27,13 +27,10 @@
*/
package mage.abilities.keyword;
import java.util.Iterator;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
import mage.abilities.costs.VariableCost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
@ -51,6 +48,8 @@ import mage.game.events.ZoneChangeEvent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* 702.32. Flashback
*
@ -206,21 +205,18 @@ class FlashbackEffect extends OneShotEffect {
for (Cost cost : source.getCosts()) {
if (cost instanceof Costs) {
Costs listOfcosts = (Costs) cost;
for (Iterator itListOfcosts = listOfcosts.iterator(); itListOfcosts.hasNext();) {
Object singleCost = itListOfcosts.next();
Costs<Cost> listOfCosts = (Costs<Cost>) cost;
for (Cost singleCost : listOfCosts) {
if (singleCost instanceof ManaCost) {
((ManaCost) singleCost).clearPaid();
singleCost.clearPaid();
spellAbility.getManaCosts().add((ManaCost) singleCost);
spellAbility.getManaCostsToPay().add((ManaCost) singleCost);
} else {
spellAbility.getCosts().add((Cost) singleCost);
spellAbility.getCosts().add(singleCost);
}
}
}
if (!(cost instanceof VariableCost) && !(cost instanceof Costs)) {
} else {
if (cost instanceof ManaCost) {
spellAbility.getManaCosts().add((ManaCost) cost);
spellAbility.getManaCostsToPay().add((ManaCost) cost);