mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Update Word of Command mana payment check conditions
This commit is contained in:
@@ -1531,7 +1531,7 @@ public class ComputerUtilMana {
|
||||
public boolean apply(final Card c) {
|
||||
for (final SpellAbility am : getAIPlayableMana(c)) {
|
||||
am.setActivatingPlayer(ai);
|
||||
if (!checkPlayable || am.canPlay()) {
|
||||
if (!checkPlayable || (am.canPlay() && am.checkRestrictions(ai))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@ package forge.game;
|
||||
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.card.mana.ManaAtom;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardState;
|
||||
import forge.game.cost.Cost;
|
||||
import forge.game.mana.ManaCostBeingPaid;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.AbilityManaPart;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.staticability.StaticAbility;
|
||||
import forge.util.Expressions;
|
||||
@@ -191,17 +192,24 @@ public class ForgeScript {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("ManaAbilityCantPaidFor")) {
|
||||
if (!sa.isManaAbility()) {
|
||||
SpellAbility paidFor = sourceController.getPaidForSA();
|
||||
if (paidFor == null) {
|
||||
return false;
|
||||
}
|
||||
SpellAbility paidFor = sourceController.getPaidForSA();
|
||||
do {
|
||||
AbilityManaPart mana = sa.getManaPart();
|
||||
if (paidFor != null && mana.meetsManaRestrictions(paidFor) && !mana.getExpressChoice().isEmpty()) {
|
||||
return false;
|
||||
ManaCostBeingPaid manaCost = paidFor.getManaCostBeingPaid();
|
||||
// The following code is taken from InputPayMana.java, to determine if this mana ability can pay for SA currently being paid
|
||||
byte colorCanUse = 0;
|
||||
for (final byte color : ManaAtom.MANATYPES) {
|
||||
if (manaCost.isAnyPartPayableWith(color, sourceController.getManaPool())) {
|
||||
colorCanUse |= color;
|
||||
}
|
||||
sa = sa.getSubAbility();
|
||||
} while(sa != null);
|
||||
}
|
||||
if (manaCost.isAnyPartPayableWith((byte) ManaAtom.GENERIC, sourceController.getManaPool())) {
|
||||
colorCanUse |= ManaAtom.GENERIC;
|
||||
}
|
||||
if (sa.isManaAbilityFor(paidFor, colorCanUse)) {
|
||||
return false;
|
||||
}
|
||||
} else if (sa.getHostCard() != null) {
|
||||
return sa.getHostCard().hasProperty(property, sourceController, source, spellAbility);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.card.CardFactoryUtil;
|
||||
import forge.game.cost.Cost;
|
||||
import forge.game.mana.ManaCostBeingPaid;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.replacement.ReplacementEffect;
|
||||
import forge.game.replacement.ReplacementHandler;
|
||||
@@ -312,7 +313,11 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
tgtSA.setSVar("IsCastFromPlayEffect", "True");
|
||||
|
||||
// Add controlled by player to target SA so when the spell is resolving, the controller would be changed again
|
||||
tgtSA.setControlledByPlayer(controlledByTimeStamp, controlledByPlayer);
|
||||
if (controlledByPlayer != null) {
|
||||
tgtSA.setControlledByPlayer(controlledByTimeStamp, controlledByPlayer);
|
||||
activator.pushPaidForSA(tgtSA);
|
||||
tgtSA.setManaCostBeingPaid(new ManaCostBeingPaid(tgtSA.getPayCosts().getCostMana().getManaCostFor(tgtSA), tgtSA.getPayCosts().getCostMana().getRestiction()));
|
||||
}
|
||||
|
||||
if (controller.getController().playSaFromPlayEffect(tgtSA)) {
|
||||
if (remember) {
|
||||
@@ -335,6 +340,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
// Remove controlled by player if any
|
||||
if (controlledByPlayer != null) {
|
||||
activator.removeController(controlledByTimeStamp);
|
||||
activator.popPaidForSA();
|
||||
}
|
||||
} // end resolve
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ import forge.game.cost.CostRemoveCounter;
|
||||
import forge.game.event.GameEventCardStatsChanged;
|
||||
import forge.game.keyword.Keyword;
|
||||
import forge.game.mana.Mana;
|
||||
import forge.game.mana.ManaCostBeingPaid;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.player.PlayerCollection;
|
||||
import forge.game.replacement.ReplacementEffect;
|
||||
@@ -110,6 +111,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
private Player activatingPlayer = null;
|
||||
private Player targetingPlayer = null;
|
||||
private Pair<Long, Player> controlledByPlayer = null;
|
||||
private ManaCostBeingPaid manaCostBeingPaid = null;
|
||||
|
||||
private SpellAbility grantorOriginal = null;
|
||||
private StaticAbility grantorStatic = null;
|
||||
@@ -474,6 +476,13 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
}
|
||||
}
|
||||
|
||||
public ManaCostBeingPaid getManaCostBeingPaid() {
|
||||
return manaCostBeingPaid;
|
||||
}
|
||||
public void setManaCostBeingPaid(ManaCostBeingPaid costBeingPaid) {
|
||||
manaCostBeingPaid = costBeingPaid;
|
||||
}
|
||||
|
||||
public boolean isSpell() { return false; }
|
||||
public boolean isAbility() { return true; }
|
||||
public boolean isActivatedAbility() { return false; }
|
||||
|
||||
@@ -518,6 +518,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
sa.getActivatingPlayer().removeController(sa.getControlledByPlayer().getLeft());
|
||||
// Cleanup controlled by player states
|
||||
sa.setControlledByPlayer(-1, null);
|
||||
sa.setManaCostBeingPaid(null);
|
||||
}
|
||||
|
||||
game.fireEvent(new GameEventSpellResolved(sa, thisHasFizzled));
|
||||
|
||||
@@ -57,9 +57,6 @@ public abstract class InputPayMana extends InputSyncronizedBase {
|
||||
game = player.getGame();
|
||||
saPaidFor = saPaidFor0;
|
||||
|
||||
// Set current paid for SA for player to be able to reference it later
|
||||
player.pushPaidForSA(saPaidFor);
|
||||
|
||||
//if player is floating mana, show mana pool to make it easier to use that mana
|
||||
wasFloatingMana = !player.getManaPool().isEmpty();
|
||||
if (wasFloatingMana) {
|
||||
@@ -69,7 +66,8 @@ public abstract class InputPayMana extends InputSyncronizedBase {
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
// Clear current paid for SA
|
||||
// Clear current Mana cost being paid for SA
|
||||
saPaidFor.setManaCostBeingPaid(null);
|
||||
player.popPaidForSA();
|
||||
|
||||
if (wasFloatingMana) { //hide mana pool if it was shown due to floating mana
|
||||
|
||||
@@ -19,6 +19,10 @@ public class InputPayManaOfCostPayment extends InputPayMana {
|
||||
manaCost = cost;
|
||||
extraMatrix = matrix;
|
||||
applyMatrix();
|
||||
|
||||
// Set Mana cost being paid for SA to be able to reference it later
|
||||
player.pushPaidForSA(saPaidFor);
|
||||
saPaidFor.setManaCostBeingPaid(manaCost);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 3467312982164195091L;
|
||||
|
||||
Reference in New Issue
Block a user