mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Clean up
This commit is contained in:
@@ -679,8 +679,13 @@ public class ComputerUtilMana {
|
||||
adjustManaCostToAvoidNegEffects(cost, sa.getHostCard(), ai);
|
||||
|
||||
List<Mana> manaSpentToPay = test ? new ArrayList<>() : sa.getPayingMana();
|
||||
List<SpellAbility> paymentList = Lists.newArrayList();
|
||||
|
||||
if (payManaCostFromPool(cost, sa, ai, test, manaSpentToPay)) {
|
||||
return true; // paid all from floating mana
|
||||
}
|
||||
|
||||
boolean purePhyrexian = cost.containsOnlyPhyrexianMana();
|
||||
int testEnergyPool = ai.getCounters(CounterEnumType.ENERGY);
|
||||
|
||||
boolean ignoreColor = false, ignoreType = false;
|
||||
StaticAbility mayPlay = sa.getMayPlay();
|
||||
@@ -691,13 +696,6 @@ public class ComputerUtilMana {
|
||||
ignoreType = true;
|
||||
}
|
||||
}
|
||||
|
||||
List<SpellAbility> paymentList = Lists.newArrayList();
|
||||
|
||||
if (payManaCostFromPool(cost, sa, ai, test, manaSpentToPay)) {
|
||||
return true; // paid all from floating mana
|
||||
}
|
||||
|
||||
boolean hasConverge = sa.getHostCard().hasConverge();
|
||||
ListMultimap<ManaCostShard, SpellAbility> sourcesForShards = getSourcesForShards(cost, sa, ai, test,
|
||||
checkPlayable, manaSpentToPay, hasConverge, ignoreColor, ignoreType);
|
||||
@@ -706,6 +704,7 @@ public class ComputerUtilMana {
|
||||
return false; // no mana abilities to use for paying
|
||||
}
|
||||
|
||||
int testEnergyPool = ai.getCounters(CounterEnumType.ENERGY);
|
||||
final ManaPool manapool = ai.getManaPool();
|
||||
ManaCostShard toPay = null;
|
||||
List<SpellAbility> saExcludeList = new ArrayList<>();
|
||||
|
||||
@@ -36,16 +36,14 @@ import forge.game.zone.ZoneType;
|
||||
public class CostAdjustment {
|
||||
|
||||
public static Cost adjust(final Cost cost, final SpellAbility sa) {
|
||||
final Player player = sa.getActivatingPlayer();
|
||||
final Card host = sa.getHostCard();
|
||||
final Game game = player.getGame();
|
||||
|
||||
if (sa.isTrigger() || cost == null) {
|
||||
return cost;
|
||||
}
|
||||
|
||||
final Player player = sa.getActivatingPlayer();
|
||||
final Card host = sa.getHostCard();
|
||||
final Game game = player.getGame();
|
||||
Cost result = cost.copy();
|
||||
|
||||
boolean isStateChangeToFaceDown = false;
|
||||
|
||||
if (sa.isSpell()) {
|
||||
@@ -158,14 +156,14 @@ public class CostAdjustment {
|
||||
// If cardsToDelveOut is null, will immediately exile the delved cards and remember them on the host card.
|
||||
// Otherwise, will return them in cardsToDelveOut and the caller is responsible for doing the above.
|
||||
public static final void adjust(ManaCostBeingPaid cost, final SpellAbility sa, CardCollection cardsToDelveOut, boolean test) {
|
||||
final Game game = sa.getActivatingPlayer().getGame();
|
||||
final Card originalCard = sa.getHostCard();
|
||||
|
||||
if (sa.isTrigger()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Game game = sa.getActivatingPlayer().getGame();
|
||||
final Card originalCard = sa.getHostCard();
|
||||
boolean isStateChangeToFaceDown = false;
|
||||
|
||||
if (sa.isSpell()) {
|
||||
if (sa.isCastFaceDown()) {
|
||||
// Turn face down to apply cost modifiers correctly
|
||||
|
||||
@@ -23,11 +23,9 @@ import java.util.Map;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.game.Game;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.mana.ManaConversionMatrix;
|
||||
import forge.game.mana.ManaCostBeingPaid;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
@@ -181,18 +179,8 @@ public class CostPayment extends ManaConversionMatrix {
|
||||
}
|
||||
|
||||
Map<CostPart, PaymentDecision> decisions = Maps.newHashMap();
|
||||
Cost adjustedCost = CostAdjustment.adjust(cost, ability);
|
||||
List<CostPart> parts = adjustedCost.getCostParts();
|
||||
|
||||
// For Trinisphere
|
||||
if (!adjustedCost.hasManaCost()) {
|
||||
ManaCostBeingPaid mc = new ManaCostBeingPaid(ManaCost.ZERO);
|
||||
CostAdjustment.adjust(mc, ability, null, false);
|
||||
if (mc.getConvertedManaCost() > 0) {
|
||||
// add placeholder so AI will calculate it
|
||||
parts.add(new CostPartMana(ManaCost.ZERO, null));
|
||||
}
|
||||
}
|
||||
// for Trinisphere make sure to include Zero
|
||||
List<CostPart> parts = CostAdjustment.adjust(cost, ability).getCostPartsWithZeroMana();
|
||||
|
||||
// Set all of the decisions before attempting to pay anything
|
||||
|
||||
|
||||
Reference in New Issue
Block a user