mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- Fixed AI's static abilities bypassing addAndUnfreeze (and miss ActivationNumber increase).
This commit is contained in:
@@ -47,7 +47,6 @@ import forge.card.cost.CostPart;
|
|||||||
import forge.card.cost.CostPayment;
|
import forge.card.cost.CostPayment;
|
||||||
import forge.card.cost.CostSacrifice;
|
import forge.card.cost.CostSacrifice;
|
||||||
import forge.card.spellability.AbilityManaPart;
|
import forge.card.spellability.AbilityManaPart;
|
||||||
import forge.card.spellability.AbilityStatic;
|
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.spellability.SpellAbilityStackInstance;
|
import forge.card.spellability.SpellAbilityStackInstance;
|
||||||
import forge.card.spellability.TargetRestrictions;
|
import forge.card.spellability.TargetRestrictions;
|
||||||
@@ -86,27 +85,6 @@ public class ComputerUtil {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public static boolean handlePlayingSpellAbility(final Player ai, final SpellAbility sa, final Game game) {
|
public static boolean handlePlayingSpellAbility(final Player ai, final SpellAbility sa, final Game game) {
|
||||||
|
|
||||||
if (sa instanceof AbilityStatic) {
|
|
||||||
final Cost cost = sa.getPayCosts();
|
|
||||||
if (cost == null) {
|
|
||||||
if (ComputerUtilMana.payManaCost(ai, sa)) {
|
|
||||||
sa.resolve();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final CostPayment pay = new CostPayment(cost, sa);
|
|
||||||
if (pay.payComputerCosts(ai, game)) {
|
|
||||||
sa.resolve();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Why?
|
|
||||||
game.getPhaseHandler().setPriority(ai);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
game.getStack().freezeStack();
|
game.getStack().freezeStack();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
@@ -122,9 +100,10 @@ public class ComputerUtil {
|
|||||||
final Cost cost = sa.getPayCosts();
|
final Cost cost = sa.getPayCosts();
|
||||||
|
|
||||||
if (cost == null) {
|
if (cost == null) {
|
||||||
ComputerUtilMana.payManaCost(ai, sa);
|
if (ComputerUtilMana.payManaCost(ai, sa)) {
|
||||||
game.getStack().addAndUnfreeze(sa);
|
game.getStack().addAndUnfreeze(sa);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final CostPayment pay = new CostPayment(cost, sa);
|
final CostPayment pay = new CostPayment(cost, sa);
|
||||||
if (pay.payComputerCosts(ai, game)) {
|
if (pay.payComputerCosts(ai, game)) {
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ public class ComputerUtilMana {
|
|||||||
saPayment.getSourceCard().tap();
|
saPayment.getSourceCard().tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbilityUtils.resolve(saPayment);
|
ai.getGame().getStack().addAndUnfreeze(saPayment);
|
||||||
// subtract mana from mana pool
|
// subtract mana from mana pool
|
||||||
manapool.payManaFromAbility(sa, cost, saPayment);
|
manapool.payManaFromAbility(sa, cost, saPayment);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user