"Desertion"
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
package com.gempukku.lotro.cards.set6.isengard;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
|
||||
import com.gempukku.lotro.common.*;
|
||||
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.actions.ActivateCardAction;
|
||||
import com.gempukku.lotro.logic.effects.AssignmentEffect;
|
||||
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Ents of Fangorn
|
||||
* Side: Shadow
|
||||
* Culture: Isengard
|
||||
* Twilight Cost: 1
|
||||
* Type: Condition
|
||||
* Strength: -1
|
||||
* Game Text: To play, spot an [ISENGARD] Man. Plays on a companion (except the Ring-bearer). Assignment: Assign
|
||||
* an [ISENGARD] minion with less strength than bearer to skirmish bearer. Discard this condition.
|
||||
*/
|
||||
public class Card6_061 extends AbstractAttachable {
|
||||
public Card6_061() {
|
||||
super(Side.SHADOW, CardType.CONDITION, 1, Culture.ISENGARD, null, "Desertion");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, Filter additionalAttachmentFilter, int twilightModifier) {
|
||||
return super.checkPlayRequirements(playerId, game, self, additionalAttachmentFilter, twilightModifier)
|
||||
&& PlayConditions.canSpot(game, Culture.ISENGARD, Race.MAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
|
||||
return Filters.and(CardType.COMPANION, Filters.not(Keyword.RING_BEARER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Modifier> getAlwaysOnModifiers(LotroGame game, PhysicalCard self) {
|
||||
return Collections.singletonList(
|
||||
new StrengthModifier(self, Filters.hasAttached(self), -1));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.ASSIGNMENT, self, 0)
|
||||
&& Filters.canBeAssignedToSkirmishByEffect(Side.SHADOW).accepts(game.getGameState(), game.getModifiersQuerying(), self.getAttachedTo())) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(self, playerId, "Choose an ISENGARD minion", Culture.ISENGARD, CardType.MINION, Filters.canBeAssignedToSkirmishByEffect(Side.SHADOW), Filters.lessStrengthThan(self.getAttachedTo())) {
|
||||
@Override
|
||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||
action.insertEffect(
|
||||
new AssignmentEffect(playerId, self.getAttachedTo(), card));
|
||||
}
|
||||
});
|
||||
action.appendEffect(
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,15 @@ public class Filters {
|
||||
|
||||
// Filters available
|
||||
|
||||
public static Filter lessStrengthThan(final PhysicalCard card) {
|
||||
return new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
return modifiersQuerying.getStrength(gameState, physicalCard) < modifiersQuerying.getStrength(gameState, card);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Filter possessionClass(final PossessionClass possessionClass) {
|
||||
return new Filter() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user