"Silinde" and ProxyingModifier
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
package com.gempukku.lotro.cards.modifiers;
|
||||
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
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.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
|
||||
public class ProxyingModifier implements Modifier {
|
||||
private PhysicalCard _card;
|
||||
private Filter _filter;
|
||||
|
||||
public ProxyingModifier(PhysicalCard card, Filter filter) {
|
||||
_card = card;
|
||||
_filter = filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PhysicalCard getSource() {
|
||||
return _card;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "Copy of another card text";
|
||||
}
|
||||
|
||||
private Modifier getProxiedModifier(GameState gameState, ModifiersQuerying modifiersQuerying) {
|
||||
PhysicalCard firstActive = Filters.findFirstActive(gameState, modifiersQuerying, _filter);
|
||||
if (firstActive != null)
|
||||
return firstActive.getBlueprint().getAlwaysOnEffect(_card);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean affectsCard(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.affectsCard(gameState, modifiersQuerying, physicalCard);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasKeyword(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, Keyword keyword, boolean result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.hasKeyword(gameState, modifiersQuerying, physicalCard, keyword, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getKeywordCount(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, Keyword keyword, int result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.getKeywordCount(gameState, modifiersQuerying, physicalCard, keyword, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStrength(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.getStrength(gameState, modifiersQuerying, physicalCard, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVitality(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.getVitality(gameState, modifiersQuerying, physicalCard, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTwilightCost(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.getTwilightCost(gameState, modifiersQuerying, physicalCard, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayOnTwilightCost(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, PhysicalCard target, int result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.getPlayOnTwilightCost(gameState, modifiersQuerying, physicalCard, target, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverwhelmedByStrength(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int strength, int opposingStrength, boolean result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.isOverwhelmedByStrength(gameState, modifiersQuerying, physicalCard, strength, opposingStrength, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeWound(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, boolean result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.canTakeWound(gameState, modifiersQuerying, physicalCard, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllyOnCurrentSite(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean allyOnCurrentSite) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.isAllyOnCurrentSite(gameState, modifiersQuerying, card, allyOnCurrentSite);
|
||||
return allyOnCurrentSite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArcheryTotal(GameState gameState, ModifiersQuerying modifiersQuerying, Side side, int result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.getArcheryTotal(gameState, modifiersQuerying, side, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMoveLimit(GameState gameState, ModifiersQuerying modifiersQuerying, int result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.getMoveLimit(gameState, modifiersQuerying, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addsToArcheryTotal(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.addsToArcheryTotal(gameState, modifiersQuerying, card, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.gempukku.lotro.cards.set1.elven;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAlly;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.modifiers.ProxyingModifier;
|
||||
import com.gempukku.lotro.common.*;
|
||||
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.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: Elven
|
||||
* Twilight Cost: 2
|
||||
* Type: Ally • Home 3 • Elf
|
||||
* Strength: 5
|
||||
* Vitality: 2
|
||||
* Site: 3
|
||||
* Game Text: While you can spot your site 3, Silinde has the game text of that site.
|
||||
*/
|
||||
public class Card1_060 extends AbstractAlly {
|
||||
public Card1_060() {
|
||||
super(2, 3, 5, 2, Culture.ELVEN, "Silinde", "1_60", true);
|
||||
addKeyword(Keyword.ELF);
|
||||
}
|
||||
|
||||
private Filter getFilter(PhysicalCard self) {
|
||||
return Filters.and(Filters.type(CardType.SITE), Filters.owner(self.getOwner()), Filters.siteNumber(3));
|
||||
}
|
||||
|
||||
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> getRequiredIsAboutToActions(LotroGame game, Effect effect, EffectResult effectResult, PhysicalCard self) {
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null)
|
||||
return copied.getRequiredIsAboutToActions(game, effect, effectResult, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getRequiredWhenActions(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null)
|
||||
return copied.getRequiredWhenActions(game, effectResult, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getPlayableIsAboutToActions(String playerId, LotroGame game, Effect effect, EffectResult effectResult, PhysicalCard self) {
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null)
|
||||
return copied.getPlayableIsAboutToActions(playerId, game, effect, effectResult, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getPlayableWhenActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null)
|
||||
return copied.getPlayableWhenActions(playerId, game, effectResult, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (self.getZone() == Zone.FREE_SUPPORT) {
|
||||
LotroCardBlueprint copied = getCopied(game, self);
|
||||
if (copied != null)
|
||||
return copied.getPlayablePhaseActions(playerId, game, self);
|
||||
return null;
|
||||
} else if (PlayConditions.canPlayFromHandDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)) {
|
||||
List<Action> actions = new LinkedList<Action>();
|
||||
|
||||
appendPlayAllyActions(actions, game, self);
|
||||
appendHealAllyActions(actions, game, self);
|
||||
|
||||
return actions;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user