Some FotR cards

This commit is contained in:
marcin.sciesinski
2019-09-13 15:52:25 -07:00
parent 43bdf1ad4b
commit ddc470beca
4 changed files with 101 additions and 4 deletions

View File

@@ -53,6 +53,93 @@
}
}
},
"1_31": {
"title": "*Asfaloth",
"culture": "elven",
"cost": 2,
"type": "possession",
"possession": "mount",
"strength": 2,
"target": "elf",
"effects": [
{
"type": "modifyOwnCost",
"on": "name(Arwen)",
"amount": -2
},
{
"type": "modifier",
"modifier": {
"type": "modifyStrength",
"filter": "bearer",
"condition": {
"type": "location",
"filter": "plains"
},
"amount": 2
}
},
{
"type": "trigger",
"trigger": {
"type": "condition",
"condition": {
"type": "location",
"filter": "underground"
}
},
"effect": {
"type": "discard",
"filter": "self"
}
}
]
},
"1_32": {
"title": "Border Defenses",
"culture": "elven",
"cost": 1,
"type": "event",
"keyword": "skirmish",
"effects": {
"type": "event",
"effect": {
"type": "modifyStrength",
"filter": "choose(elf)",
"memorize": "chosenElf",
"amount": {
"type": "condition",
"condition": {
"type": "canSpot",
"filter": "memory(chosenElf),inSkirmishAgainst(archer)"
},
"true": 4,
"false": 2
}
}
}
},
"1_33": {
"title": "*Bow of the Galadhrim",
"culture": "elven",
"cost": 1,
"type": "possession",
"possession": "ranged weapon",
"strength": 1,
"target": "name(Legolas)",
"effects": {
"type": "trigger",
"optional": true,
"trigger": {
"type": "winsSkirmish",
"filter": "bearer"
},
"effect": {
"type": "wound",
"filter": "choose(minion)"
}
}
},
"1_38": {
"title": "Double Shot",
"culture": "elven",

View File

@@ -463,7 +463,7 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
int result = 0;
for (TwilightCostModifierSource twilightCostModifier : twilightCostModifiers)
result += twilightCostModifier.getTwilightCostModifier(actionContext);
result += twilightCostModifier.getTwilightCostModifier(actionContext, target);
return result;
}

View File

@@ -1,5 +1,7 @@
package com.gempukku.lotro.cards.build;
import com.gempukku.lotro.game.PhysicalCard;
public interface TwilightCostModifierSource {
int getTwilightCostModifier(ActionContext actionContext);
int getTwilightCostModifier(ActionContext actionContext, PhysicalCard target);
}

View File

@@ -4,26 +4,34 @@ import com.gempukku.lotro.cards.build.*;
import com.gempukku.lotro.cards.build.field.EffectProcessor;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.cards.build.field.effect.appender.resolver.ValueResolver;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.logic.modifiers.evaluator.Evaluator;
import org.json.simple.JSONObject;
public class ModifyOwnCost implements EffectProcessor {
@Override
public void processEffect(JSONObject value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(value, "amount", "condition");
FieldUtils.validateAllowedFields(value, "amount", "condition", "on");
final String onFilter = FieldUtils.getString(value.get("on"), "on", "any");
final ValueSource amountSource = ValueResolver.resolveEvaluator(value.get("amount"), 0, environment);
final JSONObject[] conditionArray = FieldUtils.getObjectArray(value.get("condition"), "condition");
final FilterableSource onFilterableSource = environment.getFilterFactory().generateFilter(onFilter, environment);
final Requirement[] requirements = environment.getRequirementFactory().getRequirements(conditionArray, environment);
blueprint.appendTwilightCostModifier(
(actionContext) -> {
(actionContext, target) -> {
for (Requirement requirement : requirements) {
if (!requirement.accepts(actionContext))
return 0;
}
if (target != null) {
if (!Filters.and(onFilterableSource.getFilterable(actionContext)).accepts(actionContext.getGame(), target))
return 0;
}
final Evaluator evaluator = amountSource.getEvaluator(actionContext);
return evaluator.evaluateExpression(actionContext.getGame(), actionContext.getSource());
});