Changing how the allies are played (simplified).

This commit is contained in:
marcins78@gmail.com
2011-09-02 17:05:26 +00:00
parent 843225bdfa
commit 0f17da92c6
13 changed files with 91 additions and 132 deletions

View File

@@ -14,6 +14,7 @@ import com.gempukku.lotro.logic.effects.HealCharacterEffect;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.List;
public class AbstractAlly extends AbstractLotroCardBlueprint {
@@ -34,19 +35,35 @@ public class AbstractAlly extends AbstractLotroCardBlueprint {
_vitality = vitality;
}
protected void appendPlayAllyActions(List<Action> actions, LotroGame lotroGame, PhysicalCard self) {
ModifiersQuerying modifiersQuerying = lotroGame.getModifiersQuerying();
if (PlayConditions.canPlayCharacterDuringFellowship(lotroGame.getGameState(), modifiersQuerying, self)) {
actions.add(new PlayPermanentAction(self, Zone.FREE_SUPPORT));
@Override
public final List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
if (checkPlayRequirements(playerId, game, self))
appendPlayAllyActions(actions, 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, LotroGame game, PhysicalCard self) {
ModifiersQuerying modifiersQuerying = game.getModifiersQuerying();
if (PlayConditions.canPlayCharacterDuringFellowship(game.getGameState(), modifiersQuerying, self)) {
actions.add(getPlayAllyAction(game, self));
}
}
protected void appendHealAllyActions(List<Action> actions, LotroGame lotroGame, PhysicalCard self) {
if (PlayConditions.canHealByDiscarding(lotroGame.getGameState(), lotroGame.getModifiersQuerying(), self)) {
private void appendHealAllyActions(List<Action> actions, LotroGame game, PhysicalCard self) {
if (PlayConditions.canHealByDiscarding(game.getGameState(), game.getModifiersQuerying(), self)) {
CostToEffectAction action = new CostToEffectAction(self, null, "Discard card to heal");
action.addCost(new DiscardCardFromHandEffect(self));
PhysicalCard active = Filters.findFirstActive(lotroGame.getGameState(), lotroGame.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()));
PhysicalCard active = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()));
if (active != null)
action.addEffect(new HealCharacterEffect(active));
@@ -54,6 +71,18 @@ public class AbstractAlly extends AbstractLotroCardBlueprint {
}
}
protected boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self) {
return true;
}
protected Action getPlayAllyAction(LotroGame game, PhysicalCard self) {
return new PlayPermanentAction(self, Zone.FREE_SUPPORT);
}
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
return null;
}
@Override
public int getTwilightCost() {
return _twilight;

View File

@@ -16,7 +16,7 @@ import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.Collections;
import java.util.List;
/**
@@ -37,12 +37,7 @@ public class Card1_017 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final CostToEffectAction action = new CostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Grimir to shuffle a DWARVEN event from your discard pile into draw deck");
@@ -60,9 +55,8 @@ public class Card1_017 extends AbstractAlly {
}
}
);
actions.add(action);
return Collections.singletonList(action);
}
return actions;
return null;
}
}

View File

@@ -14,7 +14,7 @@ import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.Collections;
import java.util.List;
/**
@@ -36,12 +36,7 @@ public class Card1_027 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.MANEUVER, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
CostToEffectAction action = new CostToEffectAction(self, Keyword.MANEUVER, "Exert Thrarin to allow him to participate in archery fire and skirmished until the regroup phase");
@@ -49,8 +44,9 @@ public class Card1_027 extends AbstractAlly {
action.addEffect(
new AddUntilStartOfPhaseModifierEffect(
new AllyOnCurrentSiteModifier(self, Filters.sameCard(self)), Phase.REGROUP));
return Collections.singletonList(action);
}
return actions;
return null;
}
}

View File

@@ -15,7 +15,7 @@ import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
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;
/**
@@ -36,12 +36,7 @@ public class Card1_034 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final CostToEffectAction action = new CostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Celeborn to Heal an ELVEN ally");
@@ -53,9 +48,8 @@ public class Card1_034 extends AbstractAlly {
}
});
actions.add(action);
return Collections.singletonList(action);
}
return actions;
return null;
}
}

View File

@@ -17,7 +17,6 @@ import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
@@ -39,23 +38,20 @@ public class Card1_040 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
if (Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.or(Filters.keyword(Keyword.ELF), Filters.name("Gandalf"))))
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self) {
return 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) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
CostToEffectAction action = new CostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Elrond to draw a card");
action.addCost(new ExertCharacterEffect(self));
action.addEffect(new DrawCardEffect(playerId));
actions.add(action);
return Collections.singletonList(action);
}
return actions;
return null;
}
@Override

View File

@@ -19,7 +19,6 @@ import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
@@ -41,12 +40,7 @@ public class Card1_045 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected List<? extends Action> getExtraPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
CostToEffectAction action = new CostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Galadriel to play an Elf for free");
@@ -69,13 +63,11 @@ public class Card1_045 extends AbstractAlly {
}
}
});
actions.add(action);
return Collections.singletonList(action);
}
return actions;
return null;
}
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.START_OF_TURN) {

View File

@@ -14,7 +14,7 @@ import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.WoundCharacterEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.Collections;
import java.util.List;
/**
@@ -36,12 +36,7 @@ public class Card1_056 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.ARCHERY, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final CostToEffectAction action = new CostToEffectAction(self, Keyword.ARCHERY, "Exert to wound an Uruk-hai");
@@ -53,9 +48,9 @@ public class Card1_056 extends AbstractAlly {
action.addEffect(new WoundCharacterEffect(urukHai));
}
});
actions.add(action);
return Collections.singletonList(action);
}
return actions;
return null;
}
}

View File

@@ -14,7 +14,7 @@ import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.WoundCharacterEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.Collections;
import java.util.List;
/**
@@ -36,12 +36,7 @@ public class Card1_057 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.ARCHERY, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final CostToEffectAction action = new CostToEffectAction(self, Keyword.ARCHERY, "Exert to wound an Orc");
@@ -53,9 +48,8 @@ public class Card1_057 extends AbstractAlly {
action.addEffect(new WoundCharacterEffect(urukHai));
}
});
actions.add(action);
return Collections.singletonList(action);
}
return actions;
return null;
}
}

View File

@@ -1,9 +1,10 @@
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.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.LotroCardBlueprint;
@@ -14,7 +15,6 @@ 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;
/**
@@ -83,20 +83,10 @@ public class Card1_060 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (self.getZone() == Zone.FREE_SUPPORT) {
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
LotroCardBlueprint copied = getCopied(game, self);
if (copied != null)
return copied.getPhaseActions(playerId, game, self);
return null;
} else if (PlayConditions.canPlayFPCardDuringPhase(game, Phase.FELLOWSHIP, self)) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
return actions;
}
return null;
}
}

View File

@@ -1,9 +1,10 @@
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.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.LotroCardBlueprint;
@@ -14,7 +15,6 @@ 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;
/**
@@ -83,20 +83,10 @@ public class Card1_067 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (self.getZone() == Zone.FREE_SUPPORT) {
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
LotroCardBlueprint copied = getCopied(game, self);
if (copied != null)
return copied.getPhaseActions(playerId, game, self);
return null;
} else if (PlayConditions.canPlayFPCardDuringPhase(game, Phase.FELLOWSHIP, self)) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
return actions;
}
return null;
}
}

View File

@@ -15,7 +15,7 @@ import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.Collections;
import java.util.List;
/**
@@ -36,11 +36,7 @@ public class Card1_284 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final CostToEffectAction action = new CostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Bilbo to shuffle a SHIRE card from your discard pile into your draw deck.");
@@ -55,7 +51,7 @@ public class Card1_284 extends AbstractAlly {
}
}
);
actions.add(action);
return Collections.singletonList(action);
}
return null;
}

View File

@@ -15,7 +15,7 @@ import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
import java.util.Collections;
import java.util.List;
/**
@@ -37,11 +37,7 @@ public class Card1_286 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final CostToEffectAction action = new CostToEffectAction(self, Keyword.SKIRMISH, "Exert this ally to prevent a Hobbit from being overwhelmed unless that Hobbit's strength is tripled.");
@@ -56,8 +52,8 @@ public class Card1_286 extends AbstractAlly {
}
}
);
actions.add(action);
return Collections.singletonList(action);
}
return actions;
return null;
}
}

View File

@@ -15,6 +15,7 @@ import com.gempukku.lotro.logic.effects.HealCharacterEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -36,11 +37,7 @@ public class Card1_288 extends AbstractAlly {
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayAllyActions(actions, game, self);
appendHealAllyActions(actions, game, self);
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
CostToEffectAction action = new CostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Farmer Maggot to heal Merry or Pippin.");
@@ -61,8 +58,8 @@ public class Card1_288 extends AbstractAlly {
action.addEffect(
new ChoiceEffect(action, playerId, possibleEffects, false));
actions.add(action);
return Collections.singletonList(action);
}
return actions;
return null;
}
}