- For some reason the input for paying mana was clearing out the card chosen for the "Offering" alternate cost

This commit is contained in:
Sol
2016-02-17 20:16:50 +00:00
parent 8984606931
commit 13eda99d4e

View File

@@ -133,7 +133,7 @@ public class HumanPlay {
/** /**
* choose optional additional costs. For HUMAN only * choose optional additional costs. For HUMAN only
* @param activator * @param p
* *
* @param original * @param original
* the original sa * the original sa
@@ -208,8 +208,6 @@ public class HumanPlay {
* *
* @param sa * @param sa
* a {@link forge.game.spellability.SpellAbility} object. * a {@link forge.game.spellability.SpellAbility} object.
* @param skipTargeting
* a boolean.
*/ */
public final static void playSpellAbilityNoStack(final PlayerControllerHuman controller, final Player player, final SpellAbility sa) { public final static void playSpellAbilityNoStack(final PlayerControllerHuman controller, final Player player, final SpellAbility sa) {
playSpellAbilityNoStack(controller, player, sa, false); playSpellAbilityNoStack(controller, player, sa, false);
@@ -252,14 +250,8 @@ public class HumanPlay {
* payCostDuringAbilityResolve. * payCostDuringAbilityResolve.
* </p> * </p>
* *
* @param ability
* a {@link forge.game.spellability.SpellAbility} object.
* @param cost * @param cost
* a {@link forge.game.cost.Cost} object. * a {@link forge.game.cost.Cost} object.
* @param paid
* a {@link forge.UiCommand} object.
* @param unpaid
* a {@link forge.UiCommand} object.
* @param sourceAbility TODO * @param sourceAbility TODO
*/ */
public static boolean payCostDuringAbilityResolve(final PlayerControllerHuman controller, final Player p, final Card source, final Cost cost, SpellAbility sourceAbility, String prompt) { public static boolean payCostDuringAbilityResolve(final PlayerControllerHuman controller, final Player p, final Card source, final Cost cost, SpellAbility sourceAbility, String prompt) {
@@ -343,7 +335,7 @@ public class HumanPlay {
part.payAsDecided(p, pd, sourceAbility); part.payAsDecided(p, pd, sourceAbility);
} }
else if (part instanceof CostAddMana) { else if (part instanceof CostAddMana) {
if (!p.getController().confirmPayment(part, "Do you want to add " + ((CostAddMana) part).toString() + " to your mana pool?" + orString)) { if (!p.getController().confirmPayment(part, "Do you want to add " + part.toString() + " to your mana pool?" + orString)) {
return false; return false;
} }
PaymentDecision pd = part.accept(hcd); PaymentDecision pd = part.accept(hcd);
@@ -451,7 +443,7 @@ public class HumanPlay {
return false; return false;
} }
list = CardLists.getValidCards(list, ((CostRemoveAnyCounter) part).getType().split(";"), p, source); list = CardLists.getValidCards(list, part.getType().split(";"), p, source);
while (amount > 0) { while (amount > 0) {
final CounterType counterType; final CounterType counterType;
list = CardLists.filter(list, new Predicate<Card>() { list = CardLists.filter(list, new Predicate<Card>() {
@@ -764,12 +756,19 @@ public class HumanPlay {
ManaCostAdjustment.adjust(toPay, ability, cardsToDelve, false); ManaCostAdjustment.adjust(toPay, ability, cardsToDelve, false);
} }
Card offering = null;
InputPayMana inpPayment; InputPayMana inpPayment;
if (ability.isOffering() && ability.getSacrificedAsOffering() == null) { if (ability.isOffering()) {
if (ability.getSacrificedAsOffering() == null) {
System.out.println("Sacrifice input for Offering cancelled"); System.out.println("Sacrifice input for Offering cancelled");
return false; return false;
} else {
offering = ability.getSacrificedAsOffering();
}
} }
if (!toPay.isPaid()) { if (!toPay.isPaid()) {
// Input is somehow clearing out the offering card?
inpPayment = new InputPayManaOfCostPayment(controller, toPay, ability, activator); inpPayment = new InputPayManaOfCostPayment(controller, toPay, ability, activator);
inpPayment.setMessagePrefix(prompt); inpPayment.setMessagePrefix(prompt);
inpPayment.showAndWait(); inpPayment.showAndWait();
@@ -783,13 +782,17 @@ public class HumanPlay {
} }
// Handle convoke and offerings // Handle convoke and offerings
if (ability.isOffering() && ability.getSacrificedAsOffering() != null) { if (ability.isOffering()) {
if (ability.getSacrificedAsOffering() == null && offering != null) {
ability.setSacrificedAsOffering(offering);
}
if (ability.getSacrificedAsOffering() != null) {
System.out.println("Finishing up Offering"); System.out.println("Finishing up Offering");
final Card offering = ability.getSacrificedAsOffering();
offering.setUsedToPay(false); offering.setUsedToPay(false);
activator.getGame().getAction().sacrifice(offering, ability); activator.getGame().getAction().sacrifice(offering, ability);
ability.resetSacrificedAsOffering(); ability.resetSacrificedAsOffering();
} }
}
if (ability.getTappedForConvoke() != null) { if (ability.getTappedForConvoke() != null) {
for (final Card c : ability.getTappedForConvoke()) { for (final Card c : ability.getTappedForConvoke()) {
c.setTapped(false); c.setTapped(false);