"Unexpected Visitor"

This commit is contained in:
marcins78@gmail.com
2011-11-03 00:00:31 +00:00
parent 12e7743f32
commit 9b288cd42a

View File

@@ -0,0 +1,72 @@
package com.gempukku.lotro.cards.set7.gondor;
import com.gempukku.lotro.cards.AbstractAttachable;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.cards.modifiers.AddActionToCardModifier;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
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.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: The Return of the King
* Side: Free
* Culture: Gondor
* Twilight Cost: 2
* Type: Condition
* Game Text: Bearer must be an [GONDOR] companion. Each minion gains this ability: 'Assignment: Assign this minion
* to bearer of Unexpected Visitor.' Regroup: Discard this condition to discard a minion and remove (4).
*/
public class Card7_126 extends AbstractAttachable {
public Card7_126() {
super(Side.FREE_PEOPLE, CardType.CONDITION, 2, Culture.GONDOR, null, "Unexpected Visitor", true);
}
@Override
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Culture.GONDOR, CardType.COMPANION);
}
@Override
public List<? extends Modifier> getAlwaysOnModifiers(final LotroGame game, final PhysicalCard self) {
return Collections.singletonList(
new AddActionToCardModifier(self, null, CardType.MINION) {
@Override
protected ActivateCardAction createExtraPhaseAction(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard matchingCard) {
if (PlayConditions.canUseFPCardDuringPhase(gameState, Phase.ASSIGNMENT, matchingCard)) {
ActivateCardAction action = new ActivateCardAction(matchingCard);
action.setText("Assign to " + self.getAttachedTo().getBlueprint().getName());
action.appendEffect(
new AssignmentEffect(matchingCard.getOwner(), self.getAttachedTo(), matchingCard));
return action;
}
return null;
}
});
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.REGROUP, self)
&& PlayConditions.canSelfDiscard(self, game)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new DiscardCardsFromPlayEffect(self, self));
action.appendEffect(
new RemoveTwilightEffect(4));
return Collections.singletonList(action);
}
return null;
}
}