forked from External/mage
Disable auto-payment of mana for spells which care about mana color (#9173)
This commit is contained in:
parent
045b07c7cf
commit
6035f04140
26 changed files with 174 additions and 20 deletions
|
|
@ -2,6 +2,8 @@ package mage.abilities;
|
|||
|
||||
import mage.MageIdentifier;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.*;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
|
|
@ -39,10 +41,7 @@ import mage.util.ThreadLocalStringBuilder;
|
|||
import mage.watchers.Watcher;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -1429,4 +1428,17 @@ public abstract class AbilityImpl implements Ability {
|
|||
this.identifier = identifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Needed for disabling auto-mana payments for things like Sunburst.
|
||||
*
|
||||
* @return true if the ability is impacted by the color of the mana used to pay for it.
|
||||
*/
|
||||
public boolean caresAboutManaColor() {
|
||||
return this.getEffects().stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(Effect::getCondition)
|
||||
.filter(Objects::nonNull)
|
||||
.anyMatch(Condition::caresAboutManaColor);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue