"Goblin Scavengers"
This commit is contained in:
@@ -32,9 +32,13 @@ public abstract class AbstractAttachable extends AbstractLotroCardBlueprint {
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||
return checkPlayRequirements(playerId, game, self, Filters.any(), twilightModifier);
|
||||
}
|
||||
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, Filter additionalAttachmentFilter, int twilightModifier) {
|
||||
return (self.getBlueprint().getSide() != Side.SHADOW || PlayConditions.canPayForShadowCard(game, self, twilightModifier))
|
||||
&& PlayConditions.checkUniqueness(game.getGameState(), game.getModifiersQuerying(), self)
|
||||
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), getValidTargetFilter(playerId, game, self));
|
||||
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), getValidTargetFilter(playerId, game, self), additionalAttachmentFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,7 +60,11 @@ public abstract class AbstractAttachable extends AbstractLotroCardBlueprint {
|
||||
|
||||
@Override
|
||||
public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||
return new AttachPermanentAction(game, self, getValidTargetFilter(playerId, game, self), getAttachCostModifiers(playerId, game, self));
|
||||
return getPlayCardAction(playerId, game, self, Filters.any(), twilightModifier);
|
||||
}
|
||||
|
||||
public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, Filter additionalAttachmentFilter, int twilightModifier) {
|
||||
return new AttachPermanentAction(game, self, Filters.and(getValidTargetFilter(playerId, game, self), additionalAttachmentFilter), getAttachCostModifiers(playerId, game, self));
|
||||
}
|
||||
|
||||
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ChooseAndPlayCardFromDiscardEffect extends UnrespondableEffect {
|
||||
private String _playerId;
|
||||
private Filter _filter;
|
||||
private int _twilightModifier;
|
||||
|
||||
public ChooseAndPlayCardFromDiscardEffect(String playerId, Filter filter) {
|
||||
this(playerId, filter, 0);
|
||||
}
|
||||
|
||||
public ChooseAndPlayCardFromDiscardEffect(String playerId, Filter filter, int twilightModifier) {
|
||||
_playerId = playerId;
|
||||
_filter = filter;
|
||||
_twilightModifier = twilightModifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "Play card from discard";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(final LotroGame game) {
|
||||
List<PhysicalCard> discard = Filters.filter(game.getGameState().getDiscard(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier));
|
||||
game.getUserFeedback().sendAwaitingDecision(_playerId,
|
||||
new ArbitraryCardsSelectionDecision(1, "Choose a card to play", discard, 0, 1) {
|
||||
@Override
|
||||
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||
List<PhysicalCard> selectedCards = getSelectedCardsByResponse(result);
|
||||
if (selectedCards.size() > 0) {
|
||||
PhysicalCard selectedCard = selectedCards.get(0);
|
||||
game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.gempukku.lotro.cards.set1.moria;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||
import com.gempukku.lotro.cards.AbstractMinion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.ChooseArbitraryCardsEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.DefaultCostToEffectAction;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Fellowship of the Ring
|
||||
* Side: Shadow
|
||||
* Culture: Moria
|
||||
* Twilight Cost: 3
|
||||
* Type: Minion • Orc
|
||||
* Strength: 8
|
||||
* Vitality: 1
|
||||
* Site: 4
|
||||
* Game Text: When you play this minion, you may play a weapon from your discard pile on your [MORIA] Orc.
|
||||
*/
|
||||
public class Card1_179 extends AbstractMinion {
|
||||
public Card1_179() {
|
||||
super(3, 8, 1, 4, Keyword.ORC, Culture.MORIA, "Goblin Scavengers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalAfterTriggers(final String playerId, final LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
||||
if (PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.sameCard(self))) {
|
||||
final Filter additionalAttachmentFilter = Filters.and(Filters.owner(self.getOwner()), Filters.culture(Culture.MORIA), Filters.keyword(Keyword.ORC));
|
||||
|
||||
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Play a weapon from your discard pile on your [MORIA] Orc.");
|
||||
action.addEffect(
|
||||
new ChooseArbitraryCardsEffect(playerId, "Choose card to play", game.getGameState().getDiscard(playerId),
|
||||
Filters.and(
|
||||
Filters.or(Filters.keyword(Keyword.HAND_WEAPON), Filters.keyword(Keyword.RANGED_WEAPON)),
|
||||
new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
AbstractAttachable weapon = (AbstractAttachable) physicalCard.getBlueprint();
|
||||
return weapon.checkPlayRequirements(playerId, game, physicalCard, additionalAttachmentFilter, 0);
|
||||
}
|
||||
})
|
||||
, 1, 1) {
|
||||
@Override
|
||||
protected void cardsSelected(List<PhysicalCard> selectedCards) {
|
||||
PhysicalCard selectedCard = selectedCards.get(0);
|
||||
game.getActionsEnvironment().addActionToStack(((AbstractAttachable) selectedCard.getBlueprint()).getPlayCardAction(playerId, game, selectedCard, additionalAttachmentFilter, 0));
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user