mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
[CMM] Implement Desecrate Reality (#10684)
This commit is contained in:
parent
d205981516
commit
a8bba53adf
3 changed files with 155 additions and 6 deletions
|
|
@ -19,22 +19,33 @@ public enum AdamantCondition implements Condition {
|
|||
BLACK(ColoredManaSymbol.B),
|
||||
RED(ColoredManaSymbol.R),
|
||||
GREEN(ColoredManaSymbol.G),
|
||||
COLORLESS(null, true),
|
||||
ANY(null);
|
||||
|
||||
private final ColoredManaSymbol coloredManaSymbol;
|
||||
private final boolean colorless;
|
||||
|
||||
|
||||
private AdamantCondition(ColoredManaSymbol coloredManaSymbol) {
|
||||
this(coloredManaSymbol, false);
|
||||
}
|
||||
|
||||
private AdamantCondition(ColoredManaSymbol coloredManaSymbol, boolean colorless) {
|
||||
this.coloredManaSymbol = coloredManaSymbol;
|
||||
this.colorless = colorless;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source.getAbilityType() == AbilityType.SPELL) {
|
||||
if (colorless) {
|
||||
return source.getManaCostsToPay().getUsedManaToPay().getColorless() > 2;
|
||||
}
|
||||
if (coloredManaSymbol == null) {
|
||||
return Arrays
|
||||
.stream(ColoredManaSymbol.values())
|
||||
.map(source.getManaCostsToPay().getUsedManaToPay()::getColor)
|
||||
.anyMatch(i -> i > 2);
|
||||
.stream(ColoredManaSymbol.values())
|
||||
.map(source.getManaCostsToPay().getUsedManaToPay()::getColor)
|
||||
.anyMatch(i -> i > 2);
|
||||
}
|
||||
return source.getManaCostsToPay().getUsedManaToPay().getColor(coloredManaSymbol) > 2;
|
||||
}
|
||||
|
|
@ -46,11 +57,14 @@ public enum AdamantCondition implements Condition {
|
|||
if (payment == null) {
|
||||
return false;
|
||||
}
|
||||
if (colorless) {
|
||||
return payment.getColorless() > 2;
|
||||
}
|
||||
if (coloredManaSymbol == null) {
|
||||
return Arrays
|
||||
.stream(ColoredManaSymbol.values())
|
||||
.map(payment::getColor)
|
||||
.anyMatch(i -> i > 2);
|
||||
.stream(ColoredManaSymbol.values())
|
||||
.map(payment::getColor)
|
||||
.anyMatch(i -> i > 2);
|
||||
}
|
||||
return payment.getColor(coloredManaSymbol) > 2;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue