mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Merge branch 'lands' into 'master'
Improve AI land handling See merge request core-developers/forge!4435
This commit is contained in:
@@ -96,7 +96,7 @@ public class CardRanker {
|
||||
if (card.getRules().getAiHints().getRemAIDecks()) {
|
||||
score -= 20.0;
|
||||
}
|
||||
if( !canAddMoreColors && !card.getRules().getManaCost().canBePaidWithAvaliable(chosenColors.getColor())) {
|
||||
if( !canAddMoreColors && !card.getRules().getDeckbuildingColors().hasNoColorsExcept(chosenColors)) {
|
||||
score -= 50.0;
|
||||
}
|
||||
|
||||
|
||||
@@ -844,25 +844,12 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
||||
|
||||
for (final PaperCard card : lands) {
|
||||
if (landsNeeded > minBasics) {
|
||||
// Throw out any dual-lands for the wrong colors. Assume
|
||||
// everything else is either
|
||||
// (a) dual-land of the correct two colors, or
|
||||
// (b) a land that generates colorless mana and has some other
|
||||
// beneficial effect.
|
||||
if (!card.getRules().getColorIdentity().isColorless() && card.getRules().getColorIdentity().getSharedColors(colors).countColors()==0
|
||||
|| card.getRules().getColorIdentity().isMulticolor()&&colors.isMonoColor()){//remove dual lands from mono coloured decks
|
||||
//skip as does not match colours
|
||||
if (logToConsole) {
|
||||
System.out.println("Excluding NonBasicLand: " + card.getName());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!inverseDLands.contains(card.getName())&&!dLands.contains(card.getName())&&MyRandom.getRandom().nextInt(100)<90) {
|
||||
// Use only lands that are within our colors
|
||||
if (card.getRules().getDeckbuildingColors().hasNoColorsExcept(colors)) {
|
||||
landsToAdd.add(card);
|
||||
landsNeeded--;
|
||||
if (logToConsole) {
|
||||
System.out.println("NonBasicLand[" + landsNeeded + "]:" + card.getName());
|
||||
}
|
||||
} else if (logToConsole) {
|
||||
System.out.println("Excluding NonBasicLand: " + card.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class DeckColors {
|
||||
|
||||
public void addColorsOf(final IPaperCard pickedCard) {
|
||||
final ColorSet colorsCanAdd = chosen.inverse();
|
||||
final ColorSet toAdd = colorsCanAdd.getSharedColors(pickedCard.getRules().getColor());
|
||||
final ColorSet toAdd = colorsCanAdd.getSharedColors(pickedCard.getRules().getDeckbuildingColors());
|
||||
|
||||
int cntColorsAssigned = getChosenColors().countColors();
|
||||
final boolean haveSpace = cntColorsAssigned < MAX_COLORS;
|
||||
|
||||
@@ -460,18 +460,14 @@ public class LimitedDeckBuilder extends DeckGeneratorBase {
|
||||
* Add non-basic lands to the deck.
|
||||
*/
|
||||
private void addNonBasicLands() {
|
||||
final List<String> inverseDuals = getInverseDualLandList();
|
||||
final Iterable<PaperCard> lands = Iterables.filter(aiPlayables,
|
||||
Predicates.compose(CardRulesPredicates.Presets.IS_NONBASIC_LAND, PaperCard.FN_GET_RULES));
|
||||
List<PaperCard> landsToAdd = new ArrayList<>();
|
||||
for (final PaperCard card : lands) {
|
||||
if (landsNeeded > 0) {
|
||||
// Throw out any dual-lands for the wrong colors. Assume
|
||||
// everything else is either
|
||||
// (a) dual-land of the correct two colors, or
|
||||
// (b) a land that generates colorless mana and has some other
|
||||
// beneficial effect.
|
||||
if (!inverseDuals.contains(card.getName())) {
|
||||
// Use only lands that are within our colors
|
||||
// TODO: Use off-color fetchlands that get an on-color dual land
|
||||
if (card.getRules().getDeckbuildingColors().hasNoColorsExcept(colors)) {
|
||||
landsToAdd.add(card);
|
||||
landsNeeded--;
|
||||
if (logToConsole) {
|
||||
|
||||
Reference in New Issue
Block a user