mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Merge branch 'Shorikai' into 'master'
Fix for Shorikai See merge request core-developers/forge!6375
This commit is contained in:
@@ -540,11 +540,8 @@ public class PumpAi extends PumpAiBase {
|
||||
// Filter AI-specific targets if provided
|
||||
list = ComputerUtil.filterAITgts(sa, ai, list, true);
|
||||
|
||||
if (list.isEmpty()) {
|
||||
if (ComputerUtil.activateForCost(sa, ai)) {
|
||||
return pumpMandatoryTarget(ai, sa);
|
||||
}
|
||||
return mandatory && pumpMandatoryTarget(ai, sa);
|
||||
if (list.isEmpty() || ComputerUtil.activateForCost(sa, ai)) {
|
||||
return pumpMandatoryTarget(ai, sa);
|
||||
}
|
||||
|
||||
if (!sa.isCurse()) {
|
||||
@@ -623,9 +620,9 @@ public class PumpAi extends PumpAiBase {
|
||||
|
||||
if (sa.isCurse()) {
|
||||
pref = CardLists.filterControlledBy(list, ai.getOpponents());
|
||||
forced = CardLists.filterControlledBy(list, ai);
|
||||
forced = CardLists.filterControlledBy(list, ai.getYourTeam());
|
||||
} else {
|
||||
pref = CardLists.filterControlledBy(list, ai);
|
||||
pref = CardLists.filterControlledBy(list, ai.getYourTeam());
|
||||
forced = CardLists.filterControlledBy(list, ai.getOpponents());
|
||||
}
|
||||
|
||||
@@ -634,7 +631,7 @@ public class PumpAi extends PumpAiBase {
|
||||
break;
|
||||
}
|
||||
|
||||
Card c = ComputerUtilCard.getBestAI(list);
|
||||
Card c = ComputerUtilCard.getBestAI(pref);
|
||||
pref.remove(c);
|
||||
sa.getTargets().add(c);
|
||||
}
|
||||
@@ -652,7 +649,6 @@ public class PumpAi extends PumpAiBase {
|
||||
}
|
||||
|
||||
forced.remove(c);
|
||||
|
||||
sa.getTargets().add(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -448,10 +448,7 @@ public abstract class PumpAiBase extends SpellAbilityAi {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
protected CardCollection getCurseCreatures(final Player ai, final SpellAbility sa, final int defense, final int attack, final List<String> keywords) {
|
||||
CardCollection list = new CardCollection();
|
||||
for (final Player opp : ai.getOpponents()) {
|
||||
list.addAll(opp.getCardsIn(ZoneType.Battlefield));
|
||||
}
|
||||
CardCollection list = ai.getOpponents().getCardsIn(ZoneType.Battlefield);
|
||||
final Game game = ai.getGame();
|
||||
final Combat combat = game.getCombat();
|
||||
list = CardLists.getTargetableCards(list, sa);
|
||||
|
||||
@@ -67,8 +67,7 @@ public enum DeckSection {
|
||||
// NOTE: Same rules applies to both Deck and Side, despite "Conspiracy cards" are allowed
|
||||
// in the SideBoard (see Rule 313.2)
|
||||
// Those will be matched later, in case (see `Deck::validateDeferredSections`)
|
||||
return (!t.isConspiracy() && !t.isDungeon() && !t.isPhenomenon() && !t.isPlane() && !t.isScheme() &&
|
||||
!t.isVanguard());
|
||||
return !t.isConspiracy() && !t.isDungeon() && !t.isPhenomenon() && !t.isPlane() && !t.isScheme() && !t.isVanguard();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,7 +75,7 @@ public enum DeckSection {
|
||||
@Override
|
||||
public Boolean apply(PaperCard card) {
|
||||
CardType t = card.getRules().getType();
|
||||
return (t.isPlaneswalker() || (t.isCreature() && t.isLegendary()));
|
||||
return card.getRules().canBeCommander() || t.isPlaneswalker();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -84,7 +83,7 @@ public enum DeckSection {
|
||||
@Override
|
||||
public Boolean apply(PaperCard card) {
|
||||
CardType t = card.getRules().getType();
|
||||
return (t.isPlane() || t.isPhenomenon());
|
||||
return t.isPlane() || t.isPhenomenon();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -100,7 +99,7 @@ public enum DeckSection {
|
||||
@Override
|
||||
public Boolean apply(PaperCard card) {
|
||||
CardType t = card.getRules().getType();
|
||||
return (t.isScheme());
|
||||
return t.isScheme();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -108,7 +107,7 @@ public enum DeckSection {
|
||||
@Override
|
||||
public Boolean apply(PaperCard card) {
|
||||
CardType t = card.getRules().getType();
|
||||
return (t.isConspiracy());
|
||||
return t.isConspiracy();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -116,7 +115,7 @@ public enum DeckSection {
|
||||
@Override
|
||||
public Boolean apply(PaperCard card) {
|
||||
CardType t = card.getRules().getType();
|
||||
return ((t.isCreature() && t.hasSubtype("Avatar")) || t.isVanguard());
|
||||
return (t.isCreature() && t.hasSubtype("Avatar")) || t.isVanguard();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@ import com.google.common.base.Predicates;
|
||||
*/
|
||||
public abstract class ItemPredicate {
|
||||
|
||||
// Static builder methods - they choose concrete implementation by
|
||||
// themselves
|
||||
// Static builder methods - they choose concrete implementation by themselves
|
||||
|
||||
public static final Predicate<Object> IsBoosterPack = Predicates.instanceOf(BoosterPack.class);
|
||||
public static final Predicate<Object> IsPrebuiltDeck = Predicates.instanceOf(PreconDeck.class);
|
||||
|
||||
@@ -12,12 +12,10 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.card.CardRules;
|
||||
import forge.card.CardRulesPredicates;
|
||||
import forge.deck.io.CardThemedMatrixIO;
|
||||
import forge.deck.io.DeckStorage;
|
||||
@@ -159,13 +157,7 @@ public final class CardRelationMatrixGenerator {
|
||||
}
|
||||
|
||||
//filter to just legal commanders
|
||||
List<PaperCard> legends = Lists.newArrayList(Iterables.filter(cardList,Predicates.compose(
|
||||
new Predicate<CardRules>() {
|
||||
@Override
|
||||
public boolean apply(CardRules rules) {
|
||||
return format.isLegalCommander(rules);
|
||||
}
|
||||
}, PaperCard.FN_GET_RULES)));
|
||||
List<PaperCard> legends = Lists.newArrayList(Iterables.filter(cardList, format.isLegalCommanderPredicate()));
|
||||
|
||||
//generate lookups for legends to link commander names to matrix rows
|
||||
for (int i=0; i<legends.size(); ++i){
|
||||
|
||||
@@ -37,14 +37,8 @@ public class CommanderDeckGenerator extends DeckProxy implements Comparable<Comm
|
||||
}
|
||||
Predicate<CardRules> canPlay = isForAi ? DeckGeneratorBase.AI_CAN_PLAY : DeckGeneratorBase.HUMAN_CAN_PLAY;
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterable<PaperCard> legends = Iterables.filter(uniqueCards.toFlatList(), Predicates.compose(Predicates.and(
|
||||
new Predicate<CardRules>() {
|
||||
@Override
|
||||
public boolean apply(CardRules rules) {
|
||||
return format.isLegalCommander(rules);
|
||||
}
|
||||
},
|
||||
canPlay), PaperCard.FN_GET_RULES));
|
||||
Iterable<PaperCard> legends = Iterables.filter(uniqueCards.toFlatList(), Predicates.and(format.isLegalCommanderPredicate(), Predicates.compose(
|
||||
canPlay, PaperCard.FN_GET_RULES)));
|
||||
final List<DeckProxy> decks = new ArrayList<>();
|
||||
for (PaperCard legend: legends) {
|
||||
decks.add(new CommanderDeckGenerator(legend, format, isForAi, isCardGen));
|
||||
|
||||
@@ -601,15 +601,8 @@ public class DeckgenUtil {
|
||||
final DeckFormat format = gameType.getDeckFormat();
|
||||
Predicate<CardRules> canPlay = forAi ? DeckGeneratorBase.AI_CAN_PLAY : DeckGeneratorBase.HUMAN_CAN_PLAY;
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterable<PaperCard> legends = cardDb.getAllCards(Predicates.and(format.isLegalCardPredicate(),
|
||||
Predicates.compose(Predicates.and(
|
||||
new Predicate<CardRules>() {
|
||||
@Override
|
||||
public boolean apply(CardRules rules) {
|
||||
return format.isLegalCommander(rules);
|
||||
}
|
||||
},
|
||||
canPlay), PaperCard.FN_GET_RULES)));
|
||||
Iterable<PaperCard> legends = cardDb.getAllCards(Predicates.and(format.isLegalCardPredicate(), format.isLegalCommanderPredicate(),
|
||||
Predicates.compose(canPlay, PaperCard.FN_GET_RULES)));
|
||||
|
||||
commander = Aggregates.random(legends);
|
||||
return generateRandomCommanderDeck(commander, format, forAi, false);
|
||||
|
||||
@@ -434,7 +434,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
||||
|
||||
@Override
|
||||
public boolean apply(CardRules subject) {
|
||||
return ((allowedColor.containsAllColorsFrom(subject.getColorIdentity().getColor())));
|
||||
return allowedColor.containsAllColorsFrom(subject.getColorIdentity().getColor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user