From e752ee3156e04177a860ed6f4761aa58b7f3acfd Mon Sep 17 00:00:00 2001 From: spjspj Date: Sat, 20 May 2017 15:45:40 +1000 Subject: [PATCH] EDH Power level fix --- .../util/CardViewEDHPowerLevelComparator.java | 7 ++++++- .../src/mage/deck/Commander.java | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/util/CardViewEDHPowerLevelComparator.java b/Mage.Client/src/main/java/mage/client/util/CardViewEDHPowerLevelComparator.java index 105c9cbeed..2a1aa37a0c 100644 --- a/Mage.Client/src/main/java/mage/client/util/CardViewEDHPowerLevelComparator.java +++ b/Mage.Client/src/main/java/mage/client/util/CardViewEDHPowerLevelComparator.java @@ -96,6 +96,7 @@ public class CardViewEDHPowerLevelComparator implements Comparator { boolean xCost = false; boolean youControlTarget = false; boolean yourOpponentsControl = false; + boolean whenYouCast = false; for (String str : card.getRules()) { String s = str.toLowerCase(); @@ -103,7 +104,7 @@ public class CardViewEDHPowerLevelComparator implements Comparator { anyNumberOfTarget |= s.contains("any number"); buyback |= s.contains("buyback"); 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"); copy |= s.contains("copy"); costLessEach |= s.contains("cost") || s.contains("less") || s.contains("each"); @@ -155,6 +156,7 @@ public class CardViewEDHPowerLevelComparator implements Comparator { wheneverEnters |= s.contains("when") && s.contains("another") && s.contains("enters"); youControlTarget |= s.contains("you control target"); yourOpponentsControl |= s.contains("your opponents control"); + whenYouCast |= s.contains("when you cast") || s.contains("whenever you cast"); } if (extraTurns) { @@ -256,6 +258,9 @@ public class CardViewEDHPowerLevelComparator implements Comparator { if (yourOpponentsControl) { thisMaxPower = Math.max(thisMaxPower, 4); } + if (whenYouCast) { + thisMaxPower = Math.max(thisMaxPower, 4); + } if (anyNumberOfTarget) { thisMaxPower = Math.max(thisMaxPower, 3); } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java index 03e3790980..ec32c1aa96 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java @@ -272,6 +272,7 @@ public class Commander extends Constructed { boolean xCost = false; boolean youControlTarget = false; boolean yourOpponentsControl = false; + boolean whenYouCast = false; for (String str : card.getRules()) { String s = str.toLowerCase(); @@ -331,6 +332,7 @@ public class Commander extends Constructed { wheneverEnters |= s.contains("when") && s.contains("another") && s.contains("enters"); youControlTarget |= s.contains("you control target"); yourOpponentsControl |= s.contains("your opponents control"); + whenYouCast |= s.contains("when you cast") || s.contains("whenever you cast"); } for (ManaCost cost : card.getManaCost()) { @@ -445,6 +447,9 @@ public class Commander extends Constructed { if (yourOpponentsControl) { thisMaxPower = Math.max(thisMaxPower, 4); } + if (whenYouCast) { + thisMaxPower = Math.max(thisMaxPower, 4); + } if (anyNumberOfTarget) { thisMaxPower = Math.max(thisMaxPower, 3); } @@ -749,16 +754,16 @@ public class Commander extends Constructed { } edhPowerLevel += numberInfinitePieces * 12; - edhPowerLevel = (int) Math.round(edhPowerLevel / 4.5); - if (edhPowerLevel > 100) { - edhPowerLevel = 100; + edhPowerLevel = (int) Math.round(edhPowerLevel / 10); + if (edhPowerLevel >= 100) { + edhPowerLevel = 99; } if (color != null) { edhPowerLevel += (color.isWhite() ? 10000000 : 0); - edhPowerLevel += (color.isBlue() ? 1000000 : 0); - edhPowerLevel += (color.isBlack() ? 100000 : 0); - edhPowerLevel += (color.isRed() ? 10000 : 0); - edhPowerLevel += (color.isGreen() ? 1000 : 0); + edhPowerLevel += (color.isBlue() ? 1000000 : 0); + edhPowerLevel += (color.isBlack() ? 100000 : 0); + edhPowerLevel += (color.isRed() ? 10000 : 0); + edhPowerLevel += (color.isGreen() ? 1000 : 0); } return edhPowerLevel; }