"Bold Men and Grim"

This commit is contained in:
marcins78@gmail.com
2011-11-03 09:49:18 +00:00
parent a697923595
commit 52d3be0b95
6 changed files with 95 additions and 27 deletions

View File

@@ -1,6 +1,5 @@
package com.gempukku.lotro.cards.actions;
import com.gempukku.lotro.cards.effects.AttachCardEffect;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.cards.effects.PayPlayOnTwilightCostEffect;
import com.gempukku.lotro.cards.effects.ShuffleDeckEffect;
@@ -27,9 +26,6 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
private Iterator<Effect> _preCostIterator;
private Effect _putCardIntoPlayEffect;
private boolean _cardPutIntoPlay;
private Effect _playCardEffect;
private boolean _cardPlayed;
@@ -54,8 +50,6 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
new ExertCharactersEffect(target, target));
}
_putCardIntoPlayEffect = new AttachCardEffect(_cardToAttach, target);
int modifier = twilightModifier;
for (Map.Entry<Filter, Integer> filterIntegerEntry : attachCostModifiers.entrySet())
if (filterIntegerEntry.getKey().accepts(game.getGameState(), game.getModifiersQuerying(), target))
@@ -109,7 +103,7 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
return _chooseTargetEffect;
}
if (_putCardIntoPlayEffect != null) {
if (_playCardEffect != null) {
if (_preCostIterator.hasNext())
return _preCostIterator.next();
@@ -118,11 +112,6 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
if (cost != null)
return cost;
if (!_cardPutIntoPlay) {
_cardPutIntoPlay = true;
return _putCardIntoPlayEffect;
}
if (!_cardPlayed) {
_cardPlayed = true;
return _playCardEffect;

View File

@@ -90,8 +90,6 @@ public class PlayEventAction extends AbstractCostToEffectAction {
return cost;
if (!_cardPlayed) {
if (_eventPlayed.getZone() != null)
game.getGameState().removeCardsFromZone(_eventPlayed.getOwner(), Collections.singleton(_eventPlayed));
_cardPlayed = true;
return _playCardEffect;
}

View File

@@ -24,8 +24,6 @@ public class PlayPermanentAction extends AbstractCostToEffectAction {
private Iterator<Effect> _preCostIterator;
private boolean _cardPutIntoPlay;
private Effect _playCardEffect;
private boolean _cardPlayed;
@@ -43,7 +41,7 @@ public class PlayPermanentAction extends AbstractCostToEffectAction {
_preCostIterator = preCostEffects.iterator();
_playCardEffect = new PlayCardEffect(card);
_playCardEffect = new PlayCardEffect(card, zone);
}
@Override
@@ -77,13 +75,6 @@ public class PlayPermanentAction extends AbstractCostToEffectAction {
if (cost != null)
return cost;
if (!_cardPutIntoPlay) {
_cardPutIntoPlay = true;
if (_permanentPlayed.getZone() != null)
game.getGameState().removeCardsFromZone(_permanentPlayed.getOwner(), Collections.singleton(_permanentPlayed));
game.getGameState().addCardToZone(game, _permanentPlayed, _zone);
}
if (!_cardPlayed) {
_cardPlayed = true;
return _playCardEffect;

View File

@@ -0,0 +1,75 @@
package com.gempukku.lotro.cards.set7.raider;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
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.OptionalTriggerAction;
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.effects.AddThreatsEffect;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.effects.RemoveThreatsEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: The Return of the King
* Side: Shadow
* Culture: Raider
* Twilight Cost: 1
* Type: Condition • Support Area
* Game Text: To play, spot 2 [RAIDER] Men and add a threat. Each time a companion is about to be killed, you may remove
* a threat to discard a companion (except the Ring-bearer). Discard this condition at the start of the regroup phase.
*/
public class Card7_129 extends AbstractPermanent {
public Card7_129() {
super(Side.SHADOW, 1, CardType.CONDITION, Culture.RAIDER, Zone.SUPPORT, "Bold Men and Grim", true);
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
&& PlayConditions.canSpot(game, 2, Culture.RAIDER, Race.MAN)
&& PlayConditions.canAddThreat(game, self, 1);
}
@Override
public PlayPermanentAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
final PlayPermanentAction playCardAction = super.getPlayCardAction(playerId, game, self, twilightModifier);
playCardAction.appendCost(
new AddThreatsEffect(playerId, self, 1));
return playCardAction;
}
@Override
public List<OptionalTriggerAction> getOptionalBeforeTriggers(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (PlayConditions.isGettingKilled(effect, game, CardType.COMPANION)
&& PlayConditions.canRemoveThreat(game, self, 1)) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendCost(
new RemoveThreatsEffect(self, 1));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, CardType.COMPANION, Filters.not(Keyword.RING_BEARER)));
return Collections.singletonList(action);
}
return null;
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (PlayConditions.startOfPhase(game, effectResult, Phase.REGROUP)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new DiscardCardsFromPlayEffect(self, self));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.logic.effects;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.AbstractEffect;
@@ -11,14 +12,17 @@ import java.util.Collections;
public class PlayCardEffect extends AbstractEffect {
private PhysicalCard _cardPlayed;
private PhysicalCard _attachedToCard;
private Zone _zone;
public PlayCardEffect(PhysicalCard cardPlayed) {
this(cardPlayed, null);
public PlayCardEffect(PhysicalCard cardPlayed, Zone zone) {
_cardPlayed = cardPlayed;
_zone = zone;
}
public PlayCardEffect(PhysicalCard cardPlayed, PhysicalCard attachedToCard) {
_cardPlayed = cardPlayed;
_attachedToCard = attachedToCard;
_zone = Zone.ATTACHED;
}
public PhysicalCard getPlayedCard() {
@@ -46,6 +50,14 @@ public class PlayCardEffect extends AbstractEffect {
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (_cardPlayed.getZone() != null)
game.getGameState().removeCardsFromZone(_cardPlayed.getOwner(), Collections.singleton(_cardPlayed));
if (_attachedToCard != null) {
game.getGameState().attachCard(game, _cardPlayed, _attachedToCard);
} else {
game.getGameState().addCardToZone(game, _cardPlayed, _zone);
}
return new FullEffectResult(Collections.singleton(new PlayCardResult(_cardPlayed, _attachedToCard)), true, true);
}
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.logic.effects;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.results.PlayEventResult;
@@ -12,7 +13,7 @@ public class PlayEventEffect extends PlayCardEffect {
private PlayEventResult _playEventResult;
public PlayEventEffect(PhysicalCard cardPlayed, boolean requiresRanger) {
super(cardPlayed);
super(cardPlayed, (Zone) null);
_cardPlayed = cardPlayed;
_requiresRanger = requiresRanger;
_playEventResult = new PlayEventResult(getPlayedCard(), _requiresRanger);
@@ -24,6 +25,8 @@ public class PlayEventEffect extends PlayCardEffect {
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (_cardPlayed.getZone() != null)
game.getGameState().removeCardsFromZone(_cardPlayed.getOwner(), Collections.singleton(_cardPlayed));
return new FullEffectResult(Collections.singleton(_playEventResult), true, true);
}
}