3 more cards, and some effect streamlining

This commit is contained in:
marcin.sciesinski
2019-07-15 13:52:29 -07:00
parent 7ae5f7dd18
commit 70a5ad2a5d
8 changed files with 185 additions and 24 deletions

View File

@@ -1,5 +1,8 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
@@ -10,20 +13,18 @@ import java.util.Collections;
public class NegateWoundEffect extends UnrespondableEffect {
private WoundCharactersEffect _effect;
private Collection<PhysicalCard> _cards;
private Filter _filter;
public NegateWoundEffect(WoundCharactersEffect effect, PhysicalCard card) {
this(effect, Collections.singleton(card));
}
public NegateWoundEffect(WoundCharactersEffect effect, Collection<PhysicalCard> cards) {
_effect = effect;
_cards = cards;
public NegateWoundEffect(WoundCharactersEffect effect, Filterable... filter) {
_effect =effect;
_filter = Filters.and(filter);
}
@Override
protected void doPlayEffect(LotroGame game) {
for (PhysicalCard card : _cards)
_effect.negateWound(game, card);
for (PhysicalCard affectedCard : _effect.getAffectedCardsMinusPrevented(game)) {
if (_filter.accepts(game.getGameState(), game.getModifiersQuerying(), affectedCard))
_effect.negateWound(game, affectedCard);
}
}
}

View File

@@ -28,10 +28,9 @@ public class PreventAllWoundsActionProxy extends AbstractActionProxy {
public List<? extends RequiredTriggerAction> getRequiredBeforeTriggers(LotroGame game, Effect effect) {
if (TriggerConditions.isGettingWounded(effect, game, _filters)) {
WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
Collection<PhysicalCard> toPreventOn = Filters.filter(woundEffect.getAffectedCardsMinusPrevented(game), game.getGameState(), game.getModifiersQuerying(), _filters);
RequiredTriggerAction action = new RequiredTriggerAction(_source);
action.appendEffect(
new PreventCardEffect(woundEffect, toPreventOn));
new PreventCardEffect(woundEffect, _filters));
return Collections.singletonList(action);
}
return null;

View File

@@ -1,5 +1,8 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.effects.AbstractPreventableCardEffect;
@@ -10,20 +13,18 @@ import java.util.Collections;
public class PreventCardEffect extends UnrespondableEffect {
private AbstractPreventableCardEffect _effect;
private Collection<PhysicalCard> _cards;
private Filter _filter;
public PreventCardEffect(AbstractPreventableCardEffect effect, PhysicalCard card) {
this(effect, Collections.singleton(card));
}
public PreventCardEffect(AbstractPreventableCardEffect effect, Collection<PhysicalCard> cards) {
public PreventCardEffect(AbstractPreventableCardEffect effect, Filterable... filters) {
_effect = effect;
_cards = cards;
_filter = Filters.and(filters);
}
@Override
protected void doPlayEffect(LotroGame game) {
for (PhysicalCard card : _cards)
_effect.preventEffect(game, card);
for (PhysicalCard affectedCard : _effect.getAffectedCardsMinusPrevented(game)) {
if (_filter.accepts(game.getGameState(), game.getModifiersQuerying(), affectedCard))
_effect.preventEffect(game, affectedCard);
}
}
}

View File

@@ -56,8 +56,7 @@ public class Card20_038 extends AbstractPermanent {
action.appendCost(
new SelfDiscardEffect(self));
action.appendEffect(
new PreventCardEffect(discardEffect, Filters.filter(discardEffect.getAffectedCardsMinusPrevented(game),
game.getGameState(), game.getModifiersQuerying(), Culture.DWARVEN, CardType.CONDITION)));
new PreventCardEffect(discardEffect, Culture.DWARVEN, CardType.CONDITION));
return Collections.singletonList(action);
}
return null;

View File

@@ -52,10 +52,11 @@ public class Card40_003 extends AbstractPermanent {
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (TriggerConditions.isGettingDiscardedBy(effect, game, Side.SHADOW, Filters.and(Culture.DWARVEN, CardType.CONDITION))
&& PlayConditions.canSelfDiscard(self, game)) {
DiscardCardsFromPlayEffect discardEffect = (DiscardCardsFromPlayEffect) effect;
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(new SelfDiscardEffect(self));
action.appendEffect(
new PreventCardEffect((DiscardCardsFromPlayEffect) effect, self));
new PreventCardEffect(discardEffect, Culture.DWARVEN, CardType.CONDITION));
return Collections.singletonList(action);
}
return null;

View File

@@ -0,0 +1,48 @@
package com.gempukku.lotro.cards.set40.dwarven;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.choose.ChooseAndAddUntilEOPStrengthBonusEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardStackedCardsEffect;
import com.gempukku.lotro.common.*;
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.ActivateCardAction;
import java.util.Collections;
import java.util.List;
/**
* Title: Dwarf Soldier
* Set: Second Edition
* Side: Free
* Culture: Dwarven
* Twilight Cost: 2
* Type: Companion - Dwarf
* Strength: 5
* Vitality: 3
* Resistance: 6
* Card Number: 1C9
* Game Text: Damage +1. Skirmish: Discard a card stacked on a [Dwarven] condition to make this companion strength +1.
*/
public class Card40_009 extends AbstractCompanion {
public Card40_009() {
super(2, 5, 3, 6, Culture.DWARVEN, Race.DWARF, null, "Dwarf Soldier");
addKeyword(Keyword.DAMAGE, 1);
}
@Override
protected List<ActivateCardAction> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.SKIRMISH, self)
&& PlayConditions.canDiscardFromStacked(self, game, playerId, 1, Filters.and(Culture.DWARVEN, CardType.CONDITION), Filters.any)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndDiscardStackedCardsEffect(action, playerId, 1, 1, Filters.and(Culture.DWARVEN, CardType.CONDITION), Filters.any));
action.appendEffect(
new ChooseAndAddUntilEOPStrengthBonusEffect(action, self, playerId, 1, self));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -0,0 +1,53 @@
package com.gempukku.lotro.cards.set40.dwarven;
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardStackedCardsEffect;
import com.gempukku.lotro.common.*;
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.OptionalTriggerAction;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Title: Dwarven Battle Axe
* Set: Second Edition
* Side: Free
* Culture: Possession - Hand Weapon
* Twilight Cost: 1
* Type: The One Ring
* Strength: +1
* Vitality: +1
* Card Number: 1U10
* Game Text: Bearer must be a Dwarf. Each time bearer wins a skirmish, you may discard a card stacked on a [DWARVEN] condition to wound a minion.
*/
public class Card40_010 extends AbstractAttachableFPPossession {
public Card40_010() {
super(1, 1, 1, Culture.DWARVEN, PossessionClass.HAND_WEAPON, "Dwarven Battle Axe");
}
@Override
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Race.DWARF;
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.winsSkirmish(game, effectResult, Filters.hasAttached(self))
&& PlayConditions.canDiscardFromStacked(self, game, playerId, 1, Filters.and(Culture.DWARVEN, CardType.CONDITION), Filters.any)) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendCost(
new ChooseAndDiscardStackedCardsEffect(action, playerId, 1, 1, Filters.and(Culture.DWARVEN, CardType.CONDITION), Filters.any));
action.appendEffect(
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, CardType.MINION));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -0,0 +1,59 @@
package com.gempukku.lotro.cards.set40.dwarven;
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.NegateWoundEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.cards.effects.SelfDiscardEffect;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.common.PossessionClass;
import com.gempukku.lotro.common.Race;
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.OptionalTriggerAction;
import com.gempukku.lotro.logic.effects.PreventEffect;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
/**
* Title: Dwarven Bracers
* Set: Second Edition
* Side: Free
* Culture: Dwarven
* Twilight Cost: 1
* Type: Possession - Bracers
* Strength: +1
* Card Number: 1U11
* Game Text: Bearer must be a Dwarf.
* Response: If bearer is abound to take a wound, discard this possession to prevent that wound.
*/
public class Card40_011 extends AbstractAttachableFPPossession {
public Card40_011() {
super(1, 1, 0, Culture.DWARVEN, PossessionClass.BRACERS, "Dwarven Bracers");
}
@Override
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Race.DWARF;
}
@Override
public List<? extends Action> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (TriggerConditions.isGettingWounded(effect, game, Filters.hasAttached(self))
&& PlayConditions.canSelfDiscard(self, game)) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendCost(new SelfDiscardEffect(self));
action.appendEffect(
new NegateWoundEffect((WoundCharactersEffect) effect, self.getAttachedTo()));
return Collections.singletonList(action);
}
return null;
}
}