- The three following unless costs can now be combined with other unless costs: CostPayLife, CostDamage and CostPutCounter.

- Added Mundungu by swordshine.
This commit is contained in:
Sloth
2012-10-16 20:57:58 +00:00
parent 465c3e9bcc
commit 4413eb8198
5 changed files with 74 additions and 52 deletions

1
.gitattributes vendored
View File

@@ -6393,6 +6393,7 @@ res/cardsfolder/m/multani_maro_sorcerer.txt svneol=native#text/plain
res/cardsfolder/m/multanis_acolyte.txt svneol=native#text/plain
res/cardsfolder/m/multanis_decree.txt svneol=native#text/plain
res/cardsfolder/m/multanis_harmony.txt -text svneol=unset#text/plain
res/cardsfolder/m/mundungu.txt -text
res/cardsfolder/m/mungha_wurm.txt svneol=native#text/plain
res/cardsfolder/m/muraganda_petroglyphs.txt svneol=native#text/plain
res/cardsfolder/m/murasa_pyromancer.txt svneol=native#text/plain

View File

@@ -0,0 +1,11 @@
Name:Mundungu
ManaCost:1 U B
Types:Creature Human Wizard
PT:1/1
Text:no text
A:AB$ Counter | Cost$ T | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ 1 PayLife<1> | SpellDescription$ Counter target spell unless its controller pays 1 and 1 life.
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/mundungu.jpg
SetInfo:VIS|Uncommon|http://magiccards.info/scans/en/vi/132.jpg
Oracle:{T}: Counter target spell unless its controller pays {1} and 1 life.
End

View File

@@ -369,9 +369,7 @@ public final class GameActionUtil {
final Command unpaid, SpellAbility sourceAbility) {
final Card source = ability.getSourceCard();
final ArrayList<CostPart> parts = cost.getCostParts();
if (parts.size() > 1) {
throw new RuntimeException("GameActionUtil::payCostDuringAbilityResolve - Too many payment types - " + source);
}
ArrayList<CostPart> remainingParts = new ArrayList<CostPart>(cost.getCostParts());
CostPart costPart = null;
if (!parts.isEmpty()) {
costPart = parts.get(0);
@@ -384,40 +382,39 @@ public final class GameActionUtil {
}
return;
}
if (costPart instanceof CostPayLife) {
String amountString = costPart.getAmount();
//CardFactoryUtil.xCount(source, source.getSVar(amountString))
boolean hasPaid = true;
//the three following costs do not need inputs
for (CostPart part : parts) {
if (part instanceof CostPayLife) {
String amountString = part.getAmount();
final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
: AbilityFactory.calculateAmount(source, amountString, sourceAbility);
Player p = Singletons.getControl().getPlayer();
if (p.canPayLife(amount) && showYesNoDialog(source, "Do you want to pay " + amount + " life?")) {
p.payLife(amount, null);
paid.execute();
} else {
unpaid.execute();
hasPaid = false;
}
return;
remainingParts.remove(part);
}
if (costPart instanceof CostDamage) {
String amountString = costPart.getAmount();
else if (part instanceof CostDamage) {
String amountString = part.getAmount();
final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
: CardFactoryUtil.xCount(source, source.getSVar(amountString));
Player p = Singletons.getControl().getPlayer();
if (p.canPayLife(amount) && showYesNoDialog(source, "Do you want " + source + " to deal " + amount + " damage to you?")) {
p.addDamage(amount, source);
paid.execute();
} else {
unpaid.execute();
hasPaid = false;
}
return;
remainingParts.remove(part);
}
else if (costPart instanceof CostPutCounter) {
String amountString = costPart.getAmount();
Counters counterType = ((CostPutCounter) costPart).getCounter();
else if (part instanceof CostPutCounter) {
String amountString = part.getAmount();
Counters counterType = ((CostPutCounter) part).getCounter();
int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
: CardFactoryUtil.xCount(source, source.getSVar(amountString));
String plural = amount > 1 ? "s" : "";
@@ -425,19 +422,32 @@ public final class GameActionUtil {
+ " counter" + plural + " on " + source + "?")) {
if (source.canHaveCountersPlacedOnIt(counterType)) {
source.addCounterFromNonEffect(counterType, amount);
paid.execute();
} else {
unpaid.execute();
hasPaid = false;
AllZone.getGameLog().add("ResolveStack", "Trying to pay upkeep for " + source + " but it can't have "
+ counterType.getName() + " counters put on it.", 2);
}
} else {
unpaid.execute();
hasPaid = false;
}
remainingParts.remove(part);
}
}
if (!hasPaid) {
unpaid.execute();
return;
}
if (remainingParts.isEmpty()) {
paid.execute();
return;
}
if (remainingParts.size() > 1) {
throw new RuntimeException("GameActionUtil::payCostDuringAbilityResolve - Too many payment types - " + source);
}
costPart = remainingParts.get(0);
else if (costPart instanceof CostSacrifice) {
//the following costs need inputs and can't be combined at the moment
if (costPart instanceof CostSacrifice) {
final boolean bResolving = AllZone.getStack().getResolving();
AllZone.getStack().setResolving(false);
AllZone.getInputControl().setInput(new InputPaySacCost((CostSacrifice) costPart, ability, paid, unpaid));

View File

@@ -285,7 +285,7 @@ public class AbilityFactoryCounterMagic {
return false;
}
if (this.unlessCost != null && !this.unlessCost.startsWith("Damage")) {
if (this.unlessCost != null && !this.unlessCost.endsWith(">")) {
// Is this Usable Mana Sources? Or Total Available Mana?
final int usableManaSources = CardFactoryUtil.getUsableManaSources(ai.getOpponent());
int toPay = 0;

View File

@@ -212,7 +212,7 @@ public class ComputerUtil {
// Unless Cost gets significant bonus + 10-Payment Amount
final String unless = params.get("UnlessCost");
if (unless != null && !unless.startsWith("Damage")) {
if (unless != null && !unless.endsWith(">")) {
final int amount = AbilityFactory.calculateAmount(source, unless, sa);
final int usableManaSources = CardFactoryUtil.getUsableManaSources(ai.getOpponent());