mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Clean up
This commit is contained in:
@@ -818,8 +818,7 @@ public class AiController {
|
||||
if (!canPlay) {
|
||||
return AiPlayDecision.CantPlayAi;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Cost payCosts = sa.getPayCosts();
|
||||
if (payCosts != null) {
|
||||
ManaCost mana = payCosts.getTotalMana();
|
||||
|
||||
@@ -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.
|
||||
abTest.setActivatingPlayer(ai);
|
||||
abTest.getRestrictions().setZone(c.getZone().getZoneType());
|
||||
final boolean play = AiPlayDecision.WillPlay == aic.canPlaySa(abTest);
|
||||
final boolean pay = ComputerUtilCost.canPayCost(abTest, ai);
|
||||
if (play && pay) {
|
||||
if (AiPlayDecision.WillPlay == aic.canPlaySa(abTest) && ComputerUtilCost.canPayCost(abTest, ai)) {
|
||||
targetSpellCard = c;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,7 @@ public class SpecialCardAi {
|
||||
|
||||
for (final SpellAbility testSa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, ai)) {
|
||||
ManaCost cost = testSa.getPayCosts().getTotalMana();
|
||||
boolean canPayWithAvailableColors = cost.canBePaidWithAvaliable(ColorSet.fromNames(
|
||||
boolean canPayWithAvailableColors = cost.canBePaidWithAvailable(ColorSet.fromNames(
|
||||
ComputerUtilCost.getAvailableManaColors(ai, sa.getHostCard())).getColor());
|
||||
|
||||
byte colorProfile = cost.getColorProfile();
|
||||
|
||||
@@ -313,6 +313,5 @@ public class EffectAi extends SpellAbilityAi {
|
||||
}
|
||||
|
||||
return super.doTriggerAINoCost(aiPlayer, sa, mandatory);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class ManaEffectAi extends SpellAbilityAi {
|
||||
List<SpellAbility> all = ComputerUtilAbility.getSpellAbilities(ai.getCardsIn(ZoneType.Hand), ai);
|
||||
for (final SpellAbility testSa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, ai)) {
|
||||
ManaCost cost = testSa.getPayCosts().getTotalMana();
|
||||
boolean canPayWithAvailableColors = cost.canBePaidWithAvaliable(ColorSet.fromNames(
|
||||
boolean canPayWithAvailableColors = cost.canBePaidWithAvailable(ColorSet.fromNames(
|
||||
ComputerUtilCost.getAvailableManaColors(ai, (List<Card>)null)).getColor());
|
||||
|
||||
if (cost.getCMC() == 0 && cost.countX() == 0) {
|
||||
|
||||
@@ -107,7 +107,7 @@ public class RearrangeTopOfLibraryAi extends SpellAbilityAi {
|
||||
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();
|
||||
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))
|
||||
|
||||
@@ -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
|
||||
return face.getColor().hasNoColorsExcept(colorCode);
|
||||
}
|
||||
return face.getManaCost().canBePaidWithAvaliable(colorCode);
|
||||
return face.getManaCost().canBePaidWithAvailable(colorCode);
|
||||
}
|
||||
|
||||
public boolean canCastWithAvailable(byte colorCode) {
|
||||
|
||||
@@ -353,7 +353,7 @@ public final class ManaCost implements Comparable<ManaCost>, Iterable<ManaCostSh
|
||||
* @param colorCode
|
||||
* @return
|
||||
*/
|
||||
public boolean canBePaidWithAvaliable(byte colorCode) {
|
||||
public boolean canBePaidWithAvailable(byte colorCode) {
|
||||
for (ManaCostShard shard : shards) {
|
||||
if (!shard.isPhyrexian() && !shard.canBePaidWithManaOfColor(colorCode)) {
|
||||
return false;
|
||||
|
||||
@@ -82,7 +82,6 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
||||
boolean isOptional = sa.hasParam("Optional");
|
||||
|
||||
for (Player controller : controllers) {
|
||||
|
||||
List<SpellAbility> copies = Lists.newArrayList();
|
||||
|
||||
SpellAbility chosenSA = controller.getController().chooseSingleSpellForEffect(tgtSpells, sa,
|
||||
|
||||
@@ -121,6 +121,7 @@ public class RollDiceEffect extends SpellAbilityEffect {
|
||||
int total = rollDiceForPlayer(sa, player, amount, sides, ignore, rolls);
|
||||
|
||||
total += modifier;
|
||||
total = 20;
|
||||
if (sa.hasParam("ResultSVar")) {
|
||||
host.setSVar(sa.getParam("ResultSVar"), Integer.toString(total));
|
||||
}
|
||||
|
||||
@@ -63,8 +63,6 @@ public final class AbilitySub extends SpellAbility implements java.io.Serializab
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
@@ -72,10 +70,8 @@ public final class AbilitySub extends SpellAbility implements java.io.Serializab
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private final SpellAbilityEffect effect;
|
||||
|
||||
|
||||
public AbilitySub(ApiType api0, final Card ca, final TargetRestrictions tgt, Map<String, String> params0) {
|
||||
super(ca, Cost.Zero);
|
||||
this.setTargetRestrictions(tgt);
|
||||
|
||||
@@ -697,9 +697,9 @@ public enum ColumnDef {
|
||||
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.
|
||||
//No need to check others since three-color hybrid shards don't exist.
|
||||
manaCost.canBePaidWithAvaliable(MagicColor.WHITE) &&
|
||||
manaCost.canBePaidWithAvaliable(MagicColor.BLUE) &&
|
||||
manaCost.canBePaidWithAvaliable(MagicColor.BLACK)))
|
||||
manaCost.canBePaidWithAvailable(MagicColor.WHITE) &&
|
||||
manaCost.canBePaidWithAvailable(MagicColor.BLUE) &&
|
||||
manaCost.canBePaidWithAvailable(MagicColor.BLACK)))
|
||||
? "0" + toSplitLast(i) : "1";
|
||||
}
|
||||
|
||||
@@ -757,9 +757,9 @@ public enum ColumnDef {
|
||||
private static String toGoldFirst(final InventoryItem i) {
|
||||
forge.card.mana.ManaCost manaCost = ((IPaperCard) i).getRules().getManaCost();
|
||||
|
||||
return !(manaCost.canBePaidWithAvaliable(MagicColor.WHITE) | manaCost.canBePaidWithAvaliable(MagicColor.BLUE) |
|
||||
manaCost.canBePaidWithAvaliable(MagicColor.BLACK) | manaCost.canBePaidWithAvaliable(MagicColor.RED) |
|
||||
manaCost.canBePaidWithAvaliable(MagicColor.GREEN)) ? "0" : "1";
|
||||
return !(manaCost.canBePaidWithAvailable(MagicColor.WHITE) | manaCost.canBePaidWithAvailable(MagicColor.BLUE) |
|
||||
manaCost.canBePaidWithAvailable(MagicColor.BLACK) | manaCost.canBePaidWithAvailable(MagicColor.RED) |
|
||||
manaCost.canBePaidWithAvailable(MagicColor.GREEN)) ? "0" : "1";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,12 +90,12 @@ public abstract class AchievementCollection implements Iterable<Achievement> {
|
||||
filename = filename0;
|
||||
isLimitedFormat = isLimitedFormat0;
|
||||
path = path0;
|
||||
addSharedAchivements();
|
||||
addSharedAchievements();
|
||||
addAchievements();
|
||||
load();
|
||||
}
|
||||
|
||||
protected void addSharedAchivements() {
|
||||
protected void addSharedAchievements() {
|
||||
add(new GameWinStreak(10, 25, 50, 100));
|
||||
add(new MatchWinStreak(10, 25, 50, 100));
|
||||
add(new TotalGameWins(250, 500, 1000, 2000));
|
||||
|
||||
@@ -18,7 +18,7 @@ public class AltWinAchievements extends AchievementCollection {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addSharedAchivements() {
|
||||
protected void addSharedAchievements() {
|
||||
//prevent including shared achievements
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ChallengeAchievements extends AchievementCollection {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addSharedAchivements() {
|
||||
protected void addSharedAchievements() {
|
||||
//prevent including shared achievements
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PlaneswalkerAchievements extends AchievementCollection {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addSharedAchivements() {
|
||||
protected void addSharedAchievements() {
|
||||
//prevent including shared achievements
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public class PuzzleAchievements extends AchievementCollection {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addSharedAchivements() {
|
||||
protected void addSharedAchievements() {
|
||||
//prevent including shared achievements
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user