mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Clean up
This commit is contained in:
@@ -679,8 +679,13 @@ public class ComputerUtilMana {
|
|||||||
adjustManaCostToAvoidNegEffects(cost, sa.getHostCard(), ai);
|
adjustManaCostToAvoidNegEffects(cost, sa.getHostCard(), ai);
|
||||||
|
|
||||||
List<Mana> manaSpentToPay = test ? new ArrayList<>() : sa.getPayingMana();
|
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();
|
boolean purePhyrexian = cost.containsOnlyPhyrexianMana();
|
||||||
int testEnergyPool = ai.getCounters(CounterEnumType.ENERGY);
|
|
||||||
|
|
||||||
boolean ignoreColor = false, ignoreType = false;
|
boolean ignoreColor = false, ignoreType = false;
|
||||||
StaticAbility mayPlay = sa.getMayPlay();
|
StaticAbility mayPlay = sa.getMayPlay();
|
||||||
@@ -691,13 +696,6 @@ public class ComputerUtilMana {
|
|||||||
ignoreType = true;
|
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();
|
boolean hasConverge = sa.getHostCard().hasConverge();
|
||||||
ListMultimap<ManaCostShard, SpellAbility> sourcesForShards = getSourcesForShards(cost, sa, ai, test,
|
ListMultimap<ManaCostShard, SpellAbility> sourcesForShards = getSourcesForShards(cost, sa, ai, test,
|
||||||
checkPlayable, manaSpentToPay, hasConverge, ignoreColor, ignoreType);
|
checkPlayable, manaSpentToPay, hasConverge, ignoreColor, ignoreType);
|
||||||
@@ -706,6 +704,7 @@ public class ComputerUtilMana {
|
|||||||
return false; // no mana abilities to use for paying
|
return false; // no mana abilities to use for paying
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int testEnergyPool = ai.getCounters(CounterEnumType.ENERGY);
|
||||||
final ManaPool manapool = ai.getManaPool();
|
final ManaPool manapool = ai.getManaPool();
|
||||||
ManaCostShard toPay = null;
|
ManaCostShard toPay = null;
|
||||||
List<SpellAbility> saExcludeList = new ArrayList<>();
|
List<SpellAbility> saExcludeList = new ArrayList<>();
|
||||||
|
|||||||
@@ -36,16 +36,14 @@ import forge.game.zone.ZoneType;
|
|||||||
public class CostAdjustment {
|
public class CostAdjustment {
|
||||||
|
|
||||||
public static Cost adjust(final Cost cost, final SpellAbility sa) {
|
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) {
|
if (sa.isTrigger() || cost == null) {
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Player player = sa.getActivatingPlayer();
|
||||||
|
final Card host = sa.getHostCard();
|
||||||
|
final Game game = player.getGame();
|
||||||
Cost result = cost.copy();
|
Cost result = cost.copy();
|
||||||
|
|
||||||
boolean isStateChangeToFaceDown = false;
|
boolean isStateChangeToFaceDown = false;
|
||||||
|
|
||||||
if (sa.isSpell()) {
|
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.
|
// 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.
|
// 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) {
|
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()) {
|
if (sa.isTrigger()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Game game = sa.getActivatingPlayer().getGame();
|
||||||
|
final Card originalCard = sa.getHostCard();
|
||||||
boolean isStateChangeToFaceDown = false;
|
boolean isStateChangeToFaceDown = false;
|
||||||
|
|
||||||
if (sa.isSpell()) {
|
if (sa.isSpell()) {
|
||||||
if (sa.isCastFaceDown()) {
|
if (sa.isCastFaceDown()) {
|
||||||
// Turn face down to apply cost modifiers correctly
|
// 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.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import forge.card.mana.ManaCost;
|
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.mana.ManaConversionMatrix;
|
import forge.game.mana.ManaConversionMatrix;
|
||||||
import forge.game.mana.ManaCostBeingPaid;
|
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
|
|
||||||
@@ -181,18 +179,8 @@ public class CostPayment extends ManaConversionMatrix {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<CostPart, PaymentDecision> decisions = Maps.newHashMap();
|
Map<CostPart, PaymentDecision> decisions = Maps.newHashMap();
|
||||||
Cost adjustedCost = CostAdjustment.adjust(cost, ability);
|
// for Trinisphere make sure to include Zero
|
||||||
List<CostPart> parts = adjustedCost.getCostParts();
|
List<CostPart> parts = CostAdjustment.adjust(cost, ability).getCostPartsWithZeroMana();
|
||||||
|
|
||||||
// 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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set all of the decisions before attempting to pay anything
|
// Set all of the decisions before attempting to pay anything
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user