- Added Mossbridge Troll

This commit is contained in:
swordshine
2013-08-21 09:06:48 +00:00
parent e8099b8492
commit db8a191afb
4 changed files with 66 additions and 3 deletions

1
.gitattributes vendored
View File

@@ -7245,6 +7245,7 @@ res/cardsfolder/m/mosquito_guard.txt svneol=native#text/plain
res/cardsfolder/m/moss_diamond.txt svneol=native#text/plain res/cardsfolder/m/moss_diamond.txt svneol=native#text/plain
res/cardsfolder/m/moss_kami.txt svneol=native#text/plain res/cardsfolder/m/moss_kami.txt svneol=native#text/plain
res/cardsfolder/m/moss_monster.txt svneol=native#text/plain res/cardsfolder/m/moss_monster.txt svneol=native#text/plain
res/cardsfolder/m/mossbridge_troll.txt -text
res/cardsfolder/m/mossdog.txt svneol=native#text/plain res/cardsfolder/m/mossdog.txt svneol=native#text/plain
res/cardsfolder/m/mossfire_egg.txt svneol=native#text/plain res/cardsfolder/m/mossfire_egg.txt svneol=native#text/plain
res/cardsfolder/m/mossfire_valley.txt svneol=native#text/plain res/cardsfolder/m/mossfire_valley.txt svneol=native#text/plain

View File

@@ -0,0 +1,9 @@
Name:Mossbridge Troll
ManaCost:5 G G
Types:Creature Troll
PT:5/5
K:If CARDNAME would be destroyed, regenerate it.
A:AB$ Pump | Cost$ tapXType<Any/Creature.Other+withTotalPowerGE10> | CostDesc$ Tap any number of untapped creatures you control other than CARDNAME with total power 10 or greater: | Defined$ Self | NumAtt$ +20 | NumDef$ +20 | SpellDescription$ CARDNAME gets +20/+20 until end of turn.
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/mossbridge_troll.jpg
Oracle:If Mossbridge Troll would be destroyed, regenerate it.\nTap any number of untapped creatures you control other than Mossbridge Troll with total power 10 or greater: Mossbridge Troll gets +20/+20 until end of turn.

View File

@@ -281,4 +281,18 @@ public class CardLists {
} }
return tiedForLowest; return tiedForLowest;
} }
/**
* Given a List<Card> cardList, return a int TotalPower.
*
* @param cardList the Card List to be filtered.
* @return the total power.
*/
public static int getTotalPower(Iterable<Card> cardList) {
int total =0;
for (final Card crd : cardList) {
total += crd.getNetAttack();
}
return total;
}
} }

View File

@@ -79,6 +79,9 @@ public class CostTapType extends CostPartWithList {
if (type.contains("sharesCreatureTypeWith")) { if (type.contains("sharesCreatureTypeWith")) {
sb.append("two untapped creatures you control that share a creature type"); sb.append("two untapped creatures you control that share a creature type");
} else if (type.contains("+withTotalPowerGE")) {
String num = type.split("+withTotalPowerGE")[1];
sb.append("Tap any number of untapped creatures you control other than CARDNAME with total power " + num + "or greater");
} else { } else {
sb.append(Cost.convertAmountTypeToWords(i, this.getAmount(), "untapped " + desc)); sb.append(Cost.convertAmountTypeToWords(i, this.getAmount(), "untapped " + desc));
sb.append(" you control"); sb.append(" you control");
@@ -120,7 +123,14 @@ public class CostTapType extends CostPartWithList {
sameType = true; sameType = true;
type = type.replace("sharesCreatureTypeWith", ""); type = type.replace("sharesCreatureTypeWith", "");
} }
boolean totalPower = false;
String totalP = "";
if (type.contains("+withTotalPowerGE")) {
totalPower = true;
totalP = type.split("withTotalPowerGE")[1];
type = type.replace("+withTotalPowerGE" + totalP, "");
}
typeList = CardLists.getValidCards(typeList, type.split(";"), activator, source); typeList = CardLists.getValidCards(typeList, type.split(";"), activator, source);
if (!canTapSource) { if (!canTapSource) {
@@ -142,6 +152,11 @@ public class CostTapType extends CostPartWithList {
return false; return false;
} }
if (totalPower) {
final int i = Integer.parseInt(totalP);
return CardLists.getTotalPower(typeList) >= i;
}
final Integer amount = this.convertAmount(); final Integer amount = this.convertAmount();
if ((typeList.size() == 0) || ((amount != null) && (typeList.size() < amount))) { if ((typeList.size() == 0) || ((amount != null) && (typeList.size() < amount))) {
return false; return false;
@@ -170,9 +185,18 @@ public class CostTapType extends CostPartWithList {
sameType = true; sameType = true;
type = type.replace("sharesCreatureTypeWith", ""); type = type.replace("sharesCreatureTypeWith", "");
} }
boolean totalPower = false;
String totalP = "";
if (type.contains("+withTotalPowerGE")) {
totalPower = true;
totalP = type.split("withTotalPowerGE")[1];
type = type.replace("+withTotalPowerGE" + totalP, "");
}
typeList = CardLists.getValidCards(typeList, type.split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); typeList = CardLists.getValidCards(typeList, type.split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
typeList = CardLists.filter(typeList, Presets.UNTAPPED); typeList = CardLists.filter(typeList, Presets.UNTAPPED);
if (c == null) { if (c == null && !amount.equals("Any")) {
final String sVar = ability.getSVar(amount); final String sVar = ability.getSVar(amount);
// Generalize this // Generalize this
if (sVar.equals("XChoice")) { if (sVar.equals("XChoice")) {
@@ -217,6 +241,21 @@ public class CostTapType extends CostPartWithList {
} }
return executePayment(ability, tapped); return executePayment(ability, tapped);
} }
if (totalPower) {
int i = Integer.parseInt(totalP);
InputSelectCards inp = new InputSelectCardsFromList(0, typeList.size(), typeList);
inp.setMessage("Select a card to tap.");
inp.setUnselectAllowed(true);
inp.setCancelAllowed(true);
Singletons.getControl().getInputQueue().setInputAndWait(inp);
if (inp.hasCancelled() || CardLists.getTotalPower(inp.getSelected()) < i) {
return false;
} else {
return executePayment(ability, inp.getSelected());
}
}
InputSelectCards inp = new InputSelectCardsFromList(c, c, typeList); InputSelectCards inp = new InputSelectCardsFromList(c, c, typeList);
inp.setMessage("Select a " + getDescriptiveType() + " to tap (%d left)"); inp.setMessage("Select a " + getDescriptiveType() + " to tap (%d left)");
@@ -246,7 +285,7 @@ public class CostTapType extends CostPartWithList {
c = AbilityUtils.calculateAmount(source, amount, ability); c = AbilityUtils.calculateAmount(source, amount, ability);
} }
} }
if (this.getType().contains("sharesCreatureTypeWith")) { if (this.getType().contains("sharesCreatureTypeWith") || this.getType().contains("withTotalPowerGE")) {
return null; return null;
} }