"Hobbit Farmer"
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
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.timing.UnrespondableEffect;
|
||||
|
||||
public class ReplaceOpponentSiteEffect extends UnrespondableEffect {
|
||||
private String _playerId;
|
||||
private int _siteNumber;
|
||||
|
||||
public ReplaceOpponentSiteEffect(String playerId, int siteNumber) {
|
||||
_playerId = playerId;
|
||||
_siteNumber = siteNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(LotroGame game) {
|
||||
GameState gameState = game.getGameState();
|
||||
PhysicalCard card = gameState.getSite(_siteNumber);
|
||||
gameState.stopAffecting(card);
|
||||
gameState.removeCardFromZone(card);
|
||||
gameState.addCardToZone(card, Zone.DECK);
|
||||
PhysicalCard newSite = Filters.filter(gameState.getAdventureDeck(_playerId), game.getGameState(), game.getModifiersQuerying(), Filters.siteNumber(_siteNumber)).get(0);
|
||||
gameState.addCardToZone(newSite, Zone.ADVENTURE_PATH);
|
||||
gameState.startAffecting(newSite, game.getModifiersEnvironment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.gempukku.lotro.cards.set1.shire;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAlly;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
|
||||
import com.gempukku.lotro.cards.effects.ReplaceOpponentSiteEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.ProxyingModifier;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprint;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.CostToEffectAction;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Fellowship of the Ring
|
||||
* Side: Free
|
||||
* Culture: Shire
|
||||
* Twilight Cost: 1
|
||||
* Type: Ally • Home 1 • Hobbit
|
||||
* Strength: 2
|
||||
* Vitality: 2
|
||||
* Site: 1
|
||||
* Game Text: While you can spot your site 1, this ally has the game text of that site. Fellowship: Exert this ally and
|
||||
* spot opponent's site 1 to replace it with your site 1.
|
||||
*/
|
||||
public class Card1_295 extends AbstractAlly {
|
||||
public Card1_295() {
|
||||
super(1, 1, 2, 2, Culture.SHIRE, "Hobbit Farmer");
|
||||
addKeyword(Keyword.HOBBIT);
|
||||
}
|
||||
|
||||
private Filter getFilter(PhysicalCard self) {
|
||||
return Filters.and(Filters.type(CardType.SITE), Filters.owner(self.getOwner()), Filters.siteNumber(1));
|
||||
}
|
||||
|
||||
private LotroCardBlueprint getCopied(LotroGame game, PhysicalCard self) {
|
||||
PhysicalCard firstActive = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), getFilter(self));
|
||||
if (firstActive != null)
|
||||
return firstActive.getBlueprint();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Modifier getAlwaysOnEffect(PhysicalCard self) {
|
||||
return new ProxyingModifier(self, getFilter(self));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getRequiredBeforeTriggers(LotroGame game, Effect effect, EffectResult effectResult, PhysicalCard self) {
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null)
|
||||
return copied.getRequiredBeforeTriggers(game, effect, effectResult, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null)
|
||||
return copied.getRequiredAfterTriggers(game, effectResult, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalBeforeActions(String playerId, LotroGame game, Effect effect, EffectResult effectResult, PhysicalCard self) {
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null)
|
||||
return copied.getOptionalBeforeActions(playerId, game, effect, effectResult, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null)
|
||||
return copied.getOptionalAfterTriggers(playerId, game, effectResult, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
List<Action> actions = new LinkedList<Action>();
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
|
||||
&& !game.getGameState().getSite(1).getOwner().equals(playerId)
|
||||
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
|
||||
CostToEffectAction action = new CostToEffectAction(self, Keyword.FELLOWSHIP, "Exert this ally and to replace opponent's site 1 with your site 1.");
|
||||
action.addCost(new ExertCharacterEffect(self));
|
||||
action.addEffect(new ReplaceOpponentSiteEffect(playerId, 1));
|
||||
actions.add(action);
|
||||
}
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null) {
|
||||
List<? extends Action> list = copied.getPhaseActions(playerId, game, self);
|
||||
if (list != null)
|
||||
actions.addAll(list);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user