Effect tweaks

- If: renamed parameter condition -> check
- ExchangeSite: renamed parameters selector1/selector2 -> site1/site2
- Fixed the stacked cards exchanger malformed value definition
- Various parameter checks
This commit is contained in:
Christian 'ketura' McCarty
2024-05-30 23:41:06 -05:00
parent 2c940c079b
commit a7577d1105
29 changed files with 48 additions and 46 deletions

View File

@@ -296,7 +296,7 @@
}
effect: {
type: if
condition: {
check: {
type: canSpot
filter: companion
count: 5

View File

@@ -577,7 +577,7 @@
effect: [
{
type: if
condition: {
check: {
type: canSpot
filter: name(Legolas)
}

View File

@@ -781,7 +781,7 @@
}
effect: {
type: if
condition: {
check: {
type: memoryMatches
memory: exertedCompanion
filter: unbound,culture(gondor),man

View File

@@ -436,7 +436,7 @@
}
{
type: if
condition: {
check: {
type: memoryMatches
memory: chosenCompanion
filter: hobbit

View File

@@ -1201,7 +1201,7 @@
effect: [
{
type: if
condition: {
check: {
type: location
filter: siteNumber(1-4),siteBlock(two towers)
}
@@ -1309,7 +1309,7 @@
effect: [
{
type: if
condition: {
check: {
type: location
filter: siteNumber(1-5),siteBlock(two towers)
}

View File

@@ -544,7 +544,7 @@
type: event
cost: {
type: if
condition: {
check: {
type: phase
phase: shadow
}

View File

@@ -1256,7 +1256,7 @@
effect: [
{
type: if
condition: {
check: {
type: isGreaterThan
firstNumber: {
type: forEachVitality

View File

@@ -1750,7 +1750,7 @@
}
effect: {
type: if
condition: {
check: {
type: twilightPoolLessThan
amount: 1
}

View File

@@ -337,7 +337,7 @@
}
{
type: if
condition: {
check: {
type: memoryMatches
memory: discardedCard
filter: minTwilight(memory(spotCount))

View File

@@ -27,7 +27,7 @@
effect: [
{
type: if
condition: {
check: {
type: location
filter: siteBlock(king),siteNumber(1-5)
}

View File

@@ -993,7 +993,7 @@
}
effect: {
type: if
condition: {
check: {
type: cantSpotFPCultures
amount: 3
}

View File

@@ -781,7 +781,7 @@
effect: [
{
type: if
condition: {
check: {
type: location
filter: regionNumber(1)
}

View File

@@ -33,7 +33,7 @@
effect: [
{
type: if
condition: {
check: {
type: location
filter: battleground
}

View File

@@ -331,7 +331,7 @@
effect: [
{
type: if
condition: {
check: {
type: location
filter: dwelling
}

View File

@@ -958,7 +958,7 @@
effect: [
{
type: if
condition: {
check: {
type: location
filter: regionNumber(1)
}

View File

@@ -39,7 +39,7 @@
effect: [
{
type: if
condition: {
check: {
type: location
filter: regionNumber(1)
}
@@ -335,7 +335,7 @@
}
effect: {
type: if
condition: {
check: {
type: canSpot
filter: companion
count: 6

View File

@@ -69,7 +69,7 @@
}
{
type: if
condition: {
check: {
type: memoryMatches
memory: revealedCard
filter: culture(dwarven)

View File

@@ -414,7 +414,7 @@
effect: [
{
type: if
condition: {
check: {
type: memoryIs
memory: effect
value: first

View File

@@ -1137,7 +1137,7 @@
}
{
type: if
condition: {
check: {
type: memoryMatches
memory: revealedCard
filter: culture(orc),orc
@@ -1378,7 +1378,7 @@
}
effect: {
type: if
condition: {
check: {
type: cantSpot
filter: companion
count: 6

View File

@@ -1135,8 +1135,8 @@
]
effect: {
type: exchangeSite
selector1: memory(spottedSite)
selector2: choose(controlledSite)
site1: memory(spottedSite)
site2: choose(controlledSite)
}
}
]

View File

@@ -569,7 +569,7 @@
effect: [
{
type: if
condition: {
check: {
type: memoryIs
memory: played
value: first

View File

@@ -400,7 +400,7 @@
}
{
type: if
condition: {
check: {
type: memoryMatches
memory: chosenMinion
filter: wizard
@@ -603,14 +603,14 @@
}
{
type: if
condition: {
check: {
type: memoryIs
memory: chosenFP
value: yes
}
true: {
type: if
condition: {
check: {
type: memoryMatches
memory: revealedCards
filter: side(free people)
@@ -632,7 +632,7 @@
}
false: {
type: if
condition: {
check: {
type: memoryMatches
memory: revealedCards
filter: side(shadow)

View File

@@ -21,6 +21,9 @@ public class AppendCardIdsToWhileInZone implements EffectAppenderProducer {
String memory = FieldUtils.getString(effectObject.get("memory"), "memory");
if (memory == null)
throw new InvalidCardDefinitionException("'memory' needs to be defined for AppendCardIdsToWhileInZone effect.");
return new DelayedAppender() {
@Override
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {

View File

@@ -25,18 +25,19 @@ public class ChooseArbitraryCards implements EffectAppenderProducer {
FieldUtils.validateAllowedFields(effectObject, "fromMemory", "count", "filter", "memorize", "text", "player");
final String fromMemory = FieldUtils.getString(effectObject.get("fromMemory"), "fromMemory");
if (fromMemory == null)
throw new InvalidCardDefinitionException("You need to define fromMemory to display arbitrary cards");
final ValueSource valueSource = ValueResolver.resolveEvaluator(effectObject.get("count"), 1, environment);
final String filter = FieldUtils.getString(effectObject.get("filter"), "filter", "any");
final String memorize = FieldUtils.getString(effectObject.get("memorize"), "memorize");
if (memorize == null)
throw new InvalidCardDefinitionException("You need to define what memory to use to store chosen cards");
final String text = FieldUtils.getString(effectObject.get("text"), "text");
if (text == null)
throw new InvalidCardDefinitionException("You need to define text to show");
final String player = FieldUtils.getString(effectObject.get("player"), "player", "you");
if (fromMemory == null)
throw new InvalidCardDefinitionException("'fromMemory' field required for ChooseArbitraryCards effect.");
if (memorize == null)
throw new InvalidCardDefinitionException("'memorize' field required for ChooseArbitraryCards effect.");
if (text == null)
throw new InvalidCardDefinitionException("'text' field required for ChooseArbitraryCards effect.");
FilterableSource filterableSource = environment.getFilterFactory().generateFilter(filter, environment);
final PlayerSource playerSource = PlayerResolver.resolvePlayer(player, environment);

View File

@@ -21,8 +21,6 @@ public class ChooseCardsFromDiscard implements EffectAppenderProducer {
if (memorize == null)
throw new InvalidCardDefinitionException("You need to define what memory to use to store chosen cards");
final String text = FieldUtils.getString(effectObject.get("text"), "text", "Choose cards from discard.");
if (text == null)
throw new InvalidCardDefinitionException("You need to define text to show");
return CardResolver.resolveCardsInDiscard(select, valueSource, memorize, "you", text, environment);
}

View File

@@ -28,7 +28,7 @@ public class DiscardFromPlay implements EffectAppenderProducer {
final ValueSource valueSource = ValueResolver.resolveEvaluator(effectObject.get("count"), 1, environment);
final String select = FieldUtils.getString(effectObject.get("select"), "select");
if (select == null)
throw new InvalidCardDefinitionException("select is required");
throw new InvalidCardDefinitionException("'select' is required for Discard effect.");
final String memory = FieldUtils.getString(effectObject.get("memorize"), "memorize", "_temp");
final String stackedCardsMemory = FieldUtils.getString(effectObject.get("memorizeStackedCards"), "memorizeStackedCards");

View File

@@ -32,7 +32,7 @@ public class ExchangeCardsInHandWithCardsStacked implements EffectAppenderProduc
final ValueSource countHand = ValueResolver.resolveEvaluator(effectObject.get("countInHand"), 1, environment);
final String selectInStacked = FieldUtils.getString(effectObject.get("selectInStacked"), "selectInStacked");
final ValueSource stackedCardCount = ValueResolver.resolveEvaluator("1", environment);
final ValueSource stackedCardCount = ValueResolver.resolveEvaluator(effectObject.get("countInStacked"), 1, environment);
MultiEffectAppender result = new MultiEffectAppender();

View File

@@ -18,17 +18,17 @@ import org.json.simple.JSONObject;
public class ExchangeSite implements EffectAppenderProducer {
@Override
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject, "selector1", "selector2");
FieldUtils.validateAllowedFields(effectObject, "site1", "site2");
final String selector1 = FieldUtils.getString(effectObject.get("selector1"), "selector1");
final String selector2 = FieldUtils.getString(effectObject.get("selector2"), "selector2");
final String site1 = FieldUtils.getString(effectObject.get("site1"), "site1");
final String site2 = FieldUtils.getString(effectObject.get("site2"), "site2");
MultiEffectAppender result = new MultiEffectAppender();
result.addEffectAppender(
CardResolver.resolveCard(selector1, "_temp1", "you", "Choose a site to exchange", environment));
CardResolver.resolveCard(site1, "_temp1", "you", "Choose a site to exchange", environment));
result.addEffectAppender(
CardResolver.resolveCard(selector2, "_temp2", "you", "Choose a site to exchange", environment));
CardResolver.resolveCard(site2, "_temp2", "you", "Choose a site to exchange", environment));
result.addEffectAppender(
new DelayedAppender() {
@Override

View File

@@ -16,9 +16,9 @@ import org.json.simple.JSONObject;
public class IfEffect implements EffectAppenderProducer {
@Override
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject, "condition", "true", "false");
FieldUtils.validateAllowedFields(effectObject, "check", "true", "false");
final JSONObject[] conditionArray = FieldUtils.getObjectArray(effectObject.get("condition"), "condition");
final JSONObject[] conditionArray = FieldUtils.getObjectArray(effectObject.get("check"), "check");
final JSONObject[] trueEffects = FieldUtils.getObjectArray(effectObject.get("true"), "true");
final JSONObject[] falseEffects = FieldUtils.getObjectArray(effectObject.get("false"), "false");