CantBeExerted
This commit is contained in:
@@ -840,6 +840,23 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"40_29": {
|
||||
"title": "*Staunch Defenders",
|
||||
"side": "free people",
|
||||
"culture": "dwarven",
|
||||
"cost": 2,
|
||||
"type": "condition",
|
||||
"keyword": "support area",
|
||||
"effects": {
|
||||
"type": "cantBeExerted",
|
||||
"condition": {
|
||||
"type": "canSpot",
|
||||
"filter": "self,hasStackedCount(3,any)"
|
||||
},
|
||||
"filter": "dwarf",
|
||||
"by": "side(shadow)"
|
||||
}
|
||||
},
|
||||
"40_184": {
|
||||
"title": "Black Steed",
|
||||
"subtitle": "Bred to Serve",
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Card40_029 extends AbstractPermanent{
|
||||
@Override
|
||||
public List<? extends Modifier> getInPlayModifiers(LotroGame game, PhysicalCard self) {
|
||||
CantExertWithCardModifier modifier = new CantExertWithCardModifier(
|
||||
self, Side.SHADOW, new CardStackedCondition(3, self, Filters.any), Race.DWARF);
|
||||
self, Race.DWARF, new CardStackedCondition(3, self, Filters.any), Side.SHADOW);
|
||||
return Collections.singletonList(modifier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class EffectFieldProcessor implements FieldProcessor {
|
||||
effectProcessors.put("opponentmaynotdiscard", new OpponentMayNotDiscard());
|
||||
effectProcessors.put("modifyowncost", new ModifyOwnCost());
|
||||
effectProcessors.put("canttakemorewoundsthan", new CantTakeMoreWoundsThan());
|
||||
effectProcessors.put("cantbeexerted", new CantBeExerted());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,6 +64,13 @@ public class FilterFactory {
|
||||
final FilterableSource filterableSource = filterFactory.generateFilter(parameter);
|
||||
return (playerId, game, source, effectResult, effect) -> Filters.hasStacked(filterableSource.getFilterable(playerId, game, source, effectResult, effect));
|
||||
});
|
||||
parameterFilters.put("hasStackedCount",
|
||||
(parameter, filterFactory) -> {
|
||||
String[] parameterSplit = parameter.split(",", 2);
|
||||
int count = Integer.parseInt(parameterSplit[0]);
|
||||
final FilterableSource filterableSource = filterFactory.generateFilter(parameterSplit[1]);
|
||||
return (playerId, game, source, effectResult, effect) -> Filters.hasStacked(count, filterableSource.getFilterable(playerId, game, source, effectResult, effect));
|
||||
});
|
||||
parameterFilters.put("attachedTo",
|
||||
(parameter, filterFactory) -> {
|
||||
final FilterableSource filterableSource = filterFactory.generateFilter(parameter);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.gempukku.lotro.cards.build.field.effect.modifier;
|
||||
|
||||
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.logic.modifiers.CantExertWithCardModifier;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class CantBeExerted implements EffectProcessor {
|
||||
@Override
|
||||
public void processEffect(JSONObject value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
|
||||
FieldUtils.validateAllowedFields(value, "filter", "condition", "by");
|
||||
|
||||
final JSONObject[] conditionArray = FieldUtils.getObjectArray(value.get("condition"), "condition");
|
||||
final String filter = FieldUtils.getString(value.get("filter"), "filter", "self");
|
||||
final String byFilter = FieldUtils.getString(value.get("by"), "by", "any");
|
||||
|
||||
final FilterableSource filterableSource = environment.getFilterFactory().generateFilter(filter);
|
||||
final FilterableSource byFilterableSource = environment.getFilterFactory().generateFilter(byFilter);
|
||||
final Requirement[] requirements = environment.getRequirementFactory().getRequirements(conditionArray, environment);
|
||||
|
||||
blueprint.appendInPlayModifier(
|
||||
(game, self) ->
|
||||
new CantExertWithCardModifier(self,
|
||||
filterableSource.getFilterable(null, game, self, null, null),
|
||||
new RequirementCondition(requirements, null, self, null, null),
|
||||
byFilterableSource.getFilterable(null, game, self, null, null)));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public abstract class AbstractModifier implements Modifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard exertionSource, PhysicalCard card) {
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard exertionSource, PhysicalCard exertedCard) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ public class CantExertWithCardModifier extends AbstractModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard source, PhysicalCard card) {
|
||||
if (_preventExertWithFilter.accepts(game, source))
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard exertionSource, PhysicalCard exertedCard) {
|
||||
if (_preventExertWithFilter.accepts(game, exertionSource))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public interface Modifier {
|
||||
|
||||
public boolean canTakeArcheryWound(LotroGame game, PhysicalCard physicalCard);
|
||||
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard source, PhysicalCard card);
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard exertionSource, PhysicalCard exertedCard);
|
||||
|
||||
public boolean isAllyParticipateInArcheryFire(LotroGame game, PhysicalCard card);
|
||||
|
||||
|
||||
@@ -590,11 +590,11 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard source, PhysicalCard card) {
|
||||
LoggingThreadLocal.logMethodStart(card, "canBeExerted");
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard exertionSource, PhysicalCard exertedCard) {
|
||||
LoggingThreadLocal.logMethodStart(exertedCard, "canBeExerted");
|
||||
try {
|
||||
for (Modifier modifier : getModifiersAffectingCard(game, ModifierEffect.WOUND_MODIFIER, card)) {
|
||||
if (!modifier.canBeExerted(game, source, card))
|
||||
for (Modifier modifier : getModifiersAffectingCard(game, ModifierEffect.WOUND_MODIFIER, exertedCard)) {
|
||||
if (!modifier.canBeExerted(game, exertionSource, exertedCard))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -77,7 +77,7 @@ public interface ModifiersQuerying {
|
||||
|
||||
public boolean canTakeArcheryWound(LotroGame game, PhysicalCard card);
|
||||
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard exertionSource, PhysicalCard card);
|
||||
public boolean canBeExerted(LotroGame game, PhysicalCard exertionSource, PhysicalCard exertedCard);
|
||||
|
||||
public boolean canBeHealed(LotroGame game, PhysicalCard card);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user