Few extra cards

This commit is contained in:
marcin.sciesinski
2019-08-28 14:25:19 -07:00
parent bf99b4931d
commit b81748271f
4 changed files with 198 additions and 0 deletions

View File

@@ -295,6 +295,90 @@
}
}
},
"40_9": {
"title": "Dwarf Soldier",
"side": "free people",
"culture": "dwarven",
"cost": 2,
"type": "companion",
"race": "dwarf",
"strength": 5,
"vitality": 3,
"resistance": 6,
"keyword": "damage+1",
"effects": {
"type": "activated",
"phase": "skirmish",
"cost": {
"type": "discardStackedCards",
"count": 1,
"on": "culture(dwarven),condition"
},
"effect": {
"type": "modifyStrength",
"filter": "self",
"amount": 1
}
}
},
"40_10": {
"title": "Dwarven Battle Axe",
"side": "free people",
"type": "possession",
"possession": "hand weapon",
"cost": 0,
"strength": 1,
"vitality": 1,
"target": "dwarf",
"effects": {
"type": "trigger",
"trigger": {
"type": "winsSkirmish",
"filter": "hasAttached(self)"
},
"cost": {
"type": "discardStackedCards",
"on": "culture(dwarven),condition",
"count": 1
},
"effect": {
"type": "wound",
"filter": "choose(minion)"
}
}
},
"40_11": {
"title": "Dwarven Bracers",
"side": "free people",
"culture": "dwarven",
"cost": 1,
"type": "possession",
"possession": "bracers",
"strength": 1,
"target": "dwarf",
"effects": {
"type": "activatedTrigger",
"trigger": {
"type": "aboutToTakeWound",
"filter": "hasAttached(self)"
},
"cost": [
{
"type": "memorize",
"filter": "hasAttached(self)",
"memory": "bearer"
},
{
"type": "discard",
"filter": "self"
}
],
"effect": {
"type": "preventWound",
"filter": "memory(bearer)"
}
}
},
"40_184": {
"title": "Black Steed",
"subtitle": "Bred to Serve",

View File

@@ -36,6 +36,8 @@ public class EffectAppenderFactory {
effectAppenderProducers.put("discardcardatrandomfromhand", new DiscardCardAtRandomFromHand());
effectAppenderProducers.put("putonring", new PutOnRing());
effectAppenderProducers.put("discardstackedcards", new DiscardStackedCards());
effectAppenderProducers.put("memorize", new Memorize());
effectAppenderProducers.put("preventwound", new PreventWound());
}
public EffectAppender getEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {

View File

@@ -0,0 +1,51 @@
package com.gempukku.lotro.cards.build.field.effect.appender;
import com.gempukku.lotro.cards.build.CardGenerationEnvironment;
import com.gempukku.lotro.cards.build.FilterableSource;
import com.gempukku.lotro.cards.build.InvalidCardDefinitionException;
import com.gempukku.lotro.cards.build.Requirement;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.cards.build.field.effect.EffectAppender;
import com.gempukku.lotro.cards.build.field.effect.EffectAppenderProducer;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import org.json.simple.JSONObject;
import java.util.Collection;
public class Memorize implements EffectAppenderProducer {
@Override
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject, "filter", "memory");
final String filter = FieldUtils.getString(effectObject.get("filter"), "filter");
final String memory = FieldUtils.getString(effectObject.get("memory"), "memory");
final FilterableSource filterSource = environment.getFilterFactory().generateFilter(filter);
return new DelayedAppender() {
@Override
protected Effect createEffect(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
return new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
final Filterable filterable = filterSource.getFilterable(playerId, game, self, effectResult, effect);
final Collection<PhysicalCard> physicalCards = Filters.filterActive(game, filterable);
action.setCardMemory(memory, physicalCards);
}
};
}
};
}
@Override
public Requirement createCostRequirement(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
return null;
}
}

View File

@@ -0,0 +1,61 @@
package com.gempukku.lotro.cards.build.field.effect.appender;
import com.gempukku.lotro.cards.build.CardGenerationEnvironment;
import com.gempukku.lotro.cards.build.InvalidCardDefinitionException;
import com.gempukku.lotro.cards.build.Requirement;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.cards.build.field.effect.EffectAppender;
import com.gempukku.lotro.cards.build.field.effect.EffectAppenderProducer;
import com.gempukku.lotro.cards.build.field.effect.appender.resolver.CardResolver;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.PreventCardEffect;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
import com.gempukku.lotro.logic.modifiers.ModifierFlag;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import org.json.simple.JSONObject;
import java.util.Collection;
public class PreventWound implements EffectAppenderProducer {
@Override
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject, "filter");
final String filter = FieldUtils.getString(effectObject.get("filter"), "filter", "all(any)");
MultiEffectAppender result = new MultiEffectAppender();
result.addEffectAppender(
CardResolver.resolveCards(filter,
(playerId, game, source, effectResult, effect) -> {
final WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
return Filters.in(woundEffect.getAffectedCardsMinusPrevented(game));
}, 1, 1, "_temp", "owner", "Choose characters to prevent wound to", environment));
result.addEffectAppender(
new DelayedAppender() {
@Override
protected Effect createEffect(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
final Collection<? extends PhysicalCard> cards = action.getCardsFromMemory("_temp");
final WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
return new PreventCardEffect(woundEffect, Filters.in(cards));
}
@Override
public boolean isPlayableInFull(String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
return !game.getModifiersQuerying().hasFlagActive(game, ModifierFlag.CANT_PREVENT_WOUNDS);
}
});
return result;
}
@Override
public Requirement createCostRequirement(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
return (playerId, game, self, effectResult, effect) -> !game.getModifiersQuerying().hasFlagActive(game, ModifierFlag.CANT_PREVENT_WOUNDS);
}
}