Improved flexibility of culture and site block json values. Added future card definition json goal file.
This commit is contained in:
89
gemp-lotr/card-definition-example.hjson
Normal file
89
gemp-lotr/card-definition-example.hjson
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
1_12E: {
|
||||||
|
cardInfo: {
|
||||||
|
imagePath: errata/71_13.jpg
|
||||||
|
//If this is true, then all gameplay-related info outside this cardInfo definition
|
||||||
|
// will be ignored and the java class loaded instead.
|
||||||
|
javaClass: false
|
||||||
|
//This instructs the blueprint generator to insert this card as an alt of the listed
|
||||||
|
// parent blueprint. Can of course be ommitted if not an errata or promo.
|
||||||
|
parent: 01_13
|
||||||
|
//This is the tree path to use within the alts structure on the parent.
|
||||||
|
// Can of course be ommitted if parent is null.
|
||||||
|
parentPath: errata/pc
|
||||||
|
//Versioning differentiates releases within a particular alt path, such as PC errata
|
||||||
|
// version 1 vs version 2. PC version 2 will not conflict with, say, Decipher version 2.
|
||||||
|
version: 0
|
||||||
|
collInfo: 1R13
|
||||||
|
rarity: R
|
||||||
|
setNum: "1"
|
||||||
|
cardNum: 12
|
||||||
|
// Standard, Masterwork, Tengwar, FullArt, etc
|
||||||
|
style: Standard
|
||||||
|
}
|
||||||
|
title: Gimli
|
||||||
|
subtitle: Son of Gloin
|
||||||
|
unique: true
|
||||||
|
culture: Dwarven
|
||||||
|
twilight: 2
|
||||||
|
type: Companion
|
||||||
|
requires: {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
effects: [
|
||||||
|
...
|
||||||
|
]
|
||||||
|
gametext: <b>Damage +1</b> <br> <b>Fellowship: </b> If the twilight pool has fewer than 2 twilight tokens, add (2) and place a card from hand beneath your draw deck to draw a card.
|
||||||
|
lore: "Gimli now walked ahead by the wizard's side, so eager was he to come to Moria."
|
||||||
|
promotext: ""
|
||||||
|
alts: {
|
||||||
|
promos: {
|
||||||
|
//These are all CardInfo objects
|
||||||
|
tengwar: {
|
||||||
|
imagePath: decipher/LOTR01013T.jpg
|
||||||
|
collInfo: 1R13T
|
||||||
|
}
|
||||||
|
legends: {
|
||||||
|
imagePath: decipher/LOTR01F013.jpg
|
||||||
|
collInfo: 1RF13
|
||||||
|
}
|
||||||
|
masterwork: {
|
||||||
|
imagePath: promos/masterworks/LOTR-EN01O013.0_card.jpg
|
||||||
|
collInfo: 1O13
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errata: {
|
||||||
|
pc: [
|
||||||
|
{
|
||||||
|
imagePath: errata/LOTR-EN01E013.1_card.jpg
|
||||||
|
version: 1
|
||||||
|
twilight: 4,
|
||||||
|
effects: [
|
||||||
|
...
|
||||||
|
]
|
||||||
|
alts: {
|
||||||
|
fullArt: promos/full-art/LOTR-EN01F013.1_card.jpg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
imagePath: errata/LOTR-EN01E013.2_card.jpg
|
||||||
|
version: 1
|
||||||
|
twilight: 3,
|
||||||
|
effects: [
|
||||||
|
...
|
||||||
|
]
|
||||||
|
alts: {
|
||||||
|
fullArt: promos/full-art/LOTR-EN01F013.2_card.jpg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
decipher: {
|
||||||
|
imagePath: errata/decipher/LOTR-EN01S013.1_card.jpg
|
||||||
|
version: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -45,8 +45,12 @@ public enum Culture implements Filterable {
|
|||||||
|
|
||||||
public static Culture findCulture(String name) {
|
public static Culture findCulture(String name) {
|
||||||
String nameCaps = name.toUpperCase().replace(' ', '_').replace('-', '_');
|
String nameCaps = name.toUpperCase().replace(' ', '_').replace('-', '_');
|
||||||
|
String nameLower = name.toLowerCase();
|
||||||
|
if(nameLower.equals("ringwraith"))
|
||||||
|
return WRAITH;
|
||||||
|
|
||||||
for (Culture culture : values()) {
|
for (Culture culture : values()) {
|
||||||
if (culture.getHumanReadable().equals(name) || culture.toString().equals(nameCaps))
|
if (culture.getHumanReadable().toLowerCase().equals(nameLower) || culture.toString().equals(nameCaps))
|
||||||
return culture;
|
return culture;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -17,4 +17,14 @@ public enum SitesBlock {
|
|||||||
public String getHumanReadable() {
|
public String getHumanReadable() {
|
||||||
return _humanReadable;
|
return _humanReadable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SitesBlock findBlock(String name) {
|
||||||
|
String nameCaps = name.toUpperCase().replace(' ', '_').replace('-', '_');
|
||||||
|
String nameLower = name.toLowerCase();
|
||||||
|
for (SitesBlock block : values()) {
|
||||||
|
if (block.getHumanReadable().toLowerCase().equals(nameLower) || block.toString().equals(nameCaps))
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ public class LotroCardBlueprintBuilder implements CardGenerationEnvironment {
|
|||||||
fieldProcessors.put("gametext", new NullProcessor());
|
fieldProcessors.put("gametext", new NullProcessor());
|
||||||
fieldProcessors.put("lore", new NullProcessor());
|
fieldProcessors.put("lore", new NullProcessor());
|
||||||
fieldProcessors.put("promotext", new NullProcessor());
|
fieldProcessors.put("promotext", new NullProcessor());
|
||||||
|
|
||||||
|
//Soon! But not yet
|
||||||
|
fieldProcessors.put("cardinfo", new NullProcessor());
|
||||||
|
fieldProcessors.put("alts", new NullProcessor());
|
||||||
}
|
}
|
||||||
|
|
||||||
public LotroCardBlueprint buildFromJson(JSONObject json) throws InvalidCardDefinitionException {
|
public LotroCardBlueprint buildFromJson(JSONObject json) throws InvalidCardDefinitionException {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.gempukku.lotro.common.Side;
|
|||||||
public class CultureFieldProcessor implements FieldProcessor {
|
public class CultureFieldProcessor implements FieldProcessor {
|
||||||
@Override
|
@Override
|
||||||
public void processField(String key, Object value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
|
public void processField(String key, Object value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
|
||||||
final Culture culture = FieldUtils.getEnum(Culture.class, value, key);
|
final Culture culture = Culture.findCulture(FieldUtils.getString(value, key));
|
||||||
blueprint.setCulture(culture);
|
blueprint.setCulture(culture);
|
||||||
|
|
||||||
if (culture != Culture.GOLLUM)
|
if (culture != Culture.GOLLUM)
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ import com.gempukku.lotro.common.SitesBlock;
|
|||||||
public class SiteBlockFieldProcessor implements FieldProcessor {
|
public class SiteBlockFieldProcessor implements FieldProcessor {
|
||||||
@Override
|
@Override
|
||||||
public void processField(String key, Object value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
|
public void processField(String key, Object value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
|
||||||
blueprint.setSiteBlock(FieldUtils.getEnum(SitesBlock.class, value, key));
|
blueprint.setSiteBlock(SitesBlock.findBlock(FieldUtils.getString(value, key)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user