"Destroyed Homestead"

This commit is contained in:
marcins78@gmail.com
2012-01-27 14:43:29 +00:00
parent b24a32f807
commit 47913af338
2 changed files with 57 additions and 1 deletions

View File

@@ -0,0 +1,56 @@
package com.gempukku.lotro.cards.set15.men;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.RevealCardEffect;
import com.gempukku.lotro.cards.modifiers.RemoveGameTextModifier;
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.GameUtils;
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: The Hunters
* Side: Shadow
* Culture: Men
* Twilight Cost: 3
* Type: Condition • Support Area
* Game Text: When you play this, spot 2 [MEN] Men to randomly reveal a site from the Free Peoples players
* adventure deck. Note its cardtitle. Each site on the adventure path with the same card title as the selected site
* loses its gametext.
*/
public class Card15_076 extends AbstractPermanent {
public Card15_076() {
super(Side.SHADOW, 3, CardType.CONDITION, Culture.MEN, Zone.SUPPORT, "Destroyed Homestead");
}
@Override
public Modifier getAlwaysOnModifier(PhysicalCard self) {
return new RemoveGameTextModifier(self, Filters.and(CardType.SITE, Zone.ADVENTURE_PATH, Filters.name((String) self.getWhileInZoneData())));
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.played(game, effectResult, self)
&& PlayConditions.canSpot(game, 2, Culture.MEN, Race.MAN)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
final List<PhysicalCard> randomCards = GameUtils.getRandomCards(game.getGameState().getAdventureDeck(game.getGameState().getCurrentPlayerId()), 1);
if (randomCards.size() == 1) {
PhysicalCard randomSite = randomCards.get(0);
action.appendEffect(
new RevealCardEffect(self, randomCards.get(0)));
self.setWhileInZoneData(randomSite.getBlueprint().getName());
}
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -666,7 +666,7 @@ public class Filters {
return new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return physicalCard.getBlueprint().getName() != null && physicalCard.getBlueprint().getName().equals(name);
return name != null && physicalCard.getBlueprint().getName() != null && physicalCard.getBlueprint().getName().equals(name);
}
};
}