mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Enabled the keyword "May be played without paying its mana cost" for the AI.
This commit is contained in:
@@ -26,6 +26,8 @@ import forge.Constant.Zone;
|
|||||||
import forge.card.abilityfactory.AbilityFactory;
|
import forge.card.abilityfactory.AbilityFactory;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
import forge.card.cost.Cost;
|
import forge.card.cost.Cost;
|
||||||
|
import forge.card.cost.CostMana;
|
||||||
|
import forge.card.cost.CostPart;
|
||||||
import forge.card.cost.CostPayment;
|
import forge.card.cost.CostPayment;
|
||||||
import forge.card.cost.CostUtil;
|
import forge.card.cost.CostUtil;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
@@ -72,6 +74,24 @@ public class ComputerUtil {
|
|||||||
|
|
||||||
boolean flashb = false;
|
boolean flashb = false;
|
||||||
|
|
||||||
|
if (source.hasStartOfKeyword("May be played without paying its mana cost")) {
|
||||||
|
final SpellAbility newSA = sa.copy();
|
||||||
|
final Cost cost = sa.getPayCosts();
|
||||||
|
for (CostPart part : cost.getCostParts()) {
|
||||||
|
if (part instanceof CostMana) {
|
||||||
|
((CostMana) part).setMana("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cost.setNoManaCostChange(true);
|
||||||
|
newSA.setManaCost("0");
|
||||||
|
newSA.setDescription(sa.getDescription() + " (without paying its mana cost)");
|
||||||
|
if (ComputerUtil.canBePlayedAndPayedByAI(newSA)) {
|
||||||
|
ComputerUtil.handlePlayingSpellAbility(newSA);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Flashback
|
// Flashback
|
||||||
if (source.isInZone(Constant.Zone.Graveyard) && sa.isSpell() && (source.isInstant() || source.isSorcery())) {
|
if (source.isInZone(Constant.Zone.Graveyard) && sa.isSpell() && (source.isInstant() || source.isSorcery())) {
|
||||||
for (final String keyword : source.getKeyword()) {
|
for (final String keyword : source.getKeyword()) {
|
||||||
@@ -549,7 +569,9 @@ public class ComputerUtil {
|
|||||||
|
|
||||||
ManaCost cost = new ManaCost(mana);
|
ManaCost cost = new ManaCost(mana);
|
||||||
|
|
||||||
|
if (sa.getPayCosts() == null || !sa.getPayCosts().getNoManaCostChange()) {
|
||||||
cost = AllZone.getGameAction().getSpellCostChange(sa, cost);
|
cost = AllZone.getGameAction().getSpellCostChange(sa, cost);
|
||||||
|
}
|
||||||
|
|
||||||
final ManaPool manapool = player.getManaPool();
|
final ManaPool manapool = player.getManaPool();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user