Merge pull request #5357 from Jetz72/Attractions

Attraction Support
This commit is contained in:
Chris H
2024-07-02 11:02:43 -04:00
committed by GitHub
94 changed files with 2191 additions and 499 deletions

View File

@@ -37,6 +37,7 @@ import org.apache.commons.lang3.tuple.Pair;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
public final class CardDb implements ICardDatabase, IDeckGenPool {
public final static String foilSuffix = "+";
@@ -272,7 +273,22 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
}
artIds.put(key, artIdx);
addCard(new PaperCard(cr, e.getCode(), cis.rarity, artIdx, false, cis.collectorNumber, cis.artistName));
addCard(new PaperCard(cr, e.getCode(), cis.rarity, artIdx, false, cis.collectorNumber, cis.artistName, cis.functionalVariantName));
}
private boolean addFromSetByName(String cardName, CardEdition ed, CardRules cr) {
List<CardInSet> cardsInSet = ed.getCardInSet(cardName); // empty collection if not present
if (cr.hasFunctionalVariants()) {
cardsInSet = cardsInSet.stream().filter(c -> StringUtils.isEmpty(c.functionalVariantName)
|| cr.getSupportedFunctionalVariants().contains(c.functionalVariantName)
).collect(Collectors.toList());
}
if (cardsInSet.isEmpty())
return false;
for (CardInSet cis : cardsInSet) {
addSetCard(ed, cis, cr);
}
return true;
}
public void loadCard(String cardName, String setCode, CardRules cr) {
@@ -285,18 +301,10 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
if (ed == null || ed.equals(CardEdition.UNKNOWN)) {
// look for all possible editions
for (CardEdition e : editions) {
List<CardInSet> cardsInSet = e.getCardInSet(cardName); // empty collection if not present
for (CardInSet cis : cardsInSet) {
addSetCard(e, cis, cr);
reIndexNecessary = true;
}
reIndexNecessary |= addFromSetByName(cardName, e, cr);
}
} else {
List<CardInSet> cardsInSet = ed.getCardInSet(cardName); // empty collection if not present
for (CardInSet cis : cardsInSet) {
addSetCard(ed, cis, cr);
reIndexNecessary = true;
}
reIndexNecessary |= addFromSetByName(cardName, ed, cr);
}
if (reIndexNecessary)
@@ -324,11 +332,20 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
for (CardEdition.CardInSet cis : e.getAllCardsInSet()) {
CardRules cr = rulesByName.get(cis.name);
if (cr != null) {
addSetCard(e, cis, cr);
} else {
if (cr == null) {
missingCards.add(cis.name);
continue;
}
if (cr.hasFunctionalVariants()) {
if (StringUtils.isNotEmpty(cis.functionalVariantName)
&& !cr.getSupportedFunctionalVariants().contains(cis.functionalVariantName)) {
//Supported card, unsupported variant.
//Could note the card as missing but since these are often un-cards,
//it's likely absent because it does something out of scope.
continue;
}
}
addSetCard(e, cis, cr);
}
if (isCoreExpSet && logMissingPerEdition) {
if (missingCards.isEmpty()) {
@@ -871,14 +888,16 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
@Override
public int getArtCount(String cardName, String setCode) {
return getArtCount(cardName, setCode, null);
}
public int getArtCount(String cardName, String setCode, String functionalVariantName) {
if (cardName == null || setCode == null)
return 0;
Collection<PaperCard> cardsInSet = getAllCards(cardName, new Predicate<PaperCard>() {
@Override
public boolean apply(PaperCard card) {
return card.getEdition().equalsIgnoreCase(setCode);
}
});
Predicate<PaperCard> predicate = card -> card.getEdition().equalsIgnoreCase(setCode);
if(functionalVariantName != null && !functionalVariantName.equals(IPaperCard.NO_FUNCTIONAL_VARIANT)) {
predicate = Predicates.and(predicate, card -> functionalVariantName.equals(card.getFunctionalVariant()));
}
Collection<PaperCard> cardsInSet = getAllCards(cardName, predicate);
return cardsInSet.size();
}
@@ -1142,7 +1161,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
}
if (!hasBadSetInfo) {
int artCount = getArtCount(card.getName(), card.getEdition());
int artCount = getArtCount(card.getName(), card.getEdition(), card.getFunctionalVariant());
sb.append(CardDb.NameSetSeparator).append(card.getEdition());
if (artCount >= IPaperCard.DEFAULT_ART_INDEX) {
sb.append(CardDb.NameSetSeparator).append(card.getArtIndex()); // indexes start at 1 to match image file name conventions
@@ -1229,7 +1248,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
int artIdx = IPaperCard.DEFAULT_ART_INDEX;
for (CardInSet cis : e.getCardInSet(cardName))
paperCards.add(new PaperCard(rules, e.getCode(), cis.rarity, artIdx++, false,
cis.collectorNumber, cis.artistName));
cis.collectorNumber, cis.artistName, cis.functionalVariantName));
}
} else {
String lastEdition = null;
@@ -1249,7 +1268,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
int cardInSetIndex = Math.max(artIdx-1, 0); // make sure doesn't go below zero
CardInSet cds = cardsInSet.get(cardInSetIndex); // use ArtIndex to get the right Coll. Number
paperCards.add(new PaperCard(rules, lastEdition, tuple.getValue(), artIdx++, false,
cds.collectorNumber, cds.artistName));
cds.collectorNumber, cds.artistName, cds.functionalVariantName));
}
}
if (paperCards.isEmpty()) {

View File

@@ -166,12 +166,14 @@ public final class CardEdition implements Comparable<CardEdition> {
public final String collectorNumber;
public final String name;
public final String artistName;
public final String functionalVariantName;
public CardInSet(final String name, final String collectorNumber, final CardRarity rarity, final String artistName) {
public CardInSet(final String name, final String collectorNumber, final CardRarity rarity, final String artistName, final String functionalVariantName) {
this.name = name;
this.collectorNumber = collectorNumber;
this.rarity = rarity;
this.artistName = artistName;
this.functionalVariantName = functionalVariantName;
}
public String toString() {
@@ -189,6 +191,10 @@ public final class CardEdition implements Comparable<CardEdition> {
sb.append(" @");
sb.append(artistName);
}
if (functionalVariantName != null) {
sb.append(" $");
sb.append(functionalVariantName);
}
return sb.toString();
}
@@ -567,9 +573,11 @@ public final class CardEdition implements Comparable<CardEdition> {
* cnum - grouping #2
* rarity - grouping #4
* name - grouping #5
* artist name - grouping #7
* functional variant name - grouping #9
*/
// "(^(.?[0-9A-Z]+.?))?(([SCURML]) )?(.*)$"
"(^(.?[0-9A-Z]+\\S?[A-Z]*)\\s)?(([SCURML])\\s)?([^@]*)( @(.*))?$"
"(^(.?[0-9A-Z]+\\S?[A-Z]*)\\s)?(([SCURML])\\s)?([^@\\$]*)( @([^\\$]*))?( \\$(.+))?$"
);
ListMultimap<String, CardInSet> cardMap = ArrayListMultimap.create();
@@ -595,7 +603,8 @@ public final class CardEdition implements Comparable<CardEdition> {
CardRarity r = CardRarity.smartValueOf(matcher.group(4));
String cardName = matcher.group(5);
String artistName = matcher.group(7);
CardInSet cis = new CardInSet(cardName, collectorNumber, r, artistName);
String functionalVariantName = matcher.group(9);
CardInSet cis = new CardInSet(cardName, collectorNumber, r, artistName, functionalVariantName);
cardMap.put(sectionName, cis);
}

View File

@@ -1,10 +1,12 @@
package forge.card;
import forge.card.mana.ManaCost;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import forge.card.mana.ManaCost;
//
// DO NOT AUTOFORMAT / CHECKSTYLE THIS FILE
@@ -40,6 +42,7 @@ final class CardFace implements ICardFace, Cloneable {
private String toughness = null;
private String initialLoyalty = "";
private String defense = "";
private Set<Integer> attractionLights = null;
private String nonAbilityText = null;
private List<String> keywords = null;
@@ -50,6 +53,8 @@ final class CardFace implements ICardFace, Cloneable {
private List<String> replacements = null;
private Map<String, String> variables = null;
private Map<String, CardFace> functionalVariants = null;
// these implement ICardCharacteristics
@@ -60,6 +65,7 @@ final class CardFace implements ICardFace, Cloneable {
@Override public String getToughness() { return toughness; }
@Override public String getInitialLoyalty() { return initialLoyalty; }
@Override public String getDefense() { return defense; }
@Override public Set<Integer> getAttractionLights() { return attractionLights; }
@Override public String getName() { return this.name; }
@Override public CardType getType() { return this.type; }
@Override public ManaCost getManaCost() { return this.manaCost; }
@@ -73,24 +79,35 @@ final class CardFace implements ICardFace, Cloneable {
@Override public Iterable<String> getDraftActions() { return draftActions; }
@Override public Iterable<String> getReplacements() { return replacements; }
@Override public String getNonAbilityText() { return nonAbilityText; }
@Override public Iterable<Entry<String, String>> getVariables() { return variables.entrySet(); }
@Override public Iterable<Entry<String, String>> getVariables() {
if (variables == null)
return null;
return variables.entrySet();
}
@Override public String getAltName() { return this.altName; }
public CardFace(String name0) {
public CardFace(String name0) {
this.name = name0;
if ( StringUtils.isBlank(name0) )
throw new RuntimeException("Card name is empty");
}
// Here come setters to allow parser supply values
void setName(String name) { this.name = name; }
void setName(String name) { this.name = name; }
void setAltName(String name) { this.altName = name; }
void setType(CardType type0) { this.type = type0; }
void setManaCost(ManaCost manaCost0) { this.manaCost = manaCost0; }
void setColor(ColorSet color0) { this.color = color0; }
void setOracleText(String text) { this.oracleText = text; }
void setInitialLoyalty(String value) { this.initialLoyalty = value; }
void setDefense(String value) { this.defense = value; }
void setInitialLoyalty(String value) { this.initialLoyalty = value; }
void setDefense(String value) { this.defense = value; }
void setAttractionLights(String value) {
if (value == null) {
this.attractionLights = null;
return;
}
this.attractionLights = Arrays.stream(value.split(" ")).map(Integer::parseInt).collect(Collectors.toSet());
}
void setPtText(String value) {
final String[] k = value.split("/");
@@ -127,6 +144,27 @@ final class CardFace implements ICardFace, Cloneable {
void addReplacementEffect(String value) { if (null == this.replacements) { this.replacements = new ArrayList<>(); } this.replacements.add(value);}
void addSVar(String key, String value) { if (null == this.variables) { this.variables = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); } this.variables.put(key, value); }
//Functional variant methods. Used for Attractions and some Un-cards,
//when cards with the same name can have different logic.
public boolean hasFunctionalVariants() {
return this.functionalVariants != null;
}
@Override public ICardFace getFunctionalVariant(String variant) {
if(this.functionalVariants == null)
return null;
return this.functionalVariants.get(variant);
}
CardFace getOrCreateFunctionalVariant(String variant) {
if (this.functionalVariants == null) {
this.functionalVariants = new HashMap<>();
}
if (!this.functionalVariants.containsKey(variant)) {
this.functionalVariants.put(variant, new CardFace(this.name));
}
return this.functionalVariants.get(variant);
}
void assignMissingFields() { // Most scripts do not specify color explicitly
if ( null == oracleText ) { System.err.println(name + " has no Oracle text."); oracleText = ""; }
@@ -140,6 +178,7 @@ final class CardFace implements ICardFace, Cloneable {
if ( replacements == null ) replacements = emptyList;
if ( variables == null ) variables = emptyMap;
if ( null == nonAbilityText ) nonAbilityText = "";
//Not assigning attractionLightVariants here. Too rarely used. Will test for it downstream.
}

View File

@@ -19,10 +19,10 @@ package forge.card;
import java.util.*;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forge.card.mana.IParserManaCost;
@@ -135,7 +135,8 @@ public final class CardRules implements ICardCharacteristics {
public boolean isVariant() {
CardType t = getType();
return t.isVanguard() || t.isScheme() || t.isPlane() || t.isPhenomenon() || t.isConspiracy() || t.isDungeon();
return t.isVanguard() || t.isScheme() || t.isPlane() || t.isPhenomenon()
|| t.isConspiracy() || t.isDungeon() || t.isAttraction();
}
public CardSplitType getSplitType() {
@@ -251,6 +252,8 @@ public final class CardRules implements ICardCharacteristics {
return mainPart.getDefense();
}
@Override public Set<Integer> getAttractionLights() { return mainPart.getAttractionLights(); }
@Override
public String getOracleText() {
switch (splitType.getAggregationMethod()) {
@@ -414,6 +417,14 @@ public final class CardRules implements ICardCharacteristics {
this.deltaLife = Integer.parseInt(TextUtil.fastReplace(pt.substring(slashPos+1), "+", ""));
}
private Set<String> supportedFunctionalVariants;
public boolean hasFunctionalVariants() {
return this.supportedFunctionalVariants != null;
}
public Set<String> getSupportedFunctionalVariants() {
return this.supportedFunctionalVariants;
}
public ColorSet getColorIdentity() {
return colorIdentity;
}
@@ -438,6 +449,7 @@ public final class CardRules implements ICardCharacteristics {
private boolean addsWildCardColor = false;
private String handLife = null;
private String normalizedName = "";
private Set<String> supportedFunctionalVariants = null;
private List<String> tokens = Lists.newArrayList();
@@ -475,6 +487,7 @@ public final class CardRules implements ICardCharacteristics {
this.partnerWith = "";
this.addsWildCardColor = false;
this.normalizedName = "";
this.supportedFunctionalVariants = null;
this.tokens = Lists.newArrayList();
}
@@ -503,6 +516,7 @@ public final class CardRules implements ICardCharacteristics {
}
if (StringUtils.isNotBlank(handLife))
result.setVanguardProperties(handLife);
result.supportedFunctionalVariants = this.supportedFunctionalVariants;
return result;
}
@@ -512,7 +526,7 @@ public final class CardRules implements ICardCharacteristics {
if (line.isEmpty() || line.charAt(0) == '#') {
continue;
}
this.parseLine(line);
this.parseLine(line, this.faces[curFace]);
}
this.normalizedName = filename;
return this.getCard();
@@ -523,12 +537,15 @@ public final class CardRules implements ICardCharacteristics {
}
/**
* Parses the line.
* Parses a single line of a card script.
*
* @param line
* the line
* @param line Line of text to parse.
*/
public final void parseLine(final String line) {
this.parseLine(line, this.faces[curFace]);
}
private void parseLine(final String line, CardFace face) {
int colonPos = line.indexOf(':');
String key = colonPos > 0 ? line.substring(0, colonPos) : line;
String value = colonPos > 0 ? line.substring(1+colonPos).trim() : null;
@@ -548,7 +565,7 @@ public final class CardRules implements ICardCharacteristics {
switch (key.charAt(0)) {
case 'A':
if ("A".equals(key)) {
this.faces[curFace].addAbility(value);
face.addAbility(value);
} else if ("AI".equals(key)) {
colonPos = value.indexOf(':');
String variable = colonPos > 0 ? value.substring(0, colonPos) : value;
@@ -564,7 +581,7 @@ public final class CardRules implements ICardCharacteristics {
} else if ("ALTERNATE".equals(key)) {
this.curFace = 1;
} else if ("AltName".equals(key)) {
this.faces[curFace].setAltName(value);
face.setAltName(value);
}
break;
@@ -573,7 +590,7 @@ public final class CardRules implements ICardCharacteristics {
// This is forge.card.CardColor not forge.CardColor.
// Why do we have two classes with the same name?
ColorSet newCol = ColorSet.fromNames(value.split(","));
this.faces[this.curFace].setColor(newCol);
face.setColor(newCol);
}
break;
@@ -585,9 +602,9 @@ public final class CardRules implements ICardCharacteristics {
} else if ("DeckHas".equals(key)) {
has = new DeckHints(value);
} else if ("Defense".equals(key)) {
this.faces[this.curFace].setDefense(value);
face.setDefense(value);
} else if ("Draft".equals(key)) {
this.faces[this.curFace].addDraftAction(value);
face.addDraftAction(value);
}
break;
@@ -599,7 +616,7 @@ public final class CardRules implements ICardCharacteristics {
case 'K':
if ("K".equals(key)) {
this.faces[this.curFace].addKeyword(value);
face.addKeyword(value);
if (value.startsWith("Partner:")) {
this.partnerWith = value.split(":")[1];
}
@@ -608,13 +625,16 @@ public final class CardRules implements ICardCharacteristics {
case 'L':
if ("Loyalty".equals(key)) {
this.faces[this.curFace].setInitialLoyalty(value);
face.setInitialLoyalty(value);
}
if ("Lights".equals(key)) {
face.setAttractionLights(value);
}
break;
case 'M':
if ("ManaCost".equals(key)) {
this.faces[this.curFace].setManaCost("no cost".equals(value) ? ManaCost.NO_COST
face.setManaCost("no cost".equals(value) ? ManaCost.NO_COST
: new ManaCost(new ManaCostParser(value)));
} else if ("MeldPair".equals(key)) {
this.meldWith = value;
@@ -629,25 +649,25 @@ public final class CardRules implements ICardCharacteristics {
case 'O':
if ("Oracle".equals(key)) {
this.faces[this.curFace].setOracleText(value);
face.setOracleText(value);
}
break;
case 'P':
if ("PT".equals(key)) {
this.faces[this.curFace].setPtText(value);
face.setPtText(value);
}
break;
case 'R':
if ("R".equals(key)) {
this.faces[this.curFace].addReplacementEffect(value);
face.addReplacementEffect(value);
}
break;
case 'S':
if ("S".equals(key)) {
this.faces[this.curFace].addStaticAbility(value);
face.addStaticAbility(value);
} else if (key.startsWith("SPECIALIZE")) {
if (value.equals("WHITE")) {
this.curFace = 2;
@@ -667,17 +687,32 @@ public final class CardRules implements ICardCharacteristics {
String variable = colonPos > 0 ? value.substring(0, colonPos) : value;
value = colonPos > 0 ? value.substring(1+colonPos) : null;
this.faces[curFace].addSVar(variable, value);
face.addSVar(variable, value);
}
break;
case 'T':
if ("T".equals(key)) {
this.faces[this.curFace].addTrigger(value);
face.addTrigger(value);
} else if ("Types".equals(key)) {
this.faces[this.curFace].setType(CardType.parse(value, false));
face.setType(CardType.parse(value, false));
} else if ("Text".equals(key) && !"no text".equals(value) && StringUtils.isNotBlank(value)) {
this.faces[this.curFace].setNonAbilityText(value);
face.setNonAbilityText(value);
}
break;
case 'V':
if("Variant".equals(key)) {
if (value == null) value = "";
colonPos = value.indexOf(':');
if(colonPos <= 0) throw new IllegalArgumentException("Missing variant name");
String variantName = value.substring(0, colonPos);
CardFace varFace = face.getOrCreateFunctionalVariant(variantName);
String variantLine = value.substring(1 + colonPos);
this.parseLine(variantLine, varFace);
if(this.supportedFunctionalVariants == null)
this.supportedFunctionalVariants = new HashSet<>();
this.supportedFunctionalVariants.add(variantName);
}
break;
}

View File

@@ -356,6 +356,10 @@ public final class CardRulesPredicates {
};
}
public static Predicate<CardRules> canBePartnerCommanderWith(final CardRules commander) {
return (rules) -> rules.canBePartnerCommanders(commander);
}
private static class LeafString extends PredicateString<CardRules> {
public enum CardField {
ORACLE_TEXT, NAME, SUBTYPE, JOINED_TYPE, COST
@@ -654,6 +658,9 @@ public final class CardRulesPredicates {
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_DUNGEON = CardRulesPredicates.coreType(true, CardType.CoreType.Dungeon);
public static final Predicate<CardRules> IS_ATTRACTION = Predicates.and(Presets.IS_ARTIFACT,
CardRulesPredicates.subType("Attraction")
);
public static final Predicate<CardRules> IS_NON_LAND = CardRulesPredicates.coreType(false, CardType.CoreType.Land);
public static final Predicate<CardRules> CAN_BE_BRAWL_COMMANDER = Predicates.and(Presets.IS_LEGENDARY,
Predicates.or(Presets.IS_CREATURE, Presets.IS_PLANESWALKER));

View File

@@ -500,6 +500,9 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
public final boolean isEquipment() { return hasSubtype("Equipment"); }
@Override
public final boolean isFortification() { return hasSubtype("Fortification"); }
public boolean isAttraction() {
return hasSubtype("Attraction");
}
@Override
public boolean isSaga() {

View File

@@ -56,6 +56,7 @@ public interface CardTypeView extends Iterable<String>, Serializable {
boolean isAura();
boolean isEquipment();
boolean isFortification();
boolean isAttraction();
boolean isSaga();
boolean isHistoric();

View File

@@ -2,6 +2,8 @@ package forge.card;
import forge.card.mana.ManaCost;
import java.util.Set;
public interface ICardCharacteristics {
String getName();
CardType getType();
@@ -14,6 +16,7 @@ public interface ICardCharacteristics {
String getToughness();
String getInitialLoyalty();
String getDefense();
Set<Integer> getAttractionLights();
String getOracleText();
}

View File

@@ -1,9 +1,12 @@
package forge.card;
/**
/**
* TODO: Write javadoc for this type.
*
*/
public interface ICardFace extends ICardCharacteristics, ICardRawAbilites, Comparable<ICardFace> {
String getAltName();
boolean hasFunctionalVariants();
ICardFace getFunctionalVariant(String variant);
}

View File

@@ -155,12 +155,12 @@ public class CardPool extends ItemPool<PaperCard> {
return null;
}
public int countByName(String cardName, boolean isCommonCard) {
PaperCard pc = isCommonCard
? StaticData.instance().getCommonCards().getCard(cardName)
: StaticData.instance().getVariantCards().getCard(cardName);
public int countByName(String cardName) {
return this.countAll((c) -> c.getName().equals(cardName));
}
return this.count(pc);
public int countByName(PaperCard card) {
return this.countAll((c) -> c.getName().equals(card.getName()));
}
/**

View File

@@ -552,6 +552,17 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
return allCards;
}
/**
* Counts the number of cards with the given name across all deck sections.
*/
public int countByName(String cardName) {
int sum = 0;
for (Entry<DeckSection, CardPool> section : this) {
sum += section.getValue().countByName(cardName);
}
return sum;
}
public void setAiHints(String aiHintsInfo) {
if (aiHintsInfo == null || aiHintsInfo.trim().equals("")) {
return;

View File

@@ -50,7 +50,15 @@ public enum DeckFormat {
// Main board: allowed size SB: restriction Max distinct non basic cards
Constructed ( Range.between(60, Integer.MAX_VALUE), Range.between(0, 15), 4),
QuestDeck ( Range.between(40, Integer.MAX_VALUE), Range.between(0, 15), 4),
Limited ( Range.between(40, Integer.MAX_VALUE), null, Integer.MAX_VALUE),
Limited ( Range.between(40, Integer.MAX_VALUE), null, Integer.MAX_VALUE) {
@Override
public String getAttractionDeckConformanceProblem(Deck deck) {
//Limited attraction decks have a minimum size of 3 and no singleton restriction.
if (deck.get(DeckSection.Attractions).countAll() < 3)
return "must contain at least 3 attractions, or none at all";
return null;
}
},
Commander ( Range.is(99), Range.between(0, 10), 1, null, new Predicate<PaperCard>() {
@Override
public boolean apply(PaperCard card) {
@@ -210,9 +218,9 @@ public enum DeckFormat {
// Adjust minimum base on number of Advantageous Proclamation or similar cards
CardPool conspiracies = deck.get(DeckSection.Conspiracy);
if (conspiracies != null) {
min -= (5 * conspiracies.countByName(ADVPROCLAMATION, false));
min -= (5 * conspiracies.countByName(ADVPROCLAMATION));
// Commented out to remove warnings from the code.
// noBasicLands = conspiracies.countByName(SOVREALM, false) > 0;
// noBasicLands = conspiracies.countByName(SOVREALM) > 0;
}
if (hasCommander()) {
@@ -330,6 +338,12 @@ public enum DeckFormat {
}
}
if (deck.has(DeckSection.Attractions)) {
String attractionError = getAttractionDeckConformanceProblem(deck);
if (attractionError != null)
return attractionError;
}
final int maxCopies = getMaxCardCopies();
//Must contain no more than 4 of the same card
//shared among the main deck and sideboard, except
@@ -356,7 +370,7 @@ public enum DeckFormat {
}
Integer cardCopies = canHaveSpecificNumberInDeck(simpleCard);
if (cardCopies != null && deck.getMain().countByName(cp.getKey(), true) > cardCopies) {
if (cardCopies != null && deck.getMain().countByName(cp.getKey()) > cardCopies) {
return TextUtil.concatWithSpace("must not contain more than", String.valueOf(cardCopies), "copies of the card", cp.getKey());
}
@@ -377,6 +391,18 @@ public enum DeckFormat {
return null;
}
public String getAttractionDeckConformanceProblem(Deck deck) {
CardPool attractionDeck = deck.get(DeckSection.Attractions);
if (attractionDeck.countAll() < 10)
return "must contain at least 10 attractions, or none at all";
for (Entry<PaperCard, Integer> cp : attractionDeck) {
//Constructed Attraction deck must be singleton
if (attractionDeck.countByName(cp.getKey()) > 1)
return TextUtil.concatWithSpace("contains more than 1 copy of the attraction", cp.getKey().getName());
}
return null;
}
public static boolean canHaveAnyNumberOf(final IPaperCard icard) {
return icard.getRules().getType().isBasicLand()
|| Iterables.contains(icard.getRules().getMainPart().getKeywords(),
@@ -532,16 +558,14 @@ public enum DeckFormat {
public Predicate<PaperCard> isLegalCardForCommanderPredicate(List<PaperCard> commanders) {
byte cmdCI = 0;
boolean hasPartner = false;
for (final PaperCard p : commanders) {
cmdCI |= p.getRules().getColorIdentity().getColor();
if (p.getRules().canBePartnerCommander()) {
hasPartner = true;
}
}
Predicate<CardRules> predicate = CardRulesPredicates.hasColorIdentity(cmdCI);
if (hasPartner) { //also show available partners a commander can have a partner
predicate = Predicates.or(predicate, CardRulesPredicates.Presets.CAN_BE_PARTNER_COMMANDER);
if (commanders.size() == 1 && commanders.get(0).getRules().canBePartnerCommander()) { //also show available partners a commander can have a partner
//702.124g If a legendary card has more than one partner ability, you may choose which one to use when designating your commander, but you cant use both.
//Notably, no partner ability or combination of partner abilities can ever let a player have more than two commanders.
predicate = Predicates.or(predicate, CardRulesPredicates.canBePartnerCommanderWith(commanders.get(0).getRules()));
}
return Predicates.compose(predicate, PaperCard.FN_GET_RULES);
}

View File

@@ -151,6 +151,8 @@ public class DeckRecognizer {
matchedSection = DeckSection.Conspiracy;
else if (sectionName.equals("planes"))
matchedSection = DeckSection.Planes;
else if (sectionName.equals("attractions"))
matchedSection = DeckSection.Attractions;
if (matchedSection == null) // no match found
return null;
@@ -760,6 +762,9 @@ public class DeckRecognizer {
// is not supported, but other possibilities exist (e.g. Commander card in Constructed
// could potentially go in Main)
DeckSection matchedSection = DeckSection.matchingSection(card);
// If it's a commander candidate, put it there.
if (matchedSection == DeckSection.Main && this.isAllowed(DeckSection.Commander) && DeckSection.Commander.validate(card))
return DeckSection.Commander;
if (this.isAllowed(matchedSection))
return matchedSection;
// if matched section is not allowed, try to match the card to main.

View File

@@ -13,7 +13,8 @@ public enum DeckSection {
Planes(10, Validators.PLANES_VALIDATOR),
Schemes(20, Validators.SCHEME_VALIDATOR),
Conspiracy(0, Validators.CONSPIRACY_VALIDATOR),
Dungeon(0, Validators.DUNGEON_VALIDATOR);
Dungeon(0, Validators.DUNGEON_VALIDATOR),
Attractions(0, Validators.ATTRACTION_VALIDATOR);
private final int typicalSize; // Rules enforcement is done in DeckFormat class, this is for reference only
private Function<PaperCard, Boolean> fnValidator;
@@ -40,10 +41,10 @@ public enum DeckSection {
return Avatar;
if (DeckSection.Planes.validate(card))
return Planes;
if (DeckSection.Commander.validate(card))
return Commander;
if (DeckSection.Dungeon.validate(card))
return Dungeon;
if (DeckSection.Attractions.validate(card))
return Attractions;
return Main; // default
}
@@ -119,5 +120,10 @@ public enum DeckSection {
}
};
static final Function<PaperCard, Boolean> ATTRACTION_VALIDATOR = card -> {
CardType t = card.getRules().getType();
return t.isAttraction();
};
}
}

View File

@@ -21,6 +21,7 @@ public interface IPaperCard extends InventoryItem, Serializable {
int DEFAULT_ART_INDEX = 1;
int NO_ART_INDEX = -1; // Placeholder when NO ArtIndex is Specified
String NO_ARTIST_NAME = "";
String NO_FUNCTIONAL_VARIANT = "";
/**
* Number of filters based on CardPrinted values.
@@ -243,6 +244,7 @@ public interface IPaperCard extends InventoryItem, Serializable {
String getName();
String getEdition();
String getCollectorNumber();
String getFunctionalVariant();
int getArtIndex();
boolean isFoil();
boolean isToken();

View File

@@ -56,6 +56,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
private final boolean foil;
private Boolean hasImage;
private String sortableName;
private final String functionalVariant;
// Calculated fields are below:
private transient CardRarity rarity; // rarity is given in ctor when set is assigned
@@ -79,6 +80,11 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
return collectorNumber;
}
@Override
public String getFunctionalVariant() {
return functionalVariant;
}
@Override
public int getArtIndex() {
return artIndex;
@@ -120,7 +126,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
if (this.foiledVersion == null) {
this.foiledVersion = new PaperCard(this.rules, this.edition, this.rarity,
this.artIndex, true, String.valueOf(collectorNumber), this.artist);
this.artIndex, true, String.valueOf(collectorNumber), this.artist, this.functionalVariant);
}
return this.foiledVersion;
}
@@ -129,7 +135,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
return this;
PaperCard unFoiledVersion = new PaperCard(this.rules, this.edition, this.rarity,
this.artIndex, false, String.valueOf(collectorNumber), this.artist);
this.artIndex, false, String.valueOf(collectorNumber), this.artist, this.functionalVariant);
return unFoiledVersion;
}
@@ -172,11 +178,12 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
public PaperCard(final CardRules rules0, final String edition0, final CardRarity rarity0) {
this(rules0, edition0, rarity0, IPaperCard.DEFAULT_ART_INDEX, false,
IPaperCard.NO_COLLECTOR_NUMBER, IPaperCard.NO_ARTIST_NAME);
IPaperCard.NO_COLLECTOR_NUMBER, IPaperCard.NO_ARTIST_NAME, "");
}
public PaperCard(final CardRules rules0, final String edition0, final CardRarity rarity0,
final int artIndex0, final boolean foil0, final String collectorNumber0, final String artist0) {
final int artIndex0, final boolean foil0, final String collectorNumber0,
final String artist0, final String functionalVariant) {
if (rules0 == null || edition0 == null || rarity0 == null) {
throw new IllegalArgumentException("Cannot create card without rules, edition or rarity");
}
@@ -191,6 +198,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
// If the user changes the language this will make cards sort by the old language until they restart the game.
// This is a good tradeoff
sortableName = TextUtil.toSortableName(CardTranslation.getTranslatedName(rules0.getName()));
this.functionalVariant = functionalVariant != null ? functionalVariant : IPaperCard.NO_FUNCTIONAL_VARIANT;
}
public static PaperCard FAKE_CARD = new PaperCard(CardRules.getUnsupportedCardNamed("Fake Card"), "Fake Edition", CardRarity.Common);

View File

@@ -150,6 +150,12 @@ public class PaperToken implements InventoryItemFromSet, IPaperCard {
return IPaperCard.NO_COLLECTOR_NUMBER;
}
@Override
public String getFunctionalVariant() {
//Tokens aren't differentiated by name, so they don't really need support for this.
return IPaperCard.NO_FUNCTIONAL_VARIANT;
}
@Override
public int getArtIndex() {
return artIndex;

View File

@@ -5,6 +5,7 @@ import forge.StaticData;
import forge.card.CardDb;
import forge.card.CardRules;
import forge.card.CardSplitType;
import forge.item.IPaperCard;
import forge.item.PaperCard;
import org.apache.commons.lang3.StringUtils;
@@ -74,7 +75,7 @@ public class ImageUtil {
final boolean hasManyPictures;
final CardDb db = !card.isVariant() ? StaticData.instance().getCommonCards() : StaticData.instance().getVariantCards();
if (includeSet) {
cntPictures = db.getArtCount(card.getName(), edition);
cntPictures = db.getArtCount(card.getName(), edition, cp.getFunctionalVariant());
hasManyPictures = cntPictures > 1;
} else {
cntPictures = 1;
@@ -149,6 +150,8 @@ public class ImageUtil {
}
} else if (CardSplitType.Split == cp.getRules().getSplitType()) {
return card.getMainPart().getName() + card.getOtherPart().getName();
} else if (!IPaperCard.NO_FUNCTIONAL_VARIANT.equals(cp.getFunctionalVariant())) {
return cp.getName() + " " + cp.getFunctionalVariant();
}
return cp.getName();
}

View File

@@ -156,6 +156,16 @@ public class GameAction {
}
}
//717.6. If a card with an Astrotorium card back would be put into a zone other than the battlefield, exile,
//or the command zone from anywhere, instead its owner puts it into the junkyard.
if (c.isAttractionCard() && !toBattlefield && !zoneTo.is(ZoneType.AttractionDeck)
&& !zoneTo.is(ZoneType.Junkyard) && !zoneTo.is(ZoneType.Exile) && !zoneTo.is(ZoneType.Command)) {
//This should technically be a replacement effect, but with the "can apply more than once to the same event"
//clause, this seems sufficient for now.
//TODO: Figure out what on earth happens if you animate an attraction, mutate a creature/commander/token onto it, and it dies...
return moveToJunkyard(c, cause, params);
}
boolean suppress = !c.isToken() && zoneFrom.equals(zoneTo);
Card copied = null;
@@ -447,7 +457,8 @@ public class GameAction {
}
game.getCombat().removeFromCombat(c);
}
if ((zoneFrom.is(ZoneType.Library) || zoneFrom.is(ZoneType.PlanarDeck) || zoneFrom.is(ZoneType.SchemeDeck))
if ((zoneFrom.is(ZoneType.Library) || zoneFrom.is(ZoneType.PlanarDeck)
|| zoneFrom.is(ZoneType.SchemeDeck) || zoneFrom.is(ZoneType.AttractionDeck))
&& zoneFrom == zoneTo && position.equals(zoneFrom.size()) && position != 0) {
position--;
}
@@ -507,7 +518,7 @@ public class GameAction {
if (card.isRealCommander()) {
card.setMoveToCommandZone(true);
}
// 723.3e & 903.9a
// 727.3e & 903.9a
if (wasToken && !card.isRealToken() || card.isRealCommander()) {
Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(card);
repParams.put(AbilityKey.CardLKI, card);
@@ -754,6 +765,8 @@ public class GameAction {
case Stack: return moveToStack(c, cause, params);
case PlanarDeck: return moveToVariantDeck(c, ZoneType.PlanarDeck, libPosition, cause, params);
case SchemeDeck: return moveToVariantDeck(c, ZoneType.SchemeDeck, libPosition, cause, params);
case AttractionDeck: return moveToVariantDeck(c, ZoneType.AttractionDeck, libPosition, cause, params);
case Junkyard: return moveToJunkyard(c, cause, params);
default: // sideboard will also get there
return moveTo(c.getOwner().getZone(name), c, cause);
}
@@ -899,6 +912,11 @@ public class GameAction {
}
return changeZone(game.getZoneOf(c), deck, c, deckPosition, cause, params);
}
public final Card moveToJunkyard(Card c, SpellAbility cause, Map<AbilityKey, Object> params) {
final PlayerZone junkyard = c.getOwner().getZone(ZoneType.Junkyard);
return moveTo(junkyard, c, cause, params);
}
public final CardCollection exile(final CardCollection cards, SpellAbility cause, Map<AbilityKey, Object> params) {
CardCollection result = new CardCollection();

View File

@@ -117,6 +117,7 @@ public enum AbilityKey {
ReplacementResult("ReplacementResult"),
ReplacementResultMap("ReplacementResultMap"),
Result("Result"),
RolledToVisitAttractions("RolledToVisitAttractions"),
RoomName("RoomName"),
Scheme("Scheme"),
ScryBottom("ScryBottom"),

View File

@@ -50,6 +50,7 @@ public enum ApiType {
ChooseSector (ChooseSectorEffect.class),
ChooseSource (ChooseSourceEffect.class),
ChooseType (ChooseTypeEffect.class),
ClaimThePrize (ClaimThePrizeEffect.class),
Clash (ClashEffect.class),
ClassLevelUp (ClassLevelUpEffect.class),
Cleanup (CleanUpEffect.class),
@@ -124,6 +125,7 @@ public enum ApiType {
Mutate (MutateEffect.class),
NameCard (ChooseCardNameEffect.class),
NoteCounters (CountersNoteEffect.class),
OpenAttraction (OpenAttractionEffect.class),
PeekAndReveal (PeekAndRevealEffect.class),
PermanentCreature (PermanentCreatureEffect.class),
PermanentNoncreature (PermanentNoncreatureEffect.class),

View File

@@ -0,0 +1,38 @@
package forge.game.ability.effects;
import forge.game.Game;
import forge.game.ability.AbilityKey;
import forge.game.ability.AbilityUtils;
import forge.game.ability.SpellAbilityEffect;
import forge.game.card.Card;
import forge.game.card.CardCollection;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.trigger.TriggerType;
import forge.util.Lang;
import java.util.Map;
public class ClaimThePrizeEffect extends SpellAbilityEffect {
@Override
public void resolve(SpellAbility sa) {
final Card host = sa.getHostCard();
final Player activator = sa.getActivatingPlayer();
final Game game = activator.getGame();
final CardCollection attractions = AbilityUtils.getDefinedCards(host, sa.getParamOrDefault("Defined", "Self"), sa);
for(Card c : attractions) {
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(activator);
runParams.put(AbilityKey.Card, c);
game.getTriggerHandler().runTrigger(TriggerType.ClaimPrize, runParams, false);
}
}
@Override
protected String getStackDescription(SpellAbility sa) {
final Card host = sa.getHostCard();
final CardCollection attractions = AbilityUtils.getDefinedCards(host, sa.getParamOrDefault("Defined", "Self"), sa);
return String.format("Claim the Prize from %s!", Lang.joinHomogenous(attractions));
}
}

View File

@@ -0,0 +1,62 @@
package forge.game.ability.effects;
import forge.game.ability.AbilityKey;
import forge.game.ability.AbilityUtils;
import forge.game.ability.SpellAbilityEffect;
import forge.game.card.Card;
import forge.game.card.CardZoneTable;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.zone.PlayerZone;
import forge.game.zone.ZoneType;
import forge.util.Lang;
import java.util.List;
import java.util.Map;
public class OpenAttractionEffect extends SpellAbilityEffect {
@Override
protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder();
final List<Player> tgtPlayers = getDefinedPlayersOrTargeted(sa);
int amount = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("Amount"), sa) : 1;
if(tgtPlayers.isEmpty())
return "";
sb.append(Lang.joinHomogenous(tgtPlayers));
if (tgtPlayers.size() > 1) {
sb.append(" each");
}
sb.append(Lang.joinVerb(tgtPlayers, " open")).append(" ");
sb.append(amount == 1 ? "an Attraction." : (Lang.getNumeral(amount) + " Attractions."));
return sb.toString();
}
@Override
public void resolve(SpellAbility sa) {
final Card source = sa.getHostCard();
final List<Player> tgtPlayers = getDefinedPlayersOrTargeted(sa);
int amount = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("Amount"), sa) : 1;
Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
final CardZoneTable triggerList = AbilityKey.addCardZoneTableParams(moveParams, sa);
for (Player p : tgtPlayers) {
if (!p.isInGame())
continue;
final PlayerZone attractionDeck = p.getZone(ZoneType.AttractionDeck);
for (int i = 0; i < amount; i++) {
if(attractionDeck.isEmpty())
continue;
Card attraction = attractionDeck.get(0);
attraction = p.getGame().getAction().moveToPlay(attraction, sa, moveParams);
if (sa.hasParam("Remember")) {
source.addRemembered(attraction);
}
}
}
triggerList.triggerChangesZoneAll(sa.getHostCard().getGame(), sa);
}
}

View File

@@ -12,6 +12,7 @@ import forge.game.player.PlayerCollection;
import forge.game.replacement.ReplacementType;
import forge.game.spellability.SpellAbility;
import forge.game.trigger.TriggerType;
import forge.util.Lang;
import forge.util.Localizer;
import forge.util.MyRandom;
import org.apache.commons.lang3.StringUtils;
@@ -44,6 +45,13 @@ public class RollDiceEffect extends SpellAbilityEffect {
protected String getStackDescription(SpellAbility sa) {
final PlayerCollection player = getTargetPlayers(sa);
if(sa.hasParam("ToVisitYourAttractions")) {
if (player.size() == 1 && player.get(0).equals(sa.getActivatingPlayer()))
return "Roll to Visit Your Attractions.";
else
return String.format("%s %s to visit their Attractions.", Lang.joinHomogenous(player), Lang.joinVerb(player, "roll"));
}
StringBuilder stringBuilder = new StringBuilder();
if (player.size() == 1 && player.get(0).equals(sa.getActivatingPlayer())) {
stringBuilder.append("Roll ");
@@ -60,9 +68,13 @@ public class RollDiceEffect extends SpellAbilityEffect {
}
public static int rollDiceForPlayer(SpellAbility sa, Player player, int amount, int sides) {
return rollDiceForPlayer(sa, player, amount, sides, 0, 0, null);
boolean toVisitAttractions = sa != null && sa.hasParam("ToVisitYourAttractions");
return rollDiceForPlayer(sa, player, amount, sides, 0, 0, null, toVisitAttractions);
}
private static int rollDiceForPlayer(SpellAbility sa, Player player, int amount, int sides, int ignore, int modifier, List<Integer> rollsResult) {
public static int rollDiceForPlayerToVisitAttractions(Player player) {
return rollDiceForPlayer(null, player, 1, 6, 0, 0, null, true);
}
private static int rollDiceForPlayer(SpellAbility sa, Player player, int amount, int sides, int ignore, int modifier, List<Integer> rollsResult, boolean toVisitAttractions) {
Map<Player, Integer> ignoreChosenMap = Maps.newHashMap();
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(player);
@@ -76,6 +88,7 @@ public class RollDiceEffect extends SpellAbilityEffect {
case Updated: {
amount = (int) repParams.get(AbilityKey.Number);
ignore = (int) repParams.get(AbilityKey.Ignore);
//noinspection unchecked
ignoreChosenMap = (Map<Player, Integer>) repParams.get(AbilityKey.IgnoreChosen);
break;
}
@@ -121,8 +134,9 @@ public class RollDiceEffect extends SpellAbilityEffect {
//Notify of results
if (amount > 0) {
StringBuilder sb = new StringBuilder();
sb.append(Localizer.getInstance().getMessage("lblPlayerRolledResult", player,
StringUtils.join(naturalRolls, ", ")));
String rollResults = StringUtils.join(naturalRolls, ", ");
String resultMessage = toVisitAttractions ? "lblAttractionRollResult" : "lblPlayerRolledResult";
sb.append(Localizer.getInstance().getMessage(resultMessage, player, rollResults));
if (!ignored.isEmpty()) {
sb.append("\r\n").append(Localizer.getInstance().getMessage("lblIgnoredRolls",
StringUtils.join(ignored, ", ")));
@@ -149,15 +163,17 @@ public class RollDiceEffect extends SpellAbilityEffect {
countMaxRolls++;
}
}
if (sa.hasParam("EvenOddResults")) {
sa.setSVar("EvenResults", Integer.toString(evenResults));
sa.setSVar("OddResults", Integer.toString(oddResults));
}
if (sa.hasParam("DifferentResults")) {
sa.setSVar("DifferentResults", Integer.toString(differentResults));
}
if (sa.hasParam("MaxRollsResults")) {
sa.setSVar("MaxRolls", Integer.toString(countMaxRolls));
if (sa != null) {
if (sa.hasParam("EvenOddResults")) {
sa.setSVar("EvenResults", Integer.toString(evenResults));
sa.setSVar("OddResults", Integer.toString(oddResults));
}
if (sa.hasParam("DifferentResults")) {
sa.setSVar("DifferentResults", Integer.toString(differentResults));
}
if (sa.hasParam("MaxRollsResults")) {
sa.setSVar("MaxRolls", Integer.toString(countMaxRolls));
}
}
total += modifier;
@@ -168,6 +184,7 @@ public class RollDiceEffect extends SpellAbilityEffect {
runParams.put(AbilityKey.Sides, sides);
runParams.put(AbilityKey.Modifier, modifier);
runParams.put(AbilityKey.Result, roll);
runParams.put(AbilityKey.RolledToVisitAttractions, toVisitAttractions);
runParams.put(AbilityKey.Number, player.getNumRollsThisTurn() - amount + rollNum);
player.getGame().getTriggerHandler().runTrigger(TriggerType.RolledDie, runParams, false);
rollNum++;
@@ -175,6 +192,7 @@ public class RollDiceEffect extends SpellAbilityEffect {
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(player);
runParams.put(AbilityKey.Sides, sides);
runParams.put(AbilityKey.Result, rolls);
runParams.put(AbilityKey.RolledToVisitAttractions, toVisitAttractions);
player.getGame().getTriggerHandler().runTrigger(TriggerType.RolledDieOnce, runParams, false);
return total;
@@ -210,7 +228,13 @@ public class RollDiceEffect extends SpellAbilityEffect {
final int ignore = AbilityUtils.calculateAmount(host, sa.getParamOrDefault("IgnoreLower", "0"), sa);
List<Integer> rolls = new ArrayList<>();
int total = rollDiceForPlayer(sa, player, amount, sides, ignore, modifier, rolls);
int total = rollDiceForPlayer(sa, player, amount, sides, ignore, modifier, rolls, sa.hasParam("ToVisitYourAttractions"));
if (sa.hasParam("UseHighestRoll")) {
total = Collections.max(rolls);
} else if (sa.hasParam("UseDifferenceBetweenRolls")) {
total = Collections.max(rolls) - Collections.min(rolls);
}
if (sa.hasParam("StoreResults")) {
host.addStoredRolls(rolls);
@@ -234,9 +258,6 @@ public class RollDiceEffect extends SpellAbilityEffect {
sa.setSVar(sa.getParam("OtherSVar"), Integer.toString(other));
}
}
if (sa.hasParam("UseHighestRoll")) {
total = Collections.max(rolls);
}
if (sa.hasParam("SubsForEach")) {
for (Integer roll : rolls) {
@@ -278,6 +299,9 @@ public class RollDiceEffect extends SpellAbilityEffect {
} else {
int result = rollDice(sa, player, amount, sides);
results.add(result);
if (sa.hasParam("ToVisitYourAttractions")) {
player.visitAttractions(result);
}
}
}
if (rememberHighest) {

View File

@@ -141,12 +141,16 @@ public class SubgameEffect extends SpellAbilityEffect {
// Planes
setCardsInZone(player, ZoneType.PlanarDeck, maingamePlayer.getCardsIn(ZoneType.PlanarDeck), false);
// Attractions
setCardsInZone(player, ZoneType.AttractionDeck, maingamePlayer.getCardsIn(ZoneType.AttractionDeck), false);
// Vanguard and Commanders
initVariantsZonesSubgame(subgame, maingamePlayer, player);
player.shuffle(null);
player.getZone(ZoneType.SchemeDeck).shuffle();
player.getZone(ZoneType.PlanarDeck).shuffle();
player.getZone(ZoneType.AttractionDeck).shuffle();
}
}
@@ -249,6 +253,7 @@ public class SubgameEffect extends SpellAbilityEffect {
player.shuffle(sa);
player.getZone(ZoneType.SchemeDeck).shuffle();
player.getZone(ZoneType.PlanarDeck).shuffle();
player.getZone(ZoneType.AttractionDeck).shuffle();
}
}

View File

@@ -223,6 +223,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
private int timesSaddledThisTurn = 0;
private CardCollection saddledByThisTurn;
private boolean visitedThisTurn = false;
private int classLevel = 1;
private long bestowTimestamp = -1;
private long transformedTimestamp = 0;
@@ -249,6 +251,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
private boolean isImmutable = false;
private boolean isEmblem = false;
private boolean isBoon = false;
private boolean isAttractionCard = false;
private int exertThisTurn = 0;
private PlayerCollection exertedByPlayer = new PlayerCollection();
@@ -263,8 +266,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
private Table<Long, Long, Pair<Integer,Integer>> newPT = TreeBasedTable.create(); // Layer 7b
private Table<Long, Long, Pair<Integer,Integer>> boostPT = TreeBasedTable.create(); // Layer 7c
private String oracleText = "";
private final Map<Card, Integer> assignedDamageMap = Maps.newTreeMap();
private Map<Integer, Integer> damage = Maps.newHashMap();
private boolean hasBeenDealtDeathtouchDamage;
@@ -2504,7 +2505,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|| keyword.startsWith("Class") || keyword.startsWith("Blitz")
|| keyword.startsWith("Specialize") || keyword.equals("Ravenous")
|| keyword.equals("For Mirrodin") || keyword.startsWith("Craft")
|| keyword.startsWith("Landwalk")) {
|| keyword.startsWith("Landwalk") || keyword.startsWith("Visit")) {
// keyword parsing takes care of adding a proper description
} else if (keyword.equals("Read ahead")) {
sb.append(Localizer.getInstance().getMessage("lblReadAhead")).append(" (").append(Localizer.getInstance().getMessage("lblReadAheadDesc"));
@@ -3496,7 +3497,11 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
public final void setCopiedPermanent(final Card c) {
if (copiedPermanent == c) { return; }
copiedPermanent = c;
currentState.getView().updateOracleText(this);
if(c != null)
currentState.setOracleText(c.getOracleText());
//Could fetch the card rules oracle text in an "else" clause here,
//but CardRules isn't aware of the card's state. May be better to
//just stash the original oracle text if this comes up.
}
public final boolean isCopiedSpell() {
@@ -4235,6 +4240,14 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
currentState.setBaseDefense(Integer.toString(n));
}
public final Set<Integer> getAttractionLights() {
return currentState.getAttractionLights();
}
public final void setAttractionLights(Set<Integer> attractionLights) {
currentState.setAttractionLights(attractionLights);
}
public final int getBasePower() {
return currentState.getBasePower();
}
@@ -5473,6 +5486,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
public final boolean isEquipment() { return getType().isEquipment(); }
public final boolean isFortification() { return getType().isFortification(); }
public final boolean isAttraction() { return getType().isAttraction(); }
public final boolean isCurse() { return getType().hasSubtype("Curse"); }
public final boolean isAura() { return getType().isAura(); }
public final boolean isShrine() { return getType().hasSubtype("Shrine"); }
@@ -5849,6 +5863,16 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
view.updateBoon(this);
}
/**
* @return true if this is physically an Attraction card with an Astrotorium card back. False otherwise.
*/
public final boolean isAttractionCard() {
return this.isAttractionCard;
}
public final void setAttractionCard(boolean isAttractionCard) {
this.isAttractionCard = isAttractionCard;
}
/*
* there are easy checkers for Color. The CardUtil functions should be made
* part of the Card class, so calling out is not necessary
@@ -6605,6 +6629,17 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
crewedByThisTurn = crew;
}
public final void visitAttraction(Player visitor) {
this.visitedThisTurn = true;
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(this);
runParams.put(AbilityKey.Player, visitor);
game.getTriggerHandler().runTrigger(TriggerType.VisitAttraction, runParams, false);
}
public final boolean wasVisitedThisTurn() {
return this.visitedThisTurn;
}
public final int getClassLevel() {
return classLevel;
}
@@ -7115,6 +7150,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
resetExertedThisTurn();
resetCrewed();
resetSaddled();
visitedThisTurn = false;
resetChosenModeTurn();
resetAbilityResolvedThisTurn();
}
@@ -7253,7 +7289,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
public void setRules(CardRules r) {
cardRules = r;
currentState.getView().updateRulesText(r, getType());
currentState.getView().updateOracleText(this);
}
public boolean isCommander() {
@@ -7582,15 +7617,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
}
public String getOracleText() {
CardRules rules = cardRules;
if (copiedPermanent != null) { //return oracle text of copied permanent if applicable
rules = copiedPermanent.getRules();
}
return rules != null ? rules.getOracleText() : oracleText;
return currentState.getOracleText();
}
public void setOracleText(final String oracleText0) {
oracleText = oracleText0;
currentState.getView().updateOracleText(this);
public void setOracleText(final String oracleText) {
currentState.setOracleText(oracleText);
}
@Override

View File

@@ -44,9 +44,7 @@ import forge.item.IPaperCard;
import forge.util.CardTranslation;
import forge.util.TextUtil;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
/**
@@ -190,6 +188,8 @@ public class CardFactory {
c.setImageKey(originalPicture);
c.setToken(cp.isToken());
c.setAttractionCard(cardRules.getType().isAttraction());
if (c.hasAlternateState()) {
if (c.isFlipCard()) {
c.setState(CardStateName.Flipped, false);
@@ -346,9 +346,9 @@ public class CardFactory {
card.setColor(combinedColor);
card.setType(new CardType(rules.getType()));
// Combined text based on Oracle text - might not be necessary, temporarily disabled.
//String combinedText = String.format("%s: %s\n%s: %s", rules.getMainPart().getName(), rules.getMainPart().getOracleText(), rules.getOtherPart().getName(), rules.getOtherPart().getOracleText());
//card.setText(combinedText);
// Combined text based on Oracle text - might not be necessary
String combinedText = String.format("(%s) %s\r\n\r\n(%s) %s", rules.getMainPart().getName(), rules.getMainPart().getOracleText(), rules.getOtherPart().getName(), rules.getOtherPart().getOracleText());
card.getState(CardStateName.Original).setOracleText(combinedText);
}
return card;
}
@@ -380,7 +380,7 @@ public class CardFactory {
c.getCurrentState().setBaseLoyalty(face.getInitialLoyalty());
c.getCurrentState().setBaseDefense(face.getDefense());
c.setOracleText(face.getOracleText());
c.getCurrentState().setOracleText(face.getOracleText());
// Super and 'middle' types should use enums.
c.setType(new CardType(face.getType()));
@@ -396,6 +396,8 @@ public class CardFactory {
c.setBaseToughnessString(face.getToughness());
}
c.setAttractionLights(face.getAttractionLights());
// SpellPermanent only for Original State
if (c.getCurrentStateName() == CardStateName.Original || c.getCurrentStateName() == CardStateName.Modal || c.getCurrentStateName().toString().startsWith("Specialize")) {
// this is the "default" spell for permanents like creatures and artifacts
@@ -412,6 +414,73 @@ public class CardFactory {
}
CardFactoryUtil.addAbilityFactoryAbilities(c, face.getAbilities());
if (face.hasFunctionalVariants()) {
applyFunctionalVariant(c, face);
}
}
private static void applyFunctionalVariant(Card c, ICardFace originalFace) {
String variantName = c.getPaperCard().getFunctionalVariant();
if (IPaperCard.NO_FUNCTIONAL_VARIANT.equals(variantName))
return;
ICardFace variant = originalFace.getFunctionalVariant(variantName);
if (variant == null) {
System.out.printf("Tried to apply unknown or unsupported variant - Card: \"%s\"; Variant: %s\n", originalFace.getName(), variantName);
return;
}
if (variant.getVariables() != null)
for (Entry<String, String> v : variant.getVariables())
c.setSVar(v.getKey(), v.getValue());
if (variant.getReplacements() != null)
for (String r : variant.getReplacements())
c.addReplacementEffect(ReplacementHandler.parseReplacement(r, c, true, c.getCurrentState()));
if (variant.getStaticAbilities() != null)
for (String s : variant.getStaticAbilities())
c.addStaticAbility(s);
if (variant.getTriggers() != null)
for (String t : variant.getTriggers())
c.addTrigger(TriggerHandler.parseTrigger(t, c, true, c.getCurrentState()));
if (variant.getKeywords() != null)
c.addIntrinsicKeywords(variant.getKeywords(), false);
if (variant.getManaCost() != ManaCost.NO_COST)
c.setManaCost(variant.getManaCost());
if (variant.getNonAbilityText() != null)
c.setText(variant.getNonAbilityText());
if (!"".equals(variant.getInitialLoyalty()))
c.getCurrentState().setBaseLoyalty(variant.getInitialLoyalty());
if (!"".equals(variant.getDefense()))
c.getCurrentState().setBaseDefense(variant.getDefense());
if (variant.getOracleText() != null)
c.getCurrentState().setOracleText(variant.getOracleText());
if (variant.getType() != null) {
for(String type : variant.getType())
c.addType(type);
}
if (variant.getColor() != null)
c.setColor(variant.getColor().getColor());
if (variant.getIntPower() != Integer.MAX_VALUE) {
c.setBasePower(variant.getIntPower());
c.setBasePowerString(variant.getPower());
}
if (variant.getIntToughness() != Integer.MAX_VALUE) {
c.setBaseToughness(variant.getIntToughness());
c.setBaseToughnessString(variant.getToughness());
}
if (variant.getAttractionLights() != null)
c.setAttractionLights(variant.getAttractionLights());
if (variant.getAbilities() != null)
CardFactoryUtil.addAbilityFactoryAbilities(c, variant.getAbilities());
}
public static void copySpellAbility(SpellAbility from, SpellAbility to, final Card host, final Player p, final boolean lki, final boolean keepTextChanges) {

View File

@@ -1965,6 +1965,31 @@ public class CardFactoryUtil {
inst.addTrigger(parsedUpkeepTrig);
inst.addTrigger(parsedSacTrigger);
} else if (keyword.startsWith("Visit")) {
final String[] k = keyword.split(":");
SpellAbility sa = AbilityFactory.getAbility(card, k[1]);
String descStr = "Visit — " + sa.getDescription();
final String trigStr = "Mode$ VisitAttraction | TriggerZones$ Battlefield | ValidCard$ Card.Self" +
"| TriggerDescription$ " + descStr;
final Trigger t = TriggerHandler.parseTrigger(trigStr, card, intrinsic);
t.setOverridingAbility(sa);
inst.addTrigger(t);
} else if (keyword.startsWith("Prize")) {
final String[] k = keyword.split(":");
SpellAbility sa = AbilityFactory.getAbility(card, k[1]);
String descStr = "Prize — " + sa.getDescription();
final String trigStr = "Mode$ ClaimPrize | Static$ True | TriggerZones$ Battlefield | ValidCard$ Card.Self" +
"| TriggerDescription$ " + descStr;
final Trigger t = TriggerHandler.parseTrigger(trigStr, card, intrinsic);
t.setOverridingAbility(sa);
inst.addTrigger(t);
} else if (keyword.startsWith("Dungeon")) {
final List<String> abs = Arrays.asList(keyword.substring("Dungeon:".length()).split(","));
final Map<String, SpellAbility> saMap = new LinkedHashMap<>();

View File

@@ -532,6 +532,10 @@ public final class CardPredicates {
};
}
public static Predicate<Card> isAttractionWithLight(int light) {
return c -> c.isAttraction() && c.getAttractionLights().contains(light);
}
public static class Presets {
/**
@@ -768,6 +772,7 @@ public final class CardPredicates {
return c.canBeDestroyed();
}
};
public static final Predicate<Card> ATTRACTIONS = Card::isAttraction;
}
public static class Accessors {

View File

@@ -1947,6 +1947,10 @@ public class CardProperty {
}
} else if (property.equals("SaddledThisTurn")) {
if (!hasTimestampMatch(card, source.getSaddledByThisTurn())) return false;
} else if (property.equals("VisitedThisTurn")) {
if (!card.wasVisitedThisTurn()) {
return false;
}
} else if (property.equals("IsSuspected")) {
if (!card.isSuspected()) {
return false;

View File

@@ -20,6 +20,7 @@ package forge.game.card;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -57,6 +58,7 @@ public class CardState extends GameObject implements IHasSVars {
private CardType type = new CardType(false);
private ManaCost manaCost = ManaCost.NO_COST;
private byte color = MagicColor.COLORLESS;
private String oracleText = "";
private int basePower = 0;
private int baseToughness = 0;
private String basePowerString = null;
@@ -64,6 +66,7 @@ public class CardState extends GameObject implements IHasSVars {
private String baseLoyalty = "";
private String baseDefense = "";
private KeywordCollection intrinsicKeywords = new KeywordCollection();
private Set<Integer> attractionLights = null;
private final FCollection<SpellAbility> nonManaAbilities = new FCollection<>();
private final FCollection<SpellAbility> manaAbilities = new FCollection<>();
@@ -192,6 +195,15 @@ public class CardState extends GameObject implements IHasSVars {
view.updateColors(card);
}
public String getOracleText() {
return oracleText;
}
public void setOracleText(final String oracleText) {
this.oracleText = oracleText;
view.setOracleText(oracleText);
}
public final int getBasePower() {
return basePower;
}
@@ -240,6 +252,15 @@ public class CardState extends GameObject implements IHasSVars {
view.updateDefense(this);
}
public Set<Integer> getAttractionLights() {
return this.attractionLights;
}
public final void setAttractionLights(Set<Integer> attractionLights) {
this.attractionLights = attractionLights;
view.updateAttractionLights(this);
}
public final Collection<KeywordInterface> getCachedKeywords() {
return cachedKeywords.getValues();
}
@@ -584,10 +605,12 @@ public class CardState extends GameObject implements IHasSVars {
setType(source.type);
setManaCost(source.getManaCost());
setColor(source.getColor());
setOracleText(source.getOracleText());
setBasePower(source.getBasePower());
setBaseToughness(source.getBaseToughness());
setBaseLoyalty(source.getBaseLoyalty());
setBaseDefense(source.getBaseDefense());
setAttractionLights(source.getAttractionLights());
setSVars(source.getSVars());
manaAbilities.clear();

View File

@@ -583,6 +583,7 @@ public class CardView extends GameEntityView {
case Graveyard:
case Flashback:
case Stack:
case Junkyard:
//cards in these zones are visible to all
return true;
case Exile:
@@ -605,6 +606,7 @@ public class CardView extends GameEntityView {
return true;
case Library:
case PlanarDeck:
case AttractionDeck:
//cards in these zones are hidden to all unless they specify otherwise
break;
case SchemeDeck:
@@ -808,6 +810,12 @@ public class CardView extends GameEntityView {
sb.append(nonAbilityText.replaceAll("CARDNAME", getName()));
}
Set<Integer> attractionLights = get(TrackableProperty.AttractionLights);
if (attractionLights != null && !attractionLights.isEmpty()) {
sb.append("\r\n\r\nLights: ");
sb.append(StringUtils.join(attractionLights, ", "));
}
sb.append(getRemembered());
Direction chosenDirection = getChosenDirection();
@@ -1023,6 +1031,8 @@ public class CardView extends GameEntityView {
currentState.getView().updateKeywords(c, currentState); //update keywords even if state doesn't change
currentState.getView().setOriginalColors(c); //set original Colors
currentStateView.updateAttractionLights(currentState);
CardState alternateState = isSplitCard && isFaceDown() ? c.getState(CardStateName.RightSplit) : c.getAlternateState();
if (isSplitCard && isFaceDown()) {
@@ -1301,8 +1311,8 @@ public class CardView extends GameEntityView {
public String getOracleText() {
return get(TrackableProperty.OracleText);
}
void updateOracleText(Card c) {
set(TrackableProperty.OracleText, c.getOracleText().replace("\\n", "\r\n\r\n").trim());
void setOracleText(String oracleText) {
set(TrackableProperty.OracleText, oracleText.replace("\\n", "\r\n\r\n").trim());
}
public String getRulesText() {
@@ -1432,6 +1442,13 @@ public class CardView extends GameEntityView {
updateDefense("0");
}
public Set<Integer> getAttractionLights() {
return get(TrackableProperty.AttractionLights);
}
void updateAttractionLights(CardState c) {
set(TrackableProperty.AttractionLights, c.getAttractionLights());
}
public String getSetCode() {
return get(TrackableProperty.SetCode);
}
@@ -1718,6 +1735,9 @@ public class CardView extends GameEntityView {
return false;
return Iterables.size(getType().getCoreTypes()) > 1;
}
public boolean isAttraction() {
return getType().isAttraction();
}
}
//special methods for updating card and player properties as needed and returning the new collection

View File

@@ -17,10 +17,7 @@
*/
package forge.game.phase;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.*;
import forge.game.*;
import forge.game.ability.AbilityKey;
import forge.game.ability.effects.AddTurnEffect;
@@ -280,12 +277,16 @@ public class PhaseHandler implements java.io.Serializable {
playerTurn.setSchemeInMotion(null);
}
GameEntityCounterTable table = new GameEntityCounterTable();
// all Saga get Lore counter at the begin of pre combat
// all Sagas get a Lore counter at the beginning of pre combat
for (Card c : playerTurn.getCardsIn(ZoneType.Battlefield)) {
if (c.isSaga()) {
c.addCounter(CounterEnumType.LORE, 1, playerTurn, table);
}
}
// roll for attractions if we have any
if (Iterables.any(playerTurn.getCardsIn(ZoneType.Battlefield), Presets.ATTRACTIONS)) {
playerTurn.rollToVisitAttractions();
}
table.replaceCounterEffect(game, null, false);
}
break;

View File

@@ -33,6 +33,7 @@ import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityKey;
import forge.game.ability.ApiType;
import forge.game.ability.effects.DetachedCardEffect;
import forge.game.ability.effects.RollDiceEffect;
import forge.game.card.*;
import forge.game.card.CardPredicates.Presets;
import forge.game.event.*;
@@ -78,7 +79,8 @@ import java.util.Map.Entry;
public class Player extends GameEntity implements Comparable<Player> {
public static final List<ZoneType> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(ZoneType.Battlefield,
ZoneType.Library, ZoneType.Graveyard, ZoneType.Hand, ZoneType.Exile, ZoneType.Command, ZoneType.Ante,
ZoneType.Sideboard, ZoneType.PlanarDeck, ZoneType.SchemeDeck, ZoneType.Merged, ZoneType.Subgame, ZoneType.None));
ZoneType.Sideboard, ZoneType.PlanarDeck, ZoneType.SchemeDeck, ZoneType.AttractionDeck, ZoneType.Junkyard,
ZoneType.Merged, ZoneType.Subgame, ZoneType.None));
private final Map<Card, Integer> commanderDamage = Maps.newHashMap();
@@ -2999,6 +3001,14 @@ public class Player extends GameEntity implements Comparable<Player> {
com.add(conspire);
}
// Attractions
PlayerZone attractionDeck = getZone(ZoneType.AttractionDeck);
for (IPaperCard cp : registeredPlayer.getAttractions()) {
attractionDeck.add(Card.fromPaperCard(cp, this));
}
if (!attractionDeck.isEmpty())
attractionDeck.shuffle();
// Adventure Mode items
Iterable<? extends IPaperCard> adventureItemCards = registeredPlayer.getExtraCardsInCommandZone();
if (adventureItemCards != null) {
@@ -3850,6 +3860,16 @@ public class Player extends GameEntity implements Comparable<Player> {
committedCrimeThisTurn = v;
}
public void visitAttractions(int light) {
CardCollection attractions = CardLists.filter(getCardsIn(ZoneType.Battlefield), CardPredicates.isAttractionWithLight(light));
for (Card c : attractions) {
c.visitAttraction(this);
}
}
public void rollToVisitAttractions() {
this.visitAttractions(RollDiceEffect.rollDiceForPlayerToVisitAttractions(this));
}
public void addDeclaresAttackers(long ts, Player p) {
this.declaresAttackers.put(ts, p);
}

View File

@@ -32,6 +32,7 @@ public class RegisteredPlayer {
private Iterable<? extends IPaperCard> schemes = null;
private Iterable<PaperCard> planes = null;
private Iterable<PaperCard> conspiracies = null;
private Iterable<PaperCard> attractions = null;
private List<PaperCard> commanders = Lists.newArrayList();
private List<PaperCard> vanguardAvatars = null;
private PaperCard planeswalker = null;
@@ -231,8 +232,18 @@ public class RegisteredPlayer {
}
}
public Iterable<PaperCard> getAttractions() {
return attractions;
}
private void assignAttractions() {
attractions = currentDeck.has(DeckSection.Attractions)
? currentDeck.get(DeckSection.Attractions).toFlatList()
: EmptyList;
}
public void restoreDeck() {
currentDeck = (Deck) originalDeck.copyTo(originalDeck.getName());
assignAttractions();
}
public boolean useRandomFoil() {

View File

@@ -0,0 +1,36 @@
package forge.game.trigger;
import forge.game.ability.AbilityKey;
import forge.game.card.Card;
import forge.game.spellability.SpellAbility;
import forge.util.Localizer;
import java.util.Map;
public class TriggerClaimPrize extends Trigger{
public TriggerClaimPrize(Map<String, String> params, Card host, boolean intrinsic) {
super(params, host, intrinsic);
}
@Override
public boolean performTest(Map<AbilityKey, Object> runParams) {
if (!matchesValidParam("ValidPlayer", runParams.get(AbilityKey.Player))) {
return false;
}
if (!matchesValidParam("ValidCard", runParams.get(AbilityKey.Card))) {
return false;
}
return true;
}
@Override
public void setTriggeringObjects(SpellAbility sa, Map<AbilityKey, Object> runParams) {
sa.setTriggeringObjectsFrom(runParams, AbilityKey.Player, AbilityKey.Card);
}
@Override
public String getImportantStackObjects(SpellAbility sa) {
return Localizer.getInstance().getMessage("lblPlayer") + ": " +
sa.getTriggeringObject(AbilityKey.Player);
}
}

View File

@@ -24,6 +24,10 @@ public class TriggerRolledDie extends Trigger {
if (!matchesValidParam("ValidPlayer", runParams.get(AbilityKey.Player))) {
return false;
}
if (hasParam("RolledToVisitAttractions")) {
if (!(boolean) runParams.getOrDefault(AbilityKey.RolledToVisitAttractions, false))
return false;
}
if (hasParam("ValidResult")) {
String[] params = getParam("ValidResult").split(",");
int result = (int) runParams.get(AbilityKey.Result);

View File

@@ -21,6 +21,10 @@ public class TriggerRolledDieOnce extends Trigger {
if (!matchesValidParam("ValidPlayer", runParams.get(AbilityKey.Player))) {
return false;
}
if (hasParam("RolledToVisitAttractions")) {
if (!(boolean) runParams.getOrDefault(AbilityKey.RolledToVisitAttractions, false))
return false;
}
return true;
}

View File

@@ -43,6 +43,7 @@ public enum TriggerType {
ChangesZone(TriggerChangesZone.class),
ChangesZoneAll(TriggerChangesZoneAll.class),
ChaosEnsues(TriggerChaosEnsues.class),
ClaimPrize(TriggerClaimPrize.class),
Clashed(TriggerClashed.class),
ClassLevelGained(TriggerClassLevelGained.class),
CommitCrime(TriggerCommitCrime.class),
@@ -138,6 +139,7 @@ public enum TriggerType {
Unattach(TriggerUnattach.class),
UntapAll(TriggerUntapAll.class),
Untaps(TriggerUntaps.class),
VisitAttraction(TriggerVisitAttraction.class),
Vote(TriggerVote.class);
private final Constructor<? extends Trigger> constructor;

View File

@@ -0,0 +1,39 @@
package forge.game.trigger;
import forge.game.ability.AbilityKey;
import forge.game.card.Card;
import forge.game.spellability.SpellAbility;
import forge.util.Localizer;
import java.util.Map;
public class TriggerVisitAttraction extends Trigger {
public TriggerVisitAttraction(Map<String, String> params, Card host, boolean intrinsic) {
super(params, host, intrinsic);
}
@Override
public boolean performTest(Map<AbilityKey, Object> runParams) {
if (!matchesValidParam("ValidPlayer", runParams.get(AbilityKey.Player))) {
return false;
}
if (!matchesValidParam("ValidCard", runParams.get(AbilityKey.Card))) {
return false;
}
return true;
}
@Override
public void setTriggeringObjects(SpellAbility sa, Map<AbilityKey, Object> runParams) {
//TODO: Attraction roll value? Person who caused the attraction roll?
sa.setTriggeringObjectsFrom(runParams, AbilityKey.Player, AbilityKey.Card);
}
@Override
public String getImportantStackObjects(SpellAbility sa) {
return Localizer.getInstance().getMessage("lblPlayer") + ": " +
sa.getTriggeringObject(AbilityKey.Player);
}
}

View File

@@ -24,6 +24,8 @@ public enum ZoneType {
Merged(false, "lblBattlefieldZone"),
SchemeDeck(true, "lblSchemeDeckZone"),
PlanarDeck(true, "lblPlanarDeckZone"),
AttractionDeck(true, "lblAttractionDeckZone"),
Junkyard(false, "lblJunkyardZone"),
Subgame(true, "lblSubgameZone"),
// ExtraHand is used for Backup Plan for temporary extra hands
ExtraHand(true, "lblHandZone"),

View File

@@ -126,6 +126,7 @@ public enum TrackableProperty {
Toughness(TrackableTypes.IntegerType),
Loyalty(TrackableTypes.StringType),
Defense(TrackableTypes.StringType),
AttractionLights(TrackableTypes.IntegerSetType),
ChangedColorWords(TrackableTypes.StringMapType),
HasChangedColors(TrackableTypes.BooleanType),
ChangedTypes(TrackableTypes.StringMapType),

View File

@@ -559,6 +559,34 @@ public class TrackableTypes {
}
}
};
public static final TrackableType<Set<Integer>> IntegerSetType = new TrackableType<Set<Integer>>() {
@Override
public Set<Integer> getDefaultValue() {
return null;
}
@Override
public Set<Integer> deserialize(TrackableDeserializer td, Set<Integer> oldValue) {
int size = td.readInt();
if (size > 0) {
Set<Integer> set = Sets.newHashSet();
for (int i = 0; i < size; i++) {
set.add(td.readInt());
}
return set;
}
return null;
}
@Override
public void serialize(TrackableSerializer ts, Set<Integer> value) {
ts.write(value.size());
for (int i : value) {
ts.write(i);
}
}
};
public static final TrackableType<Map<Integer, Integer>> IntegerMapType = new TrackableType<Map<Integer, Integer>>() {
@Override
public Map<Integer, Integer> getDefaultValue() {

View File

@@ -30,7 +30,7 @@ public class MessageUtil {
// These are not much related to PlayerController
public static String formatNotificationMessage(SpellAbility sa, Player player, GameObject target, String value) {
if (sa == null || sa.getApi() == null || sa.getHostCard() == null) {
return Localizer.getInstance().getMessage("lblResultIs", value);
return String.valueOf(value);
}
String choser = StringUtils.capitalize(mayBeYou(player, target));
switch(sa.getApi()) {

View File

@@ -56,7 +56,7 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
private DeckController<Deck> controller;
private final List<DeckSection> allSections = new ArrayList<>();
private ItemPool<PaperCard> normalPool, avatarPool, planePool, schemePool, conspiracyPool,
commanderPool, dungeonPool;
commanderPool, dungeonPool, attractionPool;
CardManager catalogManager;
CardManager deckManager;
@@ -131,6 +131,9 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
default:
}
allSections.add(DeckSection.Attractions);
attractionPool = FModel.getAttractionPool();
catalogManager = new CardManager(getCDetailPicture(), wantUnique, false, false);
deckManager = new CardManager(getCDetailPicture(), false, false, false);
deckManager.setAlwaysNonUnique(true);
@@ -342,6 +345,9 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
case Dungeon:
cmb.addMoveItems(localizer.getMessage("lblAdd"), localizer.getMessage("lbltodungeondeck"));
break;
case Attractions:
cmb.addMoveItems(localizer.getMessage("lblAdd"), localizer.getMessage("lbltoattractiondeck"));
break;
}
}
@@ -374,6 +380,9 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
case Dungeon:
cmb.addMoveItems(localizer.getMessage("lblRemove"), localizer.getMessage("lblfromdungeondeck"));
break;
case Attractions:
cmb.addMoveItems(localizer.getMessage("lblRemove"), localizer.getMessage("lblfromattractiondeck"));
break;
}
if (foilAvailable) {
cmb.addMakeFoils();
@@ -482,6 +491,12 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
this.getCatalogManager().setAllowMultipleSelections(true);
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Dungeon));
break;
case Attractions:
this.getCatalogManager().setup(ItemManagerConfig.ATTRACTION_POOL);
this.getCatalogManager().setPool(attractionPool, true);
this.getCatalogManager().setAllowMultipleSelections(true);
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Attractions));
break;
}
case Commander:
case Oathbreaker:
@@ -506,6 +521,12 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
this.getCatalogManager().setAllowMultipleSelections(false);
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Commander));
break;
case Attractions:
this.getCatalogManager().setup(ItemManagerConfig.ATTRACTION_POOL);
this.getCatalogManager().setPool(attractionPool, true);
this.getCatalogManager().setAllowMultipleSelections(true);
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Attractions));
break;
default:
break;
}

View File

@@ -113,6 +113,7 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
allSections.add(DeckSection.Main);
allSections.add(DeckSection.Conspiracy);
allSections.add(DeckSection.Attractions);
this.getCbxSection().removeAllItems();
for (DeckSection section : allSections) {
@@ -221,6 +222,10 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
this.getCatalogManager().setup(ItemManagerConfig.DRAFT_CONSPIRACY);
this.getDeckManager().setPool(getHumanDeck().getOrCreate(DeckSection.Conspiracy));
break;
case Attractions:
this.getCatalogManager().setup(ItemManagerConfig.ATTRACTION_POOL);
this.getDeckManager().setPool(getHumanDeck().getOrCreate(DeckSection.Attractions));
break;
case Main:
this.getCatalogManager().setup(getScreen() == FScreen.DECK_EDITOR_DRAFT ? ItemManagerConfig.DRAFT_POOL : ItemManagerConfig.SEALED_POOL);
this.getDeckManager().setPool(getHumanDeck().getOrCreate(DeckSection.Main));

View File

@@ -1408,7 +1408,7 @@ public class AdventureDeckEditor extends TabPageScreen<AdventureDeckEditor> {
selected++;
if (selected > 2)
selected = 0;
setSelectedPage(tabPages[selected]);
setSelectedPage(tabPages.get(selected));
if (getSelectedPage() instanceof CatalogPage) {
((CatalogPage) getSelectedPage()).cardManager.getConfig().setPileBy(null);
((CatalogPage) getSelectedPage()).cardManager.setHideFilters(true);

View File

@@ -471,6 +471,7 @@ public class CardRenderer {
public static void drawCardListItem(Graphics g, FSkinFont font, FSkinColor foreColor, FImageComplex cardArt, CardView card, String set, CardRarity rarity, int power, int toughness, String loyalty, int count, String suffix, float x, float y, float w, float h, boolean compactMode) {
float cardArtHeight = h + 2 * FList.PADDING;
float cardArtWidth = cardArtHeight * CARD_ART_RATIO;
CardView.CardStateView cardCurrentState = card.getCurrentState();
if (cardArt != null) {
float artX = x - FList.PADDING;
float artY = y - FList.PADDING;
@@ -485,7 +486,7 @@ public class CardRenderer {
g.drawRotatedImage(cardArt.getTexture(), artX, artY, cardArtHeight, cardArtWidth / 2, artX + cardArtWidth / 2, artY + cardArtWidth / 2, cardArt.getRegionX(), (int) srcY, (int) cardArt.getWidth(), (int) srcHeight, -90);
g.drawRotatedImage(cardArt.getTexture(), artX, artY + cardArtWidth / 2, cardArtHeight, cardArtWidth / 2, artX + cardArtWidth / 2, artY + cardArtWidth / 2, cardArt.getRegionX(), (int) cardArt.getHeight() - (int) (srcY + srcHeight), (int) cardArt.getWidth(), (int) srcHeight, -90);
} else if (card.getText().contains("Aftermath")) {
FImageComplex secondArt = CardRenderer.getAftermathSecondCardArt(card.getCurrentState().getImageKey());
FImageComplex secondArt = CardRenderer.getAftermathSecondCardArt(cardCurrentState.getImageKey());
g.drawRotatedImage(cardArt.getTexture(), artX, artY, cardArtWidth, cardArtHeight / 2, artX + cardArtWidth, artY + cardArtHeight / 2, cardArt.getRegionX(), cardArt.getRegionY(), (int) cardArt.getWidth(), (int) cardArt.getHeight() / 2, 0);
g.drawRotatedImage(secondArt.getTexture(), artX - cardArtHeight / 2, artY + cardArtHeight / 2, cardArtHeight / 2, cardArtWidth, artX, artY + cardArtHeight / 2, secondArt.getRegionX(), secondArt.getRegionY(), (int) secondArt.getWidth(), (int) secondArt.getHeight(), 90);
} else {
@@ -495,7 +496,7 @@ public class CardRenderer {
//render card name and mana cost on first line
float manaCostWidth = 0;
ManaCost mainManaCost = card.getCurrentState().getManaCost();
ManaCost mainManaCost = cardCurrentState.getManaCost();
if (card.isSplitCard()) {
//handle rendering both parts of split card
mainManaCost = card.getLeftSplitState().getManaCost();
@@ -535,14 +536,17 @@ public class CardRenderer {
drawSetLabel(g, typeFont, set, rarity, x + availableTypeWidth + SET_BOX_MARGIN, y - SET_BOX_MARGIN, setWidth, lineHeight + 2 * SET_BOX_MARGIN);
}
String type = CardDetailUtil.formatCardType(card.getCurrentState(), true);
if (card.getCurrentState().isCreature()) { //include P/T or Loyalty at end of type
if (cardCurrentState.isCreature()) { //include P/T or Loyalty at end of type
type += " (" + power + " / " + toughness + ")";
} else if (card.getCurrentState().isPlaneswalker()) {
} else if (cardCurrentState.isPlaneswalker()) {
type += " (" + loyalty + ")";
} else if (card.getCurrentState().getType().hasSubtype("Vehicle")) {
} else if (cardCurrentState.isVehicle()) {
type += String.format(" [%s / %s]", power, toughness);
} else if (card.getCurrentState().isBattle()) {
type += " (" + card.getCurrentState().getDefense() + ")";
} else if (cardCurrentState.isBattle()) {
type += " (" + cardCurrentState.getDefense() + ")";
} else if (cardCurrentState.isAttraction()) {
//TODO: Probably shouldn't be non-localized text here? Not sure what to do if someone makes an attraction with no lights...
type += " (" + (cardCurrentState.getAttractionLights().isEmpty() ? "No Lights" : StringUtils.join(cardCurrentState.getAttractionLights(), ", ")) + ")";
}
g.drawText(type, typeFont, foreColor, x, y, availableTypeWidth, lineHeight, false, Align.left, true);
}

View File

@@ -38,7 +38,7 @@ public class GameEntityPicker extends TabPageScreen<GameEntityPicker> {
@Override
public void run(Integer result) {
if (result == 0) {
callback.run(((PickerTab)tabPages[0]).list.getSelectedItem());
callback.run(((PickerTab) tabPages.get(0)).list.getSelectedItem());
}
else {
callback.run(null);

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import forge.Forge;
import forge.Graphics;
@@ -81,6 +82,7 @@ public class FDeckImportDialog extends FDialog {
supportedSections.add(DeckSection.Sideboard);
if (editorType != FDeckEditor.EditorType.Constructed)
supportedSections.add(DeckSection.Commander);
supportedSections.addAll(Lists.newArrayList(FDeckEditor.getExtraSections(editorType)));
controller.setAllowedSections(supportedSections);
}

View File

@@ -60,16 +60,16 @@ public class FSideboardDialog extends FDialog {
new SideboardPage(sideboard),
new MainDeckPage(main)
}, false);
((SideboardPage)tabPages[0]).parent = this;
((MainDeckPage)tabPages[1]).parent = this;
((SideboardPage) tabPages.get(0)).parent = this;
((MainDeckPage) tabPages.get(1)).parent = this;
}
private SideboardPage getSideboardPage() {
return ((SideboardPage)tabPages[0]);
return ((SideboardPage) tabPages.get(0));
}
private MainDeckPage getMainDeckPage() {
return ((MainDeckPage)tabPages[1]);
return ((MainDeckPage) tabPages.get(1));
}
@Override

View File

@@ -107,7 +107,6 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
* ItemManager Constructor.
*
* @param genericType0 the class of item that this table will contain
* @param statLabels0 stat labels for this item manager
* @param wantUnique0 whether this table should display only one item with the same name
*/
protected ItemManager(final Class<T> genericType0, final boolean wantUnique0) {
@@ -749,6 +748,33 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
}
}
public void applyAdvancedSearchFilter(String filterString) {
applyAdvancedSearchFilter(new String[]{filterString}, false);
}
/**
* Programmatic method to set this ItemManager's advanced search filter value.
* Other filters will be cleared.
*/
public void applyAdvancedSearchFilter(String[] filterStrings, boolean joinAnd) {
if(advancedSearchFilter == null) {
advancedSearchFilter = createAdvancedSearchFilter();
ItemManager.this.add(advancedSearchFilter.getWidget());
}
lockFiltering = true;
for (final ItemFilter<? extends T> filter : filters) {
filter.reset();
}
searchFilter.reset();
advancedSearchFilter.reset();
advancedSearchFilter.setFilterParts(filterStrings, joinAnd);
lockFiltering = false;
applyFilters();
advancedSearchFilter.refreshWidget();
revalidate();
}
//Refresh displayed items
public void refresh() {
updateView(true, getSelectedItems());

View File

@@ -7,6 +7,7 @@ import com.google.common.collect.Iterables;
import forge.Forge;
import forge.assets.FSkinImage;
import forge.assets.TextRenderer;
import forge.gui.GuiBase;
import forge.gui.interfaces.IButton;
import forge.item.InventoryItem;
import forge.itemmanager.AdvancedSearch;
@@ -71,6 +72,34 @@ public class AdvancedSearchFilter<T extends InventoryItem> extends ItemFilter<T>
editScreen = null;
}
public void setFilterParts(final String[] items, boolean joinAnd) {
//This could be made more robust, processing "and"s, "or"s, and parentheses to fully configure the filter,
//but that'll have to wait until there's a use case for it.
//This could also probably be moved up to the interface and shared with the desktop version,
//but again, can't think of a use case at the moment.
this.reset();
editScreen = new EditScreen();
EditScreen.Filter currFilter = this.editScreen.getNewestFilter();
for (int i = 0; i < items.length; i++) {
String filterText = items[i];
AdvancedSearch.Filter<T> filter = AdvancedSearch.getFilter(itemManager.getGenericType(), filterText);
if(filter == null)
continue;
currFilter.setFilter(filter);
currFilter.getBtnFilter().setText(GuiBase.getInterface().encodeSymbols(filter.toString(), false));
if(i < items.length - 1) {
if (joinAnd)
currFilter.btnAnd.setSelected(true);
else
currFilter.btnOr.setSelected(true);
this.editScreen.addNewFilter(currFilter);
currFilter = this.editScreen.getNewestFilter();
}
}
onFilterChange.run();
}
@Override
protected void buildWidget(Widget widget) {
label = new FiltersLabel();
@@ -203,6 +232,11 @@ public class AdvancedSearchFilter<T extends InventoryItem> extends ItemFilter<T>
scroller.setBounds(0, startY, width, height - startY);
}
@SuppressWarnings("unchecked") //Nothing except Filters are ever added to this FScrollPane.
private Filter getNewestFilter() {
return (Filter) scroller.getChildAt(scroller.getChildCount() - 1);
}
private void addNewFilter(Filter fromFilter) {
if (scroller.getChildAt(scroller.getChildCount() - 1) == fromFilter) {
Filter filter = new Filter();

View File

@@ -18,11 +18,14 @@ import forge.toolbox.FLabel;
import forge.toolbox.FScrollPane;
import forge.util.Utils;
import java.util.ArrayList;
import java.util.List;
public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
public static boolean COMPACT_TABS = FModel.getPreferences().getPrefBoolean(FPref.UI_COMPACT_TABS);
protected final TabHeader<T> tabHeader;
protected final TabPage<T>[] tabPages;
protected final List<TabPage<T>> tabPages;
private TabPage<T> selectedPage;
@SuppressWarnings("unchecked")
@@ -72,7 +75,17 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
add(tabPage);
tabPage.setVisible(false);
}
setSelectedPage(tabPages[0]);
setSelectedPage(tabPages.get(0));
}
@SuppressWarnings("unchecked")
public void addTabPage(TabPage<T> tabPage) {
tabHeader.addTab(tabPage);
tabPage.index = tabPages.size();
tabPage.parentScreen = (T) this;
add(tabPage);
tabPage.setVisible(false);
this.revalidate();
}
public TabPage<T> getSelectedPage() {
@@ -135,7 +148,7 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
private static final float BACK_BUTTON_WIDTH = Math.round(HEIGHT / 2);
private static final FSkinColor SEPARATOR_COLOR = getBackColor().stepColor(-40);
private final TabPage<T>[] tabPages;
private final List<TabPage<T>> tabPages = new ArrayList<>();
public final FLabel btnBack;
private boolean isScrollable;
private FDisplayObject finalVisibleTab;
@@ -184,8 +197,7 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
}
});
public TabHeader(TabPage<T>[] tabPages0, boolean showBackButton) {
tabPages = tabPages0;
public TabHeader(TabPage<T>[] tabPages, boolean showBackButton) {
if (showBackButton) {
btnBack = add(new FLabel.Builder().icon(new BackIcon(BACK_BUTTON_WIDTH, BACK_BUTTON_WIDTH)).pressedColor(getBtnPressedColor()).align(Align.center).command(e -> Forge.back()).build());
}
@@ -194,11 +206,11 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
}
for (TabPage<T> tabPage : tabPages) {
scroller.add(tabPage.tab);
this.tabPages.add(tabPage);
this.scroller.add(tabPage.tab);
}
}
public TabHeader(TabPage<T>[] tabPages0, FEventHandler backButton) {
tabPages = tabPages0;
public TabHeader(TabPage<T>[] tabPages, FEventHandler backButton) {
if(backButton==null) {
btnBack = add(new FLabel.Builder().icon(new BackIcon(BACK_BUTTON_WIDTH, BACK_BUTTON_WIDTH)).pressedColor(getBtnPressedColor()).align(Align.center).command(e -> Forge.back()).build());
}
@@ -208,16 +220,24 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
}
for (TabPage<T> tabPage : tabPages) {
scroller.add(tabPage.tab);
this.tabPages.add(tabPage);
this.scroller.add(tabPage.tab);
}
}
public void addTab(TabPage<T> tabPage) {
this.tabPages.add(tabPage);
this.scroller.add(tabPage.tab);
this.scroller.revalidate();
}
protected boolean showBackButtonInLandscapeMode() {
return btnBack != null;
}
@Override
public float getPreferredHeight() {
return tabPages[0].parentScreen.showCompactTabs() ? COMPACT_HEIGHT : HEIGHT;
return tabPages.get(0).parentScreen.showCompactTabs() ? COMPACT_HEIGHT : HEIGHT;
}
@Override
@@ -262,7 +282,7 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
}
}
else {
btnBack.setIconScaleAuto(tabPages[0].parentScreen.showCompactTabs());
btnBack.setIconScaleAuto(tabPages.get(0).parentScreen.showCompactTabs());
btnBack.setSize(BACK_BUTTON_WIDTH, height);
x += BACK_BUTTON_WIDTH;
}
@@ -326,12 +346,12 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
//switch to next/previous tab page when flung left or right
if (Math.abs(velocityX) > Math.abs(velocityY)) {
if (velocityX < 0) {
if (index < parentScreen.tabPages.length - 1) {
parentScreen.setSelectedPage(parentScreen.tabPages[index + 1]);
if (index < parentScreen.tabPages.size() - 1) {
parentScreen.setSelectedPage(parentScreen.tabPages.get(index + 1));
}
}
else if (index > 0) {
parentScreen.setSelectedPage(parentScreen.tabPages[index - 1]);
parentScreen.setSelectedPage(parentScreen.tabPages.get(index - 1));
}
return true;
}
@@ -352,16 +372,16 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
if (!b0 && parentScreen.getSelectedPage() == TabPage.this) {
//select next page if this page is hidden
for (int i = index + 1; i < parentScreen.tabPages.length; i++) {
if (parentScreen.tabPages[i].tab.isVisible()) {
parentScreen.setSelectedPage(parentScreen.tabPages[i]);
for (int i = index + 1; i < parentScreen.tabPages.size(); i++) {
if (parentScreen.tabPages.get(i).tab.isVisible()) {
parentScreen.setSelectedPage(parentScreen.tabPages.get(i));
return;
}
}
//select previous page if selecting next page is not possible
for (int i = index - 1; i >= 0; i--) {
if (parentScreen.tabPages[i].tab.isVisible()) {
parentScreen.setSelectedPage(parentScreen.tabPages[i]);
if (parentScreen.tabPages.get(i).tab.isVisible()) {
parentScreen.setSelectedPage(parentScreen.tabPages.get(i));
return;
}
}

View File

@@ -60,7 +60,7 @@ public class ConquestCollectionScreen extends TabPageScreen<ConquestCollectionSc
FThreads.invokeInBackgroundThread(new Runnable() {
@Override
public void run() {
if (getSelectedPage() == tabPages[0]) {
if (getSelectedPage() == tabPages.get(0)) {
int value = 0;
for (PaperCard card : cards) {
value += ConquestUtil.getShardValue(card, CQPref.AETHER_BASE_EXILE_VALUE);
@@ -143,7 +143,7 @@ public class ConquestCollectionScreen extends TabPageScreen<ConquestCollectionSc
String caption;
CQPref baseValuePref;
Collection<PaperCard> cards;
if (getSelectedPage() == tabPages[0]) {
if (getSelectedPage() == tabPages.get(0)) {
caption = Forge.getLocalizer().getMessage("lblExile");
baseValuePref = CQPref.AETHER_BASE_EXILE_VALUE;
cards = getCollectionTab().list.getSelectedItems();
@@ -172,11 +172,11 @@ public class ConquestCollectionScreen extends TabPageScreen<ConquestCollectionSc
}
private CollectionTab getCollectionTab() {
return (CollectionTab)tabPages[0];
return (CollectionTab) tabPages.get(0);
}
private CollectionTab getExileTab() {
return (CollectionTab)tabPages[1];
return (CollectionTab) tabPages.get(1);
}
@Override

View File

@@ -43,8 +43,8 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
public QuestSpellShopScreen() {
super("", QuestMenu.getMenu(), new SpellShopBasePage[] { new SpellShopPage(), new InventoryPage() }, true);
spellShopPage = ((SpellShopPage)tabPages[0]);
inventoryPage = ((InventoryPage)tabPages[1]);
spellShopPage = ((SpellShopPage) tabPages.get(0));
inventoryPage = ((InventoryPage) tabPages.get(1));
btnBuySellMultiple.setVisible(false); //hide unless in multi-select mode
btnBuySellMultiple.setCommand(event -> {

View File

@@ -60,7 +60,7 @@ public class SettingsScreen extends TabPageScreen<SettingsScreen> {
return !fromHomeScreen; //don't show back button if launched from home screen
}
});
settingsPage = (SettingsPage) tabPages[0];
settingsPage = (SettingsPage) tabPages.get(0);
}
public FScreen getLandscapeBackdropScreen() {

View File

@@ -0,0 +1,11 @@
Name:Bounce Chamber
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 6
Variant:B:Lights:3 6
Variant:C:Lights:4 6
Variant:D:Lights:5 6
K:Visit:TrigChoose
SVar:TrigChoose:DB$ ChooseCard | Choices$ Creature.YouDontCtrl+leastToughnessControlledByOpponent | ChoiceTitle$ Choose a creature with the least toughness among creatures your opponents control | Mandatory$ True | SubAbility$ DBBounce | SpellDescription$ Return a creature you dont control with the lowest toughness among creatures you dont control to its owners hand.
SVar:DBBounce:DB$ ChangeZone | Defined$ ChosenCard | Origin$ Battlefield | Destination$ Hand
Oracle:Visit — Return a creature you dont control with the lowest toughness among creatures you dont control to its owners hand. (If multiple creatures are tied, choose any one of them.)

View File

@@ -0,0 +1,10 @@
Name:Clown Extruder
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 6
Variant:B:Lights:3 6
Variant:C:Lights:4 6
Variant:D:Lights:5 6
K:Visit:TrigToken
SVar:TrigToken:DB$ Token | TokenScript$ w_1_1_a_clown_robot | TokenOwner$ You | SpellDescription$ Create a 1/1 white Clown Robot artifact creature token.
Oracle:Visit — Create a 1/1 white Clown Robot artifact creature token.

View File

@@ -0,0 +1,10 @@
Name:Concession Stand
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 6
Variant:B:Lights:3 6
Variant:C:Lights:4 6
Variant:D:Lights:5 6
K:Visit:TrigFood
SVar:TrigFood:DB$ Token | TokenScript$ c_a_food_sac | TokenOwner$ You | SpellDescription$ Create a Food token.
Oracle:Visit — Create a Food token. (Its an artifact with “{2}, {T}, Sacrifice this artifact: You gain 3 life.”)

View File

@@ -0,0 +1,11 @@
Name:Everythingamajig
ManaCost:5
Types:Artifact
Variant:C:A:AB$ FlipACoin | Cost$ 1 | WinSubAbility$ DBAddMana | InstantSpeed$ True | SpellDescription$ Flip a coin. If you win the flip, add {C}{C}.
Variant:C:SVar:DBAddMana:DB$ Mana | Produced$ C | Amount$ 2
Variant:C:A:AB$ Discard | Cost$ 3 T | ValidTgts$ Player | NumCards$ 1 | Mode$ TgtChoose | PlayerTurn$ True | SpellDescription$ Target player discards a card.
Variant:C:A:AB$ Animate | Cost$ X | Defined$ Self | Power$ X | Toughness$ X | Types$ Creature,Artifact,Construct | RemoveCreatureTypes$ True | SpellDescription$ CARDNAME becomes an X/X Construct artifact creature until end of turn.
Variant:C:SVar:X:Count$xPaid
AI:RemoveDeck:All
Oracle:<Unsupported Variant>
Variant:C:Oracle:{1}: Flip a coin. If you win the flip, add {C}{C}. Activate only as an instant.\n{3}, {T}: Target player discards a card. Activate only during your turn.\n{X}: Everythingamajig becomes an X/X Construct artifact creature until end of turn.

View File

@@ -0,0 +1,12 @@
Name:Foam Weapons Kiosk
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 6
Variant:B:Lights:3 6
Variant:C:Lights:4 6
Variant:D:Lights:5 6
K:Visit:TrigCounter
SVar:TrigCounter:DB$ PutCounter | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature | CounterType$ P1P1 | CounterNum$ 1 | SubAbility$ DBPump | SpellDescription$ Put a +1/+1 counter on target creature you control. It gains Vigilance until end of turn.
SVar:DBPump:DB$ Pump | Defined$ Targeted | KW$ Vigilance
DeckHas:Ability$Counters
Oracle:Visit — Put a +1/+1 counter on target creature you control. That creature gains vigilance until end of turn.

View File

@@ -0,0 +1,12 @@
Name:Fortune Teller
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 3 6
Variant:B:Lights:2 4 6
Variant:C:Lights:2 5 6
Variant:D:Lights:3 4 6
Variant:E:Lights:3 5 6
Variant:F:Lights:4 5 6
K:Visit:TrigScry
SVar:TrigScry:DB$ Scry | ScryNum$ 1 | SpellDescription$ Scry 1.
Oracle:Visit — Scry 1.

View File

@@ -0,0 +1,16 @@
Name:Garbage Elemental
ManaCost:4 R
Types:Creature Elemental
Variant:C:PT:3/2
Variant:C:K:Battle cry
Variant:C:T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigRoll | TriggerDescription$ When CARDNAME enters the battlefield, roll two six-sided dice. Create a number of 1/1 red Goblin creature tokens equal to the difference between those results.
Variant:C:SVar:TrigRoll:DB$ RollDice | ResultSVar$ Result | Sides$ 6 | Amount$ 2 | UseDifferenceBetweenRolls$ True | SubAbility$ DBToken
Variant:C:SVar:DBToken:DB$ Token | TokenScript$ r_1_1_goblin | TokenAmount$ Result
Variant:D:PT:3/3
Variant:D:K:Cascade
Variant:D:T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigRoll | TriggerDescription$ When CARDNAME enters the battlefield, roll a six-sided die. CARDNAME deals damage equal to the result to target opponent or planeswalker.
Variant:D:SVar:TrigRoll:DB$ RollDice | ResultSVar$ Result | SubAbility$ DBDamage
Variant:D:SVar:DBDamage:DB$ DealDamage | ValidTgts$ Opponent,Planeswalker | TgtPrompt$ Select target opponent or planeswalker | NumDmg$ Result
Oracle:<Unsupported Variant>
Variant:C:Oracle:Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.)\nWhen Garbage Elemental enters the battlefield, roll two six-sided dice. Create a number of 1/1 red Goblin creature tokens equal to the difference between those results.
Variant:D:Oracle:Cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom of your library in a random order.)\nWhen Garbage Elemental enters the battlefield, roll a six-sided die. Garbage Elemental deals damage equal to the result to target opponent or planeswalker.

View File

@@ -0,0 +1,9 @@
Name:Haunted House
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:3 6
Variant:B:Lights:4 6
K:Visit:TrigRes
SVar:TrigRes:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | ValidTgts$ Creature.YouOwn | TgtPrompt$ Choose target creature in your graveyard. | SubAbility$ DBHaste | SpellDescription$ Return target creature card from your graveyard to the battlefield. It gains haste. Exile it at the beginning of the next end step.
SVar:DBHaste:DB$ Animate | Defined$ Targeted | Keywords$ Haste | Duration$ Permanent | AtEOT$ YourExile
Oracle:Visit — Return target creature card from your graveyard to the battlefield. It gains haste. Exile it at the beginning of your next end step.

View File

@@ -0,0 +1,10 @@
Name:Information Booth
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 6
Variant:B:Lights:3 6
Variant:C:Lights:4 6
Variant:D:Lights:5 6
K:Visit:TrigDraw
SVar:TrigDraw:DB$ Draw | SpellDescription$ Draw a card.
Oracle:Visit — Draw a card.

View File

@@ -0,0 +1,12 @@
Name:Kiddie Coaster
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 3 6
Variant:B:Lights:2 4 6
Variant:C:Lights:2 5 6
Variant:D:Lights:3 4 6
Variant:E:Lights:3 5 6
Variant:F:Lights:4 5 6
K:Visit:TrigPump
SVar:TrigPump:DB$ PumpAll | ValidCards$ Creature.YouCtrl | NumAtt$ +1 | SpellDescription$ Creatures you control get +1/+0 until end of turn.
Oracle:Visit — Creatures you control get +1/+0 until end of turn.

View File

@@ -0,0 +1,10 @@
Name:"Lifetime" Pass Holder
ManaCost:B
Types:Creature Zombie Guest
PT:2/1
K:CARDNAME enters the battlefield tapped.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigOpenAttraction | TriggerDescription$ When CARDNAME dies, open an Attraction.
SVar:TrigOpenAttraction:DB$ OpenAttraction
T:Mode$ RolledDie | TriggerZones$ Graveyard | Execute$ TrigReturn | ValidResult$ 6 | RolledToVisitAttractions$ True | ValidPlayer$ You | TriggerDescription$ Whenever you roll to visit your Attractions, if you roll a 6, you may return CARDNAME from your graveyard to the battlefield.
SVar:TrigReturn:DB$ ChangeZone | Defined$ Self | Origin$ Graveyard | Destination$ Battlefield
Oracle:"Lifetime" Pass Holder enters the battlefield tapped.\nWhen "Lifetime" Pass Holder dies, open an Attraction.\nWhenever you roll to visit your Attractions, if you roll a 6, you may return "Lifetime" Pass Holder from your graveyard to the battlefield.

View File

@@ -0,0 +1,8 @@
Name:Merry-Go-Round
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 6
Variant:B:Lights:5 6
K:Visit:TrigPump
SVar:TrigPump:DB$ PumpAll | ValidCards$ Creature.powerLE2+YouCtrl | KW$ Horsemanship | SpellDescription$ Creatures you control with power 2 or less gain horsemanship until end of turn.
Oracle:Visit — Creatures you control with power 2 or less gain horsemanship until end of turn. (They cant be blocked except by creatures with horsemanship.)

View File

@@ -0,0 +1,8 @@
Name:Petting Zookeeper
ManaCost:2 G
Types:Creature Elf Employee
PT:0/4
K:Reach
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigOpenAttraction | TriggerDescription$ When CARDNAME enters the battlefield, open an Attraction.
SVar:TrigOpenAttraction:DB$ OpenAttraction
Oracle:Reach\nWhen Petting Zookeeper enters the battlefield, open an Attraction.

View File

@@ -0,0 +1,19 @@
Name:Pick-a-Beeble
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 3 6
Variant:B:Lights:2 4 6
Variant:C:Lights:2 5 6
Variant:D:Lights:3 4 6
Variant:E:Lights:3 5 6
Variant:F:Lights:4 5 6
K:Visit:TrigRoll
K:Prize:TrigPrize
SVar:TrigRoll:DB$ RollDice | ResultSVar$ Result | Sides$ 6 | SubAbility$ DBCounters | SpellDescription$ Roll a six-sided die. Put a number of luck counters on CARDNAME equal to the result and create a Treasure token. Then if there are six or more luck counters on CARDNAME, claim the prize!
SVar:DBCounters:DB$ PutCounter | Defined$ Self | CounterType$ LUCK | CounterNum$ Result | SubAbility$ DBTreasure
SVar:DBTreasure:DB$ Token | TokenAmount$ 1 | TokenScript$ c_a_treasure_sac | SubAbility$ DBClaim
SVar:DBClaim:DB$ ClaimThePrize | ConditionDefined$ Self | ConditionPresent$ Card.Self+counters_GE6_LUCK
SVar:TrigPrize:DB$ Token | TokenAmount$ 2 | TokenScript$ c_a_treasure_sac | SubAbility$ DBSack | SpellDescription$ Create two Treasure tokens, then sacrifice CARDNAME and open an Attraction.
SVar:DBSack:DB$ Sacrifice | SacValid$ Self | SubAbility$ DBOpen
SVar:DBOpen:DB$ OpenAttraction
Oracle:Visit — Roll a six-sided die. Put a number of luck counters on Pick-a-Beeble equal to the result and create a Treasure token. Then if there are six or more luck counters on Pick-a-Beeble, claim the prize!\nPrize — Create two Treasure tokens, then sacrifice Pick-a-Beeble and open an Attraction.

View File

@@ -0,0 +1,8 @@
Name:Quick Fixer
ManaCost:2 B
Types:Creature Azra Employee
PT:2/3
K:Menace
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigOpenAttraction | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, open an Attraction.
SVar:TrigOpenAttraction:DB$ OpenAttraction
Oracle:Menace\nWhenever Quick Fixer deals combat damage to a player, open an Attraction.

View File

@@ -0,0 +1,7 @@
Name:Rad Rascal
ManaCost:3 R
Types:Creature Devil Employee
PT:3/3
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigOpenAttraction | TriggerDescription$ When CARDNAME enters the battlefield, open an Attraction.
SVar:TrigOpenAttraction:DB$ OpenAttraction
Oracle:When Rad Rascal enters the battlefield, open an Attraction.

View File

@@ -0,0 +1,7 @@
Name:Ride Guide
ManaCost:4 W
Types:Creature Human Employee
PT:4/4
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigOpenAttraction | TriggerDescription$ When CARDNAME enters the battlefield, open an Attraction.
SVar:TrigOpenAttraction:DB$ OpenAttraction
Oracle:When Ride Guide enters the battlefield, open an Attraction.

View File

@@ -0,0 +1,10 @@
Name:Roller Coaster
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 6
Variant:B:Lights:3 6
Variant:C:Lights:4 6
Variant:D:Lights:5 6
K:Visit:TrigPump
SVar:TrigPump:DB$ PumpAll | ValidCards$ Creature.YouCtrl | NumAtt$ +2 | SpellDescription$ Creatures you control get +2/+0 until end of turn.
Oracle:Visit — Creatures you control get +2/+0 until end of turn.

View File

@@ -0,0 +1,7 @@
Name:Seasoned Buttoneer
ManaCost:2 U
Types:Creature Vedalken Employee
PT:2/2
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigOpenAttraction | TriggerDescription$ When CARDNAME enters the battlefield, open an Attraction.
SVar:TrigOpenAttraction:DB$ OpenAttraction
Oracle:When Seasoned Buttoneer enters the battlefield, open an Attraction.

View File

@@ -0,0 +1,9 @@
Name:Sly Spy
ManaCost:2 B
Types:Creature Human Spy
PT:2/2
Variant:F:T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigRoll | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, roll a six-sided die. That player loses life equal to the result.
Variant:F:SVar:TrigRoll:DB$ RollDice | ResultSVar$ Result | SubAbility$ DBLoseLife
Variant:F:SVar:DBLoseLife:DB$ LoseLife | Defined$ TriggeredTarget | LifeAmount$ Result
Oracle:<Unsupported Variant>
Variant:F:Oracle:Whenever Sly Spy deals combat damage to a player, roll a six-sided die. That player loses life equal to the result.

View File

@@ -0,0 +1,12 @@
Name:Spinny Ride
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 3 6
Variant:B:Lights:2 4 6
Variant:C:Lights:2 5 6
Variant:D:Lights:3 4 6
Variant:E:Lights:3 5 6
Variant:F:Lights:4 5 6
K:Visit:TrigTap
SVar:TrigTap:DB$ Tap | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Choose target creature an opponent controls. | SpellDescription$ Tap target creature an opponent controls.
Oracle:Visit — Tap target creature an opponent controls.

View File

@@ -0,0 +1,11 @@
Name:Squirrel Squatters
ManaCost:3 G G
Types:Creature Squirrel
PT:4/4
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigOpenAttraction | TriggerDescription$ When CARDNAME enters the battlefield, open an Attraction.
SVar:TrigOpenAttraction:DB$ OpenAttraction
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigToken | TriggerDescription$ Whenever CARDNAME attacks, create a 1/1 green Squirrel creature token that's tapped and attacking for each Attraction you've visited this turn.
SVar:TrigToken:DB$ Token | TokenAmount$ X | TokenScript$ g_1_1_squirrel | TokenOwner$ You | TokenTapped$ True | TokenAttacking$ True
SVar:X:Count$Valid Attraction.VisitedThisTurn
SVar:HasAttackEffect:TRUE
Oracle:When Squirrel Squatters enters the battlefield, open an Attraction. (Put the top card of your Attraction deck onto the battlefield.)\nWhenever Squirrel Squatters attacks, create a 1/1 green Squirrel creature token thats tapped and attacking for each Attraction youve visited this turn.

View File

@@ -0,0 +1,13 @@
Name:The Most Dangerous Gamer
ManaCost:2 B G
Types:Legendary Creature Human Gamer Guest
PT:2/2
K:Deathtouch
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ DBOpen | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, open an Attraction.
T:Mode$ Attacks | ValidCard$ Card.Self | Secondary$ True | Execute$ DBOpen | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, open an Attraction.
SVar:DBOpen:DB$ OpenAttraction
T:Mode$ ChangesZone | Origin$ AttractionDeck | Destination$ Battlefield | ValidCard$ Attraction.YouCtrl | TriggerZones$ Battlefield | Execute$ DBCounter | TriggerDescription$ Whenever you open an Attraction, put a +1/+1 counter on CARDNAME.
SVar:DBCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
T:Mode$ ClaimPrize | ValidCard$ Attraction.YouCtrl | TriggerZones$ Battlefield | Execute$ DBDestroy | TriggerDescription$ Whenever you claim the prize of an Attraction, destroy target permanent.
SVar:DBDestroy:DB$ Destroy | ValidTgts$ Permanent | TgtPrompt$ Select target permanent.
Oracle:Deathtouch\nWhenever The Most Dangerous Gamer enters the battlefield or attacks, open an Attraction.\nWhenever you open an Attraction, put a +1/+1 counter on The Most Dangerous Gamer.\nWhenever you claim the prize of an Attraction, destroy target permanent.

View File

@@ -0,0 +1,12 @@
Name:Trash Bin
ManaCost:no cost
Types:Artifact Attraction
Variant:A:Lights:2 6
Variant:B:Lights:3 6
Variant:C:Lights:4 6
Variant:D:Lights:5 6
K:Visit:TrigMill
SVar:TrigMill:DB$ Mill | NumCards$ 2 | SubAbility$ DBReturn | SpellDescription$ Mill two cards, then return a creature card from your graveyard to your hand.
SVar:DBReturn:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | ChangeType$ Card.YouOwn | AtRandom$ True | Hidden$ True
DeckHas:Ability$Graveyard|Mill
Oracle:Visit — Mill two cards, then return a card at random from your graveyard to your hand. (To mill a card, a player puts the top card of their library into their graveyard.)

View File

@@ -205,41 +205,141 @@ F192 R Souvenir T-Shirt @Michael Phillippi
F197 U The Big Top @Kirsten Zirngibl
F198 C Nearby Planet @Bruce Brenneise
F199 R Urza's Fun House @Dmitry Burmak
200 U Balloon Stand @Jakub Kasper
201 U Bounce Chamber @Dmitry Burmak
202 U Bumper Cars @Gabor Szikszai
F203 R Centrifuge @Greg Staples
204 C Clown Extruder @Marco Bucci
205 U Concession Stand @David Sladek
206 C Costume Shop @Raluca Marinescu
F207 C Cover the Spot @Jeff Miracola
F208 C Dart Throw @Gaboleps
209 C Drop Tower @Dmitry Burmak
200a U Balloon Stand @Jakub Kasper $A
200b U Balloon Stand @Jakub Kasper $B
200c U Balloon Stand @Jakub Kasper $C
200d U Balloon Stand @Jakub Kasper $D
201a U Bounce Chamber @Dmitry Burmak $A
201b U Bounce Chamber @Dmitry Burmak $B
201c U Bounce Chamber @Dmitry Burmak $C
201d U Bounce Chamber @Dmitry Burmak $D
202a U Bumper Cars @Gabor Szikszai $A
202b U Bumper Cars @Gabor Szikszai $B
202c U Bumper Cars @Gabor Szikszai $C
202d U Bumper Cars @Gabor Szikszai $D
202e U Bumper Cars @Gabor Szikszai $E
202f U Bumper Cars @Gabor Szikszai $F
F203a R Centrifuge @Greg Staples $A
F203b R Centrifuge @Greg Staples $B
204a C Clown Extruder @Marco Bucci $A
204b C Clown Extruder @Marco Bucci $B
204c C Clown Extruder @Marco Bucci $C
204d C Clown Extruder @Marco Bucci $D
205a U Concession Stand @David Sladek $A
205b U Concession Stand @David Sladek $B
205c U Concession Stand @David Sladek $C
205d U Concession Stand @David Sladek $D
206a C Costume Shop @Raluca Marinescu $A
206b C Costume Shop @Raluca Marinescu $B
206c C Costume Shop @Raluca Marinescu $C
206d C Costume Shop @Raluca Marinescu $D
206e C Costume Shop @Raluca Marinescu $E
206f C Costume Shop @Raluca Marinescu $F
F207a C Cover the Spot @Jeff Miracola $A
F207b C Cover the Spot @Jeff Miracola $B
F207c C Cover the Spot @Jeff Miracola $C
F207d C Cover the Spot @Jeff Miracola $D
F208a C Dart Throw @Gaboleps $A
F208b C Dart Throw @Gaboleps $B
F208c C Dart Throw @Gaboleps $C
F208d C Dart Throw @Gaboleps $D
209a C Drop Tower @Dmitry Burmak $A
209b C Drop Tower @Dmitry Burmak $B
209c C Drop Tower @Dmitry Burmak $C
209d C Drop Tower @Dmitry Burmak $D
209e C Drop Tower @Dmitry Burmak $E
209f C Drop Tower @Dmitry Burmak $F
210 R Ferris Wheel @Kirsten Zirngibl
211 C Foam Weapons Kiosk @Matt Gaser
212 C Fortune Teller @Jamroz Gary
F213 R Gallery of Legends @Jakub Kasper
F214 R Gift Shop @Matt Gaser
F215 U Guess Your Fate @Bruce Brenneise
216 R Hall of Mirrors @Vincent Christiaens
217 R Haunted House @Dmitry Burmak
218 U Information Booth @Gaboleps
219 C Kiddie Coaster @Marco Bucci
F220 R Log Flume @Marco Bucci
F221 R Memory Test @Setor Fiadzigbey
222 R Merry-Go-Round @Carl Critchlow
223 C Pick-a-Beeble @Dave Greco
F224 R Push Your Luck @Sebastian Giacobino
225 U Roller Coaster @Gabor Szikszai
F226 U Scavenger Hunt @Jamroz Gary
227 C Spinny Ride @Aaron J. Riley
F228 U Squirrel Stack @Andrea Radeck
229 R Storybook Ride @Dmitry Burmak
F230 U The Superlatorium @Simon Dominic
231 R Swinging Ship @Mike Burns
232 U Trash Bin @Greg Bobrowski
F233 U Trivia Contest @Caroline Gariba
234 R Tunnel of Love @Vladimir Krisetskiy
211a C Foam Weapons Kiosk @Matt Gaser $A
211b C Foam Weapons Kiosk @Matt Gaser $B
211c C Foam Weapons Kiosk @Matt Gaser $C
211d C Foam Weapons Kiosk @Matt Gaser $D
212a C Fortune Teller @Jamroz Gary $A
212b C Fortune Teller @Jamroz Gary $B
212c C Fortune Teller @Jamroz Gary $C
212d C Fortune Teller @Jamroz Gary $D
212e C Fortune Teller @Jamroz Gary $E
212f C Fortune Teller @Jamroz Gary $F
F213a R Gallery of Legends @Jakub Kasper $A
F213b R Gallery of Legends @Jakub Kasper $B
F214a R Gift Shop @Matt Gaser $A
F214b R Gift Shop @Matt Gaser $B
F215a U Guess Your Fate @Bruce Brenneise $A
F215b U Guess Your Fate @Bruce Brenneise $B
F215c U Guess Your Fate @Bruce Brenneise $C
F215d U Guess Your Fate @Bruce Brenneise $D
216a R Hall of Mirrors @Vincent Christiaens $A
216b R Hall of Mirrors @Vincent Christiaens $B
217a R Haunted House @Dmitry Burmak $A
217b R Haunted House @Dmitry Burmak $B
218a U Information Booth @Gaboleps $A
218b U Information Booth @Gaboleps $B
218c U Information Booth @Gaboleps $C
218d U Information Booth @Gaboleps $D
219a C Kiddie Coaster @Marco Bucci $A
219b C Kiddie Coaster @Marco Bucci $B
219c C Kiddie Coaster @Marco Bucci $C
219d C Kiddie Coaster @Marco Bucci $D
219e C Kiddie Coaster @Marco Bucci $E
219f C Kiddie Coaster @Marco Bucci $F
F220a R Log Flume @Marco Bucci $A
F220b R Log Flume @Marco Bucci $B
F221a R Memory Test @Setor Fiadzigbey $A
F221b R Memory Test @Setor Fiadzigbey $B
222a R Merry-Go-Round @Carl Critchlow $A
222b R Merry-Go-Round @Carl Critchlow $B
223a C Pick-a-Beeble @Dave Greco $A
223b C Pick-a-Beeble @Dave Greco $B
223c C Pick-a-Beeble @Dave Greco $C
223d C Pick-a-Beeble @Dave Greco $D
223e C Pick-a-Beeble @Dave Greco $E
223f C Pick-a-Beeble @Dave Greco $F
F224a R Push Your Luck @Sebastian Giacobino $A
F224b R Push Your Luck @Sebastian Giacobino $B
225a U Roller Coaster @Gabor Szikszai $A
225b U Roller Coaster @Gabor Szikszai $B
225c U Roller Coaster @Gabor Szikszai $C
225d U Roller Coaster @Gabor Szikszai $D
F226a U Scavenger Hunt @Jamroz Gary $A
F226b U Scavenger Hunt @Jamroz Gary $B
F226c U Scavenger Hunt @Jamroz Gary $C
F226d U Scavenger Hunt @Jamroz Gary $D
F226e U Scavenger Hunt @Jamroz Gary $E
F226f U Scavenger Hunt @Jamroz Gary $F
227a C Spinny Ride @Aaron J. Riley $A
227b C Spinny Ride @Aaron J. Riley $B
227c C Spinny Ride @Aaron J. Riley $C
227d C Spinny Ride @Aaron J. Riley $D
227e C Spinny Ride @Aaron J. Riley $E
227f C Spinny Ride @Aaron J. Riley $F
F228a U Squirrel Stack @Andrea Radeck $A
F228b U Squirrel Stack @Andrea Radeck $B
F228c U Squirrel Stack @Andrea Radeck $C
F228d U Squirrel Stack @Andrea Radeck $D
F228e U Squirrel Stack @Andrea Radeck $E
F228f U Squirrel Stack @Andrea Radeck $F
229a R Storybook Ride @Dmitry Burmak $A
229b R Storybook Ride @Dmitry Burmak $B
F230a U The Superlatorium @Simon Dominic $A
F230b U The Superlatorium @Simon Dominic $B
F230c U The Superlatorium @Simon Dominic $C
F230d U The Superlatorium @Simon Dominic $D
F230e U The Superlatorium @Simon Dominic $E
F230f U The Superlatorium @Simon Dominic $F
231a R Swinging Ship @Mike Burns $A
231b R Swinging Ship @Mike Burns $B
232a U Trash Bin @Greg Bobrowski $A
232b U Trash Bin @Greg Bobrowski $B
232c U Trash Bin @Greg Bobrowski $C
232d U Trash Bin @Greg Bobrowski $D
F233a U Trivia Contest @Caroline Gariba $A
F233b U Trivia Contest @Caroline Gariba $B
F233c U Trivia Contest @Caroline Gariba $C
F233d U Trivia Contest @Caroline Gariba $D
F233e U Trivia Contest @Caroline Gariba $E
F233f U Trivia Contest @Caroline Gariba $F
234a R Tunnel of Love @Vladimir Krisetskiy $A
234b R Tunnel of Love @Vladimir Krisetskiy $B
235 L Plains @Adam Paquette
236 L Island @Adam Paquette
237 L Swamp @Adam Paquette

View File

@@ -20,12 +20,12 @@ ScryfallCode=UST
9 U Half-Kitten, Half-
10 C Humming-
11 R Jackknight
12a U Knight of the Kitchen Sink A
12b U Knight of the Kitchen Sink B
12c U Knight of the Kitchen Sink C
12d U Knight of the Kitchen Sink D
12e U Knight of the Kitchen Sink E
12f U Knight of the Kitchen Sink F
12a U Knight of the Kitchen Sink $A
12b U Knight of the Kitchen Sink $B
12c U Knight of the Kitchen Sink $C
12d U Knight of the Kitchen Sink $D
12e U Knight of the Kitchen Sink $E
12f U Knight of the Kitchen Sink $F
13 U Knight of the Widget
14 U Midlife Upgrade
15 R Oddly Uneven
@@ -65,12 +65,12 @@ ScryfallCode=UST
46 U Spy Eye
47 U Suspicious Nanny
48 C Time Out
49a R Very Cryptic Command A
49b R Very Cryptic Command B
49c R Very Cryptic Command C
49d R Very Cryptic Command D
49e R Very Cryptic Command E
49f R Very Cryptic Command F
49a R Very Cryptic Command $A
49b R Very Cryptic Command $B
49c R Very Cryptic Command $C
49d R Very Cryptic Command $D
49e R Very Cryptic Command $E
49f R Very Cryptic Command $F
50 C Wall of Fortune
51 C Big Boa Constrictor
52 C capital offense
@@ -91,12 +91,12 @@ ScryfallCode=UST
64 U Overt Operative
65 U "Rumors of My Death..."
66 U Skull Saucer
67a U Sly Spy A
67b U Sly Spy B
67c U Sly Spy C
67d U Sly Spy D
67e U Sly Spy E
67f U Sly Spy F
67a U Sly Spy $A
67b U Sly Spy $B
67c U Sly Spy $C
67d U Sly Spy $D
67e U Sly Spy $E
67f U Sly Spy $F
68 C Snickering Squirrel
69 R Spike, Tournament Grinder
70 U Squirrel-Powered Scheme
@@ -111,12 +111,12 @@ ScryfallCode=UST
79 C Common Iguana
80 R The Countdown Is at One
81 C Feisty Stegosaurus
82a U Garbage Elemental A
82b U Garbage Elemental B
82c U Garbage Elemental C
82d U Garbage Elemental D
82e U Garbage Elemental E
82f U Garbage Elemental F
82a U Garbage Elemental $A
82b U Garbage Elemental $B
82c U Garbage Elemental $C
82d U Garbage Elemental $D
82e U Garbage Elemental $E
82f U Garbage Elemental $F
83 U Goblin Haberdasher
84 U Half-Orc, Half-
85 C Hammer Helper
@@ -153,12 +153,12 @@ ScryfallCode=UST
110 U Ground Pounder
111 U Half-Squirrel, Half-
112 R Hydradoodle
113a R Ineffable Blessing A
113b R Ineffable Blessing B
113c R Ineffable Blessing C
113d R Ineffable Blessing D
113e R Ineffable Blessing E
113f R Ineffable Blessing F
113a R Ineffable Blessing $A
113b R Ineffable Blessing $B
113c R Ineffable Blessing $C
113d R Ineffable Blessing $D
113e R Ineffable Blessing $E
113f R Ineffable Blessing $F
114 C Joyride Rigger
115 U Monkey-
116 C Mother Kangaroo
@@ -195,12 +195,12 @@ ScryfallCode=UST
145c C Despondent Killbot
145d C Enraged Killbot
146 U Entirely Normal Armchair
147a R Everythingamajig A
147b R Everythingamajig B
147c R Everythingamajig C
147d R Everythingamajig D
147e R Everythingamajig E
147f R Everythingamajig F
147a R Everythingamajig $A
147b R Everythingamajig $B
147c R Everythingamajig $C
147d R Everythingamajig $D
147e R Everythingamajig $E
147f R Everythingamajig $F
148 C Gnome-Made Engine
149 R Handy Dandy Clone Machine
150 R Kindslaver

View File

@@ -902,14 +902,16 @@ lblColumns=Columns
lblPiles=Piles:
lblGroups=Groups:
lblImageView=Image View
#CEditorVariant.java, CEditorConstructed.java
#CEditorVariant.java, CEditorConstructed.java, FDeckEditor.java
lblCatalog=Catalog
lblAdd=Add
lblAddCommander=Set
lbltodeck=to deck
lblfromdeck=from deck
lbltosideboard=to sideboard
lblfromsideboard=from sideboard
lblascommander=as commander
lblaspartnercommander=as partner commander
lblasoathbreaker=as oathbreaker
lblassignaturespell=as signature spell
lblasavatar=as avatar
@@ -917,10 +919,12 @@ lblfromschemedeck=from scheme deck
lblfromplanardeck=from planar deck
lblfromconspiracydeck=from conspiracy deck
lblfromdungeondeck=from dungeon deck
lblfromattractiondeck=from attraction deck
lbltoschemedeck=to scheme deck
lbltoplanardeck=to planar deck
lbltoconspiracydeck=to conspiracy deck
lbltodungeondeck=to dungeon deck
lbltoattractiondeck=to attraction deck
lblMove=Move
#VDock.java
lblDock=Dock
@@ -1129,17 +1133,22 @@ lblChangePreferredArt=Change Preferred Art
lblSelectPreferredArt=Select preferred art for
lblReplaceCard=Replace Card Variant
lblSelectReplacementCard=Select Replacement Card Variant for
lblAddDeckSection=Add Variant Section...
lblAddDeckSectionSelect=Select Section to Add
lblTo=to
lblFrom=from
lblAvatar=Avatar
lblCards=Cards
lblPlanes=Planes
lblSchemes=Schemes
lblAttractions=Attractions
lblToMainDeck=to Main Deck
lblHowMany=how many?
lblInventory=Inventory
lblCollection=Collection
lblCommanders=Commanders
lblOathbreakers=Oathbreakers
lblConspiracies=Conspiracies
lblSave=Save
lblDontSave=Don''t Save
lblPackN=Pack {0}
@@ -1353,6 +1362,7 @@ lblChooseOrderCardsPutIntoGraveyard=Choose order of cards to put into the gravey
lblClosestToBottom=Closest to bottom
lblChooseOrderCardsPutIntoPlanarDeck=Choose order of cards to put into the planar deck
lblChooseOrderCardsPutIntoSchemeDeck=Choose order of cards to put into the scheme deck
lblChooseOrderCardsPutIntoAttractionDeck=Choose order of cards to put into the attraction deck
lblChooseOrderCopiesCast=Choose order of copies to cast
lblChooseOrderCards=Choose card order
lblDelveHowManyCards=Delve how many cards?
@@ -2099,6 +2109,7 @@ lblDoYouWantRevealYourHand=Do you want to reveal your hand?
lblPlayerRolledResult={0} rolled {1}
lblIgnoredRolls=Ignored rolls: {0}
lblRerollResult=Reroll {0}?
lblAttractionRollResult={0} rolled to visit their Attractions. Result: {1}.
#RollPlanarDiceEffect.java
lblPlanarDiceResult=Planar dice result: {0}
#SacrificeEffect.java
@@ -2193,6 +2204,8 @@ lblSideboardZone=sideboard
lblAnteZone=ante
lblSchemeDeckZone=schemedeck
lblPlanarDeckZone=planardeck
lblAttractionDeckZone=attractiondeck
lblJunkyardZone=junkyard
lblSubgameZone=subgame
lblNoneZone=none
#BoosterDraft.java
@@ -3017,6 +3030,7 @@ lblDetails=Details
lblChosenColors=Chosen colors:
lblLoyalty=Loyalty
lblDefense=Defense
lblLights=Lights
#Achievement.java
lblStandard=Standard
lblChaos=Chaos

View File

@@ -334,6 +334,7 @@ Saga
Shrine
Shard
[ArtifactTypes]
Attraction
Blood
Bobblehead:Bobbleheads
Clue:Clues

View File

@@ -459,8 +459,7 @@ public class DeckImportController {
// Account for any [un]foiled version
PaperCard cardKey;
if (card.isFoil())
cardKey = new PaperCard(card.getRules(), card.getEdition(), card.getRarity(), card.getArtIndex(),
false, card.getCollectorNumber(), card.getArtist());
cardKey = card.getUnFoiled();
else
cardKey = card.getFoiled();

View File

@@ -31,6 +31,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
public class CardDetailUtil {
@@ -215,6 +216,17 @@ public class CardDetailUtil {
ptText.append(card.getDefense());
}
if (card.isAttraction()) {
ptText.append(Localizer.getInstance().getMessage("lblLights")).append(": (");
Set<Integer> lights = card.getAttractionLights();
//TODO: It'd be really nice if the actual lights were drawn as symbols here. Need to look into that...
if (lights == null || lights.isEmpty())
ptText.append(Localizer.getInstance().getMessage("lblNone"));
else
ptText.append(StringUtils.join(lights, ", "));
ptText.append(")");
}
return ptText.toString();
}

View File

@@ -11,11 +11,13 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import forge.card.CardEdition;
import forge.card.CardRarity;
@@ -1095,8 +1097,7 @@ public class AdvancedSearch {
private static abstract class FilterEvaluator<T extends InventoryItem, V> {
@SuppressWarnings("unchecked")
public final Filter<T> createFilter(FilterOption option, FilterOperator operator) {
final List<V> values = getValues(option, operator);
public final Filter<T> createFilter(FilterOption option, FilterOperator operator, List<V> values) {
if (values == null || values.isEmpty()) {
return null;
}
@@ -1127,7 +1128,26 @@ public class AdvancedSearch {
return new Filter<>(option, operator, caption, predicate);
}
public final Filter<T> createFilter(FilterOption option, FilterOperator operator) {
final List<V> values = getValues(option, operator);
return createFilter(option, operator, values);
}
public final Filter<T> createFilter(FilterOption option, FilterOperator operator, String initialValueText) {
final List<V> values;
try {
values = getValuesFromString(initialValueText, option, operator);
}
catch(Exception e) {
e.printStackTrace();
return null;
}
return createFilter(option, operator, values);
}
protected abstract List<V> getValues(FilterOption option, FilterOperator operator);
protected abstract List<V> getValuesFromString(String valueText, FilterOption option, FilterOperator operator);
protected abstract String getCaption(List<V> values, FilterOption option, FilterOperator operator);
protected abstract V getItemValue(T input);
@@ -1147,6 +1167,11 @@ public class AdvancedSearch {
return values;
}
@Override
protected List<Boolean> getValuesFromString(String valueText, FilterOption option, FilterOperator operator) {
return getValues(option, operator);
}
@Override
protected String getCaption(List<Boolean> values, FilterOption option, FilterOperator operator) {
return String.format(operator.formatStr, option.name);
@@ -1190,6 +1215,11 @@ public class AdvancedSearch {
return values;
}
@Override
protected List<Integer> getValuesFromString(String valueText, FilterOption option, FilterOperator operator) {
return Arrays.stream(valueText.split(";")).map(String::trim).map(Integer::parseInt).collect(Collectors.toList());
}
@Override
protected String getCaption(List<Integer> values, FilterOption option, FilterOperator operator) {
if (operator.valueCount == FilterValueCount.TWO) {
@@ -1218,6 +1248,11 @@ public class AdvancedSearch {
return values;
}
@Override
protected List<String> getValuesFromString(String valueText, FilterOption option, FilterOperator operator) {
return Lists.newArrayList(valueText);
}
@Override
protected String getCaption(List<String> values, FilterOption option, FilterOperator operator) {
return String.format(operator.formatStr, option.name, values.get(0));
@@ -1247,6 +1282,20 @@ public class AdvancedSearch {
return SGuiChoose.getChoices(message, 0, max, choices, null, toLongString);
}
@Override
protected List<V> getValuesFromString(String valueText, FilterOption option, FilterOperator operator) {
String[] values = valueText.split(";");
return choices.stream().filter((choice) -> Arrays.stream(values).anyMatch((name) -> eitherStringMatches(choice, name))).collect(Collectors.toList());
}
private boolean eitherStringMatches(V choice, String name) {
if(toLongString != null && name.equals(toLongString.apply(choice)))
return true;
if(toShortString != null)
return name.equals(toShortString.apply(choice));
return name.equals(choice.toString());
}
@Override
protected String getCaption(List<V> values, FilterOption option, FilterOperator operator) {
String valuesStr;
@@ -1330,6 +1379,26 @@ public class AdvancedSearch {
return values;
}
@Override
protected List<Map<String, Integer>> getValuesFromString(String valueText, FilterOption option, FilterOperator operator) {
int amount = -1;
String cardName;
if(operator == FilterOperator.CONTAINS_X_COPIES_OF_CARD) {
//Take the format "2 Mountain"
String[] split = valueText.split(" ", 2);
amount = Integer.parseInt(split[0]);
cardName = split[1];
}
else
cardName = valueText;
Map<String, Integer> map = new HashMap<>();
map.put(cardName, amount);
List<Map<String, Integer>> values = new ArrayList<>();
values.add(map);
return values;
}
@Override
protected String getCaption(List<Map<String, Integer>> values, FilterOption option, FilterOperator operator) {
Entry<String, Integer> entry = values.get(0).entrySet().iterator().next();
@@ -1381,6 +1450,40 @@ public class AdvancedSearch {
return filter;
}
@SuppressWarnings("unchecked")
public static <T extends InventoryItem> Filter<T> getFilter(Class<? super T> type, String filterText) {
String[] words = filterText.split(" ", 3);
if(words.length < 2)
{
System.out.printf("Unable to generate filter from expression '%s'%n", filterText);
return null;
}
String filterValue = words.length > 2 ? words[2] : "";
FilterOption option;
try {
option = FilterOption.valueOf(words[0]);
} catch (IllegalArgumentException e) {
System.out.printf("Unable to generate filter from FilterOption '%s'%n", words[0]);
return null;
}
if(option.type != type)
{
System.out.printf("Unable to generate filter from FilterOption '%s' - filter type '%s' != option type '%s' %n", words[0], type, option.type);
return null;
}
FilterOperator operator;
try {
operator = FilterOperator.valueOf(words[1]);
} catch (IllegalArgumentException e) {
System.out.printf("Unable to generate filter from FilterOption '%s' - no matching operator '%s'%n", words[0], words[1]);
return null;
}
return (Filter<T>) option.evaluator.createFilter(option, operator, filterValue);
}
public static class Filter<T extends InventoryItem> {
private final FilterOption option;
private final FilterOperator operator;

View File

@@ -66,6 +66,12 @@ public enum ItemManagerConfig {
null, null, 4, 0),
PLANAR_DECK_EDITOR(SColumnUtil.getCatalogDefaultColumns(true), true, false, true,
null, null, 4, 0),
ATTRACTION_POOL(SColumnUtil.getAttractionPoolDefaultColumns(), false, false, true,
null, null, 4, 0),
ATTRACTION_DECK_EDITOR(SColumnUtil.getCatalogDefaultColumns(true), false, false, true,
null, null, 4, 0),
ATTRACTION_DECK_EDITOR_LIMITED(SColumnUtil.getCatalogDefaultColumns(false), false, false, true,
null, null, 4, 0),
COMMANDER_POOL(SColumnUtil.getCatalogDefaultColumns(true), true, false, false,
null, null, 4, 0),
COMMANDER_SECTION(SColumnUtil.getCatalogDefaultColumns(true), true, false, true,

View File

@@ -143,6 +143,22 @@ public final class SColumnUtil {
return columns;
}
public static Map<ColumnDef, ItemColumnConfig> getAttractionPoolDefaultColumns() {
//Similar to special card pool, but show the collector number and hide the type.
List<ColumnDef> colDefs = new ArrayList<>();
colDefs.add(ColumnDef.FAVORITE);
colDefs.add(ColumnDef.NAME);
colDefs.add(ColumnDef.RARITY);
colDefs.add(ColumnDef.SET);
colDefs.add(ColumnDef.COLLECTOR_ORDER);
Map<ColumnDef, ItemColumnConfig> columns = getColumns(colDefs);
columns.get(ColumnDef.FAVORITE).setSortPriority(1);
columns.get(ColumnDef.NAME).setSortPriority(2);
columns.get(ColumnDef.COLLECTOR_ORDER).setSortPriority(3);
return columns;
}
public static Map<ColumnDef, ItemColumnConfig> getSpellShopDefaultColumns() {
Map<ColumnDef, ItemColumnConfig> columns = getCardColumns(ColumnDef.QUANTITY, false, true, true, false, false);
columns.get(ColumnDef.OWNED).setSortPriority(1);

View File

@@ -101,7 +101,7 @@ public final class FModel {
private static GameFormat.Collection formats;
private static ItemPool<PaperCard> uniqueCardsNoAlt, allCardsNoAlt, planechaseCards, archenemyCards,
brawlCommander, oathbreakerCommander, tinyLeadersCommander, commanderPool,
avatarPool, conspiracyPool, dungeonPool;
avatarPool, conspiracyPool, dungeonPool, attractionPool;
public static void initialize(final IProgressBar progressBar, Function<ForgePreferences, Void> adjustPrefs) {
//init version to log
@@ -294,6 +294,7 @@ public final class FModel {
allCardsNoAlt = getAllCardsNoAlt();
archenemyCards = getArchenemyCards();
planechaseCards = getPlanechaseCards();
attractionPool = getAttractionPool();
if (GuiBase.getInterface().isLibgdxPort()) {
//preload mobile Itempool
uniqueCardsNoAlt = getUniqueCardsNoAlt();
@@ -389,6 +390,11 @@ public final class FModel {
return dungeonPool;
}
public static ItemPool<PaperCard> getAttractionPool() {
if (attractionPool == null)
return ItemPool.createFrom(getMagicDb().getVariantCards().getAllCards(Predicates.compose(CardRulesPredicates.Presets.IS_ATTRACTION, PaperCard.FN_GET_RULES)), PaperCard.class);
return attractionPool;
}
private static boolean keywordsLoaded = false;
/**

View File

@@ -1118,6 +1118,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
case SchemeDeck:
choices = getGui().order(localizer.getMessage("lblChooseOrderCardsPutIntoSchemeDeck"), localizer.getMessage("lblClosestToTop"), choices, null);
break;
case AttractionDeck:
choices = getGui().order(localizer.getMessage("lblChooseOrderCardsPutIntoAttractionDeck"), localizer.getMessage("lblClosestToTop"), choices, null);
case Stack:
choices = getGui().order(localizer.getMessage("lblChooseOrderCopiesCast"), localizer.getMessage("lblPutFirst"), choices, null);
break;

View File

@@ -33,6 +33,7 @@ public class DeckAIUtils {
case Schemes: return localizer.getMessage("lblSchemeDeck");
case Conspiracy: return /* TODO localise */ "Conspiracy";
case Dungeon: return /* TODO localise */ "Dungeon";
case Attractions: return /* TODO localize */ "Attractions";
default: return /* TODO better handling */ "UNKNOWN";
}
}