"Memories of Darkness"

This commit is contained in:
marcins78@gmail.com
2011-11-15 15:31:21 +00:00
parent 976f997164
commit 1b4ed2ebcd
2 changed files with 67 additions and 0 deletions

View File

@@ -173,6 +173,15 @@ public class PlayConditions {
return game.getModifiersQuerying().hasInitiative(game.getGameState()) == side;
}
public static boolean loseInitiative(EffectResult effectResult, Side side) {
if (effectResult.getType() == EffectResult.Type.INITIATIVE_CHANGE) {
InitiativeChangeResult initiativeChangeResult = (InitiativeChangeResult) effectResult;
if (initiativeChangeResult.getSide() != side)
return true;
}
return false;
}
public static boolean canAddThreat(LotroGame game, PhysicalCard card, int count) {
return Filters.countActive(game.getGameState(), game.getModifiersQuerying(), CardType.COMPANION) - game.getGameState().getThreats() >= count;
}

View File

@@ -0,0 +1,58 @@
package com.gempukku.lotro.cards.set10.dwarven;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromHandEffect;
import com.gempukku.lotro.common.*;
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.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* Set: Mount Doom
* Side: Free
* Culture: Dwarven
* Twilight Cost: 1
* Type: Condition • Support Area
* Game Text: To play, spot a Dwarf. Each time you lose initiative (except during the fellowship phase), you may play
* a [DWARVEN] condition from hand or from your discard pile.
*/
public class Card10_002 extends AbstractPermanent {
public Card10_002() {
super(Side.FREE_PEOPLE, 1, CardType.CONDITION, Culture.DWARVEN, Zone.SUPPORT, "Memories of Darkness", true);
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier, ignoreRoamingPenalty)
&& PlayConditions.canSpot(game, Race.DWARF);
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (PlayConditions.loseInitiative(effectResult, Side.FREE_PEOPLE)
&& game.getGameState().getCurrentPhase() != Phase.FELLOWSHIP
&& (
PlayConditions.canPlayFromHand(playerId, game, Culture.DWARVEN, CardType.CONDITION)
|| PlayConditions.canPlayFromDiscard(playerId, game, Culture.DWARVEN, CardType.CONDITION))) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
List<Effect> possibleEffects = new LinkedList<Effect>();
possibleEffects.add(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Culture.DWARVEN, CardType.CONDITION));
possibleEffects.add(
new ChooseAndPlayCardFromDiscardEffect(playerId, game.getGameState().getDiscard(playerId), Culture.DWARVEN, CardType.CONDITION));
action.appendEffect(
new ChoiceEffect(action, playerId, possibleEffects));
return Collections.singletonList(action);
}
return null;
}
}