"Gloin"
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package com.gempukku.lotro.cards.effects.choose;
|
||||
|
||||
import com.gempukku.lotro.cards.effects.PutCardFromHandOnBottomOfDeckEffect;
|
||||
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.ChooseArbitraryCardsEffect;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSubActionEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class ChooseAndPutCardsFromHandBeneathDrawDeckEffect extends AbstractSubActionEffect {
|
||||
private Action _action;
|
||||
private String _playerId;
|
||||
private int _count;
|
||||
private Filterable[] _filters;
|
||||
|
||||
public ChooseAndPutCardsFromHandBeneathDrawDeckEffect(Action action, String playerId, int count, Filterable... filters) {
|
||||
_action = action;
|
||||
_playerId = playerId;
|
||||
_count = count;
|
||||
_filters = filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
return Filters.filter(game.getGameState().getHand(_playerId), game.getGameState(), game.getModifiersQuerying(), _filters).size() >= _count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(LotroGame game) {
|
||||
final Collection<PhysicalCard> cards = Filters.filter(game.getGameState().getHand(_playerId), game.getGameState(), game.getModifiersQuerying(), _filters);
|
||||
SubAction subAction = new SubAction(_action);
|
||||
subAction.appendEffect(
|
||||
new ChooseAndPutNextCardFromHandOnBottomOfLibrary(subAction, Math.min(_count, cards.size()), cards));
|
||||
processSubAction(game, subAction);
|
||||
}
|
||||
|
||||
private class ChooseAndPutNextCardFromHandOnBottomOfLibrary extends ChooseArbitraryCardsEffect {
|
||||
private Collection<PhysicalCard> _remainingCards;
|
||||
private SubAction _subAction;
|
||||
private int _remainingCount;
|
||||
|
||||
public ChooseAndPutNextCardFromHandOnBottomOfLibrary(SubAction subAction, int remainingCount, Collection<PhysicalCard> remainingCards) {
|
||||
super(_playerId, "Choose a card to put on bottom of your deck", remainingCards, 1, 1);
|
||||
_subAction = subAction;
|
||||
_remainingCount = remainingCount;
|
||||
_remainingCards = remainingCards;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||
for (PhysicalCard selectedCard : selectedCards) {
|
||||
_subAction.appendEffect(
|
||||
new PutCardFromHandOnBottomOfDeckEffect(selectedCard));
|
||||
_remainingCards.remove(selectedCard);
|
||||
if (_remainingCount - 1 > 0)
|
||||
_subAction.appendEffect(
|
||||
new ChooseAndPutNextCardFromHandOnBottomOfLibrary(_subAction, _remainingCount - 1, _remainingCards));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.gempukku.lotro.cards.set15.dwarven;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractCompanion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndPutCardsFromHandBeneathDrawDeckEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndRemoveCultureTokensFromCardEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.common.Race;
|
||||
import com.gempukku.lotro.common.Token;
|
||||
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.ActivateCardAction;
|
||||
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.effects.DrawCardsEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Hunters
|
||||
* Side: Free
|
||||
* Culture: Dwarven
|
||||
* Twilight Cost: 2
|
||||
* Type: Companion • Dwarf
|
||||
* Strength: 6
|
||||
* Vitality: 3
|
||||
* Resistance: 6
|
||||
* Game Text: Each time Gloin wins a skirmish, you may draw 3 cards, then place 3 cards from your hand beneath your draw
|
||||
* deck in any order. Skirmish: Remove a [DWARVEN] token to make Gloin strength +2.
|
||||
*/
|
||||
public class Card15_006 extends AbstractCompanion {
|
||||
public Card15_006() {
|
||||
super(2, 6, 3, 6, Culture.DWARVEN, Race.DWARF, null, "Gloin", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.winsSkirmish(game, effectResult, self)) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new DrawCardsEffect(playerId, 3));
|
||||
action.appendEffect(
|
||||
new ChooseAndPutCardsFromHandBeneathDrawDeckEffect(action, playerId, 3, Filters.any));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ActivateCardAction> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.SKIRMISH, self)
|
||||
&& PlayConditions.canRemoveTokens(game, Token.DWARVEN, 1, Filters.any)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new ChooseAndRemoveCultureTokensFromCardEffect(self, playerId, Token.DWARVEN, 1, Filters.any));
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new StrengthModifier(self, self, 2), Phase.SKIRMISH));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user