mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
CostPayment: reset CardMatrix after being used
This commit is contained in:
committed by
Michael Kamensky
parent
15eca3f80a
commit
d25825c595
@@ -6,12 +6,12 @@
|
|||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -68,7 +68,7 @@ public class CostPartMana extends CostPart {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the mana.
|
* Gets the mana.
|
||||||
*
|
*
|
||||||
* @return the mana
|
* @return the mana
|
||||||
*/
|
*/
|
||||||
public final ManaCost getMana() {
|
public final ManaCost getMana() {
|
||||||
@@ -89,30 +89,30 @@ public class CostPartMana extends CostPart {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the mana to pay.
|
* Gets the mana to pay.
|
||||||
*
|
*
|
||||||
* @return the mana to pay
|
* @return the mana to pay
|
||||||
*/
|
*/
|
||||||
public final ManaCost getManaToPay() {
|
public final ManaCost getManaToPay() {
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the isExiledCreatureCost
|
* @return the isExiledCreatureCost
|
||||||
*/
|
*/
|
||||||
public boolean isExiledCreatureCost() {
|
public boolean isExiledCreatureCost() {
|
||||||
return isExiledCreatureCost;
|
return isExiledCreatureCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnchantedCreatureCost() {
|
public boolean isEnchantedCreatureCost() {
|
||||||
return isEnchantedCreatureCost;
|
return isEnchantedCreatureCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReusable() { return true; }
|
public boolean isReusable() { return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUndoable() { return true; }
|
public boolean isUndoable() { return true; }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
@@ -145,7 +145,17 @@ public class CostPartMana extends CostPart {
|
|||||||
return getManaToPay();
|
return getManaToPay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CostPart copy() {
|
||||||
|
CostPart copied = super.copy();
|
||||||
|
// when copied, clear cardMatrix
|
||||||
|
if (copied instanceof CostPartMana) {
|
||||||
|
((CostPartMana)copied).cardMatrix = null;
|
||||||
|
}
|
||||||
|
return copied;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean payAsDecided(Player payer, PaymentDecision pd, SpellAbility sa) {
|
public boolean payAsDecided(Player payer, PaymentDecision pd, SpellAbility sa) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|||||||
@@ -145,11 +145,17 @@ public class CostPayment extends ManaConversionMatrix {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pd == null || !part.payAsDecided(decisionMaker.getPlayer(), pd, ability)) {
|
if (pd == null || !part.payAsDecided(decisionMaker.getPlayer(), pd, ability)) {
|
||||||
|
if (part instanceof CostPartMana) {
|
||||||
|
((CostPartMana)part).setCardMatrix(null);
|
||||||
|
}
|
||||||
game.costPaymentStack.pop(); // cost is resolved
|
game.costPaymentStack.pop(); // cost is resolved
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.paidCostParts.add(part);
|
this.paidCostParts.add(part);
|
||||||
|
|
||||||
|
if (part instanceof CostPartMana) {
|
||||||
|
((CostPartMana)part).setCardMatrix(null);
|
||||||
|
}
|
||||||
game.costPaymentStack.pop(); // cost is resolved
|
game.costPaymentStack.pop(); // cost is resolved
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user