From 9caaf0d5be6398972a2d9a0b96fd72bfb5826439 Mon Sep 17 00:00:00 2001 From: spjspj Date: Thu, 8 Dec 2016 11:57:45 +1100 Subject: [PATCH] spjspj - Final update to edh Power Level. --- .../src/mage/deck/Commander.java | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) 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 44ba78fcbd..66da5a90c5 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 @@ -32,7 +32,9 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import mage.abilities.Ability; import mage.abilities.common.CanBeYourCommanderAbility; +import mage.abilities.costs.mana.ManaCost; import mage.abilities.keyword.PartnerAbility; import mage.cards.Card; import mage.cards.ExpansionSet; @@ -212,7 +214,7 @@ public class Commander extends Constructed { int edhPowerLevel = 0; int numberInfinitePieces = 0; - + for (Card card : deck.getCards()) { int thisMaxPower = 0; @@ -262,8 +264,10 @@ public class Commander extends Constructed { boolean twiceAs = false; boolean unblockable = false; boolean undying = false; + boolean untapTarget = false; boolean wheneverEnters = false; boolean whenCounterThatSpell = false; + boolean xCost = false; boolean youControlTarget = false; for (String str : card.getRules()) { @@ -313,11 +317,25 @@ public class Commander extends Constructed { twiceAs |= s.contains("twice that many") || s.contains("twice as much"); unblockable |= s.contains("can't be blocked"); undying |= s.contains("undying"); + untapTarget |= s.contains("untap target"); whenCounterThatSpell |= s.contains("when") && s.contains("counter that spell"); wheneverEnters |= s.contains("when") && s.contains("another") && s.contains("enters"); youControlTarget |= s.contains("you control target"); } + for (ManaCost cost : card.getManaCost()) { + if (cost.getText().contains("X")) { + xCost = true; + } + } + for (Ability a : card.getAbilities()) { + for (ManaCost cost : a.getManaCosts()) { + if (cost.getText().contains("X")) { + xCost = true; + } + } + } + if (extraTurns) { thisMaxPower = Math.max(thisMaxPower, 7); } @@ -390,6 +408,9 @@ public class Commander extends Constructed { if (wheneverEnters) { thisMaxPower = Math.max(thisMaxPower, 4); } + if (xCost) { + thisMaxPower = Math.max(thisMaxPower, 4); + } if (youControlTarget) { thisMaxPower = Math.max(thisMaxPower, 4); } @@ -438,6 +459,9 @@ public class Commander extends Constructed { if (sacrifice) { thisMaxPower = Math.max(thisMaxPower, 2); } + if (untapTarget) { + thisMaxPower = Math.max(thisMaxPower, 2); + } if (copy) { thisMaxPower = Math.max(thisMaxPower, 1); } @@ -603,7 +627,7 @@ public class Commander extends Constructed { || cn.equals("worthy cause") || cn.equals("yawgmoth's will") || cn.equals("zealous conscripts")) { thisMaxPower = Math.max(thisMaxPower, 7); - numberInfinitePieces ++; + numberInfinitePieces++; } edhPowerLevel += thisMaxPower; } @@ -662,7 +686,7 @@ public class Commander extends Constructed { } edhPowerLevel += numberInfinitePieces * 10; - edhPowerLevel = (int) Math.round(edhPowerLevel / 3.5); + edhPowerLevel = (int) Math.round(edhPowerLevel / 4.5); if (edhPowerLevel > 100) { edhPowerLevel = 100; }