"Cave Troll of Moria", "Monstrous Fiend"
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package com.gempukku.lotro.cards.effects.discount;
|
||||
|
||||
import com.gempukku.lotro.cards.effects.DiscountEffect;
|
||||
import com.gempukku.lotro.common.Filterable;
|
||||
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.SubAction;
|
||||
import com.gempukku.lotro.logic.effects.ChooseAndDiscardCardsFromHandEffect;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSubActionEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class DiscardCardFromHandDiscountEffect extends AbstractSubActionEffect implements DiscountEffect {
|
||||
private Action _action;
|
||||
private String _playerId;
|
||||
private int _minimalDiscount;
|
||||
private int _discardedCount;
|
||||
private Filterable[] _discardedCardFilter;
|
||||
|
||||
public DiscardCardFromHandDiscountEffect(Action action, String playerId, Filterable... discardedCardFilter) {
|
||||
_action = action;
|
||||
_playerId = playerId;
|
||||
_discardedCardFilter = discardedCardFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDiscountPaidFor() {
|
||||
return _discardedCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinimalRequiredDiscount(int minimalDiscount) {
|
||||
_minimalDiscount = minimalDiscount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Discard cards to reduce twilight cost";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
return Filters.filter(game.getGameState().getHand(_playerId), game.getGameState(), game.getModifiersQuerying(), _discardedCardFilter).size() >= _minimalDiscount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(LotroGame game) {
|
||||
if (isPlayableInFull(game)) {
|
||||
SubAction subAction = new SubAction(_action);
|
||||
subAction.appendEffect(
|
||||
new ChooseAndDiscardCardsFromHandEffect(_action, _playerId, false, _minimalDiscount, Integer.MAX_VALUE, _discardedCardFilter) {
|
||||
@Override
|
||||
protected void cardsBeingDiscardedCallback(Collection<PhysicalCard> cardsBeingDiscarded) {
|
||||
_discardedCount = cardsBeingDiscarded.size();
|
||||
}
|
||||
});
|
||||
processSubAction(game, subAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.gempukku.lotro.cards.set20.moria;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractMinion;
|
||||
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
|
||||
import com.gempukku.lotro.cards.effects.DiscountEffect;
|
||||
import com.gempukku.lotro.cards.effects.discount.DiscardCardFromHandDiscountEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Race;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
|
||||
/**
|
||||
* 10
|
||||
* •Cave Troll of Moria, Monstrous Fiend
|
||||
* Moria Minion • Troll
|
||||
* 15 4 4
|
||||
* Damage +1. Fierce.
|
||||
* When you play Cave Troll of Moria, you may discard X [Moria] cards from hand; Cave Troll of Moria's twilight cost
|
||||
* is -1 for each [Moria] card discarded in this way.
|
||||
*/
|
||||
public class Card20_256 extends AbstractMinion {
|
||||
public Card20_256() {
|
||||
super(10, 15, 4, 4, Race.TROLL, Culture.MORIA, "Cave Troll of Moria", "Monstrous Fiend", true);
|
||||
addKeyword(Keyword.DAMAGE, 1);
|
||||
addKeyword(Keyword.FIERCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPotentialExtraPaymentDiscount(String playerId, LotroGame game, PhysicalCard self) {
|
||||
return -Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Culture.MORIA, Filters.not(self)).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DiscountEffect getDiscountEffect(PlayPermanentAction action, String playerId, LotroGame game, PhysicalCard self) {
|
||||
return new DiscardCardFromHandDiscountEffect(action, playerId, Culture.MORIA);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user