Some FotR cards
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user