This commit is contained in:
marcins78@gmail.com
2011-12-15 11:49:33 +00:00
parent 6a221661b2
commit b6c828074e
3 changed files with 127 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.common.Token;
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;
public class ReinforceTokenEffect extends ChooseActiveCardEffect {
private Token _token;
private int _count;
public ReinforceTokenEffect(PhysicalCard source, String playerId, Token token) {
this(source, playerId, token, 1);
}
public ReinforceTokenEffect(PhysicalCard source, String playerId, Token token, int count) {
super(source, playerId, "Choose card to reinforce", Filters.owner(playerId), Filters.hasToken(token));
_token = token;
_count = count;
}
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
game.getGameState().addTokens(card, _token, _count);
}
}

View File

@@ -0,0 +1,68 @@
package com.gempukku.lotro.cards.set13;
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.cards.effects.ReinforceTokenEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndRemoveCultureTokensFromCardEffect;
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 com.gempukku.lotro.logic.actions.OptionalTriggerAction;
import com.gempukku.lotro.logic.effects.AbstractPreventableCardEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: Bloodlines
* Side: Free
* Culture: Dwarven
* Twilight Cost: 1
* Type: Possession • Mount
* Resistance: +1
* Game Text: Bearer must be a Dwarf. When you play Arod, you may reinforce a [DWARVEN] token. Response: If bearer is
* about to take a wound during a skirmish, remove 2 [DWARVEN] tokens to prevent that.
*/
public class Card13_001 extends AbstractAttachableFPPossession {
public Card13_001() {
super(1, 0, 0, Culture.DWARVEN, PossessionClass.MOUNT, "Arod", true);
}
@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.played(game, effectResult, self)) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ReinforceTokenEffect(self, playerId, Token.DWARVEN));
return Collections.singletonList(action);
}
return null;
}
@Override
public List<? extends Action> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (TriggerConditions.isGettingWounded(effect, game, self.getAttachedTo())
&& PlayConditions.isPhase(game, Phase.SKIRMISH)
&& PlayConditions.canRemoveTokens(game, Token.DWARVEN, 2, Filters.any)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndRemoveCultureTokensFromCardEffect(self, playerId, Token.DWARVEN, 2, Filters.any));
action.appendEffect(
new PreventCardEffect((AbstractPreventableCardEffect) effect, self.getAttachedTo()));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -213,4 +213,36 @@ public class IndividualCardAtTest extends AbstractAtTest {
assertEquals(Zone.ATTACHED, mumak.getZone());
}
@Test
public void musterFrodoAllowsToDiscardAndDraw() throws DecisionResultInvalidException {
Map<String, LotroDeck> decks = new HashMap<String, LotroDeck>();
final LotroDeck p1Deck = createSimplestDeck();
p1Deck.setRingBearer("11_164");
decks.put(P1, p1Deck);
decks.put(P2, createSimplestDeck());
initializeGameWithDecks(decks);
skipMulligans();
PhysicalCardImpl mumakChieftain = new PhysicalCardImpl(100, "10_45", P1, _library.getLotroCardBlueprint("10_45"));
_game.getGameState().addCardToZone(_game, mumakChieftain, Zone.HAND);
// End fellowship phase
playerDecided(P1, "");
// End fellowship phase
playerDecided(P2, "");
playerDecided(P1, "0");
assertEquals(1, _game.getGameState().getWounds(_game.getGameState().getRingBearer(P1)));
assertEquals(1, _game.getGameState().getHand(P1).size());
playerDecided(P1, "0");
assertEquals(0, _game.getGameState().getHand(P1).size());
}
}