mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
setColorsToPay, setSunburst moved from input/InputPayManaOfCostPayment.java to CostPartMana
ManaPool.payManaFromAbility does not return ManaCostBeingPaid - that means it does not create a new instance, but alters the one passed as parameter a few mana-paying inputs: the player who is shown the input is taken from base class field, not from singletons
This commit is contained in:
@@ -133,6 +133,9 @@ public class CostPartMana extends CostPart {
|
||||
FThreads.setInputAndWait(inpPayment);
|
||||
if(!inpPayment.isPaid())
|
||||
return false;
|
||||
|
||||
source.setColorsPaid(toPay.getColorsPaid());
|
||||
source.setSunburstValue(toPay.getSunburst());
|
||||
}
|
||||
if (this.getAmountOfX() > 0) {
|
||||
if( !ability.isAnnouncing("X") && !xWasBilled) {
|
||||
|
||||
@@ -493,11 +493,7 @@ public class ManaPool {
|
||||
* a {@link forge.card.spellability.AbilityMana} object.
|
||||
* @return a {@link forge.card.mana.ManaCostBeingPaid} object.
|
||||
*/
|
||||
public final ManaCostBeingPaid payManaFromAbility(final SpellAbility sa, ManaCostBeingPaid manaCost, final SpellAbility ma) {
|
||||
if (manaCost.isPaid() || this.isEmpty()) {
|
||||
return manaCost;
|
||||
}
|
||||
|
||||
public final void payManaFromAbility(final SpellAbility sa, ManaCostBeingPaid manaCost, final SpellAbility ma) {
|
||||
// Mana restriction must be checked before this method is called
|
||||
|
||||
final List<SpellAbility> paidAbs = sa.getPayingManaAbilities();
|
||||
@@ -522,7 +518,6 @@ public class ManaPool {
|
||||
}
|
||||
}
|
||||
}
|
||||
return manaCost;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -308,7 +308,7 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
||||
|
||||
public void onManaAbilityPlayed(final SpellAbility saPaymentSrc) {
|
||||
if ( saPaymentSrc != null) // null comes when they've paid from pool
|
||||
this.manaCost = player.getManaPool().payManaFromAbility(saPaidFor, manaCost, saPaymentSrc);
|
||||
player.getManaPool().payManaFromAbility(saPaidFor, manaCost, saPaymentSrc);
|
||||
|
||||
onManaAbilityPaid();
|
||||
if ( saPaymentSrc != null )
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package forge.control.input;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostBeingPaid;
|
||||
@@ -95,9 +94,9 @@ public class InputPayManaExecuteCommands extends InputPayManaBase {
|
||||
@Override
|
||||
protected void done() {
|
||||
if (this.phyLifeToLose > 0) {
|
||||
Singletons.getControl().getPlayer().payLife(this.phyLifeToLose, null);
|
||||
player.payLife(this.phyLifeToLose, null);
|
||||
}
|
||||
Singletons.getControl().getPlayer().getManaPool().clearManaPaid(this.saPaidFor, false);
|
||||
player.getManaPool().clearManaPaid(this.saPaidFor, false);
|
||||
bPaid = true;
|
||||
this.stop();
|
||||
}
|
||||
@@ -105,7 +104,7 @@ public class InputPayManaExecuteCommands extends InputPayManaBase {
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected final void onCancel() {
|
||||
Singletons.getControl().getPlayer().getManaPool().refundManaPaid(this.saPaidFor, true);
|
||||
player.getManaPool().refundManaPaid(this.saPaidFor, true);
|
||||
bPaid = false;
|
||||
this.stop();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package forge.control.input;
|
||||
|
||||
import forge.Card;
|
||||
import forge.Singletons;
|
||||
import forge.card.mana.ManaCostBeingPaid;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.game.player.Player;
|
||||
@@ -32,10 +31,8 @@ public class InputPayManaOfCostPayment extends InputPayManaBase {
|
||||
protected void done() {
|
||||
final Card source = saPaidFor.getSourceCard();
|
||||
if (this.phyLifeToLose > 0) {
|
||||
Singletons.getControl().getPlayer().payLife(this.phyLifeToLose, source);
|
||||
player.payLife(this.phyLifeToLose, source);
|
||||
}
|
||||
source.setColorsPaid(this.manaCost.getColorsPaid());
|
||||
source.setSunburstValue(this.manaCost.getSunburst());
|
||||
|
||||
// If this is a spell with convoke, re-tap all creatures used for it.
|
||||
// This is done to make sure Taps triggers go off at the right time
|
||||
|
||||
@@ -50,16 +50,6 @@ public class InputPayManaSimple extends InputPayManaBase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* resetManaCost.
|
||||
* </p>
|
||||
*/
|
||||
private void resetManaCost() {
|
||||
this.manaCost = new ManaCostBeingPaid(this.originalManaCost);
|
||||
this.phyLifeToLose = 0;
|
||||
}
|
||||
|
||||
protected void onManaAbilityPaid() {
|
||||
if (this.manaCost.isPaid()) {
|
||||
this.originalCard.setSunburstValue(this.manaCost.getSunburst());
|
||||
@@ -92,7 +82,6 @@ public class InputPayManaSimple extends InputPayManaBase {
|
||||
}
|
||||
if (!this.saPaidFor.getSourceCard().isCopiedSpell()) {
|
||||
player.getManaPool().clearManaPaid(this.saPaidFor, false);
|
||||
this.resetManaCost();
|
||||
|
||||
if (this.saPaidFor.isSpell()) {
|
||||
this.saPaidFor.setSourceCard(game.getAction().moveToStack(this.originalCard));
|
||||
@@ -108,7 +97,6 @@ public class InputPayManaSimple extends InputPayManaBase {
|
||||
@Override
|
||||
protected final void onCancel() {
|
||||
handleConvokedCards(true);
|
||||
this.resetManaCost();
|
||||
|
||||
player.getManaPool().refundManaPaid(this.saPaidFor, true);
|
||||
player.getZone(ZoneType.Battlefield).updateObservers(); // DO
|
||||
|
||||
@@ -216,7 +216,7 @@ public class ComputerUtilMana {
|
||||
//ma.resolve();
|
||||
AbilityUtils.resolve(ma, false);
|
||||
// subtract mana from mana pool
|
||||
cost = manapool.payManaFromAbility(sa, cost, ma);
|
||||
manapool.payManaFromAbility(sa, cost, ma);
|
||||
} else {
|
||||
cost.payMultipleMana(manaProduced);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user