- Stacking discarded Hobbits on Treebeard should no longer cancel their action, for which the cost was discarding them.

This commit is contained in:
marcins78@gmail.com
2012-03-05 14:13:30 +00:00
parent 0508abaa31
commit 86afd76195
3 changed files with 16 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collection;
import java.util.Collections;
@@ -42,7 +43,7 @@ public class Card4_103 extends AbstractAlly {
@Override
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, final PhysicalCard self) {
if (TriggerConditions.isGettingDiscarded(effect, game, Race.HOBBIT, Filters.unboundCompanion)) {
DiscardCardsFromPlayEffect discardEffect = (DiscardCardsFromPlayEffect) effect;
final DiscardCardsFromPlayEffect discardEffect = (DiscardCardsFromPlayEffect) effect;
Collection<PhysicalCard> discardedHobbits = Filters.filter(discardEffect.getAffectedCardsMinusPrevented(game), game.getGameState(), game.getModifiersQuerying(), Filters.unboundCompanion, Race.HOBBIT);
final ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(
@@ -51,6 +52,13 @@ public class Card4_103 extends AbstractAlly {
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.insertEffect(
new StackCardFromPlayEffect(card, self));
action.appendEffect(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
discardEffect.incrementInstead();
}
});
}
});
return Collections.singletonList(action);

View File

@@ -13,6 +13,7 @@ public abstract class AbstractPreventableCardEffect extends AbstractEffect {
private Filter _filter;
private Set<PhysicalCard> _preventedTargets = new HashSet<PhysicalCard>();
private int _requiredTargets;
private int _insteadCount;
public AbstractPreventableCardEffect(PhysicalCard... cards) {
List<PhysicalCard> affectedCards = Arrays.asList(cards);
@@ -48,10 +49,14 @@ public abstract class AbstractPreventableCardEffect extends AbstractEffect {
Collection<PhysicalCard> affectedCards = getAffectedCards(game);
Collection<PhysicalCard> affectedMinusPreventedCards = getAffectedCardsMinusPrevented(game);
playoutEffectOn(game, affectedMinusPreventedCards);
return new FullEffectResult(affectedCards.size() >= _requiredTargets, affectedMinusPreventedCards.size() >= _requiredTargets);
return new FullEffectResult(affectedCards.size() + _insteadCount >= _requiredTargets, affectedMinusPreventedCards.size() >= _requiredTargets);
}
public void preventEffect(LotroGame game, PhysicalCard card) {
_preventedTargets.add(card);
}
public void incrementInstead() {
_insteadCount++;
}
}

View File

@@ -1,6 +1,7 @@
<pre style="font-size:80%">
<b>5 Mar. 2012</b>
- "Discard to heal" actions now shows the card to the opponent, the same way, as in case of played events.
- Stacking discarded Hobbits on Treebeard should no longer cancel their action, for which the cost was discarding them.
<b>3 Mar. 2012</b>
- "The Palantir of Orthanc, Recovered Seeing Stone" should no longer discard itself.