"Theoden"

This commit is contained in:
marcins78@gmail.com
2011-11-14 23:29:25 +00:00
parent 971025921e
commit c7f1bfed59
8 changed files with 129 additions and 5 deletions

View File

@@ -193,7 +193,12 @@ public abstract class AbstractLotroCardBlueprint implements LotroCardBlueprint {
}
@Override
public RequiredTriggerAction getDiscardedFromPlayTrigger(LotroGame game, PhysicalCard self) {
public RequiredTriggerAction getDiscardedFromPlayRequiredTrigger(LotroGame game, PhysicalCard self) {
return null;
}
@Override
public OptionalTriggerAction getKilledOptionalTrigger(LotroGame game, PhysicalCard self) {
return null;
}

View File

@@ -128,7 +128,12 @@ public class SimpleLotroCardBlueprint implements LotroCardBlueprint {
}
@Override
public RequiredTriggerAction getDiscardedFromPlayTrigger(LotroGame game, PhysicalCard self) {
public RequiredTriggerAction getDiscardedFromPlayRequiredTrigger(LotroGame game, PhysicalCard self) {
return null;
}
@Override
public OptionalTriggerAction getKilledOptionalTrigger(LotroGame game, PhysicalCard self) {
return null;
}

View File

@@ -48,7 +48,7 @@ public class Card7_287 extends AbstractMinion {
}
@Override
public RequiredTriggerAction getDiscardedFromPlayTrigger(LotroGame game, PhysicalCard self) {
public RequiredTriggerAction getDiscardedFromPlayRequiredTrigger(LotroGame game, PhysicalCard self) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new RemoveThreatsEffect(self, 3));

View File

@@ -0,0 +1,67 @@
package com.gempukku.lotro.cards.set8.rohan;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect;
import com.gempukku.lotro.common.*;
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.OptionalTriggerAction;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.LinkedList;
import java.util.List;
/**
* Set: Siege of Gondor
* Side: Free
* Culture: Rohan
* Twilight Cost: 3
* Type: Companion • Man
* Strength: 7
* Vitality: 3
* Resistance: 6
* Signet: Aragorn
* Game Text: Valiant. While you can spot a [ROHAN] Man, Theodens twilight cost is -1. When Theoden is killed, you may
* play a [ROHAN] companion from your discard pile or draw deck.
*/
public class Card8_092 extends AbstractCompanion {
public Card8_092() {
super(3, 7, 3, Culture.ROHAN, Race.MAN, Signet.ARAGORN, "Theoden", true);
addKeyword(Keyword.VALIANT);
}
@Override
public int getTwilightCostModifier(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) {
if (Filters.canSpot(gameState, modifiersQuerying, Culture.ROHAN, Race.MAN))
return -1;
return 0;
}
@Override
public OptionalTriggerAction getKilledOptionalTrigger(LotroGame game, PhysicalCard self) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
List<Effect> possibleEffects = new LinkedList<Effect>();
possibleEffects.add(
new ChooseAndPlayCardFromDeckEffect(self.getOwner(), Culture.ROHAN, CardType.COMPANION) {
@Override
public String getText(LotroGame game) {
return "Play from deck";
}
});
possibleEffects.add(
new ChooseAndPlayCardFromDiscardEffect(self.getOwner(), game.getGameState().getDiscard(self.getOwner()), Culture.ROHAN, CardType.COMPANION) {
@Override
public String getText(LotroGame game) {
return "Play from discard";
}
});
action.appendEffect(
new ChoiceEffect(action, self.getOwner(), possibleEffects));
return action;
}
}

View File

@@ -71,7 +71,9 @@ public interface LotroCardBlueprint {
public List<? extends Action> getOptionalAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self);
public RequiredTriggerAction getDiscardedFromPlayTrigger(LotroGame game, PhysicalCard self);
public RequiredTriggerAction getDiscardedFromPlayRequiredTrigger(LotroGame game, PhysicalCard self);
public OptionalTriggerAction getKilledOptionalTrigger(LotroGame game, PhysicalCard self);
public Block getSiteBlock();

View File

@@ -30,6 +30,8 @@ public class RuleSet {
new DiscardedCardRule(_actionsEnvironment).applyRule();
new KilledCardRule(_actionsEnvironment).applyRule();
new FrodoAndSamRule(_modifiersLogic).applyRule();
new ThreatRule(_actionsEnvironment).applyRule();

View File

@@ -30,7 +30,7 @@ public class DiscardedCardRule {
Collection<PhysicalCard> discardedCards = discardResult.getDiscardedCards();
List<RequiredTriggerAction> actions = new LinkedList<RequiredTriggerAction>();
for (PhysicalCard discardedCard : discardedCards) {
RequiredTriggerAction trigger = discardedCard.getBlueprint().getDiscardedFromPlayTrigger(game, discardedCard);
RequiredTriggerAction trigger = discardedCard.getBlueprint().getDiscardedFromPlayRequiredTrigger(game, discardedCard);
if (trigger != null)
actions.add(trigger);
}

View File

@@ -0,0 +1,43 @@
package com.gempukku.lotro.logic.timing.rules;
import com.gempukku.lotro.game.AbstractActionProxy;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.game.state.actions.DefaultActionsEnvironment;
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.results.KillResult;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
public class KilledCardRule {
private DefaultActionsEnvironment _actionsEnvironment;
public KilledCardRule(DefaultActionsEnvironment actionsEnvironment) {
_actionsEnvironment = actionsEnvironment;
}
public void applyRule() {
_actionsEnvironment.addAlwaysOnActionProxy(
new AbstractActionProxy() {
@Override
public List<? extends Action> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.KILL) {
KillResult killResult = (KillResult) effectResult;
Set<PhysicalCard> killedCards = killResult.getKilledCards();
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
for (PhysicalCard killedCard : killedCards) {
OptionalTriggerAction trigger = killedCard.getBlueprint().getKilledOptionalTrigger(game, killedCard);
if (trigger != null)
actions.add(trigger);
}
return actions;
}
return null;
}
});
}
}