This restores mana payment prompts (lost yesterday)

This commit is contained in:
Maxmtg
2014-02-18 20:28:03 +00:00
parent 164490ffc9
commit b299711be7
8 changed files with 23 additions and 13 deletions

View File

@@ -717,7 +717,7 @@ public class PlayerControllerAi extends PlayerController {
}
@Override
public boolean payManaCost(ManaCost toPay, CostPartMana costPartMana, SpellAbility sa) {
public boolean payManaCost(ManaCost toPay, CostPartMana costPartMana, SpellAbility sa, String prompt /* ai needs hints as well */ ) {
// TODO Auto-generated method stub
return ComputerUtilMana.payManaCost(new ManaCostBeingPaid(toPay), sa, player);
}

View File

@@ -128,7 +128,7 @@ public class CostPartMana extends CostPart {
sa.clearManaPaid();
// decision not used here, the whole payment is interactive!
return payer.getController().payManaCost(this, sa);
return payer.getController().payManaCost(this, sa, null);
}
}

View File

@@ -222,10 +222,10 @@ public abstract class PlayerController {
public List<Card> cheatShuffle(List<Card> list) { return list; }
public Collection<? extends PaperCard> complainCardsCantPlayWell(Deck myDeck) { return null; }
public final boolean payManaCost(CostPartMana costPartMana, SpellAbility sa) {
return payManaCost(costPartMana.getManaCostFor(sa), costPartMana, sa);
public final boolean payManaCost(CostPartMana costPartMana, SpellAbility sa, String prompt) {
return payManaCost(costPartMana.getManaCostFor(sa), costPartMana, sa, prompt);
}
public abstract boolean payManaCost(ManaCost toPay, CostPartMana costPartMana, SpellAbility sa);
public abstract boolean payManaCost(ManaCost toPay, CostPartMana costPartMana, SpellAbility sa, String prompt);
public abstract Map<Card, ManaCostShard> chooseCardsForConvoke(SpellAbility sa, ManaCost manaCost, List<Card> untappedCreats);

View File

@@ -372,4 +372,10 @@ public abstract class InputPayMana extends InputSyncronizedBase {
}
public boolean isPaid() { return bPaid; }
protected String messagePrefix;
public void setMessagePrefix(String prompt) {
// TODO Auto-generated method stub
messagePrefix = prompt;
}
}

View File

@@ -44,7 +44,10 @@ public class InputPayManaOfCostPayment extends InputPayMana {
protected String getMessage() {
final String displayMana = manaCost.toString(false);
final StringBuilder msg = new StringBuilder("Pay Mana Cost: " + displayMana);
final StringBuilder msg = new StringBuilder();
if( messagePrefix != null )
msg.append(messagePrefix).append("\n");
msg.append("Pay Mana Cost: ").append(displayMana);
if (this.phyLifeToLose > 0) {
msg.append(" (");
msg.append(this.phyLifeToLose);

View File

@@ -628,7 +628,7 @@ public class HumanPlay {
}
sourceAbility.clearManaPaid();
boolean paid = p.getController().payManaCost(cost.getCostMana(), sourceAbility);
boolean paid = p.getController().payManaCost(cost.getCostMana(), sourceAbility, prompt);
if (!paid) {
p.getManaPool().refundManaPaid(sourceAbility);
}
@@ -679,7 +679,7 @@ public class HumanPlay {
return done;
}
public static boolean payManaCost(final ManaCost realCost, final CostPartMana mc, final SpellAbility ability, final Player activator) {
public static boolean payManaCost(final ManaCost realCost, final CostPartMana mc, final SpellAbility ability, final Player activator, String prompt) {
final Card source = ability.getHostCard();
ManaCostBeingPaid toPay = new ManaCostBeingPaid(realCost, mc.getRestiction());
@@ -699,16 +699,17 @@ public class HumanPlay {
toPay.addManaCost(mkCost);
}
InputPayMana inpPayment;
toPay.applySpellCostChange(ability, false);
InputPayMana inpPayment;
if (ability.isOffering() && ability.getSacrificedAsOffering() == null) {
System.out.println("Sacrifice input for Offering cancelled");
return false;
}
if (!toPay.isPaid()) {
inpPayment = new InputPayManaOfCostPayment(toPay, ability, activator);
inpPayment.setMessagePrefix(prompt);
inpPayment.showAndWait();
if (!inpPayment.isPaid()) {
return handleOfferingAndConvoke(ability, true, false);

View File

@@ -1062,8 +1062,8 @@ public class PlayerControllerHuman extends PlayerController {
}
@Override
public boolean payManaCost(ManaCost toPay, CostPartMana costPartMana, SpellAbility sa) {
return HumanPlay.payManaCost(toPay, costPartMana, sa, player);
public boolean payManaCost(ManaCost toPay, CostPartMana costPartMana, SpellAbility sa, String prompt /* ai needs hints as well */ ) {
return HumanPlay.payManaCost(toPay, costPartMana, sa, player, prompt);
}
@Override

View File

@@ -566,7 +566,7 @@ public class PlayerControllerForTests extends PlayerController {
}
@Override
public boolean payManaCost(ManaCost toPay, CostPartMana costPartMana, SpellAbility sa) {
public boolean payManaCost(ManaCost toPay, CostPartMana costPartMana, SpellAbility sa, String prompt /* ai needs hints as well */ ) {
// TODO Auto-generated method stub
return ComputerUtilMana.payManaCost(new ManaCostBeingPaid(toPay), sa, player);
}