New version of "Caught in a Sack"

This commit is contained in:
PhallenCassidy
2018-12-11 09:11:26 -05:00
committed by GitHub
parent 19b64c5527
commit 960cd08539

View File

@@ -3,20 +3,21 @@ package com.gempukku.lotro.cards.set31.troll;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.cards.effects.PreventableEffect;
import com.gempukku.lotro.cards.effects.SelfDiscardEffect;
import com.gempukku.lotro.cards.effects.TransferPermanentEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.cards.modifiers.ResistanceModifier;
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.actions.SubAction;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.modifiers.CantBeAssignedToSkirmishModifier;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
@@ -30,26 +31,43 @@ import java.util.List;
* Culture: Troll
* Twilight Cost: 2
* Type: Condition • Support Area
* Game Text: At the start of each assignment phase, you may discard a minion (or exert
* a [TROLL] Troll) to spot a [DWARVEN] or [SHIRE] companion. That companion cannot be
* assigned to a skirmish. Bilbo may exert twice to prevent this.
* Game Text: Discard this condition if Bilbo wins a skirmish. Regroup: Discard a
* minion (or exert a Troll) to transfer this condition to a [DWARVEN] companion.
* Bearer cannot be assigned to a skirmish by any player.
*/
public class Card31_065 extends AbstractPermanent {
public Card31_065() {
super(Side.SHADOW, 2, CardType.CONDITION, Culture.GUNDABAD, Zone.SUPPORT, "Caught in a Sack", null, true);
super(Side.SHADOW, 0, CardType.CONDITION, Culture.GUNDABAD, Zone.SUPPORT, "Caught in a Sack");
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
if (TriggerConditions.startOfPhase(game, effectResult, Phase.ASSIGNMENT)
&& (PlayConditions.canExert(self, game, 1, Culture.GUNDABAD, Race.TROLL) || PlayConditions.canDiscardFromPlay(self, game, CardType.MINION))) {
final OptionalTriggerAction action = new OptionalTriggerAction(self);
List<Effect> possibleCosts = new LinkedList<Effect>();
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.winsSkirmish(game, effectResult, Filters.name("Bilbo"))) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new SelfDiscardEffect(self));
return Collections.singletonList(action);
}
return null;
}
@Override
public Modifier getAlwaysOnModifier(LotroGame game, PhysicalCard self) {
return new CantBeAssignedToSkirmishModifier(self, Filters.hasAttached(self));
}
@Override
public List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.REGROUP, self, 0)
&& (PlayConditions.canExert(self, game, CardType.MINION, Race.TROLL)
|| PlayConditions.canSpot(game, CardType.MINION))) {
final ActivateCardAction action = new ActivateCardAction(self);
List<Effect> possibleCosts = new LinkedList<Effect>();
possibleCosts.add(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 1, Culture.GUNDABAD, Race.TROLL) {
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 1, Race.TROLL) {
@Override
public String getText(LotroGame game) {
return "Exert a [TROLL] Troll";
return "Exert a Troll";
}
});
possibleCosts.add(
@@ -59,36 +77,17 @@ public class Card31_065 extends AbstractPermanent {
return "Discard a minion";
}
});
action.appendCost(
new ChoiceEffect(action, playerId, possibleCosts));
action.appendCost(new ChoiceEffect(action, playerId, possibleCosts));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a [DWARVEN] or [SHIRE] companion", CardType.COMPANION, Filters.or(Culture.DWARVEN, Culture.SHIRE)) {
@Override
protected void cardSelected(LotroGame game, final PhysicalCard card) {
action.appendEffect(new PreventableEffect(
action,
new AddUntilEndOfPhaseModifierEffect(new CantBeAssignedToSkirmishModifier(self, card)) {
@Override
public String getText(LotroGame game) {
return "prevent that";
}
},
Collections.singletonList(game.getGameState().getCurrentPlayerId()),
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 2, Filters.name("Bilbo")) {
@Override
public String getText(LotroGame game) {
return "exert Bilbo twice";
}
};
}
}));
}
new ChooseActiveCardEffect(self, playerId, "Choose a [DWARVEN] companion", Culture.DWARVEN, CardType.COMPANION, Filters.not(Filters.hasAttached(self))) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.appendEffect(
new TransferPermanentEffect(self, card));
}
});
return Collections.singletonList(action);
}
return null;
}
}
}