This commit is contained in:
tool4EvEr
2021-07-26 19:11:40 +02:00
parent 20bc46c0fd
commit 91e8c24769
18 changed files with 21 additions and 29 deletions

View File

@@ -818,8 +818,7 @@ public class AiController {
if (!canPlay) { if (!canPlay) {
return AiPlayDecision.CantPlayAi; return AiPlayDecision.CantPlayAi;
} }
} } else {
else {
Cost payCosts = sa.getPayCosts(); Cost payCosts = sa.getPayCosts();
if (payCosts != null) { if (payCosts != null) {
ManaCost mana = payCosts.getTotalMana(); ManaCost mana = payCosts.getTotalMana();

View File

@@ -2913,9 +2913,7 @@ public class ComputerUtil {
// at this point, we're assuming that card will be castable from whichever zone it's in by the AI player. // at this point, we're assuming that card will be castable from whichever zone it's in by the AI player.
abTest.setActivatingPlayer(ai); abTest.setActivatingPlayer(ai);
abTest.getRestrictions().setZone(c.getZone().getZoneType()); abTest.getRestrictions().setZone(c.getZone().getZoneType());
final boolean play = AiPlayDecision.WillPlay == aic.canPlaySa(abTest); if (AiPlayDecision.WillPlay == aic.canPlaySa(abTest) && ComputerUtilCost.canPayCost(abTest, ai)) {
final boolean pay = ComputerUtilCost.canPayCost(abTest, ai);
if (play && pay) {
targetSpellCard = c; targetSpellCard = c;
break; break;
} }

View File

@@ -633,7 +633,7 @@ public class ComputerUtilCost {
} }
// Check if the AI intends to play the card and if it can pay for it with the mana it has // Check if the AI intends to play the card and if it can pay for it with the mana it has
boolean willPlay = ComputerUtil.hasReasonToPlayCardThisTurn(payer, c); boolean willPlay = ComputerUtil.hasReasonToPlayCardThisTurn(payer, c);
boolean canPay = c.getManaCost().canBePaidWithAvaliable(ColorSet.fromNames(getAvailableManaColors(payer, source)).getColor()); boolean canPay = c.getManaCost().canBePaidWithAvailable(ColorSet.fromNames(getAvailableManaColors(payer, source)).getColor());
return canPay && willPlay; return canPay && willPlay;
} }
} }

View File

@@ -1099,7 +1099,7 @@ public class SpecialCardAi {
for (final SpellAbility testSa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, ai)) { for (final SpellAbility testSa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, ai)) {
ManaCost cost = testSa.getPayCosts().getTotalMana(); ManaCost cost = testSa.getPayCosts().getTotalMana();
boolean canPayWithAvailableColors = cost.canBePaidWithAvaliable(ColorSet.fromNames( boolean canPayWithAvailableColors = cost.canBePaidWithAvailable(ColorSet.fromNames(
ComputerUtilCost.getAvailableManaColors(ai, sa.getHostCard())).getColor()); ComputerUtilCost.getAvailableManaColors(ai, sa.getHostCard())).getColor());
byte colorProfile = cost.getColorProfile(); byte colorProfile = cost.getColorProfile();

View File

@@ -313,6 +313,5 @@ public class EffectAi extends SpellAbilityAi {
} }
return super.doTriggerAINoCost(aiPlayer, sa, mandatory); return super.doTriggerAINoCost(aiPlayer, sa, mandatory);
} }
} }

View File

@@ -167,7 +167,7 @@ public class ManaEffectAi extends SpellAbilityAi {
List<SpellAbility> all = ComputerUtilAbility.getSpellAbilities(ai.getCardsIn(ZoneType.Hand), ai); List<SpellAbility> all = ComputerUtilAbility.getSpellAbilities(ai.getCardsIn(ZoneType.Hand), ai);
for (final SpellAbility testSa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, ai)) { for (final SpellAbility testSa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, ai)) {
ManaCost cost = testSa.getPayCosts().getTotalMana(); ManaCost cost = testSa.getPayCosts().getTotalMana();
boolean canPayWithAvailableColors = cost.canBePaidWithAvaliable(ColorSet.fromNames( boolean canPayWithAvailableColors = cost.canBePaidWithAvailable(ColorSet.fromNames(
ComputerUtilCost.getAvailableManaColors(ai, (List<Card>)null)).getColor()); ComputerUtilCost.getAvailableManaColors(ai, (List<Card>)null)).getColor());
if (cost.getCMC() == 0 && cost.countX() == 0) { if (cost.getCMC() == 0 && cost.countX() == 0) {

View File

@@ -107,7 +107,7 @@ public class RearrangeTopOfLibraryAi extends SpellAbilityAi {
uncastableCMCThreshold = aic.getIntProperty(AiProps.SCRY_IMMEDIATELY_UNCASTABLE_CMC_DIFF); uncastableCMCThreshold = aic.getIntProperty(AiProps.SCRY_IMMEDIATELY_UNCASTABLE_CMC_DIFF);
} }
Player p = pc.getFirst(); // FIXME: is this always a single target spell? Player p = pc.getFirst(); // currently always a single target spell
Card top = p.getCardsIn(ZoneType.Library).getFirst(); Card top = p.getCardsIn(ZoneType.Library).getFirst();
int landsOTB = CardLists.filter(p.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.LANDS_PRODUCING_MANA).size(); int landsOTB = CardLists.filter(p.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.LANDS_PRODUCING_MANA).size();
int cmc = top.isSplitCard() ? Math.min(top.getCMC(Card.SplitCMCMode.LeftSplitCMC), top.getCMC(Card.SplitCMCMode.RightSplitCMC)) int cmc = top.isSplitCard() ? Math.min(top.getCMC(Card.SplitCMCMode.LeftSplitCMC), top.getCMC(Card.SplitCMCMode.RightSplitCMC))

View File

@@ -182,7 +182,7 @@ public final class CardRules implements ICardCharacteristics {
//if card face has no cost, assume castable only by mana of its defined color //if card face has no cost, assume castable only by mana of its defined color
return face.getColor().hasNoColorsExcept(colorCode); return face.getColor().hasNoColorsExcept(colorCode);
} }
return face.getManaCost().canBePaidWithAvaliable(colorCode); return face.getManaCost().canBePaidWithAvailable(colorCode);
} }
public boolean canCastWithAvailable(byte colorCode) { public boolean canCastWithAvailable(byte colorCode) {

View File

@@ -353,7 +353,7 @@ public final class ManaCost implements Comparable<ManaCost>, Iterable<ManaCostSh
* @param colorCode * @param colorCode
* @return * @return
*/ */
public boolean canBePaidWithAvaliable(byte colorCode) { public boolean canBePaidWithAvailable(byte colorCode) {
for (ManaCostShard shard : shards) { for (ManaCostShard shard : shards) {
if (!shard.isPhyrexian() && !shard.canBePaidWithManaOfColor(colorCode)) { if (!shard.isPhyrexian() && !shard.canBePaidWithManaOfColor(colorCode)) {
return false; return false;

View File

@@ -82,7 +82,6 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
boolean isOptional = sa.hasParam("Optional"); boolean isOptional = sa.hasParam("Optional");
for (Player controller : controllers) { for (Player controller : controllers) {
List<SpellAbility> copies = Lists.newArrayList(); List<SpellAbility> copies = Lists.newArrayList();
SpellAbility chosenSA = controller.getController().chooseSingleSpellForEffect(tgtSpells, sa, SpellAbility chosenSA = controller.getController().chooseSingleSpellForEffect(tgtSpells, sa,

View File

@@ -121,6 +121,7 @@ public class RollDiceEffect extends SpellAbilityEffect {
int total = rollDiceForPlayer(sa, player, amount, sides, ignore, rolls); int total = rollDiceForPlayer(sa, player, amount, sides, ignore, rolls);
total += modifier; total += modifier;
total = 20;
if (sa.hasParam("ResultSVar")) { if (sa.hasParam("ResultSVar")) {
host.setSVar(sa.getParam("ResultSVar"), Integer.toString(total)); host.setSVar(sa.getParam("ResultSVar"), Integer.toString(total));
} }

View File

@@ -63,8 +63,6 @@ public final class AbilitySub extends SpellAbility implements java.io.Serializab
return this.parent; return this.parent;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public boolean canPlay() { public boolean canPlay() {
@@ -72,10 +70,8 @@ public final class AbilitySub extends SpellAbility implements java.io.Serializab
return false; return false;
} }
private final SpellAbilityEffect effect; private final SpellAbilityEffect effect;
public AbilitySub(ApiType api0, final Card ca, final TargetRestrictions tgt, Map<String, String> params0) { public AbilitySub(ApiType api0, final Card ca, final TargetRestrictions tgt, Map<String, String> params0) {
super(ca, Cost.Zero); super(ca, Cost.Zero);
this.setTargetRestrictions(tgt); this.setTargetRestrictions(tgt);

View File

@@ -697,9 +697,9 @@ public enum ColumnDef {
return !(((IPaperCard) i).getRules().getType().isArtifact() && (toColor(i).isColorless() || return !(((IPaperCard) i).getRules().getType().isArtifact() && (toColor(i).isColorless() ||
//If it isn't colorless, see if it can be paid with only white, only blue, only black. //If it isn't colorless, see if it can be paid with only white, only blue, only black.
//No need to check others since three-color hybrid shards don't exist. //No need to check others since three-color hybrid shards don't exist.
manaCost.canBePaidWithAvaliable(MagicColor.WHITE) && manaCost.canBePaidWithAvailable(MagicColor.WHITE) &&
manaCost.canBePaidWithAvaliable(MagicColor.BLUE) && manaCost.canBePaidWithAvailable(MagicColor.BLUE) &&
manaCost.canBePaidWithAvaliable(MagicColor.BLACK))) manaCost.canBePaidWithAvailable(MagicColor.BLACK)))
? "0" + toSplitLast(i) : "1"; ? "0" + toSplitLast(i) : "1";
} }
@@ -757,9 +757,9 @@ public enum ColumnDef {
private static String toGoldFirst(final InventoryItem i) { private static String toGoldFirst(final InventoryItem i) {
forge.card.mana.ManaCost manaCost = ((IPaperCard) i).getRules().getManaCost(); forge.card.mana.ManaCost manaCost = ((IPaperCard) i).getRules().getManaCost();
return !(manaCost.canBePaidWithAvaliable(MagicColor.WHITE) | manaCost.canBePaidWithAvaliable(MagicColor.BLUE) | return !(manaCost.canBePaidWithAvailable(MagicColor.WHITE) | manaCost.canBePaidWithAvailable(MagicColor.BLUE) |
manaCost.canBePaidWithAvaliable(MagicColor.BLACK) | manaCost.canBePaidWithAvaliable(MagicColor.RED) | manaCost.canBePaidWithAvailable(MagicColor.BLACK) | manaCost.canBePaidWithAvailable(MagicColor.RED) |
manaCost.canBePaidWithAvaliable(MagicColor.GREEN)) ? "0" : "1"; manaCost.canBePaidWithAvailable(MagicColor.GREEN)) ? "0" : "1";
} }
/** /**

View File

@@ -90,12 +90,12 @@ public abstract class AchievementCollection implements Iterable<Achievement> {
filename = filename0; filename = filename0;
isLimitedFormat = isLimitedFormat0; isLimitedFormat = isLimitedFormat0;
path = path0; path = path0;
addSharedAchivements(); addSharedAchievements();
addAchievements(); addAchievements();
load(); load();
} }
protected void addSharedAchivements() { protected void addSharedAchievements() {
add(new GameWinStreak(10, 25, 50, 100)); add(new GameWinStreak(10, 25, 50, 100));
add(new MatchWinStreak(10, 25, 50, 100)); add(new MatchWinStreak(10, 25, 50, 100));
add(new TotalGameWins(250, 500, 1000, 2000)); add(new TotalGameWins(250, 500, 1000, 2000));

View File

@@ -18,7 +18,7 @@ public class AltWinAchievements extends AchievementCollection {
} }
@Override @Override
protected void addSharedAchivements() { protected void addSharedAchievements() {
//prevent including shared achievements //prevent including shared achievements
} }

View File

@@ -15,7 +15,7 @@ public class ChallengeAchievements extends AchievementCollection {
} }
@Override @Override
protected void addSharedAchivements() { protected void addSharedAchievements() {
//prevent including shared achievements //prevent including shared achievements
} }

View File

@@ -23,7 +23,7 @@ public class PlaneswalkerAchievements extends AchievementCollection {
} }
@Override @Override
protected void addSharedAchivements() { protected void addSharedAchievements() {
//prevent including shared achievements //prevent including shared achievements
} }

View File

@@ -8,7 +8,7 @@ public class PuzzleAchievements extends AchievementCollection {
} }
@Override @Override
protected void addSharedAchivements() { protected void addSharedAchievements() {
//prevent including shared achievements //prevent including shared achievements
} }