Introduce AbstractPermanent into Blueprint hierarchy.

This commit is contained in:
marcins78@gmail.com
2011-09-11 06:45:46 +00:00
parent cf79c5c9de
commit d5b2a9dd4b
39 changed files with 140 additions and 168 deletions

View File

@@ -1,6 +1,5 @@
package com.gempukku.lotro.cards;
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
@@ -10,11 +9,10 @@ import com.gempukku.lotro.logic.effects.DiscardCardFromHandEffect;
import com.gempukku.lotro.logic.effects.HealCharacterEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.Collections;
import java.util.List;
public class AbstractAlly extends AbstractLotroCardBlueprint {
private int _twilight;
public class AbstractAlly extends AbstractPermanent {
private int _siteNumber;
private int _strength;
private int _vitality;
@@ -25,8 +23,7 @@ public class AbstractAlly extends AbstractLotroCardBlueprint {
}
public AbstractAlly(int twilight, int siteNumber, int strength, int vitality, Keyword race, Culture culture, String name, boolean unique) {
super(Side.FREE_PEOPLE, CardType.ALLY, culture, name, unique);
_twilight = twilight;
super(Side.FREE_PEOPLE, twilight, CardType.ALLY, culture, Zone.FREE_SUPPORT, name, unique);
_siteNumber = siteNumber;
_strength = strength;
_vitality = vitality;
@@ -38,28 +35,7 @@ public class AbstractAlly extends AbstractLotroCardBlueprint {
return _race;
}
@Override
public final List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
if (checkPlayRequirements(playerId, game, self, 0))
appendPlayAllyActions(actions, playerId, game, self);
appendHealAllyActions(actions, game, self);
List<? extends Action> extraActions = getExtraPhaseActions(playerId, game, self);
if (extraActions != null)
actions.addAll(extraActions);
return actions;
}
private void appendPlayAllyActions(List<Action> actions, String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canPlayCardDuringPhase(game, Phase.FELLOWSHIP, self))
actions.add(getPlayCardAction(playerId, game, self, 0));
}
private void appendHealAllyActions(List<Action> actions, LotroGame game, PhysicalCard self) {
protected final List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canHealByDiscarding(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Discard card to heal");
action.addCost(new DiscardCardFromHandEffect(self));
@@ -68,27 +44,15 @@ public class AbstractAlly extends AbstractLotroCardBlueprint {
if (active != null)
action.addEffect(new HealCharacterEffect(active));
actions.add(action);
return Collections.singletonList(action);
}
return getExtraInPlayPhaseActions(playerId, game, self);
}
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return PlayConditions.checkUniqueness(game.getGameState(), game.getModifiersQuerying(), self);
}
public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return new PlayPermanentAction(self, Zone.FREE_SUPPORT);
}
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
return null;
}
@Override
public int getTwilightCost() {
return _twilight;
}
@Override
public int getSiteNumber() {
return _siteNumber;

View File

@@ -1,6 +1,5 @@
package com.gempukku.lotro.cards;
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
@@ -10,11 +9,10 @@ import com.gempukku.lotro.logic.effects.DiscardCardFromHandEffect;
import com.gempukku.lotro.logic.effects.HealCharacterEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.Collections;
import java.util.List;
public abstract class AbstractCompanion extends AbstractLotroCardBlueprint {
private int _twilightCost;
public abstract class AbstractCompanion extends AbstractPermanent {
private int _strength;
private int _vitality;
private Keyword _race;
@@ -25,8 +23,7 @@ public abstract class AbstractCompanion extends AbstractLotroCardBlueprint {
}
public AbstractCompanion(int twilightCost, int strength, int vitality, Culture culture, Keyword race, Signet signet, String name, boolean unique) {
super(Side.FREE_PEOPLE, CardType.COMPANION, culture, name, unique);
_twilightCost = twilightCost;
super(Side.FREE_PEOPLE, twilightCost, CardType.COMPANION, culture, Zone.FREE_CHARACTERS, name, unique);
_strength = strength;
_vitality = vitality;
_race = race;
@@ -44,12 +41,12 @@ public abstract class AbstractCompanion extends AbstractLotroCardBlueprint {
return _signet;
}
private void appendPlayCompanionActions(List<Action> actions, String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canPlayCardDuringPhase(game, Phase.FELLOWSHIP, self))
actions.add(getPlayCardAction(playerId, game, self, 0));
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
&& PlayConditions.checkRuleOfNine(game.getGameState(), game.getModifiersQuerying(), self);
}
private void appendHealCompanionActions(List<Action> actions, LotroGame game, PhysicalCard self) {
protected final List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canHealByDiscarding(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Discard card to heal");
action.addCost(new DiscardCardFromHandEffect(self));
@@ -58,44 +55,16 @@ public abstract class AbstractCompanion extends AbstractLotroCardBlueprint {
if (active != null)
action.addEffect(new HealCharacterEffect(active));
actions.add(action);
return Collections.singletonList(action);
}
return getExtraInPlayPhaseActions(playerId, game, self);
}
@Override
public final List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
if (checkPlayRequirements(playerId, game, self, 0))
appendPlayCompanionActions(actions, playerId, game, self);
appendHealCompanionActions(actions, game, self);
List<? extends Action> extraActions = getExtraPhaseActions(playerId, game, self);
if (extraActions != null)
actions.addAll(extraActions);
return actions;
}
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return PlayConditions.checkUniqueness(game.getGameState(), game.getModifiersQuerying(), self)
&& PlayConditions.checkRuleOfNine(game.getGameState(), game.getModifiersQuerying(), self);
}
public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return new PlayPermanentAction(self, Zone.FREE_CHARACTERS);
}
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
return null;
}
@Override
public final int getTwilightCost() {
return _twilightCost;
}
@Override
public final int getStrength() {
return _strength;

View File

@@ -41,7 +41,7 @@ public abstract class AbstractEvent extends AbstractLotroCardBlueprint {
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return (getSide() != Side.SHADOW
|| game.getModifiersQuerying().getTwilightCost(game.getGameState(), self) + twilightModifier <= game.getGameState().getTwilightPool());
|| PlayConditions.canPayForShadowCard(game, self, twilightModifier));
}
@Override

View File

@@ -1,16 +1,8 @@
package com.gempukku.lotro.cards;
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.List;
public class AbstractMinion extends AbstractLotroCardBlueprint {
private int _twilightCost;
public class AbstractMinion extends AbstractPermanent {
private int _strength;
private int _vitality;
private int _site;
@@ -21,8 +13,7 @@ public class AbstractMinion extends AbstractLotroCardBlueprint {
}
public AbstractMinion(int twilightCost, int strength, int vitality, int site, Keyword race, Culture culture, String name, boolean unique) {
super(Side.SHADOW, CardType.MINION, culture, name, unique);
_twilightCost = twilightCost;
super(Side.SHADOW, twilightCost, CardType.MINION, culture, Zone.SHADOW_CHARACTERS, name, unique);
_strength = strength;
_vitality = vitality;
_site = site;
@@ -30,43 +21,6 @@ public class AbstractMinion extends AbstractLotroCardBlueprint {
addKeyword(_race);
}
private void appendPlayMinionActions(List<Action> actions, String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canPlayCardDuringPhase(game, Phase.SHADOW, self))
actions.add(getPlayCardAction(playerId, game, self, 0));
}
@Override
public final List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
if (checkPlayRequirements(playerId, game, self, 0))
appendPlayMinionActions(actions, playerId, game, self);
List<? extends Action> extraActions = getExtraPhaseActions(playerId, game, self);
if (extraActions != null)
actions.addAll(extraActions);
return actions;
}
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return PlayConditions.checkUniqueness(game.getGameState(), game.getModifiersQuerying(), self)
&& PlayConditions.canPayForShadowCard(game, self, twilightModifier);
}
public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return new PlayPermanentAction(self, Zone.SHADOW_CHARACTERS);
}
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
return null;
}
@Override
public int getTwilightCost() {
return _twilightCost;
}
@Override
public int getStrength() {
return _strength;

View File

@@ -0,0 +1,56 @@
package com.gempukku.lotro.cards;
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
public class AbstractPermanent extends AbstractLotroCardBlueprint {
private int _twilightCost;
private Zone _playedToZone;
public AbstractPermanent(Side side, int twilightCost, CardType cardType, Culture culture, Zone playedToZone, String name) {
super(side, cardType, culture, name);
_playedToZone = playedToZone;
_twilightCost = twilightCost;
}
public AbstractPermanent(Side side, int twilightCost, CardType cardType, Culture culture, Zone playedToZone, String name, boolean unique) {
super(side, cardType, culture, name, unique);
_playedToZone = playedToZone;
_twilightCost = twilightCost;
}
@Override
public PlayPermanentAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return new PlayPermanentAction(self, _playedToZone, twilightModifier);
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return PlayConditions.checkUniqueness(game.getGameState(), game.getModifiersQuerying(), self)
&& (getSide() != Side.SHADOW || PlayConditions.canPayForShadowCard(game, self, twilightModifier));
}
@Override
public final int getTwilightCost() {
return _twilightCost;
}
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
return null;
}
@Override
public final List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canPlayCardDuringPhase(game, (getSide() == Side.FREE_PEOPLE) ? Phase.FELLOWSHIP : Phase.SHADOW, self)
&& checkPlayRequirements(playerId, game, self, 0))
return Collections.singletonList(getPlayCardAction(playerId, game, self, 0));
return getExtraPhaseActions(playerId, game, self);
}
}

View File

@@ -104,6 +104,14 @@ public class ProxyingModifier implements Modifier {
return result;
}
@Override
public int getRoamingPenalty(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int result) {
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
if (modifier != null)
return modifier.getRoamingPenalty(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);

View File

@@ -35,7 +35,7 @@ public class Card1_012 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& game.getGameState().getTwilightPool() < 2) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Add (2) to place a card from hand beneath your draw deck");

View File

@@ -37,7 +37,7 @@ public class Card1_013 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.SKIRMISH, "Exert Gimli to make him strength +2");

View File

@@ -36,7 +36,7 @@ public class Card1_017 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Grimir to shuffle a DWARVEN event from your discard pile into draw deck");

View File

@@ -35,7 +35,7 @@ public class Card1_027 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.MANEUVER, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.MANEUVER, "Exert Thrarin to allow him to participate in archery fire and skirmished until the regroup phase");

View File

@@ -35,7 +35,7 @@ public class Card1_034 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Celeborn to Heal an ELVEN ally");

View File

@@ -38,11 +38,12 @@ public class Card1_040 extends AbstractAlly {
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier) && Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.or(Filters.keyword(Keyword.ELF), Filters.name("Gandalf")));
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.or(Filters.keyword(Keyword.ELF), Filters.name("Gandalf")));
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Elrond to draw a card");

View File

@@ -37,7 +37,7 @@ public class Card1_045 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Galadriel to play an Elf for free");

View File

@@ -36,7 +36,7 @@ public class Card1_050 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.ARCHERY, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.ARCHERY, "Exert Legolas to wound a minion");

View File

@@ -35,7 +35,7 @@ public class Card1_056 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.ARCHERY, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.ARCHERY, "Exert to wound an Uruk-hai");

View File

@@ -35,7 +35,7 @@ public class Card1_057 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.ARCHERY, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.ARCHERY, "Exert to wound an Orc");

View File

@@ -82,7 +82,7 @@ public class Card1_060 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
LotroCardBlueprint copied = getCopied(game, self);
if (copied != null)
return copied.getPhaseActions(playerId, game, self);

View File

@@ -82,7 +82,7 @@ public class Card1_067 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
LotroCardBlueprint copied = getCopied(game, self);
if (copied != null)
return copied.getPhaseActions(playerId, game, self);

View File

@@ -41,7 +41,7 @@ public class Card1_069 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.MANEUVER, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.MANEUVER, "Exert Albert Dreary to discard a ISENGARD or MORIA condition.");

View File

@@ -35,7 +35,7 @@ public class Card1_070 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Barliman Butterbur to take a GANDALF event into hand from your discard pile.");

View File

@@ -42,7 +42,7 @@ public class Card1_080 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Ottar to discard up to 3 cards from hand and draw an equal number of cards.");

View File

@@ -33,7 +33,7 @@ public class Card1_364 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Gandalf to play a companion who has the Gandalf signet. The twilight cost of that companion is -2.");

View File

@@ -37,7 +37,7 @@ public class Card1_089 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.MANEUVER, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.MANEUVER, "Exert Aragorn to make him defender +1 until the regroup phase.");

View File

@@ -37,7 +37,7 @@ public class Card1_097 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.SKIRMISH, "Exert Boromir to make a Hobbit strength +3.");

View File

@@ -1,12 +1,12 @@
package com.gempukku.lotro.cards.set1.moria;
import com.gempukku.lotro.cards.AbstractMinion;
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.Action;
/**
* Set: The Fellowship of the Ring
@@ -37,7 +37,7 @@ public class Card1_165 extends AbstractMinion {
}
@Override
public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
public PlayPermanentAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
PhysicalCard currentSite = game.getGameState().getCurrentSite();
if (game.getModifiersQuerying().hasKeyword(game.getGameState(), currentSite, Keyword.UNDERGROUND))
twilightModifier -= 3;

View File

@@ -35,7 +35,7 @@ public class Card1_284 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Bilbo to shuffle a SHIRE card from your discard pile into your draw deck.");

View File

@@ -36,7 +36,7 @@ public class Card1_286 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.SKIRMISH, "Exert this ally to prevent a Hobbit from being overwhelmed unless that Hobbit's strength is tripled.");

View File

@@ -36,7 +36,7 @@ public class Card1_288 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Farmer Maggot to heal Merry or Pippin.");

View File

@@ -33,7 +33,7 @@ public class Card1_290 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.type(CardType.COMPANION), Filters.signet(Signet.FRODO), Filters.not(Filters.sameCard(self)), Filters.canExert())) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert another companion who has the Frodo signet to heal Frodo.");

View File

@@ -36,7 +36,7 @@ public class Card1_291 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert The Gaffer to heal Frodo or Sam.");

View File

@@ -89,7 +89,7 @@ public class Card1_295 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(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)

View File

@@ -37,7 +37,7 @@ public class Card1_297 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert this ally to heal another Hobbit ally whose home is site 1.");

View File

@@ -1,11 +1,13 @@
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.AddTwilightEffect;
import com.gempukku.lotro.cards.effects.DiscardCardFromDeckEffect;
import com.gempukku.lotro.cards.effects.PutCardFromDeckIntoHandOrDiscardEffect;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.DefaultCostToEffectAction;
@@ -34,8 +36,9 @@ public class Card1_301 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
if (game.getGameState().getTwilightPool() < 3) {
protected List<? extends Action> getExtraInPlayPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& game.getGameState().getTwilightPool() < 3) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Add (2) to reveal the top 3 cards of your draw deck. Take all SHIRE cards revealed into hand and discard the rest.");
action.addCost(new AddTwilightEffect(2));
action.addEffect(

View File

@@ -36,7 +36,7 @@ public class Card1_302 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, final LotroGame game, final PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, final LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& game.getModifiersQuerying().getVitality(game.getGameState(), self) > 2 + game.getGameState().getWounds(self)
&& !isAssigned(game, self)) {

View File

@@ -40,7 +40,7 @@ public class Card1_309 extends AbstractAlly {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Rosie Cotton to heal Sam");

View File

@@ -44,7 +44,7 @@ public class Card1_310 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, final LotroGame game, final PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(final String playerId, final LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Play Bill the Pony from your draw deck.");
action.addEffect(

View File

@@ -38,7 +38,7 @@ public class Card1_311 extends AbstractCompanion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Sam to remove a burden.");

View File

@@ -108,6 +108,14 @@ public class CompositeModifier implements Modifier {
return result;
}
@Override
public int getRoamingPenalty(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int result) {
for (Modifier modifier : _modifiers)
result = modifier.getRoamingPenalty(gameState, modifiersQuerying, physicalCard, result);
return result;
}
@Override
public int getPlayOnTwilightCost(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, PhysicalCard target, int result) {
for (Modifier modifier : _modifiers)

9
gemp-lotr/todo.txt Normal file
View File

@@ -0,0 +1,9 @@
1. Introduce AbstractPermanent into Blueprint hierarchy.
2. Migrate Race (Orc, Elf, etc) into separate enum from Keyword.
3. Refactor Effect to return EffectResult upon playEffect, which will contain information about what actually
happened. Modify the Blueprints to have the "before" methods to take Effect parameter only and the "after" to
take the EffectResult parameter only. Effects which modify cards should take filters as parameters, use
overloaded constructor for single cards for backward compatibility, this constructor will call another constructor
with Filters.sameCard(...) filter.
4. Modify the Blueprint hierarchy to return possible return objects (PlayEventAction), TriggeredAction, etc. Use
final methods were possible to avoid implementation errors on new cards added.