mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
Merge pull request #3738 from tool4ever/lastchapter
Fix LastChapter logic
This commit is contained in:
@@ -680,6 +680,7 @@ public class SpecialCardAi {
|
|||||||
// Gideon Blackblade
|
// Gideon Blackblade
|
||||||
public static class GideonBlackblade {
|
public static class GideonBlackblade {
|
||||||
public static boolean consider(final Player ai, final SpellAbility sa) {
|
public static boolean consider(final Player ai, final SpellAbility sa) {
|
||||||
|
sa.resetTargets();
|
||||||
CardCollectionView otb = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.isTargetableBy(sa));
|
CardCollectionView otb = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.isTargetableBy(sa));
|
||||||
if (!otb.isEmpty()) {
|
if (!otb.isEmpty()) {
|
||||||
sa.getTargets().add(ComputerUtilCard.getBestAI(otb));
|
sa.getTargets().add(ComputerUtilCard.getBestAI(otb));
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ public enum DeckFormat {
|
|||||||
final CardPool allCards = deck.getAllCardsInASinglePool(hasCommander());
|
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
|
// 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());
|
IPaperCard simpleCard = StaticData.instance().getCommonCards().getCard(cp.getKey());
|
||||||
if (simpleCard != null && simpleCard.getRules().isCustom() && !StaticData.instance().allowCustomCardsInDecksConformance())
|
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.");
|
return TextUtil.concatWithSpace("contains a Custom Card:", cp.getKey(), "\nPlease Enable Custom Cards in Forge Preferences to use this deck.");
|
||||||
|
|||||||
@@ -415,7 +415,6 @@ public abstract class DeckGeneratorBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> regexLandSearch(String pattern, Iterable<PaperCard> landCards) {
|
public List<String> regexLandSearch(String pattern, Iterable<PaperCard> landCards) {
|
||||||
//final List<String> dLands = new ArrayList<>();
|
|
||||||
Pattern p = Pattern.compile(pattern);
|
Pattern p = Pattern.compile(pattern);
|
||||||
for (PaperCard card:landCards) {
|
for (PaperCard card:landCards) {
|
||||||
Matcher matcher = p.matcher(card.getRules().getOracleText());
|
Matcher matcher = p.matcher(card.getRules().getOracleText());
|
||||||
@@ -437,7 +436,6 @@ public abstract class DeckGeneratorBase {
|
|||||||
|
|
||||||
public List<String> regexFetchLandSearch(Iterable<PaperCard> landCards) {
|
public List<String> regexFetchLandSearch(Iterable<PaperCard> landCards) {
|
||||||
final String fetchPattern="Search your library for an* ([^\\s]*) or ([^\\s]*) card";
|
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<>();
|
Map<String,String> colorLookup= new HashMap<>();
|
||||||
colorLookup.put("Plains","W");
|
colorLookup.put("Plains","W");
|
||||||
colorLookup.put("Forest","G");
|
colorLookup.put("Forest","G");
|
||||||
|
|||||||
@@ -1801,7 +1801,7 @@ public class CardFactoryUtil {
|
|||||||
for (int i = idx; i <= skipId; i++) {
|
for (int i = idx; i <= skipId; i++) {
|
||||||
SpellAbility sa = AbilityFactory.getAbility(card, ab);
|
SpellAbility sa = AbilityFactory.getAbility(card, ab);
|
||||||
sa.setChapter(i);
|
sa.setChapter(i);
|
||||||
sa.setLastChapter(idx == abs.size());
|
sa.setLastChapter(i == abs.size());
|
||||||
|
|
||||||
StringBuilder trigStr = new StringBuilder("Mode$ CounterAdded | ValidCard$ Card.Self | TriggerZones$ Battlefield");
|
StringBuilder trigStr = new StringBuilder("Mode$ CounterAdded | ValidCard$ Card.Self | TriggerZones$ Battlefield");
|
||||||
trigStr.append("| Chapter$ ").append(i).append(" | CounterType$ LORE | CounterAmount$ EQ").append(i);
|
trigStr.append("| Chapter$ ").append(i).append(" | CounterType$ LORE | CounterAmount$ EQ").append(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user