Merge pull request #44 from PhallenCassidy/hobbit-bugs

Round of Hobbit bug fixes
This commit is contained in:
Marcin Sciesinski
2018-04-16 12:53:25 -07:00
committed by GitHub
10 changed files with 134 additions and 81 deletions

View File

@@ -13,6 +13,7 @@ import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.LinkedList;
@@ -39,29 +40,42 @@ public class Card30_024 extends AbstractEvent {
}
@Override
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
PlayEventAction action = new PlayEventAction(self);
public PlayEventAction getPlayCardAction(String playerId, final LotroGame game, final PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 2, Filters.gandalf));
List<Effect> possibleEffects = new LinkedList<Effect>();
if (Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), CardType.MINION, Filters.moreVitalityThan(1))) {
possibleEffects.add(
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, 2, CardType.MINION, Filters.moreVitalityThan(1)) {
@Override
public String getText(LotroGame game) {
return "Wound a minion twice";
}
});
} else if (!Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Race.TROLL)) {
possibleEffects.add(
new ChooseActiveCardEffect(self, playerId, "Choose minion", CardType.MINION, Filters.canTakeWounds(self, 1)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.insertEffect(
new WoundCharactersEffect(self, card));
action.insertEffect(
new WoundCharactersEffect(self, card));
}
});
}
possibleEffects.add(
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, 2, CardType.MINION) {
@Override
public String getText(LotroGame game) {
return "Wound a minion twice";
}
});
possibleEffects.add(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Race.TROLL) {
@Override
public String getText(LotroGame game) {
return "Discard a Troll";
}
});
@Override
public String getText(LotroGame game) {
return "Discard a Troll";
}
});
action.appendEffect(
new ChoiceEffect(action, playerId, possibleEffects));
return action;
}
}

View File

@@ -6,6 +6,7 @@ import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.SelfExertEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseCardsFromDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDeckEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
@@ -36,6 +37,7 @@ import java.util.List;
public class Card30_025 extends AbstractCompanion {
public Card30_025() {
super(4, 7, 4, 6, Culture.GANDALF, Race.WIZARD, null, "Gandalf", "Leader of Dwarves", true);
addKeyword(Keyword.WISE);
}
@Override
@@ -51,16 +53,18 @@ public class Card30_025 extends AbstractCompanion {
return null;
}
@Override
public List<? extends Action> getPhaseActionsFromDiscard(String playerId, LotroGame game, final PhysicalCard self) {
@Override
public List<? extends Action> getPhaseActionsFromDiscard(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.isPhase(game, Phase.MANEUVER)
&& (PlayConditions.canDiscardFromPlay(self, game, 2, Race.DWARF, CardType.FOLLOWER))
&& (PlayConditions.canPlayFromDiscard(playerId, game, self))) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 2, 2, Race.DWARF, CardType.FOLLOWER));
return Collections.singletonList(getPlayCardAction(playerId, game, self, 0, false));
&& (PlayConditions.canDiscardFromPlay(self, game, 2, Race.DWARF, CardType.FOLLOWER))
&& (PlayConditions.canPlayFromDiscard(playerId, game, self))) {
ActivateCardAction replayGandalf = new ActivateCardAction(self);
replayGandalf.appendCost(
new ChooseAndDiscardCardsFromPlayEffect(replayGandalf, playerId, 2, 2, Race.DWARF, CardType.FOLLOWER));
replayGandalf.appendEffect(
new ChooseAndPlayCardFromDiscardEffect(playerId, game, self));
return Collections.singletonList(replayGandalf);
}
return null;
}
}
}
}

View File

@@ -33,6 +33,7 @@ import java.util.List;
public class Card30_028 extends AbstractCompanion {
public Card30_028() {
super(4, 7, 4, 6, Culture.GANDALF, Race.WIZARD, null, "Gandalf", "Leader of the Company", true);
addKeyword(Keyword.WISE);
}
@Override
@@ -53,4 +54,4 @@ public class Card30_028 extends AbstractCompanion {
}
return null;
}
}
}

View File

@@ -38,7 +38,7 @@ public class Card30_030 extends AbstractEvent {
public PlayEventAction getPlayCardAction(final String playerId, LotroGame game, final PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
final PlayEventAction action = new PlayEventAction(self);
if ((PlayConditions.canExert(self, game, Filters.gandalf))
&& (PlayConditions.canExert(self, game, Keyword.WISE, CardType.ALLY))) {
&& (PlayConditions.canExert(self, game, Keyword.WISE, Culture.ELVEN, CardType.ALLY))) {
action.appendCost(
new PlayoutDecisionEffect(playerId,
new YesNoDecision("Do you want to exert Gandalf and a Wise ally?") {

View File

@@ -44,9 +44,10 @@ public class Card31_013 extends AbstractFollower {
}
@Override
public Modifier getAlwaysOnModifier(LotroGame game, PhysicalCard self) {
return new CantDiscardFromPlayModifier(self, "Cannot be discarded from play by Shadow cards",
new SpotCondition(Filters.hasAttached(self)), self, Side.SHADOW);
protected List<? extends Modifier> getNonBasicStatsModifiers(PhysicalCard self) {
return Collections.singletonList(
new CantDiscardFromPlayModifier(self, "Cannot be discarded from play by Shadow cards",
new SpotCondition(Filters.hasAttached(self)), self, Side.SHADOW));
}
@Override

View File

@@ -3,18 +3,23 @@ package com.gempukku.lotro.cards.set31.gandalf;
import com.gempukku.lotro.cards.AbstractEvent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.actions.SubCostToEffectAction;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.cards.effects.OptionalEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndTransferAttachableEffect;
import com.gempukku.lotro.cards.effects.TransferPermanentEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.StackActionEffect;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -39,8 +44,8 @@ public class Card31_014 extends AbstractEvent {
}
@Override
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
PlayEventAction action = new PlayEventAction(self);
public PlayEventAction getPlayCardAction(final String playerId, final LotroGame game, final PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.name("Gandalf")));
@@ -53,15 +58,30 @@ public class Card31_014 extends AbstractEvent {
action.appendEffect(
new ChoiceEffect(action, playerId, possibleEffects));
action.appendEffect(
new OptionalEffect(action, playerId,
new ChooseAndTransferAttachableEffect(action, playerId, true, Filters.and(Culture.GANDALF, CardType.FOLLOWER, Zone.SUPPORT), Filters.any, CardType.COMPANION)) {
SubCostToEffectAction subAction = new SubCostToEffectAction(action);
subAction.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a [GANDALF] follower", Culture.GANDALF, CardType.FOLLOWER, Zone.SUPPORT) {
@Override
protected void cardSelected(LotroGame game, final PhysicalCard follower) {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a companion", CardType.COMPANION) {
@Override
public String getText(LotroGame game) {
return "Attach a [GANDALF] follower";
protected void cardSelected(LotroGame game, PhysicalCard companion) {
action.appendEffect(new TransferPermanentEffect(follower, companion));
}
});
return action;
}
});
action.appendEffect(
new OptionalEffect(action, playerId,
new StackActionEffect(subAction) {
@Override
public String getText(LotroGame game) {
return "Attach a [GANDALF] follower";
}
}));
return action;
}
}

View File

@@ -49,38 +49,42 @@ public class Card31_022 extends AbstractPermanent {
}
return null;
}
@Override
public List<? extends ActivateCardAction> getOptionalInPlayAfterActions(final String playerId, final LotroGame game, EffectResult effectResult, final PhysicalCard self) {
if (TriggerConditions.forEachExerted(game, effectResult, Filters.name("Bilbo")) || TriggerConditions.forEachWounded(game, effectResult, Filters.name("Bilbo"))) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.MINION));
action.appendCost(
new ChooseAndDiscardCardsFromHandEffect(action, playerId, true, 1, 1));
if (TriggerConditions.forEachExerted(game, effectResult, Filters.name("Bilbo")) || TriggerConditions.forEachWounded(game, effectResult, Filters.name("Bilbo"))) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.MINION));
action.appendCost(
new ChooseAndDiscardCardsFromHandEffect(action, playerId, true, 1, 1));
action.appendEffect(
new PreventableEffect(action,
new UnrespondableEffect() {
@Override
public String getText(LotroGame game) {
return "Choose a SHIRE card";
}
@Override
protected void doPlayEffect(LotroGame game) {
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Culture.SHIRE));
}
new PreventableEffect(action,
new UnrespondableEffect() {
@Override
public String getText(LotroGame game) {
return "a SHIRE card from being discarded";
}
@Override
protected void doPlayEffect(LotroGame game) {
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Culture.SHIRE));
}
}, Collections.singletonList(game.getGameState().getCurrentPlayerId()),
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromHandEffect(subAction, playerId, true, 2, 2);
}
}
));
return Collections.singletonList(action);
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromHandEffect(subAction, playerId, false, 2, 2) {
@Override
public String getText(LotroGame game) {
return "Discard 2 cards from hand";
}
};
}
}));
return Collections.singletonList(action);
}
return null;
}
}
return null;
}
}

View File

@@ -11,6 +11,7 @@ import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
@@ -39,8 +40,8 @@ public class Card31_033 extends AbstractEvent {
@Override
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 2, 2, Race.ORC));
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 2, 2, Race.ORC));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.or(CardType.POSSESSION, CardType.ARTIFACT), Filters.attachedTo(Filters.and(CardType.COMPANION, Race.DWARF))));
return action;
@@ -50,12 +51,18 @@ public class Card31_033 extends AbstractEvent {
public List<? extends Action> getPhaseActionsFromDiscard(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.isPhase(game, Phase.MANEUVER)
&& PlayConditions.canExert(self, game, 2, Filters.name("The Great Goblin"))
&& PlayConditions.canPlayFromDiscard(playerId, game, self)) {
final PlayEventAction action = getPlayCardAction(playerId, game, self, 0, false);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 2, Filters.name("The Great Goblin")));
&& (PlayConditions.canExert(self, game, 1, 2, Filters.and(Race.ORC, Filters.not(Filters.name("The Great Goblin"))))
|| (PlayConditions.canExert(self, game, 1, Filters.and(Race.ORC, Filters.not(Filters.name("The Great Goblin"))))
&& PlayConditions.canExert(self, game, 3, Filters.name("The Great Goblin"))))) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 2, Filters.name("The Great Goblin")));
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 2, 2, Race.ORC));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.or(CardType.POSSESSION, CardType.ARTIFACT), Filters.attachedTo(Filters.and(CardType.COMPANION, Race.DWARF))));
return Collections.singletonList(action);
}
return null;
}
}
}

View File

@@ -31,11 +31,13 @@ public class Card31_045 extends AbstractSite {
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.startOfPhase(game, effectResult, Phase.MANEUVER)) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ChooseAndPlayCardFromDeckEffect(playerId, PossessionClass.HAND_WEAPON));
RequiredTriggerAction action = new RequiredTriggerAction(self);
for (String playerId : GameUtils.getAllPlayers(game)) {
action.appendEffect(new OptionalEffect(action, playerId,
new ChooseAndPlayCardFromDeckEffect(playerId, PossessionClass.HAND_WEAPON)));
}
return Collections.singletonList(action);
}
return null;

View File

@@ -36,7 +36,7 @@ import java.util.List;
*/
public class Card31_065 extends AbstractPermanent {
public Card31_065() {
super(Side.SHADOW, 2, CardType.CONDITION, Culture.GUNDABAD, Zone.SUPPORT, "Caught in a Sack");
super(Side.SHADOW, 2, CardType.CONDITION, Culture.GUNDABAD, Zone.SUPPORT, "Caught in a Sack", null, true);
}
@Override