mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Split cards correctly interact with cards like Isochron Scepter and Dark Confidant as far as calculating their CMC goes.
- Merge: merging the latest trunk into SplitCards.
This commit is contained in:
@@ -7058,15 +7058,29 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
} else if (property.startsWith("greatestCMC")) {
|
||||
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
|
||||
for (final Card crd : list) {
|
||||
if (crd.getCMC() > this.getCMC()) {
|
||||
return false;
|
||||
if (crd.getRules() != null && crd.getRules().getSplitType() == CardSplitType.Split) {
|
||||
if (crd.getCMC(Card.SplitCMCMode.LeftSplitCMC) > this.getCMC() || crd.getCMC(Card.SplitCMCMode.RightSplitCMC) > this.getCMC()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (crd.getCMC() > this.getCMC()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("lowestCMC")) {
|
||||
final List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card crd : list) {
|
||||
if (!crd.isLand() && !crd.isImmutable() && (crd.getCMC() < this.getCMC())) {
|
||||
return false;
|
||||
if (!crd.isLand() && !crd.isImmutable()) {
|
||||
if (crd.getRules() != null && crd.getRules().getSplitType() == CardSplitType.Split) {
|
||||
if (crd.getCMC(Card.SplitCMCMode.LeftSplitCMC) < this.getCMC() || crd.getCMC(Card.SplitCMCMode.RightSplitCMC) < this.getCMC()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (crd.getCMC() < this.getCMC()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("enchanted")) {
|
||||
@@ -7117,6 +7131,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|| property.startsWith("cmc") || property.startsWith("totalPT")) {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int y2 = -1; // alternative value for the second split face of a split card
|
||||
String rhs = "";
|
||||
|
||||
if (property.startsWith("power")) {
|
||||
@@ -7127,7 +7142,12 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
y = this.getNetDefense();
|
||||
} else if (property.startsWith("cmc")) {
|
||||
rhs = property.substring(5);
|
||||
y = getCMC();
|
||||
if (getRules() != null && getRules().getSplitType() == CardSplitType.Split) {
|
||||
y = getState(CardCharacteristicName.LeftSplit).getManaCost().getCMC();
|
||||
y2 = getState(CardCharacteristicName.RightSplit).getManaCost().getCMC();
|
||||
} else {
|
||||
y = getCMC();
|
||||
}
|
||||
} else if (property.startsWith("totalPT")) {
|
||||
rhs = property.substring(10);
|
||||
y = this.getNetAttack() + this.getNetDefense();
|
||||
@@ -7138,8 +7158,14 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
x = CardFactoryUtil.xCount(source, source.getSVar(rhs));
|
||||
}
|
||||
|
||||
if (!Expressions.compare(y, property, x)) {
|
||||
return false;
|
||||
if (y2 == -1) {
|
||||
if (!Expressions.compare(y, property, x)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!Expressions.compare(y, property, x) || !Expressions.compare(y2, property, x)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user