EDH Power level fix

This commit is contained in:
spjspj 2017-05-20 15:45:40 +10:00
parent c85b4830a5
commit e752ee3156
2 changed files with 18 additions and 8 deletions

View file

@ -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);
} }

View file

@ -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,16 +754,16 @@ 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);
edhPowerLevel += (color.isBlue() ? 1000000 : 0); edhPowerLevel += (color.isBlue() ? 1000000 : 0);
edhPowerLevel += (color.isBlack() ? 100000 : 0); edhPowerLevel += (color.isBlack() ? 100000 : 0);
edhPowerLevel += (color.isRed() ? 10000 : 0); edhPowerLevel += (color.isRed() ? 10000 : 0);
edhPowerLevel += (color.isGreen() ? 1000 : 0); edhPowerLevel += (color.isGreen() ? 1000 : 0);
} }
return edhPowerLevel; return edhPowerLevel;
} }