mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
EDH Power level fix
This commit is contained in:
parent
c85b4830a5
commit
e752ee3156
2 changed files with 18 additions and 8 deletions
|
@ -96,6 +96,7 @@ public class CardViewEDHPowerLevelComparator implements Comparator<CardView> {
|
||||||
boolean xCost = false;
|
boolean xCost = false;
|
||||||
boolean youControlTarget = false;
|
boolean youControlTarget = false;
|
||||||
boolean yourOpponentsControl = false;
|
boolean yourOpponentsControl = false;
|
||||||
|
boolean whenYouCast = false;
|
||||||
|
|
||||||
for (String str : card.getRules()) {
|
for (String str : card.getRules()) {
|
||||||
String s = str.toLowerCase();
|
String s = str.toLowerCase();
|
||||||
|
@ -103,7 +104,7 @@ public class CardViewEDHPowerLevelComparator implements Comparator<CardView> {
|
||||||
anyNumberOfTarget |= s.contains("any number");
|
anyNumberOfTarget |= s.contains("any number");
|
||||||
buyback |= s.contains("buyback");
|
buyback |= s.contains("buyback");
|
||||||
cantBe |= s.contains("can't be");
|
cantBe |= s.contains("can't be");
|
||||||
cantUntap |= s.contains("can't untap");
|
cantUntap |= s.contains("can't untap") || s.contains("don't untap");
|
||||||
cascade |= s.contains("cascade");
|
cascade |= s.contains("cascade");
|
||||||
copy |= s.contains("copy");
|
copy |= s.contains("copy");
|
||||||
costLessEach |= s.contains("cost") || s.contains("less") || s.contains("each");
|
costLessEach |= s.contains("cost") || s.contains("less") || s.contains("each");
|
||||||
|
@ -155,6 +156,7 @@ public class CardViewEDHPowerLevelComparator implements Comparator<CardView> {
|
||||||
wheneverEnters |= s.contains("when") && s.contains("another") && s.contains("enters");
|
wheneverEnters |= s.contains("when") && s.contains("another") && s.contains("enters");
|
||||||
youControlTarget |= s.contains("you control target");
|
youControlTarget |= s.contains("you control target");
|
||||||
yourOpponentsControl |= s.contains("your opponents control");
|
yourOpponentsControl |= s.contains("your opponents control");
|
||||||
|
whenYouCast |= s.contains("when you cast") || s.contains("whenever you cast");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extraTurns) {
|
if (extraTurns) {
|
||||||
|
@ -256,6 +258,9 @@ public class CardViewEDHPowerLevelComparator implements Comparator<CardView> {
|
||||||
if (yourOpponentsControl) {
|
if (yourOpponentsControl) {
|
||||||
thisMaxPower = Math.max(thisMaxPower, 4);
|
thisMaxPower = Math.max(thisMaxPower, 4);
|
||||||
}
|
}
|
||||||
|
if (whenYouCast) {
|
||||||
|
thisMaxPower = Math.max(thisMaxPower, 4);
|
||||||
|
}
|
||||||
if (anyNumberOfTarget) {
|
if (anyNumberOfTarget) {
|
||||||
thisMaxPower = Math.max(thisMaxPower, 3);
|
thisMaxPower = Math.max(thisMaxPower, 3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,6 +272,7 @@ public class Commander extends Constructed {
|
||||||
boolean xCost = false;
|
boolean xCost = false;
|
||||||
boolean youControlTarget = false;
|
boolean youControlTarget = false;
|
||||||
boolean yourOpponentsControl = false;
|
boolean yourOpponentsControl = false;
|
||||||
|
boolean whenYouCast = false;
|
||||||
|
|
||||||
for (String str : card.getRules()) {
|
for (String str : card.getRules()) {
|
||||||
String s = str.toLowerCase();
|
String s = str.toLowerCase();
|
||||||
|
@ -331,6 +332,7 @@ public class Commander extends Constructed {
|
||||||
wheneverEnters |= s.contains("when") && s.contains("another") && s.contains("enters");
|
wheneverEnters |= s.contains("when") && s.contains("another") && s.contains("enters");
|
||||||
youControlTarget |= s.contains("you control target");
|
youControlTarget |= s.contains("you control target");
|
||||||
yourOpponentsControl |= s.contains("your opponents control");
|
yourOpponentsControl |= s.contains("your opponents control");
|
||||||
|
whenYouCast |= s.contains("when you cast") || s.contains("whenever you cast");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ManaCost cost : card.getManaCost()) {
|
for (ManaCost cost : card.getManaCost()) {
|
||||||
|
@ -445,6 +447,9 @@ public class Commander extends Constructed {
|
||||||
if (yourOpponentsControl) {
|
if (yourOpponentsControl) {
|
||||||
thisMaxPower = Math.max(thisMaxPower, 4);
|
thisMaxPower = Math.max(thisMaxPower, 4);
|
||||||
}
|
}
|
||||||
|
if (whenYouCast) {
|
||||||
|
thisMaxPower = Math.max(thisMaxPower, 4);
|
||||||
|
}
|
||||||
if (anyNumberOfTarget) {
|
if (anyNumberOfTarget) {
|
||||||
thisMaxPower = Math.max(thisMaxPower, 3);
|
thisMaxPower = Math.max(thisMaxPower, 3);
|
||||||
}
|
}
|
||||||
|
@ -749,9 +754,9 @@ public class Commander extends Constructed {
|
||||||
}
|
}
|
||||||
|
|
||||||
edhPowerLevel += numberInfinitePieces * 12;
|
edhPowerLevel += numberInfinitePieces * 12;
|
||||||
edhPowerLevel = (int) Math.round(edhPowerLevel / 4.5);
|
edhPowerLevel = (int) Math.round(edhPowerLevel / 10);
|
||||||
if (edhPowerLevel > 100) {
|
if (edhPowerLevel >= 100) {
|
||||||
edhPowerLevel = 100;
|
edhPowerLevel = 99;
|
||||||
}
|
}
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
edhPowerLevel += (color.isWhite() ? 10000000 : 0);
|
edhPowerLevel += (color.isWhite() ? 10000000 : 0);
|
||||||
|
|
Loading…
Reference in a new issue