"Ted Sandyman"

This commit is contained in:
marcins78@gmail.com
2012-03-07 14:35:22 +00:00
parent b98fb27145
commit 457159bed8
3 changed files with 94 additions and 3 deletions

View File

@@ -41,6 +41,10 @@ public class PlayConditions {
return PlayConditions.canSpot(game, Filters.siteControlledByShadowPlayer(game.getGameState().getCurrentPlayerId()));
}
public static boolean canLiberateASite(LotroGame game, String playerId) {
return PlayConditions.canSpot(game, Filters.siteControlled(playerId));
}
public static boolean canDiscardFromHand(LotroGame game, String playerId, int count, Filterable... cardFilter) {
return Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), cardFilter).size() >= count;
}

View File

@@ -14,11 +14,17 @@ import java.util.Set;
public class LiberateASiteEffect extends AbstractEffect {
private PhysicalCard _source;
private String _playerId;
public LiberateASiteEffect(PhysicalCard source) {
_source = source;
}
public LiberateASiteEffect(PhysicalCard source, String playerId) {
_source = source;
_playerId = playerId;
}
@Override
public boolean isPlayableInFull(LotroGame game) {
return Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.siteControlledByShadowPlayer(game.getGameState().getCurrentPlayerId())) > 0;
@@ -41,9 +47,14 @@ public class LiberateASiteEffect extends AbstractEffect {
for (int i = maxUnoccupiedSite; i >= 1; i--) {
PhysicalCard site = game.getGameState().getSite(i);
if (site != null && site.getCardController() != null
&& !site.getCardController().equals(game.getGameState().getCurrentPlayerId()))
return site;
if (_playerId == null) {
if (site != null && site.getCardController() != null
&& !site.getCardController().equals(game.getGameState().getCurrentPlayerId()))
return site;
} else {
if (site != null && site.getCardController() != null && site.getCardController().equals(_playerId))
return site;
}
}
return null;

View File

@@ -0,0 +1,76 @@
package com.gempukku.lotro.cards.set18.men;
import com.gempukku.lotro.cards.AbstractMinion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.AddUntilStartOfPhaseModifierEffect;
import com.gempukku.lotro.cards.effects.LiberateASiteEffect;
import com.gempukku.lotro.cards.effects.SelfExertEffect;
import com.gempukku.lotro.cards.effects.StackCardFromPlayEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
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;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: Treachery & Deceit
* Side: Shadow
* Culture: Men
* Twilight Cost: 1
* Type: Minion • Hobbit
* Strength: 3
* Vitality: 4
* Site: 2
* Game Text: Maneuver: Liberate a site you control to make each [MEN] minion strength +2 until the regroup phase.
* Regroup: Exert Ted Sandyman to stack a [MEN] Man in play on a possession.
*/
public class Card18_075 extends AbstractMinion {
public Card18_075() {
super(1, 3, 4, 2, Race.HOBBIT, Culture.MEN, "Ted Sandyman", true);
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.MANEUVER, self, 0)
&& PlayConditions.canLiberateASite(game, playerId)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new LiberateASiteEffect(self, playerId));
action.appendEffect(
new AddUntilStartOfPhaseModifierEffect(
new StrengthModifier(self, Filters.and(Culture.MEN, CardType.MINION), 2), Phase.REGROUP));
return Collections.singletonList(action);
}
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.REGROUP, self, 0)
&& PlayConditions.canSelfExert(self, game)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new SelfExertEffect(self));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a MEN minion", Culture.MEN, CardType.MINION) {
@Override
protected void cardSelected(LotroGame game, final PhysicalCard minion) {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a possession", CardType.POSSESSION) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard possession) {
action.appendEffect(
new StackCardFromPlayEffect(minion, possession));
}
});
}
});
return Collections.singletonList(action);
}
return null;
}
}