"On Guard"
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package com.gempukku.lotro.cards.set11.dwarven;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractResponseEvent;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.PreventCardEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Race;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
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.ChooseActiveCardEffect;
|
||||
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Shadows
|
||||
* Side: Free
|
||||
* Culture: Dwarven
|
||||
* Twilight Cost: 1
|
||||
* Type: Event • Response
|
||||
* Game Text: If a Dwarf who has resistance 3 or more is about to take a wound, prevent that.
|
||||
*/
|
||||
public class Card11_013 extends AbstractResponseEvent {
|
||||
public Card11_013() {
|
||||
super(Side.FREE_PEOPLE, 1, Culture.DWARVEN, "On Guard");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlayEventAction> getOptionalBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
if (TriggerConditions.isGettingWounded(effect, game, Race.DWARF, Filters.minResistance(3))
|
||||
&& checkPlayRequirements(playerId, game, self, 0, false, false)) {
|
||||
final WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
|
||||
|
||||
final PlayEventAction action = new PlayEventAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(self, playerId, "Choose a Dwarf", Race.DWARF, Filters.minResistance(3), Filters.in(woundEffect.getAffectedCardsMinusPrevented(game))) {
|
||||
@Override
|
||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||
action.appendEffect(
|
||||
new PreventCardEffect(woundEffect, card));
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -126,6 +126,15 @@ public class Filters {
|
||||
};
|
||||
}
|
||||
|
||||
public static Filter minResistance(final int resistance) {
|
||||
return new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
return modifiersQuerying.getResistance(gameState, physicalCard) >= resistance;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Filter lessStrengthThan(final int strength) {
|
||||
return new Filter() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user