mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
I think I see why nobody wanted to do this
This commit is contained in:
@@ -37,6 +37,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public final class CardDb implements ICardDatabase, IDeckGenPool {
|
public final class CardDb implements ICardDatabase, IDeckGenPool {
|
||||||
public final static String foilSuffix = "+";
|
public final static String foilSuffix = "+";
|
||||||
@@ -272,7 +273,22 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
artIds.put(key, artIdx);
|
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) {
|
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)) {
|
if (ed == null || ed.equals(CardEdition.UNKNOWN)) {
|
||||||
// look for all possible editions
|
// look for all possible editions
|
||||||
for (CardEdition e : editions) {
|
for (CardEdition e : editions) {
|
||||||
List<CardInSet> cardsInSet = e.getCardInSet(cardName); // empty collection if not present
|
reIndexNecessary |= addFromSetByName(cardName, e, cr);
|
||||||
for (CardInSet cis : cardsInSet) {
|
|
||||||
addSetCard(e, cis, cr);
|
|
||||||
reIndexNecessary = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<CardInSet> cardsInSet = ed.getCardInSet(cardName); // empty collection if not present
|
reIndexNecessary |= addFromSetByName(cardName, ed, cr);
|
||||||
for (CardInSet cis : cardsInSet) {
|
|
||||||
addSetCard(ed, cis, cr);
|
|
||||||
reIndexNecessary = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reIndexNecessary)
|
if (reIndexNecessary)
|
||||||
@@ -324,11 +332,20 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
|
|
||||||
for (CardEdition.CardInSet cis : e.getAllCardsInSet()) {
|
for (CardEdition.CardInSet cis : e.getAllCardsInSet()) {
|
||||||
CardRules cr = rulesByName.get(cis.name);
|
CardRules cr = rulesByName.get(cis.name);
|
||||||
if (cr != null) {
|
if (cr == null) {
|
||||||
addSetCard(e, cis, cr);
|
|
||||||
} else {
|
|
||||||
missingCards.add(cis.name);
|
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 (isCoreExpSet && logMissingPerEdition) {
|
||||||
if (missingCards.isEmpty()) {
|
if (missingCards.isEmpty()) {
|
||||||
@@ -1229,7 +1246,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
int artIdx = IPaperCard.DEFAULT_ART_INDEX;
|
int artIdx = IPaperCard.DEFAULT_ART_INDEX;
|
||||||
for (CardInSet cis : e.getCardInSet(cardName))
|
for (CardInSet cis : e.getCardInSet(cardName))
|
||||||
paperCards.add(new PaperCard(rules, e.getCode(), cis.rarity, artIdx++, false,
|
paperCards.add(new PaperCard(rules, e.getCode(), cis.rarity, artIdx++, false,
|
||||||
cis.collectorNumber, cis.artistName));
|
cis.collectorNumber, cis.artistName, cis.functionalVariantName));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String lastEdition = null;
|
String lastEdition = null;
|
||||||
@@ -1249,7 +1266,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
int cardInSetIndex = Math.max(artIdx-1, 0); // make sure doesn't go below zero
|
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
|
CardInSet cds = cardsInSet.get(cardInSetIndex); // use ArtIndex to get the right Coll. Number
|
||||||
paperCards.add(new PaperCard(rules, lastEdition, tuple.getValue(), artIdx++, false,
|
paperCards.add(new PaperCard(rules, lastEdition, tuple.getValue(), artIdx++, false,
|
||||||
cds.collectorNumber, cds.artistName));
|
cds.collectorNumber, cds.artistName, cds.functionalVariantName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (paperCards.isEmpty()) {
|
if (paperCards.isEmpty()) {
|
||||||
|
|||||||
@@ -166,12 +166,14 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
public final String collectorNumber;
|
public final String collectorNumber;
|
||||||
public final String name;
|
public final String name;
|
||||||
public final String artistName;
|
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.name = name;
|
||||||
this.collectorNumber = collectorNumber;
|
this.collectorNumber = collectorNumber;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
this.artistName = artistName;
|
this.artistName = artistName;
|
||||||
|
this.functionalVariantName = functionalVariantName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@@ -189,6 +191,10 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
sb.append(" @");
|
sb.append(" @");
|
||||||
sb.append(artistName);
|
sb.append(artistName);
|
||||||
}
|
}
|
||||||
|
if (functionalVariantName != null) {
|
||||||
|
sb.append(" $");
|
||||||
|
sb.append(functionalVariantName);
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,9 +573,11 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
* cnum - grouping #2
|
* cnum - grouping #2
|
||||||
* rarity - grouping #4
|
* rarity - grouping #4
|
||||||
* name - grouping #5
|
* name - grouping #5
|
||||||
|
* artist name - grouping #7
|
||||||
|
* functional variant name - grouping #9
|
||||||
*/
|
*/
|
||||||
// "(^(.?[0-9A-Z]+.?))?(([SCURML]) )?(.*)$"
|
// "(^(.?[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();
|
ListMultimap<String, CardInSet> cardMap = ArrayListMultimap.create();
|
||||||
@@ -595,7 +603,8 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
CardRarity r = CardRarity.smartValueOf(matcher.group(4));
|
CardRarity r = CardRarity.smartValueOf(matcher.group(4));
|
||||||
String cardName = matcher.group(5);
|
String cardName = matcher.group(5);
|
||||||
String artistName = matcher.group(7);
|
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);
|
cardMap.put(sectionName, cis);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
package forge.card;
|
package forge.card;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -45,6 +42,7 @@ final class CardFace implements ICardFace, Cloneable {
|
|||||||
private String toughness = null;
|
private String toughness = null;
|
||||||
private String initialLoyalty = "";
|
private String initialLoyalty = "";
|
||||||
private String defense = "";
|
private String defense = "";
|
||||||
|
private Set<Integer> attractionLights = null;
|
||||||
|
|
||||||
private String nonAbilityText = null;
|
private String nonAbilityText = null;
|
||||||
private List<String> keywords = null;
|
private List<String> keywords = null;
|
||||||
@@ -54,6 +52,8 @@ final class CardFace implements ICardFace, Cloneable {
|
|||||||
private List<String> replacements = null;
|
private List<String> replacements = null;
|
||||||
private Map<String, String> variables = null;
|
private Map<String, String> variables = null;
|
||||||
|
|
||||||
|
private Map<String, CardFace> functionalVariants = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// these implement ICardCharacteristics
|
// these implement ICardCharacteristics
|
||||||
@@ -64,6 +64,7 @@ final class CardFace implements ICardFace, Cloneable {
|
|||||||
@Override public String getToughness() { return toughness; }
|
@Override public String getToughness() { return toughness; }
|
||||||
@Override public String getInitialLoyalty() { return initialLoyalty; }
|
@Override public String getInitialLoyalty() { return initialLoyalty; }
|
||||||
@Override public String getDefense() { return defense; }
|
@Override public String getDefense() { return defense; }
|
||||||
|
@Override public Set<Integer> getAttractionLights() { return attractionLights; }
|
||||||
@Override public String getName() { return this.name; }
|
@Override public String getName() { return this.name; }
|
||||||
@Override public CardType getType() { return this.type; }
|
@Override public CardType getType() { return this.type; }
|
||||||
@Override public ManaCost getManaCost() { return this.manaCost; }
|
@Override public ManaCost getManaCost() { return this.manaCost; }
|
||||||
@@ -76,24 +77,35 @@ final class CardFace implements ICardFace, Cloneable {
|
|||||||
@Override public Iterable<String> getTriggers() { return triggers; }
|
@Override public Iterable<String> getTriggers() { return triggers; }
|
||||||
@Override public Iterable<String> getReplacements() { return replacements; }
|
@Override public Iterable<String> getReplacements() { return replacements; }
|
||||||
@Override public String getNonAbilityText() { return nonAbilityText; }
|
@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; }
|
@Override public String getAltName() { return this.altName; }
|
||||||
|
|
||||||
public CardFace(String name0) {
|
public CardFace(String name0) {
|
||||||
this.name = name0;
|
this.name = name0;
|
||||||
if ( StringUtils.isBlank(name0) )
|
if ( StringUtils.isBlank(name0) )
|
||||||
throw new RuntimeException("Card name is empty");
|
throw new RuntimeException("Card name is empty");
|
||||||
}
|
}
|
||||||
// Here come setters to allow parser supply values
|
// 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 setAltName(String name) { this.altName = name; }
|
||||||
void setType(CardType type0) { this.type = type0; }
|
void setType(CardType type0) { this.type = type0; }
|
||||||
void setManaCost(ManaCost manaCost0) { this.manaCost = manaCost0; }
|
void setManaCost(ManaCost manaCost0) { this.manaCost = manaCost0; }
|
||||||
void setColor(ColorSet color0) { this.color = color0; }
|
void setColor(ColorSet color0) { this.color = color0; }
|
||||||
void setOracleText(String text) { this.oracleText = text; }
|
void setOracleText(String text) { this.oracleText = text; }
|
||||||
void setInitialLoyalty(String value) { this.initialLoyalty = value; }
|
void setInitialLoyalty(String value) { this.initialLoyalty = value; }
|
||||||
void setDefense(String value) { this.defense = 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) {
|
void setPtText(String value) {
|
||||||
final String[] k = value.split("/");
|
final String[] k = value.split("/");
|
||||||
@@ -129,6 +141,27 @@ final class CardFace implements ICardFace, Cloneable {
|
|||||||
void addReplacementEffect(String value) { if (null == this.replacements) { this.replacements = new ArrayList<>(); } this.replacements.add(value);}
|
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); }
|
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
|
void assignMissingFields() { // Most scripts do not specify color explicitly
|
||||||
if ( null == oracleText ) { System.err.println(name + " has no Oracle text."); oracleText = ""; }
|
if ( null == oracleText ) { System.err.println(name + " has no Oracle text."); oracleText = ""; }
|
||||||
@@ -142,6 +175,7 @@ final class CardFace implements ICardFace, Cloneable {
|
|||||||
if ( replacements == null ) replacements = emptyList;
|
if ( replacements == null ) replacements = emptyList;
|
||||||
if ( variables == null ) variables = emptyMap;
|
if ( variables == null ) variables = emptyMap;
|
||||||
if ( null == nonAbilityText ) nonAbilityText = "";
|
if ( null == nonAbilityText ) nonAbilityText = "";
|
||||||
|
//Not assigning attractionLightVariants here. Too rarely used. Will test for it downstream.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,8 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
|
|
||||||
public boolean isVariant() {
|
public boolean isVariant() {
|
||||||
CardType t = getType();
|
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() {
|
public CardSplitType getSplitType() {
|
||||||
@@ -246,6 +247,8 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
return mainPart.getDefense();
|
return mainPart.getDefense();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public Set<Integer> getAttractionLights() { return mainPart.getAttractionLights(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOracleText() {
|
public String getOracleText() {
|
||||||
switch (splitType.getAggregationMethod()) {
|
switch (splitType.getAggregationMethod()) {
|
||||||
@@ -396,6 +399,14 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
this.deltaLife = Integer.parseInt(TextUtil.fastReplace(pt.substring(slashPos+1), "+", ""));
|
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() {
|
public ColorSet getColorIdentity() {
|
||||||
return colorIdentity;
|
return colorIdentity;
|
||||||
}
|
}
|
||||||
@@ -419,6 +430,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
private String partnerWith = "";
|
private String partnerWith = "";
|
||||||
private String handLife = null;
|
private String handLife = null;
|
||||||
private String normalizedName = "";
|
private String normalizedName = "";
|
||||||
|
private Set<String> supportedFunctionalVariants = null;
|
||||||
|
|
||||||
// fields to build CardAiHints
|
// fields to build CardAiHints
|
||||||
private boolean removedFromAIDecks = false;
|
private boolean removedFromAIDecks = false;
|
||||||
@@ -453,6 +465,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
this.meldWith = "";
|
this.meldWith = "";
|
||||||
this.partnerWith = "";
|
this.partnerWith = "";
|
||||||
this.normalizedName = "";
|
this.normalizedName = "";
|
||||||
|
this.supportedFunctionalVariants = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -476,6 +489,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
result.partnerWith = this.partnerWith;
|
result.partnerWith = this.partnerWith;
|
||||||
if (StringUtils.isNotBlank(handLife))
|
if (StringUtils.isNotBlank(handLife))
|
||||||
result.setVanguardProperties(handLife);
|
result.setVanguardProperties(handLife);
|
||||||
|
result.supportedFunctionalVariants = this.supportedFunctionalVariants;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,7 +499,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
if (line.isEmpty() || line.charAt(0) == '#') {
|
if (line.isEmpty() || line.charAt(0) == '#') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.parseLine(line);
|
this.parseLine(line, this.faces[curFace]);
|
||||||
}
|
}
|
||||||
this.normalizedName = filename;
|
this.normalizedName = filename;
|
||||||
return this.getCard();
|
return this.getCard();
|
||||||
@@ -496,12 +510,15 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the line.
|
* Parses a single line of a card script.
|
||||||
*
|
*
|
||||||
* @param line
|
* @param line Line of text to parse.
|
||||||
* the line
|
|
||||||
*/
|
*/
|
||||||
public final void parseLine(final String line) {
|
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(':');
|
int colonPos = line.indexOf(':');
|
||||||
String key = colonPos > 0 ? line.substring(0, colonPos) : line;
|
String key = colonPos > 0 ? line.substring(0, colonPos) : line;
|
||||||
String value = colonPos > 0 ? line.substring(1+colonPos).trim() : null;
|
String value = colonPos > 0 ? line.substring(1+colonPos).trim() : null;
|
||||||
@@ -509,7 +526,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
switch (key.charAt(0)) {
|
switch (key.charAt(0)) {
|
||||||
case 'A':
|
case 'A':
|
||||||
if ("A".equals(key)) {
|
if ("A".equals(key)) {
|
||||||
this.faces[curFace].addAbility(value);
|
face.addAbility(value);
|
||||||
} else if ("AI".equals(key)) {
|
} else if ("AI".equals(key)) {
|
||||||
colonPos = value.indexOf(':');
|
colonPos = value.indexOf(':');
|
||||||
String variable = colonPos > 0 ? value.substring(0, colonPos) : value;
|
String variable = colonPos > 0 ? value.substring(0, colonPos) : value;
|
||||||
@@ -525,7 +542,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
} else if ("ALTERNATE".equals(key)) {
|
} else if ("ALTERNATE".equals(key)) {
|
||||||
this.curFace = 1;
|
this.curFace = 1;
|
||||||
} else if ("AltName".equals(key)) {
|
} else if ("AltName".equals(key)) {
|
||||||
this.faces[curFace].setAltName(value);
|
face.setAltName(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -534,7 +551,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
// This is forge.card.CardColor not forge.CardColor.
|
// This is forge.card.CardColor not forge.CardColor.
|
||||||
// Why do we have two classes with the same name?
|
// Why do we have two classes with the same name?
|
||||||
ColorSet newCol = ColorSet.fromNames(value.split(","));
|
ColorSet newCol = ColorSet.fromNames(value.split(","));
|
||||||
this.faces[this.curFace].setColor(newCol);
|
face.setColor(newCol);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -546,7 +563,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
} else if ("DeckHas".equals(key)) {
|
} else if ("DeckHas".equals(key)) {
|
||||||
has = new DeckHints(value);
|
has = new DeckHints(value);
|
||||||
} else if ("Defense".equals(key)) {
|
} else if ("Defense".equals(key)) {
|
||||||
this.faces[this.curFace].setDefense(value);
|
face.setDefense(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -558,7 +575,7 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
|
|
||||||
case 'K':
|
case 'K':
|
||||||
if ("K".equals(key)) {
|
if ("K".equals(key)) {
|
||||||
this.faces[this.curFace].addKeyword(value);
|
face.addKeyword(value);
|
||||||
if (value.startsWith("Partner:")) {
|
if (value.startsWith("Partner:")) {
|
||||||
this.partnerWith = value.split(":")[1];
|
this.partnerWith = value.split(":")[1];
|
||||||
}
|
}
|
||||||
@@ -567,13 +584,16 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
if ("Loyalty".equals(key)) {
|
if ("Loyalty".equals(key)) {
|
||||||
this.faces[this.curFace].setInitialLoyalty(value);
|
face.setInitialLoyalty(value);
|
||||||
|
}
|
||||||
|
if ("Lights".equals(key)) {
|
||||||
|
face.setAttractionLights(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M':
|
case 'M':
|
||||||
if ("ManaCost".equals(key)) {
|
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)));
|
: new ManaCost(new ManaCostParser(value)));
|
||||||
} else if ("MeldPair".equals(key)) {
|
} else if ("MeldPair".equals(key)) {
|
||||||
this.meldWith = value;
|
this.meldWith = value;
|
||||||
@@ -588,25 +608,25 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
|
|
||||||
case 'O':
|
case 'O':
|
||||||
if ("Oracle".equals(key)) {
|
if ("Oracle".equals(key)) {
|
||||||
this.faces[this.curFace].setOracleText(value);
|
face.setOracleText(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
if ("PT".equals(key)) {
|
if ("PT".equals(key)) {
|
||||||
this.faces[this.curFace].setPtText(value);
|
face.setPtText(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
if ("R".equals(key)) {
|
if ("R".equals(key)) {
|
||||||
this.faces[this.curFace].addReplacementEffect(value);
|
face.addReplacementEffect(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
if ("S".equals(key)) {
|
if ("S".equals(key)) {
|
||||||
this.faces[this.curFace].addStaticAbility(value);
|
face.addStaticAbility(value);
|
||||||
} else if (key.startsWith("SPECIALIZE")) {
|
} else if (key.startsWith("SPECIALIZE")) {
|
||||||
if (value.equals("WHITE")) {
|
if (value.equals("WHITE")) {
|
||||||
this.curFace = 2;
|
this.curFace = 2;
|
||||||
@@ -626,17 +646,32 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
String variable = colonPos > 0 ? value.substring(0, colonPos) : value;
|
String variable = colonPos > 0 ? value.substring(0, colonPos) : value;
|
||||||
value = colonPos > 0 ? value.substring(1+colonPos) : null;
|
value = colonPos > 0 ? value.substring(1+colonPos) : null;
|
||||||
|
|
||||||
this.faces[curFace].addSVar(variable, value);
|
face.addSVar(variable, value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T':
|
case 'T':
|
||||||
if ("T".equals(key)) {
|
if ("T".equals(key)) {
|
||||||
this.faces[this.curFace].addTrigger(value);
|
face.addTrigger(value);
|
||||||
} else if ("Types".equals(key)) {
|
} 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)) {
|
} 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -653,6 +653,9 @@ public final class CardRulesPredicates {
|
|||||||
public static final Predicate<CardRules> IS_VANGUARD = CardRulesPredicates.coreType(true, CardType.CoreType.Vanguard);
|
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_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_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> IS_NON_LAND = CardRulesPredicates.coreType(false, CardType.CoreType.Land);
|
||||||
public static final Predicate<CardRules> CAN_BE_BRAWL_COMMANDER = Predicates.and(Presets.IS_LEGENDARY,
|
public static final Predicate<CardRules> CAN_BE_BRAWL_COMMANDER = Predicates.and(Presets.IS_LEGENDARY,
|
||||||
Predicates.or(Presets.IS_CREATURE, Presets.IS_PLANESWALKER));
|
Predicates.or(Presets.IS_CREATURE, Presets.IS_PLANESWALKER));
|
||||||
|
|||||||
@@ -496,6 +496,9 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
|||||||
public final boolean isEquipment() { return hasSubtype("Equipment"); }
|
public final boolean isEquipment() { return hasSubtype("Equipment"); }
|
||||||
@Override
|
@Override
|
||||||
public final boolean isFortification() { return hasSubtype("Fortification"); }
|
public final boolean isFortification() { return hasSubtype("Fortification"); }
|
||||||
|
public boolean isAttraction() {
|
||||||
|
return hasSubtype("Attraction");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSaga() {
|
public boolean isSaga() {
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public interface CardTypeView extends Iterable<String>, Serializable {
|
|||||||
boolean isAura();
|
boolean isAura();
|
||||||
boolean isEquipment();
|
boolean isEquipment();
|
||||||
boolean isFortification();
|
boolean isFortification();
|
||||||
|
boolean isAttraction();
|
||||||
|
|
||||||
boolean isSaga();
|
boolean isSaga();
|
||||||
boolean isHistoric();
|
boolean isHistoric();
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package forge.card;
|
|||||||
|
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public interface ICardCharacteristics {
|
public interface ICardCharacteristics {
|
||||||
String getName();
|
String getName();
|
||||||
CardType getType();
|
CardType getType();
|
||||||
@@ -14,6 +16,7 @@ public interface ICardCharacteristics {
|
|||||||
String getToughness();
|
String getToughness();
|
||||||
String getInitialLoyalty();
|
String getInitialLoyalty();
|
||||||
String getDefense();
|
String getDefense();
|
||||||
|
Set<Integer> getAttractionLights();
|
||||||
|
|
||||||
String getOracleText();
|
String getOracleText();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package forge.card;
|
package forge.card;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for this type.
|
* TODO: Write javadoc for this type.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ICardFace extends ICardCharacteristics, ICardRawAbilites, Comparable<ICardFace> {
|
public interface ICardFace extends ICardCharacteristics, ICardRawAbilites, Comparable<ICardFace> {
|
||||||
String getAltName();
|
String getAltName();
|
||||||
|
|
||||||
|
boolean hasFunctionalVariants();
|
||||||
|
ICardFace getFunctionalVariant(String variant);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,15 @@ public enum DeckFormat {
|
|||||||
// Main board: allowed size SB: restriction Max distinct non basic cards
|
// Main board: allowed size SB: restriction Max distinct non basic cards
|
||||||
Constructed ( Range.between(60, Integer.MAX_VALUE), Range.between(0, 15), 4),
|
Constructed ( Range.between(60, Integer.MAX_VALUE), Range.between(0, 15), 4),
|
||||||
QuestDeck ( Range.between(40, 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>() {
|
Commander ( Range.is(99), Range.between(0, 10), 1, null, new Predicate<PaperCard>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(PaperCard card) {
|
public boolean apply(PaperCard card) {
|
||||||
@@ -321,6 +329,12 @@ public enum DeckFormat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (deck.has(DeckSection.Attractions)) {
|
||||||
|
String attractionError = getAttractionDeckConformanceProblem(deck);
|
||||||
|
if (attractionError != null)
|
||||||
|
return attractionError;
|
||||||
|
}
|
||||||
|
|
||||||
final int maxCopies = getMaxCardCopies();
|
final int maxCopies = getMaxCardCopies();
|
||||||
//Must contain no more than 4 of the same card
|
//Must contain no more than 4 of the same card
|
||||||
//shared among the main deck and sideboard, except
|
//shared among the main deck and sideboard, except
|
||||||
@@ -365,6 +379,18 @@ public enum DeckFormat {
|
|||||||
return null;
|
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().getName(), false) > 1)
|
||||||
|
return TextUtil.concatWithSpace("contains more than 1 copy of the attraction", cp.getKey().getName());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean canHaveAnyNumberOf(final IPaperCard icard) {
|
public static boolean canHaveAnyNumberOf(final IPaperCard icard) {
|
||||||
return icard.getRules().getType().isBasicLand()
|
return icard.getRules().getType().isBasicLand()
|
||||||
|| Iterables.contains(icard.getRules().getMainPart().getKeywords(),
|
|| Iterables.contains(icard.getRules().getMainPart().getKeywords(),
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ public class DeckRecognizer {
|
|||||||
matchedSection = DeckSection.Conspiracy;
|
matchedSection = DeckSection.Conspiracy;
|
||||||
else if (sectionName.equals("planes"))
|
else if (sectionName.equals("planes"))
|
||||||
matchedSection = DeckSection.Planes;
|
matchedSection = DeckSection.Planes;
|
||||||
|
else if (sectionName.equals("attractions"))
|
||||||
|
matchedSection = DeckSection.Attractions;
|
||||||
|
|
||||||
if (matchedSection == null) // no match found
|
if (matchedSection == null) // no match found
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public enum DeckSection {
|
|||||||
Planes(10, Validators.PLANES_VALIDATOR),
|
Planes(10, Validators.PLANES_VALIDATOR),
|
||||||
Schemes(20, Validators.SCHEME_VALIDATOR),
|
Schemes(20, Validators.SCHEME_VALIDATOR),
|
||||||
Conspiracy(0, Validators.CONSPIRACY_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 final int typicalSize; // Rules enforcement is done in DeckFormat class, this is for reference only
|
||||||
private Function<PaperCard, Boolean> fnValidator;
|
private Function<PaperCard, Boolean> fnValidator;
|
||||||
@@ -44,6 +45,8 @@ public enum DeckSection {
|
|||||||
return Commander;
|
return Commander;
|
||||||
if (DeckSection.Dungeon.validate(card))
|
if (DeckSection.Dungeon.validate(card))
|
||||||
return Dungeon;
|
return Dungeon;
|
||||||
|
if (DeckSection.Attractions.validate(card))
|
||||||
|
return Attractions;
|
||||||
return Main; // default
|
return Main; // default
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,5 +122,10 @@ public enum DeckSection {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static final Function<PaperCard, Boolean> ATTRACTION_VALIDATOR = card -> {
|
||||||
|
CardType t = card.getRules().getType();
|
||||||
|
return t.isAttraction();
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public interface IPaperCard extends InventoryItem, Serializable {
|
|||||||
int DEFAULT_ART_INDEX = 1;
|
int DEFAULT_ART_INDEX = 1;
|
||||||
int NO_ART_INDEX = -1; // Placeholder when NO ArtIndex is Specified
|
int NO_ART_INDEX = -1; // Placeholder when NO ArtIndex is Specified
|
||||||
String NO_ARTIST_NAME = "";
|
String NO_ARTIST_NAME = "";
|
||||||
|
String NO_FUNCTIONAL_VARIANT = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of filters based on CardPrinted values.
|
* Number of filters based on CardPrinted values.
|
||||||
@@ -243,6 +244,7 @@ public interface IPaperCard extends InventoryItem, Serializable {
|
|||||||
String getName();
|
String getName();
|
||||||
String getEdition();
|
String getEdition();
|
||||||
String getCollectorNumber();
|
String getCollectorNumber();
|
||||||
|
String getFunctionalVariant();
|
||||||
int getArtIndex();
|
int getArtIndex();
|
||||||
boolean isFoil();
|
boolean isFoil();
|
||||||
boolean isToken();
|
boolean isToken();
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
|
|||||||
private final boolean foil;
|
private final boolean foil;
|
||||||
private Boolean hasImage;
|
private Boolean hasImage;
|
||||||
private String sortableName;
|
private String sortableName;
|
||||||
|
private final String functionalVariant;
|
||||||
|
|
||||||
// Calculated fields are below:
|
// Calculated fields are below:
|
||||||
private transient CardRarity rarity; // rarity is given in ctor when set is assigned
|
private transient CardRarity rarity; // rarity is given in ctor when set is assigned
|
||||||
@@ -80,6 +81,11 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
|
|||||||
return collectorNumber;
|
return collectorNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFunctionalVariant() {
|
||||||
|
return functionalVariant;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getArtIndex() {
|
public int getArtIndex() {
|
||||||
return artIndex;
|
return artIndex;
|
||||||
@@ -121,7 +127,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
|
|||||||
|
|
||||||
if (this.foiledVersion == null) {
|
if (this.foiledVersion == null) {
|
||||||
this.foiledVersion = new PaperCard(this.rules, this.edition, this.rarity,
|
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;
|
return this.foiledVersion;
|
||||||
}
|
}
|
||||||
@@ -130,7 +136,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
|
|||||||
return this;
|
return this;
|
||||||
|
|
||||||
PaperCard unFoiledVersion = new PaperCard(this.rules, this.edition, this.rarity,
|
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;
|
return unFoiledVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +179,12 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
|
|||||||
|
|
||||||
public PaperCard(final CardRules rules0, final String edition0, final CardRarity rarity0) {
|
public PaperCard(final CardRules rules0, final String edition0, final CardRarity rarity0) {
|
||||||
this(rules0, edition0, rarity0, IPaperCard.DEFAULT_ART_INDEX, false,
|
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,
|
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) {
|
if (rules0 == null || edition0 == null || rarity0 == null) {
|
||||||
throw new IllegalArgumentException("Cannot create card without rules, edition or rarity");
|
throw new IllegalArgumentException("Cannot create card without rules, edition or rarity");
|
||||||
}
|
}
|
||||||
@@ -192,6 +199,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.
|
// 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
|
// This is a good tradeoff
|
||||||
sortableName = TextUtil.toSortableName(CardTranslation.getTranslatedName(rules0.getName()));
|
sortableName = TextUtil.toSortableName(CardTranslation.getTranslatedName(rules0.getName()));
|
||||||
|
this.functionalVariant = functionalVariant != null ? functionalVariant : IPaperCard.NO_FUNCTIONAL_VARIANT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Want this class to be a key for HashTable
|
// Want this class to be a key for HashTable
|
||||||
|
|||||||
@@ -150,6 +150,12 @@ public class PaperToken implements InventoryItemFromSet, IPaperCard {
|
|||||||
return IPaperCard.NO_COLLECTOR_NUMBER;
|
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
|
@Override
|
||||||
public int getArtIndex() {
|
public int getArtIndex() {
|
||||||
return artIndex;
|
return artIndex;
|
||||||
|
|||||||
@@ -158,6 +158,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);
|
boolean suppress = !c.isToken() && zoneFrom.equals(zoneTo);
|
||||||
|
|
||||||
Card copied = null;
|
Card copied = null;
|
||||||
@@ -449,7 +459,8 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
game.getCombat().removeFromCombat(c);
|
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) {
|
&& zoneFrom == zoneTo && position.equals(zoneFrom.size()) && position != 0) {
|
||||||
position--;
|
position--;
|
||||||
}
|
}
|
||||||
@@ -509,7 +520,7 @@ public class GameAction {
|
|||||||
if (card.isRealCommander()) {
|
if (card.isRealCommander()) {
|
||||||
card.setMoveToCommandZone(true);
|
card.setMoveToCommandZone(true);
|
||||||
}
|
}
|
||||||
// 723.3e & 903.9a
|
// 727.3e & 903.9a
|
||||||
if (wasToken && !card.isRealToken() || card.isRealCommander()) {
|
if (wasToken && !card.isRealToken() || card.isRealCommander()) {
|
||||||
Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(card);
|
Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(card);
|
||||||
repParams.put(AbilityKey.CardLKI, card);
|
repParams.put(AbilityKey.CardLKI, card);
|
||||||
@@ -756,6 +767,8 @@ public class GameAction {
|
|||||||
case Stack: return moveToStack(c, cause, params);
|
case Stack: return moveToStack(c, cause, params);
|
||||||
case PlanarDeck: return moveToVariantDeck(c, ZoneType.PlanarDeck, libPosition, cause, params);
|
case PlanarDeck: return moveToVariantDeck(c, ZoneType.PlanarDeck, libPosition, cause, params);
|
||||||
case SchemeDeck: return moveToVariantDeck(c, ZoneType.SchemeDeck, 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
|
default: // sideboard will also get there
|
||||||
return moveTo(c.getOwner().getZone(name), c, cause);
|
return moveTo(c.getOwner().getZone(name), c, cause);
|
||||||
}
|
}
|
||||||
@@ -901,6 +914,11 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
return changeZone(game.getZoneOf(c), deck, c, deckPosition, cause, params);
|
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) {
|
public final CardCollection exile(final CardCollection cards, SpellAbility cause, Map<AbilityKey, Object> params) {
|
||||||
CardCollection result = new CardCollection();
|
CardCollection result = new CardCollection();
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ public enum ApiType {
|
|||||||
Mutate (MutateEffect.class),
|
Mutate (MutateEffect.class),
|
||||||
NameCard (ChooseCardNameEffect.class),
|
NameCard (ChooseCardNameEffect.class),
|
||||||
NoteCounters (CountersNoteEffect.class),
|
NoteCounters (CountersNoteEffect.class),
|
||||||
|
OpenAttraction (OpenAttractionEffect.class),
|
||||||
PeekAndReveal (PeekAndRevealEffect.class),
|
PeekAndReveal (PeekAndRevealEffect.class),
|
||||||
PermanentCreature (PermanentCreatureEffect.class),
|
PermanentCreature (PermanentCreatureEffect.class),
|
||||||
PermanentNoncreature (PermanentNoncreatureEffect.class),
|
PermanentNoncreature (PermanentNoncreatureEffect.class),
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import forge.game.player.PlayerCollection;
|
|||||||
import forge.game.replacement.ReplacementType;
|
import forge.game.replacement.ReplacementType;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.game.trigger.TriggerType;
|
import forge.game.trigger.TriggerType;
|
||||||
|
import forge.util.Lang;
|
||||||
import forge.util.Localizer;
|
import forge.util.Localizer;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -44,6 +45,13 @@ public class RollDiceEffect extends SpellAbilityEffect {
|
|||||||
protected String getStackDescription(SpellAbility sa) {
|
protected String getStackDescription(SpellAbility sa) {
|
||||||
final PlayerCollection player = getTargetPlayers(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();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
if (player.size() == 1 && player.get(0).equals(sa.getActivatingPlayer())) {
|
if (player.size() == 1 && player.get(0).equals(sa.getActivatingPlayer())) {
|
||||||
stringBuilder.append("Roll ");
|
stringBuilder.append("Roll ");
|
||||||
@@ -121,8 +129,9 @@ public class RollDiceEffect extends SpellAbilityEffect {
|
|||||||
//Notify of results
|
//Notify of results
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(Localizer.getInstance().getMessage("lblPlayerRolledResult", player,
|
String rollResults = StringUtils.join(naturalRolls, ", ");
|
||||||
StringUtils.join(naturalRolls, ", ")));
|
String resultMessage = sa.hasParam("ToVisitYourAttractions") ? "lblAttractionRollResult" : "lblPlayerRolledResult";
|
||||||
|
sb.append(Localizer.getInstance().getMessage(resultMessage, player, rollResults));
|
||||||
if (!ignored.isEmpty()) {
|
if (!ignored.isEmpty()) {
|
||||||
sb.append("\r\n").append(Localizer.getInstance().getMessage("lblIgnoredRolls",
|
sb.append("\r\n").append(Localizer.getInstance().getMessage("lblIgnoredRolls",
|
||||||
StringUtils.join(ignored, ", ")));
|
StringUtils.join(ignored, ", ")));
|
||||||
@@ -278,6 +287,9 @@ public class RollDiceEffect extends SpellAbilityEffect {
|
|||||||
} else {
|
} else {
|
||||||
int result = rollDice(sa, player, amount, sides);
|
int result = rollDice(sa, player, amount, sides);
|
||||||
results.add(result);
|
results.add(result);
|
||||||
|
if (sa.hasParam("ToVisitYourAttractions")) {
|
||||||
|
player.visitAttractions(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rememberHighest) {
|
if (rememberHighest) {
|
||||||
|
|||||||
@@ -141,12 +141,16 @@ public class SubgameEffect extends SpellAbilityEffect {
|
|||||||
// Planes
|
// Planes
|
||||||
setCardsInZone(player, ZoneType.PlanarDeck, maingamePlayer.getCardsIn(ZoneType.PlanarDeck), false);
|
setCardsInZone(player, ZoneType.PlanarDeck, maingamePlayer.getCardsIn(ZoneType.PlanarDeck), false);
|
||||||
|
|
||||||
|
// Attractions
|
||||||
|
setCardsInZone(player, ZoneType.AttractionDeck, maingamePlayer.getCardsIn(ZoneType.AttractionDeck), false);
|
||||||
|
|
||||||
// Vanguard and Commanders
|
// Vanguard and Commanders
|
||||||
initVariantsZonesSubgame(subgame, maingamePlayer, player);
|
initVariantsZonesSubgame(subgame, maingamePlayer, player);
|
||||||
|
|
||||||
player.shuffle(null);
|
player.shuffle(null);
|
||||||
player.getZone(ZoneType.SchemeDeck).shuffle();
|
player.getZone(ZoneType.SchemeDeck).shuffle();
|
||||||
player.getZone(ZoneType.PlanarDeck).shuffle();
|
player.getZone(ZoneType.PlanarDeck).shuffle();
|
||||||
|
player.getZone(ZoneType.AttractionDeck).shuffle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +253,7 @@ public class SubgameEffect extends SpellAbilityEffect {
|
|||||||
player.shuffle(sa);
|
player.shuffle(sa);
|
||||||
player.getZone(ZoneType.SchemeDeck).shuffle();
|
player.getZone(ZoneType.SchemeDeck).shuffle();
|
||||||
player.getZone(ZoneType.PlanarDeck).shuffle();
|
player.getZone(ZoneType.PlanarDeck).shuffle();
|
||||||
|
player.getZone(ZoneType.AttractionDeck).shuffle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
private boolean isImmutable = false;
|
private boolean isImmutable = false;
|
||||||
private boolean isEmblem = false;
|
private boolean isEmblem = false;
|
||||||
private boolean isBoon = false;
|
private boolean isBoon = false;
|
||||||
|
private boolean isAttractionCard = false;
|
||||||
|
|
||||||
private int exertThisTurn = 0;
|
private int exertThisTurn = 0;
|
||||||
private PlayerCollection exertedByPlayer = new PlayerCollection();
|
private PlayerCollection exertedByPlayer = new PlayerCollection();
|
||||||
@@ -4229,6 +4230,14 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
currentState.setBaseDefense(Integer.toString(n));
|
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() {
|
public final int getBasePower() {
|
||||||
return currentState.getBasePower();
|
return currentState.getBasePower();
|
||||||
}
|
}
|
||||||
@@ -5461,6 +5470,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
|
|
||||||
public final boolean isEquipment() { return getType().isEquipment(); }
|
public final boolean isEquipment() { return getType().isEquipment(); }
|
||||||
public final boolean isFortification() { return getType().isFortification(); }
|
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 isCurse() { return getType().hasSubtype("Curse"); }
|
||||||
public final boolean isAura() { return getType().isAura(); }
|
public final boolean isAura() { return getType().isAura(); }
|
||||||
public final boolean isShrine() { return getType().hasSubtype("Shrine"); }
|
public final boolean isShrine() { return getType().hasSubtype("Shrine"); }
|
||||||
@@ -5837,6 +5847,16 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
view.updateBoon(this);
|
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
|
* there are easy checkers for Color. The CardUtil functions should be made
|
||||||
* part of the Card class, so calling out is not necessary
|
* part of the Card class, so calling out is not necessary
|
||||||
|
|||||||
@@ -44,9 +44,7 @@ import forge.item.IPaperCard;
|
|||||||
import forge.util.CardTranslation;
|
import forge.util.CardTranslation;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,6 +188,8 @@ public class CardFactory {
|
|||||||
c.setImageKey(originalPicture);
|
c.setImageKey(originalPicture);
|
||||||
c.setToken(cp.isToken());
|
c.setToken(cp.isToken());
|
||||||
|
|
||||||
|
c.setAttractionCard(cardRules.getType().isAttraction());
|
||||||
|
|
||||||
if (c.hasAlternateState()) {
|
if (c.hasAlternateState()) {
|
||||||
if (c.isFlipCard()) {
|
if (c.isFlipCard()) {
|
||||||
c.setState(CardStateName.Flipped, false);
|
c.setState(CardStateName.Flipped, false);
|
||||||
@@ -393,6 +393,8 @@ public class CardFactory {
|
|||||||
c.setBaseToughnessString(face.getToughness());
|
c.setBaseToughnessString(face.getToughness());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.setAttractionLights(face.getAttractionLights());
|
||||||
|
|
||||||
// SpellPermanent only for Original State
|
// SpellPermanent only for Original State
|
||||||
if (c.getCurrentStateName() == CardStateName.Original || c.getCurrentStateName() == CardStateName.Modal || c.getCurrentStateName().toString().startsWith("Specialize")) {
|
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
|
// this is the "default" spell for permanents like creatures and artifacts
|
||||||
@@ -409,6 +411,73 @@ public class CardFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CardFactoryUtil.addAbilityFactoryAbilities(c, face.getAbilities());
|
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.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) {
|
public static void copySpellAbility(SpellAbility from, SpellAbility to, final Card host, final Player p, final boolean lki, final boolean keepTextChanges) {
|
||||||
|
|||||||
@@ -1964,6 +1964,20 @@ public class CardFactoryUtil {
|
|||||||
|
|
||||||
inst.addTrigger(parsedUpkeepTrig);
|
inst.addTrigger(parsedUpkeepTrig);
|
||||||
inst.addTrigger(parsedSacTrigger);
|
inst.addTrigger(parsedSacTrigger);
|
||||||
|
} else if (keyword.startsWith("Visit")) {
|
||||||
|
final String[] k = keyword.split(":");
|
||||||
|
//final String dbVar = card.getSVar(k[1]);
|
||||||
|
|
||||||
|
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("Dungeon")) {
|
} else if (keyword.startsWith("Dungeon")) {
|
||||||
final List<String> abs = Arrays.asList(keyword.substring("Dungeon:".length()).split(","));
|
final List<String> abs = Arrays.asList(keyword.substring("Dungeon:".length()).split(","));
|
||||||
final Map<String, SpellAbility> saMap = new LinkedHashMap<>();
|
final Map<String, SpellAbility> saMap = new LinkedHashMap<>();
|
||||||
|
|||||||
@@ -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 {
|
public static class Presets {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -768,6 +772,7 @@ public final class CardPredicates {
|
|||||||
return c.canBeDestroyed();
|
return c.canBeDestroyed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
public static final Predicate<Card> ATTRACTIONS = Card::isAttraction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Accessors {
|
public static class Accessors {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package forge.game.card;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
@@ -64,6 +65,7 @@ public class CardState extends GameObject implements IHasSVars {
|
|||||||
private String baseLoyalty = "";
|
private String baseLoyalty = "";
|
||||||
private String baseDefense = "";
|
private String baseDefense = "";
|
||||||
private KeywordCollection intrinsicKeywords = new KeywordCollection();
|
private KeywordCollection intrinsicKeywords = new KeywordCollection();
|
||||||
|
private Set<Integer> attractionLights = null;
|
||||||
|
|
||||||
private final FCollection<SpellAbility> nonManaAbilities = new FCollection<>();
|
private final FCollection<SpellAbility> nonManaAbilities = new FCollection<>();
|
||||||
private final FCollection<SpellAbility> manaAbilities = new FCollection<>();
|
private final FCollection<SpellAbility> manaAbilities = new FCollection<>();
|
||||||
@@ -240,6 +242,15 @@ public class CardState extends GameObject implements IHasSVars {
|
|||||||
view.updateDefense(this);
|
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() {
|
public final Collection<KeywordInterface> getCachedKeywords() {
|
||||||
return cachedKeywords.getValues();
|
return cachedKeywords.getValues();
|
||||||
}
|
}
|
||||||
@@ -588,6 +599,7 @@ public class CardState extends GameObject implements IHasSVars {
|
|||||||
setBaseToughness(source.getBaseToughness());
|
setBaseToughness(source.getBaseToughness());
|
||||||
setBaseLoyalty(source.getBaseLoyalty());
|
setBaseLoyalty(source.getBaseLoyalty());
|
||||||
setBaseDefense(source.getBaseDefense());
|
setBaseDefense(source.getBaseDefense());
|
||||||
|
setAttractionLights(source.getAttractionLights());
|
||||||
setSVars(source.getSVars());
|
setSVars(source.getSVars());
|
||||||
|
|
||||||
manaAbilities.clear();
|
manaAbilities.clear();
|
||||||
|
|||||||
@@ -570,6 +570,7 @@ public class CardView extends GameEntityView {
|
|||||||
case Graveyard:
|
case Graveyard:
|
||||||
case Flashback:
|
case Flashback:
|
||||||
case Stack:
|
case Stack:
|
||||||
|
case Junkyard:
|
||||||
//cards in these zones are visible to all
|
//cards in these zones are visible to all
|
||||||
return true;
|
return true;
|
||||||
case Exile:
|
case Exile:
|
||||||
@@ -592,6 +593,7 @@ public class CardView extends GameEntityView {
|
|||||||
return true;
|
return true;
|
||||||
case Library:
|
case Library:
|
||||||
case PlanarDeck:
|
case PlanarDeck:
|
||||||
|
case AttractionDeck:
|
||||||
//cards in these zones are hidden to all unless they specify otherwise
|
//cards in these zones are hidden to all unless they specify otherwise
|
||||||
break;
|
break;
|
||||||
case SchemeDeck:
|
case SchemeDeck:
|
||||||
@@ -795,6 +797,12 @@ public class CardView extends GameEntityView {
|
|||||||
sb.append(nonAbilityText.replaceAll("CARDNAME", getName()));
|
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());
|
sb.append(getRemembered());
|
||||||
|
|
||||||
Direction chosenDirection = getChosenDirection();
|
Direction chosenDirection = getChosenDirection();
|
||||||
@@ -1010,6 +1018,8 @@ public class CardView extends GameEntityView {
|
|||||||
currentState.getView().updateKeywords(c, currentState); //update keywords even if state doesn't change
|
currentState.getView().updateKeywords(c, currentState); //update keywords even if state doesn't change
|
||||||
currentState.getView().setOriginalColors(c); //set original Colors
|
currentState.getView().setOriginalColors(c); //set original Colors
|
||||||
|
|
||||||
|
currentStateView.updateAttractionLights(currentState);
|
||||||
|
|
||||||
CardState alternateState = isSplitCard && isFaceDown() ? c.getState(CardStateName.RightSplit) : c.getAlternateState();
|
CardState alternateState = isSplitCard && isFaceDown() ? c.getState(CardStateName.RightSplit) : c.getAlternateState();
|
||||||
|
|
||||||
if (isSplitCard && isFaceDown()) {
|
if (isSplitCard && isFaceDown()) {
|
||||||
@@ -1419,6 +1429,13 @@ public class CardView extends GameEntityView {
|
|||||||
updateDefense("0");
|
updateDefense("0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<Integer> getAttractionLights() {
|
||||||
|
return get(TrackableProperty.AttractionLights);
|
||||||
|
}
|
||||||
|
void updateAttractionLights(CardState c) {
|
||||||
|
set(TrackableProperty.AttractionLights, c.getAttractionLights());
|
||||||
|
}
|
||||||
|
|
||||||
public String getSetCode() {
|
public String getSetCode() {
|
||||||
return get(TrackableProperty.SetCode);
|
return get(TrackableProperty.SetCode);
|
||||||
}
|
}
|
||||||
@@ -1697,6 +1714,9 @@ public class CardView extends GameEntityView {
|
|||||||
return false;
|
return false;
|
||||||
return Iterables.size(getType().getCoreTypes()) > 1;
|
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
|
//special methods for updating card and player properties as needed and returning the new collection
|
||||||
|
|||||||
@@ -281,12 +281,16 @@ public class PhaseHandler implements java.io.Serializable {
|
|||||||
playerTurn.setSchemeInMotion(null);
|
playerTurn.setSchemeInMotion(null);
|
||||||
}
|
}
|
||||||
GameEntityCounterTable table = new GameEntityCounterTable();
|
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)) {
|
for (Card c : playerTurn.getCardsIn(ZoneType.Battlefield)) {
|
||||||
if (c.isSaga()) {
|
if (c.isSaga()) {
|
||||||
c.addCounter(CounterEnumType.LORE, 1, playerTurn, table);
|
c.addCounter(CounterEnumType.LORE, 1, playerTurn, table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// roll for attractions if we have any
|
||||||
|
if (CardLists.count(playerTurn.getCardsIn(ZoneType.Battlefield), Presets.ATTRACTIONS) > 0) {
|
||||||
|
playerTurn.rollToVisitAttractions();
|
||||||
|
}
|
||||||
table.replaceCounterEffect(game, null, false);
|
table.replaceCounterEffect(game, null, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import forge.item.PaperCard;
|
|||||||
import forge.util.*;
|
import forge.util.*;
|
||||||
import forge.util.collect.FCollection;
|
import forge.util.collect.FCollection;
|
||||||
import forge.util.collect.FCollectionView;
|
import forge.util.collect.FCollectionView;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
@@ -78,7 +79,8 @@ import java.util.Map.Entry;
|
|||||||
public class Player extends GameEntity implements Comparable<Player> {
|
public class Player extends GameEntity implements Comparable<Player> {
|
||||||
public static final List<ZoneType> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(ZoneType.Battlefield,
|
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.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();
|
private final Map<Card, Integer> commanderDamage = Maps.newHashMap();
|
||||||
|
|
||||||
@@ -162,6 +164,8 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
private CardCollection currentPlanes = new CardCollection();
|
private CardCollection currentPlanes = new CardCollection();
|
||||||
private CardCollection planeswalkedToThisTurn = new CardCollection();
|
private CardCollection planeswalkedToThisTurn = new CardCollection();
|
||||||
|
|
||||||
|
private int attractionsVisitedThisTurn = 0; //TODO: Is "number of attractions you visited this turn" supposed to mean unique ones or just total visits?
|
||||||
|
|
||||||
private PlayerStatistics stats = new PlayerStatistics();
|
private PlayerStatistics stats = new PlayerStatistics();
|
||||||
private PlayerController controller;
|
private PlayerController controller;
|
||||||
|
|
||||||
@@ -1947,6 +1951,12 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
public final List<Card> getPlaneswalkedToThisTurn() {
|
public final List<Card> getPlaneswalkedToThisTurn() {
|
||||||
return planeswalkedToThisTurn;
|
return planeswalkedToThisTurn;
|
||||||
}
|
}
|
||||||
|
public final void incrementAttractionsVisitedThisTurn() {
|
||||||
|
this.attractionsVisitedThisTurn++;
|
||||||
|
}
|
||||||
|
public final int getAttractionsVisitedThisTurn() {
|
||||||
|
return attractionsVisitedThisTurn;
|
||||||
|
}
|
||||||
|
|
||||||
public final void altWinBySpellEffect(final String sourceName) {
|
public final void altWinBySpellEffect(final String sourceName) {
|
||||||
if (cantWin()) {
|
if (cantWin()) {
|
||||||
@@ -2517,6 +2527,8 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
damageReceivedThisTurn.clear();
|
damageReceivedThisTurn.clear();
|
||||||
planeswalkedToThisTurn.clear();
|
planeswalkedToThisTurn.clear();
|
||||||
|
|
||||||
|
attractionsVisitedThisTurn = 0;
|
||||||
|
|
||||||
// set last turn nr
|
// set last turn nr
|
||||||
if (game.getPhaseHandler().isPlayerTurn(this)) {
|
if (game.getPhaseHandler().isPlayerTurn(this)) {
|
||||||
setBeenDealtCombatDamageSinceLastTurn(false);
|
setBeenDealtCombatDamageSinceLastTurn(false);
|
||||||
@@ -2952,6 +2964,14 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
com.add(conspire);
|
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
|
// Adventure Mode items
|
||||||
Iterable<? extends IPaperCard> adventureItemCards = registeredPlayer.getExtraCardsInCommandZone();
|
Iterable<? extends IPaperCard> adventureItemCards = registeredPlayer.getExtraCardsInCommandZone();
|
||||||
if (adventureItemCards != null) {
|
if (adventureItemCards != null) {
|
||||||
@@ -3802,4 +3822,81 @@ public class Player extends GameEntity implements Comparable<Player> {
|
|||||||
public void setCommitedCrimeThisTurn(int v) {
|
public void setCommitedCrimeThisTurn(int v) {
|
||||||
committedCrimeThisTurn = v;
|
committedCrimeThisTurn = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void visitAttractions(int light) {
|
||||||
|
CardCollection attractions = CardLists.filter(getCardsIn(ZoneType.Battlefield), CardPredicates.isAttractionWithLight(light));
|
||||||
|
if(attractions.isEmpty())
|
||||||
|
return;
|
||||||
|
for (Card c : attractions) {
|
||||||
|
incrementAttractionsVisitedThisTurn();
|
||||||
|
|
||||||
|
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
|
runParams.put(AbilityKey.Card, c);
|
||||||
|
runParams.put(AbilityKey.Player, this);
|
||||||
|
game.getTriggerHandler().runTrigger(TriggerType.VisitAttraction, runParams, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void rollToVisitAttractions() {
|
||||||
|
//Essentially a retread of RollDiceEffect.rollDiceForPlayer, but without the parts that require a spell ability.
|
||||||
|
int amount = 1, sides = 6, ignore = 0;
|
||||||
|
Map<Player, Integer> ignoreChosenMap = Maps.newHashMap();
|
||||||
|
|
||||||
|
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(this);
|
||||||
|
repParams.put(AbilityKey.Number, amount);
|
||||||
|
repParams.put(AbilityKey.Ignore, ignore);
|
||||||
|
repParams.put(AbilityKey.IgnoreChosen, ignoreChosenMap);
|
||||||
|
|
||||||
|
if(getGame().getReplacementHandler().run(ReplacementType.RollDice, repParams) == ReplacementResult.Updated) {
|
||||||
|
amount = (int) repParams.get(AbilityKey.Number);
|
||||||
|
ignore = (int) repParams.get(AbilityKey.Ignore);
|
||||||
|
//noinspection unchecked
|
||||||
|
ignoreChosenMap = (Map<Player, Integer>) repParams.get(AbilityKey.IgnoreChosen);
|
||||||
|
}
|
||||||
|
if (amount == 0)
|
||||||
|
return;
|
||||||
|
int total = 0;
|
||||||
|
List<Integer> naturalRolls = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < amount; i++) {
|
||||||
|
int roll = MyRandom.getRandom().nextInt(sides) + 1;
|
||||||
|
// Play the die roll sound
|
||||||
|
getGame().fireEvent(new GameEventRollDie());
|
||||||
|
roll();
|
||||||
|
naturalRolls.add(roll);
|
||||||
|
total += roll;
|
||||||
|
}
|
||||||
|
|
||||||
|
naturalRolls.sort(null);
|
||||||
|
|
||||||
|
List<Integer> ignored = new ArrayList<>();
|
||||||
|
// Ignore the lowest rolls
|
||||||
|
if (ignore > 0) {
|
||||||
|
for (int i = ignore - 1; i >= 0; --i) {
|
||||||
|
total -= naturalRolls.get(i);
|
||||||
|
ignored.add(naturalRolls.get(i));
|
||||||
|
naturalRolls.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Player chooses to ignore rolls
|
||||||
|
for (Player chooser : ignoreChosenMap.keySet()) {
|
||||||
|
for (int ig = 0; ig < ignoreChosenMap.get(chooser); ig++) {
|
||||||
|
Integer ign = chooser.getController().chooseRollToIgnore(naturalRolls);
|
||||||
|
total -= ign;
|
||||||
|
ignored.add(ign);
|
||||||
|
naturalRolls.remove(ign);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String rollResults = StringUtils.join(naturalRolls, ", ");
|
||||||
|
String resultMessage = "lblAttractionRollResult";
|
||||||
|
sb.append(Localizer.getInstance().getMessage(resultMessage, this, rollResults));
|
||||||
|
if (!ignored.isEmpty()) {
|
||||||
|
sb.append("\r\n").append(Localizer.getInstance().getMessage("lblIgnoredRolls",
|
||||||
|
StringUtils.join(ignored, ", ")));
|
||||||
|
}
|
||||||
|
getGame().getAction().notifyOfValue(null, this, sb.toString(), null);
|
||||||
|
|
||||||
|
this.visitAttractions(total);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class RegisteredPlayer {
|
|||||||
private Iterable<? extends IPaperCard> schemes = null;
|
private Iterable<? extends IPaperCard> schemes = null;
|
||||||
private Iterable<PaperCard> planes = null;
|
private Iterable<PaperCard> planes = null;
|
||||||
private Iterable<PaperCard> conspiracies = null;
|
private Iterable<PaperCard> conspiracies = null;
|
||||||
|
private Iterable<PaperCard> attractions = null;
|
||||||
private List<PaperCard> commanders = Lists.newArrayList();
|
private List<PaperCard> commanders = Lists.newArrayList();
|
||||||
private List<PaperCard> vanguardAvatars = null;
|
private List<PaperCard> vanguardAvatars = null;
|
||||||
private PaperCard planeswalker = null;
|
private PaperCard planeswalker = null;
|
||||||
@@ -223,8 +224,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() {
|
public void restoreDeck() {
|
||||||
currentDeck = (Deck) originalDeck.copyTo(originalDeck.getName());
|
currentDeck = (Deck) originalDeck.copyTo(originalDeck.getName());
|
||||||
|
assignAttractions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useRandomFoil() {
|
public boolean useRandomFoil() {
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ public enum TriggerType {
|
|||||||
Unattach(TriggerUnattach.class),
|
Unattach(TriggerUnattach.class),
|
||||||
UntapAll(TriggerUntapAll.class),
|
UntapAll(TriggerUntapAll.class),
|
||||||
Untaps(TriggerUntaps.class),
|
Untaps(TriggerUntaps.class),
|
||||||
|
VisitAttraction(TriggerVisitAttraction.class),
|
||||||
Vote(TriggerVote.class);
|
Vote(TriggerVote.class);
|
||||||
|
|
||||||
private final Constructor<? extends Trigger> constructor;
|
private final Constructor<? extends Trigger> constructor;
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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) {
|
||||||
|
//TODO: Do I even need this much? Someone would need to implement a card to visit someone else's attraction...
|
||||||
|
return Localizer.getInstance().getMessage("lblPlayer") + ": " +
|
||||||
|
sa.getTriggeringObject(AbilityKey.Player);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,8 @@ public enum ZoneType {
|
|||||||
Merged(false, "lblBattlefieldZone"),
|
Merged(false, "lblBattlefieldZone"),
|
||||||
SchemeDeck(true, "lblSchemeDeckZone"),
|
SchemeDeck(true, "lblSchemeDeckZone"),
|
||||||
PlanarDeck(true, "lblPlanarDeckZone"),
|
PlanarDeck(true, "lblPlanarDeckZone"),
|
||||||
|
AttractionDeck(true, "lblAttractionDeckZone"),
|
||||||
|
Junkyard(false, "lblJunkyardZone"),
|
||||||
Subgame(true, "lblSubgameZone"),
|
Subgame(true, "lblSubgameZone"),
|
||||||
None(true, "lblNoneZone");
|
None(true, "lblNoneZone");
|
||||||
|
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ public enum TrackableProperty {
|
|||||||
Toughness(TrackableTypes.IntegerType),
|
Toughness(TrackableTypes.IntegerType),
|
||||||
Loyalty(TrackableTypes.StringType),
|
Loyalty(TrackableTypes.StringType),
|
||||||
Defense(TrackableTypes.StringType),
|
Defense(TrackableTypes.StringType),
|
||||||
|
AttractionLights(TrackableTypes.IntegerSetType),
|
||||||
ChangedColorWords(TrackableTypes.StringMapType),
|
ChangedColorWords(TrackableTypes.StringMapType),
|
||||||
HasChangedColors(TrackableTypes.BooleanType),
|
HasChangedColors(TrackableTypes.BooleanType),
|
||||||
ChangedTypes(TrackableTypes.StringMapType),
|
ChangedTypes(TrackableTypes.StringMapType),
|
||||||
|
|||||||
@@ -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>>() {
|
public static final TrackableType<Map<Integer, Integer>> IntegerMapType = new TrackableType<Map<Integer, Integer>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer, Integer> getDefaultValue() {
|
public Map<Integer, Integer> getDefaultValue() {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
private DeckController<Deck> controller;
|
private DeckController<Deck> controller;
|
||||||
private final List<DeckSection> allSections = new ArrayList<>();
|
private final List<DeckSection> allSections = new ArrayList<>();
|
||||||
private ItemPool<PaperCard> normalPool, avatarPool, planePool, schemePool, conspiracyPool,
|
private ItemPool<PaperCard> normalPool, avatarPool, planePool, schemePool, conspiracyPool,
|
||||||
commanderPool, dungeonPool;
|
commanderPool, dungeonPool, attractionPool;
|
||||||
|
|
||||||
CardManager catalogManager;
|
CardManager catalogManager;
|
||||||
CardManager deckManager;
|
CardManager deckManager;
|
||||||
@@ -131,6 +131,9 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allSections.add(DeckSection.Attractions);
|
||||||
|
attractionPool = FModel.getAttractionPool();
|
||||||
|
|
||||||
catalogManager = new CardManager(getCDetailPicture(), wantUnique, false, false);
|
catalogManager = new CardManager(getCDetailPicture(), wantUnique, false, false);
|
||||||
deckManager = new CardManager(getCDetailPicture(), false, false, false);
|
deckManager = new CardManager(getCDetailPicture(), false, false, false);
|
||||||
deckManager.setAlwaysNonUnique(true);
|
deckManager.setAlwaysNonUnique(true);
|
||||||
@@ -342,6 +345,9 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
case Dungeon:
|
case Dungeon:
|
||||||
cmb.addMoveItems(localizer.getMessage("lblAdd"), localizer.getMessage("lbltodungeondeck"));
|
cmb.addMoveItems(localizer.getMessage("lblAdd"), localizer.getMessage("lbltodungeondeck"));
|
||||||
break;
|
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:
|
case Dungeon:
|
||||||
cmb.addMoveItems(localizer.getMessage("lblRemove"), localizer.getMessage("lblfromdungeondeck"));
|
cmb.addMoveItems(localizer.getMessage("lblRemove"), localizer.getMessage("lblfromdungeondeck"));
|
||||||
break;
|
break;
|
||||||
|
case Attractions:
|
||||||
|
cmb.addMoveItems(localizer.getMessage("lblRemove"), localizer.getMessage("lblfromattractiondeck"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (foilAvailable) {
|
if (foilAvailable) {
|
||||||
cmb.addMakeFoils();
|
cmb.addMakeFoils();
|
||||||
@@ -482,6 +491,12 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
this.getCatalogManager().setAllowMultipleSelections(true);
|
this.getCatalogManager().setAllowMultipleSelections(true);
|
||||||
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Dungeon));
|
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Dungeon));
|
||||||
break;
|
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 Commander:
|
||||||
case Oathbreaker:
|
case Oathbreaker:
|
||||||
@@ -506,6 +521,12 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
this.getCatalogManager().setAllowMultipleSelections(false);
|
this.getCatalogManager().setAllowMultipleSelections(false);
|
||||||
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Commander));
|
this.getDeckManager().setPool(this.controller.getModel().getOrCreate(DeckSection.Commander));
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
|
|||||||
|
|
||||||
allSections.add(DeckSection.Main);
|
allSections.add(DeckSection.Main);
|
||||||
allSections.add(DeckSection.Conspiracy);
|
allSections.add(DeckSection.Conspiracy);
|
||||||
|
allSections.add(DeckSection.Attractions);
|
||||||
|
|
||||||
this.getCbxSection().removeAllItems();
|
this.getCbxSection().removeAllItems();
|
||||||
for (DeckSection section : allSections) {
|
for (DeckSection section : allSections) {
|
||||||
@@ -221,6 +222,10 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
|
|||||||
this.getCatalogManager().setup(ItemManagerConfig.DRAFT_CONSPIRACY);
|
this.getCatalogManager().setup(ItemManagerConfig.DRAFT_CONSPIRACY);
|
||||||
this.getDeckManager().setPool(getHumanDeck().getOrCreate(DeckSection.Conspiracy));
|
this.getDeckManager().setPool(getHumanDeck().getOrCreate(DeckSection.Conspiracy));
|
||||||
break;
|
break;
|
||||||
|
case Attractions:
|
||||||
|
this.getCatalogManager().setup(ItemManagerConfig.ATTRACTION_POOL);
|
||||||
|
this.getDeckManager().setPool(getHumanDeck().getOrCreate(DeckSection.Attractions));
|
||||||
|
break;
|
||||||
case Main:
|
case Main:
|
||||||
this.getCatalogManager().setup(getScreen() == FScreen.DECK_EDITOR_DRAFT ? ItemManagerConfig.DRAFT_POOL : ItemManagerConfig.SEALED_POOL);
|
this.getCatalogManager().setup(getScreen() == FScreen.DECK_EDITOR_DRAFT ? ItemManagerConfig.DRAFT_POOL : ItemManagerConfig.SEALED_POOL);
|
||||||
this.getDeckManager().setPool(getHumanDeck().getOrCreate(DeckSection.Main));
|
this.getDeckManager().setPool(getHumanDeck().getOrCreate(DeckSection.Main));
|
||||||
|
|||||||
@@ -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) {
|
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 cardArtHeight = h + 2 * FList.PADDING;
|
||||||
float cardArtWidth = cardArtHeight * CARD_ART_RATIO;
|
float cardArtWidth = cardArtHeight * CARD_ART_RATIO;
|
||||||
|
CardView.CardStateView cardCurrentState = card.getCurrentState();
|
||||||
if (cardArt != null) {
|
if (cardArt != null) {
|
||||||
float artX = x - FList.PADDING;
|
float artX = x - FList.PADDING;
|
||||||
float artY = y - 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, 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);
|
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")) {
|
} 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(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);
|
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 {
|
} else {
|
||||||
@@ -495,7 +496,7 @@ public class CardRenderer {
|
|||||||
|
|
||||||
//render card name and mana cost on first line
|
//render card name and mana cost on first line
|
||||||
float manaCostWidth = 0;
|
float manaCostWidth = 0;
|
||||||
ManaCost mainManaCost = card.getCurrentState().getManaCost();
|
ManaCost mainManaCost = cardCurrentState.getManaCost();
|
||||||
if (card.isSplitCard()) {
|
if (card.isSplitCard()) {
|
||||||
//handle rendering both parts of split card
|
//handle rendering both parts of split card
|
||||||
mainManaCost = card.getLeftSplitState().getManaCost();
|
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);
|
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);
|
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 + ")";
|
type += " (" + power + " / " + toughness + ")";
|
||||||
} else if (card.getCurrentState().isPlaneswalker()) {
|
} else if (cardCurrentState.isPlaneswalker()) {
|
||||||
type += " (" + loyalty + ")";
|
type += " (" + loyalty + ")";
|
||||||
} else if (card.getCurrentState().getType().hasSubtype("Vehicle")) {
|
} else if (cardCurrentState.isVehicle()) {
|
||||||
type += String.format(" [%s / %s]", power, toughness);
|
type += String.format(" [%s / %s]", power, toughness);
|
||||||
} else if (card.getCurrentState().isBattle()) {
|
} else if (cardCurrentState.isBattle()) {
|
||||||
type += " (" + card.getCurrentState().getDefense() + ")";
|
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);
|
g.drawText(type, typeFont, foreColor, x, y, availableTypeWidth, lineHeight, false, Align.left, true);
|
||||||
}
|
}
|
||||||
|
|||||||
12
forge-gui/res/cardsfolder/f/fortune_teller.txt
Normal file
12
forge-gui/res/cardsfolder/f/fortune_teller.txt
Normal 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.
|
||||||
10
forge-gui/res/cardsfolder/i/information_booth.txt
Normal file
10
forge-gui/res/cardsfolder/i/information_booth.txt
Normal 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.
|
||||||
8
forge-gui/res/cardsfolder/p/petting_zookeeper.txt
Normal file
8
forge-gui/res/cardsfolder/p/petting_zookeeper.txt
Normal 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.
|
||||||
8
forge-gui/res/cardsfolder/q/quick_fixer.txt
Normal file
8
forge-gui/res/cardsfolder/q/quick_fixer.txt
Normal 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.
|
||||||
7
forge-gui/res/cardsfolder/r/rad_rascal.txt
Normal file
7
forge-gui/res/cardsfolder/r/rad_rascal.txt
Normal 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.
|
||||||
7
forge-gui/res/cardsfolder/r/ride_guide.txt
Normal file
7
forge-gui/res/cardsfolder/r/ride_guide.txt
Normal 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.
|
||||||
7
forge-gui/res/cardsfolder/s/seasoned_buttoneer.txt
Normal file
7
forge-gui/res/cardsfolder/s/seasoned_buttoneer.txt
Normal 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.
|
||||||
@@ -217,13 +217,21 @@ F208 C Dart Throw @Gaboleps
|
|||||||
209 C Drop Tower @Dmitry Burmak
|
209 C Drop Tower @Dmitry Burmak
|
||||||
210 R Ferris Wheel @Kirsten Zirngibl
|
210 R Ferris Wheel @Kirsten Zirngibl
|
||||||
211 C Foam Weapons Kiosk @Matt Gaser
|
211 C Foam Weapons Kiosk @Matt Gaser
|
||||||
212 C Fortune Teller @Jamroz Gary
|
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
|
||||||
F213 R Gallery of Legends @Jakub Kasper
|
F213 R Gallery of Legends @Jakub Kasper
|
||||||
F214 R Gift Shop @Matt Gaser
|
F214 R Gift Shop @Matt Gaser
|
||||||
F215 U Guess Your Fate @Bruce Brenneise
|
F215 U Guess Your Fate @Bruce Brenneise
|
||||||
216 R Hall of Mirrors @Vincent Christiaens
|
216 R Hall of Mirrors @Vincent Christiaens
|
||||||
217 R Haunted House @Dmitry Burmak
|
217 R Haunted House @Dmitry Burmak
|
||||||
218 U Information Booth @Gaboleps
|
218a U Information Booth @Gaboleps $A
|
||||||
|
218b U Information Booth @Gaboleps $B
|
||||||
|
218c U Information Booth @Gaboleps $C
|
||||||
|
218d U Information Booth @Gaboleps $D
|
||||||
219 C Kiddie Coaster @Marco Bucci
|
219 C Kiddie Coaster @Marco Bucci
|
||||||
F220 R Log Flume @Marco Bucci
|
F220 R Log Flume @Marco Bucci
|
||||||
F221 R Memory Test @Setor Fiadzigbey
|
F221 R Memory Test @Setor Fiadzigbey
|
||||||
|
|||||||
@@ -908,10 +908,12 @@ lblfromschemedeck=from scheme deck
|
|||||||
lblfromplanardeck=from planar deck
|
lblfromplanardeck=from planar deck
|
||||||
lblfromconspiracydeck=from conspiracy deck
|
lblfromconspiracydeck=from conspiracy deck
|
||||||
lblfromdungeondeck=from dungeon deck
|
lblfromdungeondeck=from dungeon deck
|
||||||
|
lblfromattractiondeck=from attraction deck
|
||||||
lbltoschemedeck=to scheme deck
|
lbltoschemedeck=to scheme deck
|
||||||
lbltoplanardeck=to planar deck
|
lbltoplanardeck=to planar deck
|
||||||
lbltoconspiracydeck=to conspiracy deck
|
lbltoconspiracydeck=to conspiracy deck
|
||||||
lbltodungeondeck=to dungeon deck
|
lbltodungeondeck=to dungeon deck
|
||||||
|
lbltoattractiondeck=to attraction deck
|
||||||
lblMove=Move
|
lblMove=Move
|
||||||
#VDock.java
|
#VDock.java
|
||||||
lblDock=Dock
|
lblDock=Dock
|
||||||
@@ -1344,6 +1346,7 @@ lblChooseOrderCardsPutIntoGraveyard=Choose order of cards to put into the gravey
|
|||||||
lblClosestToBottom=Closest to bottom
|
lblClosestToBottom=Closest to bottom
|
||||||
lblChooseOrderCardsPutIntoPlanarDeck=Choose order of cards to put into the planar deck
|
lblChooseOrderCardsPutIntoPlanarDeck=Choose order of cards to put into the planar deck
|
||||||
lblChooseOrderCardsPutIntoSchemeDeck=Choose order of cards to put into the scheme 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
|
lblChooseOrderCopiesCast=Choose order of copies to cast
|
||||||
lblChooseOrderCards=Choose card order
|
lblChooseOrderCards=Choose card order
|
||||||
lblDelveHowManyCards=Delve how many cards?
|
lblDelveHowManyCards=Delve how many cards?
|
||||||
@@ -2087,6 +2090,7 @@ lblDoYouWantRevealYourHand=Do you want to reveal your hand?
|
|||||||
lblPlayerRolledResult={0} rolled {1}
|
lblPlayerRolledResult={0} rolled {1}
|
||||||
lblIgnoredRolls=Ignored rolls: {0}
|
lblIgnoredRolls=Ignored rolls: {0}
|
||||||
lblRerollResult=Reroll {0}?
|
lblRerollResult=Reroll {0}?
|
||||||
|
lblAttractionRollResult={0} rolled to visit their Attractions. Result: {1}.
|
||||||
#RollPlanarDiceEffect.java
|
#RollPlanarDiceEffect.java
|
||||||
lblPlanarDiceResult=Planar dice result: {0}
|
lblPlanarDiceResult=Planar dice result: {0}
|
||||||
#SacrificeEffect.java
|
#SacrificeEffect.java
|
||||||
@@ -2181,6 +2185,8 @@ lblSideboardZone=sideboard
|
|||||||
lblAnteZone=ante
|
lblAnteZone=ante
|
||||||
lblSchemeDeckZone=schemedeck
|
lblSchemeDeckZone=schemedeck
|
||||||
lblPlanarDeckZone=planardeck
|
lblPlanarDeckZone=planardeck
|
||||||
|
lblAttractionDeckZone=attractiondeck
|
||||||
|
lblJunkyardZone=junkyard
|
||||||
lblSubgameZone=subgame
|
lblSubgameZone=subgame
|
||||||
lblNoneZone=none
|
lblNoneZone=none
|
||||||
#BoosterDraft.java
|
#BoosterDraft.java
|
||||||
@@ -3004,6 +3010,7 @@ lblDetails=Details
|
|||||||
lblChosenColors=Chosen colors:
|
lblChosenColors=Chosen colors:
|
||||||
lblLoyalty=Loyalty
|
lblLoyalty=Loyalty
|
||||||
lblDefense=Defense
|
lblDefense=Defense
|
||||||
|
lblLights=Lights
|
||||||
#Achievement.java
|
#Achievement.java
|
||||||
lblStandard=Standard
|
lblStandard=Standard
|
||||||
lblChaos=Chaos
|
lblChaos=Chaos
|
||||||
|
|||||||
@@ -459,8 +459,7 @@ public class DeckImportController {
|
|||||||
// Account for any [un]foiled version
|
// Account for any [un]foiled version
|
||||||
PaperCard cardKey;
|
PaperCard cardKey;
|
||||||
if (card.isFoil())
|
if (card.isFoil())
|
||||||
cardKey = new PaperCard(card.getRules(), card.getEdition(), card.getRarity(), card.getArtIndex(),
|
cardKey = card.getUnFoiled();
|
||||||
false, card.getCollectorNumber(), card.getArtist());
|
|
||||||
else
|
else
|
||||||
cardKey = card.getFoiled();
|
cardKey = card.getFoiled();
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class CardDetailUtil {
|
public class CardDetailUtil {
|
||||||
@@ -210,6 +211,17 @@ public class CardDetailUtil {
|
|||||||
ptText.append(card.getDefense());
|
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();
|
return ptText.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ public enum ItemManagerConfig {
|
|||||||
null, null, 4, 0),
|
null, null, 4, 0),
|
||||||
PLANAR_DECK_EDITOR(SColumnUtil.getCatalogDefaultColumns(true), true, false, true,
|
PLANAR_DECK_EDITOR(SColumnUtil.getCatalogDefaultColumns(true), true, false, true,
|
||||||
null, null, 4, 0),
|
null, null, 4, 0),
|
||||||
|
ATTRACTION_POOL(SColumnUtil.getSpecialCardPoolDefaultColumns(), false, false, true,
|
||||||
|
null, null, 4, 0),
|
||||||
COMMANDER_POOL(SColumnUtil.getCatalogDefaultColumns(true), true, false, false,
|
COMMANDER_POOL(SColumnUtil.getCatalogDefaultColumns(true), true, false, false,
|
||||||
null, null, 4, 0),
|
null, null, 4, 0),
|
||||||
COMMANDER_SECTION(SColumnUtil.getCatalogDefaultColumns(true), true, false, true,
|
COMMANDER_SECTION(SColumnUtil.getCatalogDefaultColumns(true), true, false, true,
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public final class FModel {
|
|||||||
private static GameFormat.Collection formats;
|
private static GameFormat.Collection formats;
|
||||||
private static ItemPool<PaperCard> uniqueCardsNoAlt, allCardsNoAlt, planechaseCards, archenemyCards,
|
private static ItemPool<PaperCard> uniqueCardsNoAlt, allCardsNoAlt, planechaseCards, archenemyCards,
|
||||||
brawlCommander, oathbreakerCommander, tinyLeadersCommander, commanderPool,
|
brawlCommander, oathbreakerCommander, tinyLeadersCommander, commanderPool,
|
||||||
avatarPool, conspiracyPool, dungeonPool;
|
avatarPool, conspiracyPool, dungeonPool, attractionPool;
|
||||||
|
|
||||||
public static void initialize(final IProgressBar progressBar, Function<ForgePreferences, Void> adjustPrefs) {
|
public static void initialize(final IProgressBar progressBar, Function<ForgePreferences, Void> adjustPrefs) {
|
||||||
//init version to log
|
//init version to log
|
||||||
@@ -297,6 +297,7 @@ public final class FModel {
|
|||||||
allCardsNoAlt = getAllCardsNoAlt();
|
allCardsNoAlt = getAllCardsNoAlt();
|
||||||
archenemyCards = getArchenemyCards();
|
archenemyCards = getArchenemyCards();
|
||||||
planechaseCards = getPlanechaseCards();
|
planechaseCards = getPlanechaseCards();
|
||||||
|
attractionPool = getAttractionPool();
|
||||||
if (GuiBase.getInterface().isLibgdxPort()) {
|
if (GuiBase.getInterface().isLibgdxPort()) {
|
||||||
//preload mobile Itempool
|
//preload mobile Itempool
|
||||||
uniqueCardsNoAlt = getUniqueCardsNoAlt();
|
uniqueCardsNoAlt = getUniqueCardsNoAlt();
|
||||||
@@ -392,6 +393,11 @@ public final class FModel {
|
|||||||
return dungeonPool;
|
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;
|
private static boolean keywordsLoaded = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1174,6 +1174,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
case SchemeDeck:
|
case SchemeDeck:
|
||||||
choices = getGui().order(localizer.getMessage("lblChooseOrderCardsPutIntoSchemeDeck"), localizer.getMessage("lblClosestToTop"), choices, null);
|
choices = getGui().order(localizer.getMessage("lblChooseOrderCardsPutIntoSchemeDeck"), localizer.getMessage("lblClosestToTop"), choices, null);
|
||||||
break;
|
break;
|
||||||
|
case AttractionDeck:
|
||||||
|
choices = getGui().order(localizer.getMessage("lblChooseOrderCardsPutIntoAttractionDeck"), localizer.getMessage("lblClosestToTop"), choices, null);
|
||||||
case Stack:
|
case Stack:
|
||||||
choices = getGui().order(localizer.getMessage("lblChooseOrderCopiesCast"), localizer.getMessage("lblPutFirst"), choices, null);
|
choices = getGui().order(localizer.getMessage("lblChooseOrderCopiesCast"), localizer.getMessage("lblPutFirst"), choices, null);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class DeckAIUtils {
|
|||||||
case Schemes: return localizer.getMessage("lblSchemeDeck");
|
case Schemes: return localizer.getMessage("lblSchemeDeck");
|
||||||
case Conspiracy: return /* TODO localise */ "Conspiracy";
|
case Conspiracy: return /* TODO localise */ "Conspiracy";
|
||||||
case Dungeon: return /* TODO localise */ "Dungeon";
|
case Dungeon: return /* TODO localise */ "Dungeon";
|
||||||
|
case Attractions: return /* TODO localize */ "Attractions";
|
||||||
default: return /* TODO better handling */ "UNKNOWN";
|
default: return /* TODO better handling */ "UNKNOWN";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user