"Corsair Halberd"

This commit is contained in:
marcins78@gmail.com
2012-03-07 12:28:43 +00:00
parent b96a7fc33d
commit 4533e8d0fa
3 changed files with 133 additions and 2 deletions

View File

@@ -0,0 +1,59 @@
package com.gempukku.lotro.cards.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.GameUtils;
import com.gempukku.lotro.logic.timing.AbstractEffect;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
public class RemoveCardsFromDeadPileEffect extends AbstractEffect {
private String _playerPerforming;
private PhysicalCard _source;
private Collection<PhysicalCard> _cardsToRemove;
public RemoveCardsFromDeadPileEffect(String playerPerforming, PhysicalCard source, Collection<PhysicalCard> cardsToRemove) {
_playerPerforming = playerPerforming;
_source = source;
_cardsToRemove = cardsToRemove;
}
@Override
public String getText(LotroGame game) {
return null;
}
@Override
public Type getType() {
return null;
}
@Override
public boolean isPlayableInFull(LotroGame game) {
for (PhysicalCard physicalCard : _cardsToRemove) {
if (physicalCard.getZone() != Zone.DEAD)
return false;
}
return true;
}
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
Set<PhysicalCard> removedCards = new HashSet<PhysicalCard>();
for (PhysicalCard physicalCard : _cardsToRemove)
if (physicalCard.getZone() == Zone.DEAD)
removedCards.add(physicalCard);
game.getGameState().removeCardsFromZone(_playerPerforming, removedCards);
for (PhysicalCard removedCard : removedCards)
game.getGameState().addCardToZone(game, removedCard, Zone.REMOVED);
game.getGameState().sendMessage(_playerPerforming + " removed " + GameUtils.getAppendedNames(removedCards) + " from dead pile using " + GameUtils.getCardLink(_source));
return new FullEffectResult(_cardsToRemove.size() == removedCards.size(), _cardsToRemove.size() == removedCards.size());
}
}

View File

@@ -38,13 +38,13 @@ public abstract class ChooseCardsFromDeadPileEffect extends AbstractEffect {
@Override
public boolean isPlayableInFull(LotroGame game) {
Collection<PhysicalCard> cards = Filters.filter(game.getGameState().getDeadPile(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter);
Collection<PhysicalCard> cards = Filters.filter(game.getGameState().getDeadPile(game.getGameState().getCurrentPlayerId()), game.getGameState(), game.getModifiersQuerying(), _filter);
return cards.size() >= _minimum;
}
@Override
protected FullEffectResult playEffectReturningResult(final LotroGame game) {
Collection<PhysicalCard> cards = Filters.filter(game.getGameState().getDeadPile(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter);
Collection<PhysicalCard> cards = Filters.filter(game.getGameState().getDeadPile(game.getGameState().getCurrentPlayerId()), game.getGameState(), game.getModifiersQuerying(), _filter);
boolean success = cards.size() >= _minimum;

View File

@@ -0,0 +1,72 @@
package com.gempukku.lotro.cards.set18.men;
import com.gempukku.lotro.cards.AbstractAttachable;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.RemoveCardsFromDeadPileEffect;
import com.gempukku.lotro.cards.effects.TakeControlOfASiteEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseCardsFromDeadPileEffect;
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.ActivateCardAction;
import com.gempukku.lotro.logic.modifiers.KeywordModifier;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* Set: Treachery & Deceit
* Side: Shadow
* Culture: Men
* Twilight Cost: 3
* Type: Possession • Hand Weapon
* Strength: +2
* Game Text: Bearer must be a [MEN] minion. Bearer is damage +1. Shadow: Remove a companion in the dead pile from
* the game to control a site.
*/
public class Card18_063 extends AbstractAttachable {
public Card18_063() {
super(Side.SHADOW, CardType.POSSESSION, 3, Culture.MEN, PossessionClass.HAND_WEAPON, "Corsair Halberd");
}
@Override
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Culture.MEN, CardType.MINION);
}
@Override
public List<? extends Modifier> getAlwaysOnModifiers(LotroGame game, PhysicalCard self) {
List<Modifier> modifiers = new LinkedList<Modifier>();
modifiers.add(
new StrengthModifier(self, Filters.hasAttached(self), 2));
modifiers.add(
new KeywordModifier(self, Filters.hasAttached(self), Keyword.DAMAGE, 1));
return modifiers;
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.SHADOW, self, 0)
&& Filters.filter(game.getGameState().getDeadPile(game.getGameState().getCurrentPlayerId()), game.getGameState(), game.getModifiersQuerying(), CardType.COMPANION).size() > 0) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseCardsFromDeadPileEffect(playerId, 1, 1, CardType.COMPANION) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> cards) {
action.appendCost(
new RemoveCardsFromDeadPileEffect(playerId, self, cards));
}
});
action.appendEffect(
new TakeControlOfASiteEffect(self, playerId));
return Collections.singletonList(action);
}
return null;
}
}