"Mithril Mine"

This commit is contained in:
marcins78@gmail.com
2011-08-31 23:52:17 +00:00
parent 4319067f89
commit 8e8c4e66f5
2 changed files with 73 additions and 5 deletions

View File

@@ -18,13 +18,19 @@ import com.gempukku.lotro.logic.timing.results.WoundResult;
import java.util.List;
public class PlayConditions {
private static boolean nonPlayZone(Zone zone) {
return zone != Zone.SHADOW_CHARACTERS && zone != Zone.SHADOW_SUPPORT
&& zone != Zone.FREE_SUPPORT && zone != Zone.FREE_CHARACTERS
&& zone != Zone.ATTACHED && zone != Zone.ADVENTURE_PATH;
}
public static boolean canPlayFPCardDuringPhase(LotroGame game, Phase phase, PhysicalCard self) {
return (phase == null || game.getGameState().getCurrentPhase() == phase) && (self.getZone() == Zone.HAND || self.getZone() == Zone.DECK)
return (phase == null || game.getGameState().getCurrentPhase() == phase) && nonPlayZone(self.getZone())
&& (!self.getBlueprint().isUnique() || !Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName())));
}
public static boolean canPlayShadowCardDuringPhase(LotroGame game, Phase phase, PhysicalCard self) {
return (phase == null || game.getGameState().getCurrentPhase() == phase) && (self.getZone() == Zone.HAND || self.getZone() == Zone.DECK)
return (phase == null || game.getGameState().getCurrentPhase() == phase) && nonPlayZone(self.getZone())
&& game.getModifiersQuerying().getTwilightCost(game.getGameState(), self) <= game.getGameState().getTwilightPool()
&& (!self.getBlueprint().isUnique() || !Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName())));
}
@@ -44,7 +50,7 @@ public class PlayConditions {
public static boolean canPlayCompanionDuringSetup(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) {
LotroCardBlueprint blueprint = self.getBlueprint();
return (self.getZone() == Zone.DECK
return (nonPlayZone(self.getZone())
&& self.getBlueprint().getCardType() == CardType.COMPANION
&& gameState.getCurrentPhase() == Phase.GAME_SETUP
&& (!blueprint.isUnique() || !Filters.canSpot(gameState, modifiersQuerying, Filters.name(blueprint.getName())))
@@ -53,7 +59,7 @@ public class PlayConditions {
public static boolean canPlayCharacterDuringFellowship(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) {
LotroCardBlueprint blueprint = self.getBlueprint();
return (self.getZone() == Zone.HAND
return (nonPlayZone(self.getZone())
&& (self.getBlueprint().getCardType() == CardType.COMPANION || self.getBlueprint().getCardType() == CardType.ALLY)
&& gameState.getCurrentPhase() == Phase.FELLOWSHIP
&& (!blueprint.isUnique() || !Filters.canSpot(gameState, modifiersQuerying, Filters.name(blueprint.getName()))));
@@ -61,7 +67,7 @@ public class PlayConditions {
public static boolean canPlayMinionDuringShadow(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) {
LotroCardBlueprint blueprint = self.getBlueprint();
return (self.getZone() == Zone.HAND
return (nonPlayZone(self.getZone())
&& gameState.getCurrentPhase() == Phase.SHADOW
&& gameState.getTwilightPool() >= modifiersQuerying.getTwilightCost(gameState, self)
&& (!blueprint.isUnique() || !Filters.canSpot(gameState, modifiersQuerying, Filters.name(blueprint.getName()))));

View File

@@ -0,0 +1,62 @@
package com.gempukku.lotro.cards.set1.site;
import com.gempukku.lotro.cards.AbstractSite;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.filters.Filter;
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.CostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: The Fellowship of the Ring
* Twilight Cost: 3
* Type: Site
* Site: 4
* Game Text: Underground. Shadow: Remove (1) to play a Shadow weapon from your discard pile.
*/
public class Card1_345 extends AbstractSite {
public Card1_345() {
super("Mithril Mine", 4, 3, Direction.RIGHT);
addKeyword(Keyword.UNDERGROUND);
}
@Override
public List<? extends Action> getPlayablePhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseSiteDuringPhase(game.getGameState(), Phase.SHADOW, self)
&& game.getGameState().getTwilightPool() >= 1) {
CostToEffectAction action = new CostToEffectAction(self, Keyword.SHADOW, "Remove (1) to play a Shadow weapon from your discard pile.");
action.addCost(new RemoveTwilightEffect(1));
action.addEffect(
new ChooseArbitraryCardsEffect(playerId, "Choose Shadow weapon to play", Filters.filter(game.getGameState().getDiscard(playerId), game.getGameState(), game.getModifiersQuerying(),
Filters.or(
Filters.keyword(Keyword.HAND_WEAPON),
Filters.keyword(Keyword.RANGED_WEAPON)),
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
List<? extends Action> playableActions = physicalCard.getBlueprint().getPlayablePhaseActions(playerId, game, physicalCard);
return (playableActions != null && playableActions.size() > 0);
}
}), 1, 1) {
@Override
protected void cardsSelected(List<PhysicalCard> selectedCards) {
PhysicalCard selectedCard = selectedCards.get(0);
game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayablePhaseActions(playerId, game, selectedCard).get(0));
}
});
return Collections.singletonList(action);
}
return null;
}
}