mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Merge branch 'draft-bugs' into 'master'
Resolve #921, #922 Closes #921 and #922 See merge request core-developers/forge!1478
This commit is contained in:
@@ -581,12 +581,11 @@ public final class CardRulesPredicates {
|
|||||||
public static final Predicate<CardRules> IS_VANGUARD = CardRulesPredicates.coreType(true, CardType.CoreType.Vanguard);
|
public static final Predicate<CardRules> IS_VANGUARD = CardRulesPredicates.coreType(true, CardType.CoreType.Vanguard);
|
||||||
public static final Predicate<CardRules> IS_CONSPIRACY = CardRulesPredicates.coreType(true, CardType.CoreType.Conspiracy);
|
public static final Predicate<CardRules> IS_CONSPIRACY = CardRulesPredicates.coreType(true, CardType.CoreType.Conspiracy);
|
||||||
public static final Predicate<CardRules> IS_NON_LAND = CardRulesPredicates.coreType(false, CardType.CoreType.Land);
|
public static final Predicate<CardRules> IS_NON_LAND = CardRulesPredicates.coreType(false, CardType.CoreType.Land);
|
||||||
public static final Predicate<CardRules> IS_NON_CREATURE_SPELL = Predicates.not(Predicates.or(Presets.IS_CREATURE, Presets.IS_LAND));
|
|
||||||
public static final Predicate<CardRules> CAN_BE_BRAWL_COMMANDER = Predicates.or(Presets.IS_PLANESWALKER,
|
public static final Predicate<CardRules> CAN_BE_BRAWL_COMMANDER = Predicates.or(Presets.IS_PLANESWALKER,
|
||||||
Predicates.and(Presets.IS_CREATURE, Presets.IS_LEGENDARY));
|
Predicates.and(Presets.IS_CREATURE, Presets.IS_LEGENDARY));
|
||||||
|
|
||||||
/** The Constant IS_NONCREATURE_SPELL_FOR_GENERATOR. **/
|
/** The Constant IS_NON_CREATURE_SPELL. **/
|
||||||
public static final Predicate<CardRules> IS_NONCREATURE_SPELL_FOR_GENERATOR = com.google.common.base.Predicates
|
public static final Predicate<CardRules> IS_NON_CREATURE_SPELL = com.google.common.base.Predicates
|
||||||
.or(Presets.IS_SORCERY, Presets.IS_INSTANT, Presets.IS_PLANESWALKER, Presets.IS_ENCHANTMENT,
|
.or(Presets.IS_SORCERY, Presets.IS_INSTANT, Presets.IS_PLANESWALKER, Presets.IS_ENCHANTMENT,
|
||||||
Predicates.and(Presets.IS_ARTIFACT, Predicates.not(Presets.IS_CREATURE)));
|
Predicates.and(Presets.IS_ARTIFACT, Predicates.not(Presets.IS_CREATURE)));
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public abstract class DeckGeneratorBase {
|
|||||||
trace.append("Creatures to add:").append(creatCnt).append("\n");
|
trace.append("Creatures to add:").append(creatCnt).append("\n");
|
||||||
addCmcAdjusted(creatures, creatCnt, cmcLevels);
|
addCmcAdjusted(creatures, creatCnt, cmcLevels);
|
||||||
|
|
||||||
Predicate<PaperCard> preSpells = Predicates.compose(CardRulesPredicates.Presets.IS_NONCREATURE_SPELL_FOR_GENERATOR, PaperCard.FN_GET_RULES);
|
Predicate<PaperCard> preSpells = Predicates.compose(CardRulesPredicates.Presets.IS_NON_CREATURE_SPELL, PaperCard.FN_GET_RULES);
|
||||||
final Iterable<PaperCard> spells = Iterables.filter(cards, preSpells);
|
final Iterable<PaperCard> spells = Iterables.filter(cards, preSpells);
|
||||||
final int spellCnt = (int) Math.ceil(getSpellPercentage() * size);
|
final int spellCnt = (int) Math.ceil(getSpellPercentage() * size);
|
||||||
trace.append("Spells to add:").append(spellCnt).append("\n");
|
trace.append("Spells to add:").append(spellCnt).append("\n");
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ public class LimitedDeckBuilder extends DeckGeneratorBase {
|
|||||||
final Iterable<PaperCard> conspiracies = Iterables.filter(aiPlayables,
|
final Iterable<PaperCard> conspiracies = Iterables.filter(aiPlayables,
|
||||||
Predicates.compose(CardRulesPredicates.coreType(true, "Conspiracy"), PaperCard.FN_GET_RULES));
|
Predicates.compose(CardRulesPredicates.coreType(true, "Conspiracy"), PaperCard.FN_GET_RULES));
|
||||||
this.draftedConspiracies = Lists.newArrayList(conspiracies);
|
this.draftedConspiracies = Lists.newArrayList(conspiracies);
|
||||||
|
this.aiPlayables.removeAll(draftedConspiracies);
|
||||||
|
|
||||||
findBasicLandSets();
|
findBasicLandSets();
|
||||||
}
|
}
|
||||||
@@ -176,6 +177,7 @@ public class LimitedDeckBuilder extends DeckGeneratorBase {
|
|||||||
if (card != null) {
|
if (card != null) {
|
||||||
deckList.add(card);
|
deckList.add(card);
|
||||||
aiPlayables.remove(card);
|
aiPlayables.remove(card);
|
||||||
|
rankedColorList.remove(card);
|
||||||
landsNeeded--;
|
landsNeeded--;
|
||||||
if (logToConsole) {
|
if (logToConsole) {
|
||||||
System.out.println("Low CMC: " + card.getName());
|
System.out.println("Low CMC: " + card.getName());
|
||||||
@@ -290,6 +292,7 @@ public class LimitedDeckBuilder extends DeckGeneratorBase {
|
|||||||
final PaperCard c = aiPlayables.get(MyRandom.getRandom().nextInt(aiPlayables.size() - 1));
|
final PaperCard c = aiPlayables.get(MyRandom.getRandom().nextInt(aiPlayables.size() - 1));
|
||||||
deckList.add(c);
|
deckList.add(c);
|
||||||
aiPlayables.remove(c);
|
aiPlayables.remove(c);
|
||||||
|
rankedColorList.remove(c);
|
||||||
if (logToConsole) {
|
if (logToConsole) {
|
||||||
System.out.println(" - Added " + c.getName() + " randomly.");
|
System.out.println(" - Added " + c.getName() + " randomly.");
|
||||||
}
|
}
|
||||||
@@ -297,6 +300,7 @@ public class LimitedDeckBuilder extends DeckGeneratorBase {
|
|||||||
final PaperCard c = aiPlayables.get(0);
|
final PaperCard c = aiPlayables.get(0);
|
||||||
deckList.add(c);
|
deckList.add(c);
|
||||||
aiPlayables.remove(c);
|
aiPlayables.remove(c);
|
||||||
|
rankedColorList.remove(c);
|
||||||
if (logToConsole) {
|
if (logToConsole) {
|
||||||
System.out.println(" - Added " + c.getName() + " randomly.");
|
System.out.println(" - Added " + c.getName() + " randomly.");
|
||||||
}
|
}
|
||||||
@@ -521,6 +525,7 @@ public class LimitedDeckBuilder extends DeckGeneratorBase {
|
|||||||
}
|
}
|
||||||
deckList.addAll(toAdd);
|
deckList.addAll(toAdd);
|
||||||
aiPlayables.removeAll(toAdd);
|
aiPlayables.removeAll(toAdd);
|
||||||
|
rankedColorList.removeAll(toAdd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user