SImplifying actions.

This commit is contained in:
marcins78@gmail.com
2011-10-23 14:39:39 +00:00
parent 61e5f7d4e3
commit 4373073346
21 changed files with 76 additions and 162 deletions

View File

@@ -36,12 +36,8 @@ public class Card2_014 extends AbstractPermanent {
Collection<PhysicalCard> dwarfCompanions = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.DWARF), Filters.type(CardType.COMPANION));
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
for (final PhysicalCard dwarfCompanion : dwarfCompanions) {
OptionalTriggerAction action = new OptionalTriggerAction(self) {
@Override
public String getText(LotroGame game) {
return "Heal " + GameUtils.getCardLink(dwarfCompanion);
}
};
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.setText("Heal " + GameUtils.getCardLink(dwarfCompanion));
action.appendEffect(
new HealCharactersEffect(playerId, dwarfCompanion));
actions.add(action);

View File

@@ -39,12 +39,8 @@ public class Card2_120 extends AbstractSite {
Collection<PhysicalCard> hobbitCompanions = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.HOBBIT), Filters.type(CardType.COMPANION));
for (final PhysicalCard hobbitCompanion : hobbitCompanions) {
OptionalTriggerAction action = new OptionalTriggerAction(self) {
@Override
public String getText(LotroGame game) {
return "Heal " + GameUtils.getCardLink(hobbitCompanion);
}
};
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.setText("Heal " + GameUtils.getCardLink(hobbitCompanion));
action.appendEffect(
new HealCharactersEffect(playerId, hobbitCompanion));
actions.add(action);

View File

@@ -38,12 +38,8 @@ public class Card3_044 extends AbstractPermanent {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)) {
if (Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.GONDOR)).size() > 0) {
final ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Stack a GONDOR card from hand here";
}
};
final ActivateCardAction action = new ActivateCardAction(self);
action.setText("Stack a GONDOR card from hand here");
action.appendEffect(
new ChooseCardsFromHandEffect(playerId, 1, 1, Filters.culture(Culture.GONDOR)) {
@Override
@@ -60,12 +56,8 @@ public class Card3_044 extends AbstractPermanent {
List<PhysicalCard> stackedCards = game.getGameState().getStackedCards(self);
if (stackedCards.size() > 0) {
final ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Add (1) to take card stacked here into hand";
}
};
final ActivateCardAction action = new ActivateCardAction(self);
action.setText("Add (1) to take card stacked here into hand");
action.appendCost(
new AddTwilightEffect(self, 1));
action.appendEffect(

View File

@@ -43,12 +43,8 @@ public class Card4_027 extends AbstractPermanent {
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
for (final PhysicalCard physicalCard : winningDunlandMan) {
OptionalTriggerAction action = new OptionalTriggerAction(self) {
@Override
public String getText(LotroGame game) {
return "Make " + GameUtils.getCardLink(physicalCard) + " strength +2 and Fierce";
}
};
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.setText("Make " + GameUtils.getCardLink(physicalCard) + " strength +2 and Fierce");
action.appendEffect(
new AddUntilStartOfPhaseModifierEffect(
new StrengthModifier(self, Filters.sameCard(physicalCard), 2), Phase.REGROUP));

View File

@@ -46,12 +46,8 @@ public class Card4_225 extends AbstractMinion {
List<Action> actions = new LinkedList<Action>();
if (game.getGameState().getBurdens() >= 2) {
final ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Make Easterling strength +2";
}
};
final ActivateCardAction action = new ActivateCardAction(self);
action.setText("Make Easterling strength +2");
action.appendCost(
new RemoveTwilightEffect(2));
action.appendEffect(
@@ -66,12 +62,8 @@ public class Card4_225 extends AbstractMinion {
actions.add(action);
}
if (game.getGameState().getBurdens() >= 4) {
final ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Make Easterling strength +3";
}
};
final ActivateCardAction action = new ActivateCardAction(self);
action.setText("Make Easterling strength +3");
action.appendCost(
new RemoveTwilightEffect(2));
action.appendEffect(
@@ -86,12 +78,8 @@ public class Card4_225 extends AbstractMinion {
actions.add(action);
}
if (game.getGameState().getBurdens() >= 6) {
final ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Make Easterling strength +4";
}
};
final ActivateCardAction action = new ActivateCardAction(self);
action.setText("Make Easterling strength +4");
action.appendCost(
new RemoveTwilightEffect(2));
action.appendEffect(

View File

@@ -42,12 +42,8 @@ public class Card6_050 extends AbstractCompanion {
List<ActivateCardAction> actions = new LinkedList<ActivateCardAction>();
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& PlayConditions.canRemoveTokens(game, Token.ELVEN, 1, Filters.any)) {
final ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Remove ELVEN token...";
}
};
final ActivateCardAction action = new ActivateCardAction(self);
action.setText("Remove ELVEN token...");
action.appendCost(
new ChooseAndRemoveTokensFromCardEffect(self, playerId, Token.ELVEN, 1, Filters.any));
action.appendEffect(
@@ -63,12 +59,8 @@ public class Card6_050 extends AbstractCompanion {
}
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& PlayConditions.canRemoveTokens(game, Token.DWARVEN, 1, Filters.any)) {
final ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Remove DWARVEN token...";
}
};
final ActivateCardAction action = new ActivateCardAction(self);
action.setText("Remove DWARVEN token...");
action.appendCost(
new ChooseAndRemoveTokensFromCardEffect(self, playerId, Token.DWARVEN, 1, Filters.any));
action.appendEffect(

View File

@@ -45,12 +45,8 @@ public class Card6_063 extends AbstractPermanent {
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
final Collection<PhysicalCard> discardedOrcs = Filters.filter(discardEffect.getAffectedCardsMinusPrevented(game), game.getGameState(), game.getModifiersQuerying(), Culture.ISENGARD, Race.ORC);
for (final PhysicalCard discardedOrc : discardedOrcs) {
OptionalTriggerAction action = new OptionalTriggerAction(self) {
@Override
public String getText(LotroGame game) {
return "Stack " + GameUtils.getCardLink(discardedOrc);
}
};
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.setText("Stack " + GameUtils.getCardLink(discardedOrc));
action.appendEffect(
new StackCardFromPlayEffect(discardedOrc, self));
actions.add(action);

View File

@@ -45,12 +45,8 @@ public class Card6_064 extends AbstractPermanent {
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
final Collection<PhysicalCard> discardedOrcs = Filters.filter(discardEffect.getAffectedCardsMinusPrevented(game), game.getGameState(), game.getModifiersQuerying(), Culture.ISENGARD, Race.ORC);
for (final PhysicalCard discardedOrc : discardedOrcs) {
OptionalTriggerAction action = new OptionalTriggerAction(self) {
@Override
public String getText(LotroGame game) {
return "Stack " + GameUtils.getCardLink(discardedOrc);
}
};
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.setText("Stack " + GameUtils.getCardLink(discardedOrc));
action.appendEffect(
new StackCardFromPlayEffect(discardedOrc, self));
actions.add(action);

View File

@@ -46,12 +46,8 @@ public class Card6_073 extends AbstractPermanent {
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
final Collection<PhysicalCard> discardedOrcs = Filters.filter(discardEffect.getAffectedCardsMinusPrevented(game), game.getGameState(), game.getModifiersQuerying(), Culture.ISENGARD, Race.ORC);
for (final PhysicalCard discardedOrc : discardedOrcs) {
OptionalTriggerAction action = new OptionalTriggerAction(self) {
@Override
public String getText(LotroGame game) {
return "Stack " + GameUtils.getCardLink(discardedOrc);
}
};
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.setText("Stack " + GameUtils.getCardLink(discardedOrc));
action.appendEffect(
new StackCardFromPlayEffect(discardedOrc, self));
actions.add(action);

View File

@@ -42,12 +42,8 @@ public class Card6_078 extends AbstractMinion {
&& PlayConditions.canSelfExert(self, game)) {
List<ActivateCardAction> actions = new LinkedList<ActivateCardAction>();
if (game.getGameState().getBurdens() >= 2) {
ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Make an Easterling Str +1";
}
};
ActivateCardAction action = new ActivateCardAction(self);
action.setText("Make an Easterling Str +1");
action.appendCost(
new ExertCharactersEffect(self, self));
action.appendEffect(
@@ -55,12 +51,8 @@ public class Card6_078 extends AbstractMinion {
actions.add(action);
}
if (game.getGameState().getBurdens() >= 4) {
ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Make an Easterling Str +2";
}
};
ActivateCardAction action = new ActivateCardAction(self);
action.setText("Make an Easterling Str +2");
action.appendCost(
new ExertCharactersEffect(self, self));
action.appendEffect(
@@ -68,12 +60,8 @@ public class Card6_078 extends AbstractMinion {
actions.add(action);
}
if (game.getGameState().getBurdens() >= 6) {
ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Make an Easterling Str +3";
}
};
ActivateCardAction action = new ActivateCardAction(self);
action.setText("Make an Easterling Str +3");
action.appendCost(
new ExertCharactersEffect(self, self));
action.appendEffect(

View File

@@ -42,12 +42,8 @@ public class Card6_090 extends AbstractAttachableFPPossession {
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (PlayConditions.winsSkirmish(game, effectResult, self.getAttachedTo())) {
OptionalTriggerAction action = new OptionalTriggerAction(self) {
@Override
public String getText(LotroGame game) {
return "Exert a minion";
}
};
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.setText("Exert a minion");
action.appendEffect(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.MINION));
return Collections.singletonList(action);
@@ -59,12 +55,8 @@ public class Card6_090 extends AbstractAttachableFPPossession {
public List<? extends Action> getOptionalInPlayAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (PlayConditions.winsSkirmish(game, effectResult, self.getAttachedTo())
&& PlayConditions.canSelfDiscard(self, game)) {
ActivateCardAction action = new ActivateCardAction(self) {
@Override
public String getText(LotroGame game) {
return "Discard this to liberate a site";
}
};
ActivateCardAction action = new ActivateCardAction(self);
action.setText("Discard this to liberate a site");
action.appendCost(
new DiscardCardsFromPlayEffect(self, self));
action.appendEffect(

View File

@@ -15,8 +15,11 @@ public class ActivateCardAction extends AbstractCostToEffectAction {
private boolean _sentMessage;
private boolean _activated;
private String _text;
public ActivateCardAction(PhysicalCard physicalCard) {
_physicalCard = physicalCard;
_text = "Use " + _physicalCard.getBlueprint().getName();
}
@Override
@@ -29,9 +32,13 @@ public class ActivateCardAction extends AbstractCostToEffectAction {
return _physicalCard;
}
public void setText(String text) {
_text = text;
}
@Override
public String getText(LotroGame game) {
return "Use " + _physicalCard.getBlueprint().getName();
return _text;
}
@Override

View File

@@ -11,10 +11,13 @@ public class OptionalTriggerAction extends AbstractCostToEffectAction {
private PhysicalCard _actionAttachedToCard;
private boolean _sentMessage;
private String _text;
public OptionalTriggerAction(PhysicalCard physicalCard) {
_physicalCard = physicalCard;
_actionAttachedToCard = physicalCard;
_text = "Optional trigger from " + GameUtils.getCardLink(_physicalCard);
}
public void setActionAttachedToCard(PhysicalCard actionAttachedToCard) {
@@ -31,9 +34,13 @@ public class OptionalTriggerAction extends AbstractCostToEffectAction {
return _actionAttachedToCard;
}
public void setText(String text) {
_text = text;
}
@Override
public String getText(LotroGame game) {
return null;
return _text;
}
@Override

View File

@@ -11,8 +11,11 @@ public class RequiredTriggerAction extends AbstractCostToEffectAction {
private boolean _sentMessage;
private String _text;
public RequiredTriggerAction(PhysicalCard physicalCard) {
_physicalCard = physicalCard;
_text = "Required trigger from " + GameUtils.getCardLink(_physicalCard);
}
@Override
@@ -25,9 +28,13 @@ public class RequiredTriggerAction extends AbstractCostToEffectAction {
return _physicalCard;
}
public void setText(String text) {
_text = text;
}
@Override
public String getText(LotroGame game) {
return null;
return _text;
}
@Override

View File

@@ -6,7 +6,7 @@ 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.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.actions.SystemQueueAction;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.processes.GameProcess;
@@ -51,12 +51,7 @@ public class FellowshipPlayerAssignsArcheryDamageGameProcess implements GameProc
)
);
RequiredTriggerAction action = new RequiredTriggerAction(null) {
@Override
public String getText(LotroGame game) {
return "Archery fire";
}
};
SystemQueueAction action = new SystemQueueAction();
for (int i = 0; i < _woundsToAssign; i++) {
final int woundsLeft = _woundsToAssign - i;
ChooseAndWoundCharactersEffect woundCharacter = new ChooseAndWoundCharactersEffect(action, _game.getGameState().getCurrentPlayerId(), 1, 1, filter);

View File

@@ -4,7 +4,7 @@ import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.actions.SystemQueueAction;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.timing.processes.GameProcess;
@@ -28,12 +28,7 @@ public class ShadowPlayerAssignsArcheryDamageGameProcess implements GameProcess
if (_woundsToAssign > 0) {
Filter filter = Filters.and(Filters.type(CardType.MINION), Filters.owner(_playerId));
RequiredTriggerAction action = new RequiredTriggerAction(null) {
@Override
public String getText(LotroGame game) {
return "Archery fire";
}
};
SystemQueueAction action = new SystemQueueAction();
for (int i = 0; i < _woundsToAssign; i++) {
final int woundsLeft = _woundsToAssign - i;
ChooseAndWoundCharactersEffect woundCharacter = new ChooseAndWoundCharactersEffect(action, _playerId, 1, 1, filter);

View File

@@ -6,7 +6,7 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.Assignment;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.actions.SystemQueueAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.processes.GameProcess;
import com.gempukku.lotro.logic.timing.processes.turn.SkirmishGameProcess;
@@ -39,12 +39,7 @@ public class PlayoutSkirmishesGameProcess implements GameProcess {
for (Assignment assignment : assignments)
fps.add(assignment.getFellowshipCharacter());
RequiredTriggerAction chooseNextSkirmishAction = new RequiredTriggerAction(null) {
@Override
public String getText(LotroGame game) {
return "Choosing next skirmish to play out";
}
};
SystemQueueAction chooseNextSkirmishAction = new SystemQueueAction();
chooseNextSkirmishAction.appendEffect(
new ChooseActiveCardEffect(null, gameState.getCurrentPlayerId(), "Choose next skirmish to resolve", Filters.in(fps)) {
@Override

View File

@@ -34,12 +34,8 @@ public class AmbushRule {
for (PhysicalCard minion : minions) {
if (game.getModifiersQuerying().hasKeyword(game.getGameState(), minion, Keyword.AMBUSH)) {
final int count = game.getModifiersQuerying().getKeywordCount(game.getGameState(), minion, Keyword.AMBUSH);
OptionalTriggerAction action = new OptionalTriggerAction(minion) {
@Override
public String getText(LotroGame game) {
return "Ambush - add " + count;
}
};
OptionalTriggerAction action = new OptionalTriggerAction(minion);
action.setText("Ambush - add " + count);
action.appendEffect(
new AddTwilightEffect(minion, count));
actions.add(action);

View File

@@ -40,12 +40,8 @@ public class CharacterDeathRule {
deadCharacters.add(character);
if (deadCharacters.size() > 0) {
RequiredTriggerAction action = new RequiredTriggerAction(null) {
@Override
public String getText(LotroGame game) {
return "Character(s) death";
}
};
RequiredTriggerAction action = new RequiredTriggerAction(null);
action.setText("Character(s) death");
action.appendEffect(
new KillEffect(deadCharacters));
return Collections.singletonList(action);

View File

@@ -45,12 +45,8 @@ public class ResolveSkirmishRule {
List<PhysicalCard> losers = skirmishResult.getLosers();
RequiredTriggerAction action = new RequiredTriggerAction(null) {
@Override
public String getText(LotroGame game) {
return "Resolving skirmish";
}
};
RequiredTriggerAction action = new RequiredTriggerAction(null);
action.setText("Resolving skirmish");
for (int i = 0; i < dmg; i++) {
action.appendEffect(
new WoundCharactersEffect(winners, Filters.in(losers)));
@@ -61,12 +57,8 @@ public class ResolveSkirmishRule {
OverwhelmSkirmishResult skirmishResult = (OverwhelmSkirmishResult) effectResult;
List<PhysicalCard> losers = new LinkedList<PhysicalCard>(skirmishResult.getLosers());
RequiredTriggerAction action = new RequiredTriggerAction(null) {
@Override
public String getText(LotroGame game) {
return "Resolving skirmish";
}
};
RequiredTriggerAction action = new RequiredTriggerAction(null);
action.setText("Resolving skirmish");
action.appendEffect(new KillEffect(losers));
return Collections.singletonList(action);

View File

@@ -28,12 +28,8 @@ public class SanctuaryRule {
public List<? extends Action> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.START_OF_TURN
&& game.getModifiersQuerying().hasKeyword(game.getGameState(), game.getGameState().getCurrentSite(), Keyword.SANCTUARY)) {
RequiredTriggerAction action = new RequiredTriggerAction(null) {
@Override
public String getText(LotroGame game) {
return "Sanctuary healing";
}
};
RequiredTriggerAction action = new RequiredTriggerAction(game.getGameState().getCurrentSite());
action.setText("Sanctuary healing");
for (int i = 0; i < 5; i++) {
final int remainingHeals = 5 - i;
ChooseAndHealCharactersEffect healEffect = new ChooseAndHealCharactersEffect(action, game.getGameState().getCurrentPlayerId(), 0, 1, Filters.type(CardType.COMPANION));