Merge pull request #3738 from tool4ever/lastchapter

Fix LastChapter logic
This commit is contained in:
kevlahnota
2023-09-06 14:28:08 +08:00
committed by GitHub
4 changed files with 3 additions and 4 deletions

View File

@@ -680,6 +680,7 @@ public class SpecialCardAi {
// Gideon Blackblade
public static class GideonBlackblade {
public static boolean consider(final Player ai, final SpellAbility sa) {
sa.resetTargets();
CardCollectionView otb = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.isTargetableBy(sa));
if (!otb.isEmpty()) {
sa.getTargets().add(ComputerUtilCard.getBestAI(otb));

View File

@@ -341,7 +341,7 @@ public enum DeckFormat {
final CardPool allCards = deck.getAllCardsInASinglePool(hasCommander());
// should group all cards by name, so that different editions of same card are really counted as the same card
for (final Entry<String, Integer> cp : Aggregates.groupSumBy(allCards, PaperCard.FN_GET_NAME)) {
for (final Entry<String, Integer> cp : Aggregates.groupSumBy(allCards, pc -> StaticData.instance().getCommonCards().getName(pc.getName(), true))) {
IPaperCard simpleCard = StaticData.instance().getCommonCards().getCard(cp.getKey());
if (simpleCard != null && simpleCard.getRules().isCustom() && !StaticData.instance().allowCustomCardsInDecksConformance())
return TextUtil.concatWithSpace("contains a Custom Card:", cp.getKey(), "\nPlease Enable Custom Cards in Forge Preferences to use this deck.");

View File

@@ -415,7 +415,6 @@ public abstract class DeckGeneratorBase {
}
public List<String> regexLandSearch(String pattern, Iterable<PaperCard> landCards) {
//final List<String> dLands = new ArrayList<>();
Pattern p = Pattern.compile(pattern);
for (PaperCard card:landCards) {
Matcher matcher = p.matcher(card.getRules().getOracleText());
@@ -437,7 +436,6 @@ public abstract class DeckGeneratorBase {
public List<String> regexFetchLandSearch(Iterable<PaperCard> landCards) {
final String fetchPattern="Search your library for an* ([^\\s]*) or ([^\\s]*) card";
//final List<String> dLands = new ArrayList<String>();
Map<String,String> colorLookup= new HashMap<>();
colorLookup.put("Plains","W");
colorLookup.put("Forest","G");

View File

@@ -1801,7 +1801,7 @@ public class CardFactoryUtil {
for (int i = idx; i <= skipId; i++) {
SpellAbility sa = AbilityFactory.getAbility(card, ab);
sa.setChapter(i);
sa.setLastChapter(idx == abs.size());
sa.setLastChapter(i == abs.size());
StringBuilder trigStr = new StringBuilder("Mode$ CounterAdded | ValidCard$ Card.Self | TriggerZones$ Battlefield");
trigStr.append("| Chapter$ ").append(i).append(" | CounterType$ LORE | CounterAmount$ EQ").append(i);