"Cave Troll's Chain"
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
package com.gempukku.lotro.cards.modifiers;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.common.Phase;
|
||||||
|
import com.gempukku.lotro.game.PhysicalCard;
|
||||||
|
import com.gempukku.lotro.game.state.GameState;
|
||||||
|
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
|
||||||
|
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
|
||||||
|
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||||
|
|
||||||
|
public class ShouldSkipPhaseModifier extends AbstractModifier {
|
||||||
|
private Phase _phase;
|
||||||
|
private String _playerId;
|
||||||
|
|
||||||
|
public ShouldSkipPhaseModifier(PhysicalCard source, Phase phase) {
|
||||||
|
super(source, "Skip " + phase.toString() + " phase", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER});
|
||||||
|
_phase = phase;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, String playerId, boolean result) {
|
||||||
|
if (phase == _phase && (_playerId == null || _playerId.equals(playerId)))
|
||||||
|
return true;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.gempukku.lotro.cards.set2.moria;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||||
|
import com.gempukku.lotro.cards.PlayConditions;
|
||||||
|
import com.gempukku.lotro.cards.effects.AddUntilStartOfPhaseModifierEffect;
|
||||||
|
import com.gempukku.lotro.cards.modifiers.ShouldSkipPhaseModifier;
|
||||||
|
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
|
||||||
|
import com.gempukku.lotro.common.*;
|
||||||
|
import com.gempukku.lotro.filters.Filter;
|
||||||
|
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.OptionalTriggerAction;
|
||||||
|
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
|
||||||
|
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
|
||||||
|
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||||
|
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
|
||||||
|
import com.gempukku.lotro.logic.effects.WoundCharacterEffect;
|
||||||
|
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||||
|
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set: Mines of Moria
|
||||||
|
* Side: Shadow
|
||||||
|
* Culture: Moria
|
||||||
|
* Twilight Cost: 1
|
||||||
|
* Type: Possession
|
||||||
|
* Strength: +2
|
||||||
|
* Game Text: Bearer must be Cave Troll of Moria. The Free Peoples player may choose for the archery phase to
|
||||||
|
* be skipped. Each time Cave Troll of Moria takes a wound during the archery phase, you may wound an archer companion.
|
||||||
|
*/
|
||||||
|
public class Card2_053 extends AbstractAttachable {
|
||||||
|
public Card2_053() {
|
||||||
|
super(Side.SHADOW, CardType.POSSESSION, 1, Culture.MORIA, null, "Cave Troll's Chain", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
|
||||||
|
return Filters.name("Cave Troll of Moria");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Modifier> getAlwaysOnModifiers(PhysicalCard self) {
|
||||||
|
return Collections.singletonList(
|
||||||
|
new StrengthModifier(self, Filters.hasAttached(self), 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
||||||
|
if (effectResult.getType() == EffectResult.Type.END_OF_PHASE
|
||||||
|
&& game.getGameState().getCurrentPhase() == Phase.MANEUVER) {
|
||||||
|
final RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||||
|
action.appendEffect(
|
||||||
|
new PlayoutDecisionEffect(game.getUserFeedback(), game.getGameState().getCurrentPlayerId(),
|
||||||
|
new MultipleChoiceAwaitingDecision(1, "Would you like to skip Archery phase?", new String[]{"Yes", "No"}) {
|
||||||
|
@Override
|
||||||
|
protected void validDecisionMade(int index, String result) {
|
||||||
|
if (result.equals("Yes")) {
|
||||||
|
action.appendEffect(
|
||||||
|
new AddUntilStartOfPhaseModifierEffect(
|
||||||
|
new ShouldSkipPhaseModifier(self, Phase.ARCHERY), Phase.REGROUP));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
return Collections.singletonList(action);
|
||||||
|
}
|
||||||
|
return super.getRequiredAfterTriggers(game, effectResult, self);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OptionalTriggerAction> getOptionalAfterTriggers(final String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||||
|
if (PlayConditions.isWounded(effectResult, self.getAttachedTo())
|
||||||
|
&& game.getGameState().getCurrentPhase() == Phase.ARCHERY) {
|
||||||
|
final OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||||
|
action.appendEffect(
|
||||||
|
new ChooseActiveCardEffect(playerId, "Choose Archer companion", Filters.keyword(Keyword.ARCHER), Filters.type(CardType.COMPANION)) {
|
||||||
|
@Override
|
||||||
|
protected void cardSelected(PhysicalCard card) {
|
||||||
|
action.insertEffect(
|
||||||
|
new WoundCharacterEffect(playerId, card));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return Collections.singletonList(action);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user