"Denethor"
This commit is contained in:
@@ -15,10 +15,7 @@ import com.gempukku.lotro.logic.effects.*;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.ActivateCardResult;
|
||||
import com.gempukku.lotro.logic.timing.results.PlayCardResult;
|
||||
import com.gempukku.lotro.logic.timing.results.SkirmishResult;
|
||||
import com.gempukku.lotro.logic.timing.results.WoundResult;
|
||||
import com.gempukku.lotro.logic.timing.results.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -312,6 +309,22 @@ public class PlayConditions {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean addedBurden(LotroGame game, EffectResult effectResult, Filterable... sourceFilters) {
|
||||
if (effectResult.getType() == EffectResult.Type.ADD_BURDEN) {
|
||||
AddBurdenResult burdenResult = (AddBurdenResult) effectResult;
|
||||
return (Filters.and(sourceFilters).accepts(game.getGameState(), game.getModifiersQuerying(), burdenResult.getSource()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean addedThreat(LotroGame game, EffectResult effectResult, Filterable... sourceFilters) {
|
||||
if (effectResult.getType() == EffectResult.Type.ADD_THREAT) {
|
||||
AddThreatResult burdenResult = (AddThreatResult) effectResult;
|
||||
return (Filters.and(sourceFilters).accepts(game.getGameState(), game.getModifiersQuerying(), burdenResult.getSource()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canCardAssignToSkirmish(PhysicalCard source, LotroGame game, PhysicalCard card) {
|
||||
return Filters.canBeAssignedToSkirmishByEffect(source.getBlueprint().getSide()).accepts(game.getGameState(), game.getModifiersQuerying(), card);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.gempukku.lotro.cards.set7.gondor;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractCompanion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromHandEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
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.actions.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.effects.AddThreatsEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AddBurdenResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AddThreatResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Return of the King
|
||||
* Side: Free
|
||||
* Culture: Gondor
|
||||
* Twilight Cost: 2
|
||||
* Type: Companion • Man
|
||||
* Strength: 8
|
||||
* Vitality: 3
|
||||
* Resistance: 6
|
||||
* Signet: Aragorn
|
||||
* Game Text: Fellowship: Play a [GONDOR] knight. That knight's twilight cost is -2. Each time a Shadow card adds
|
||||
* a threat, add a burden. Each time a Shadow card adds a burden, add a threat.
|
||||
*/
|
||||
public class Card7_085 extends AbstractCompanion {
|
||||
public Card7_085() {
|
||||
super(2, 8, 3, Culture.GONDOR, Race.MAN, Signet.ARAGORN, "Denethor", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
|
||||
&& PlayConditions.canPlayFromHand(playerId, game, -2, Culture.GONDOR, Keyword.KNIGHT)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Culture.GONDOR, Keyword.KNIGHT));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (PlayConditions.addedBurden(game, effectResult, Side.SHADOW)) {
|
||||
AddBurdenResult burdenResult = (AddBurdenResult) effectResult;
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new AddThreatsEffect(self.getOwner(), self, burdenResult.getCount()));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
if (PlayConditions.addedThreat(game, effectResult, Side.SHADOW)) {
|
||||
AddThreatResult threatResult = (AddThreatResult) effectResult;
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new AddBurdenEffect(self, threatResult.getCount()));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,9 @@ import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.GameUtils;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.results.AddThreatResult;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class AddThreatsEffect extends AbstractEffect {
|
||||
private Action _action;
|
||||
@@ -46,7 +49,8 @@ public class AddThreatsEffect extends AbstractEffect {
|
||||
if (toAdd > 0) {
|
||||
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " adds " + toAdd + " threat" + ((toAdd > 1) ? "s" : ""));
|
||||
game.getGameState().addThreats(game.getGameState().getCurrentPlayerId(), toAdd);
|
||||
return new FullEffectResult(null, toAdd == _count, toAdd == _count);
|
||||
|
||||
return new FullEffectResult(Collections.singleton(new AddThreatResult(_source, toAdd)), toAdd == _count, toAdd == _count);
|
||||
}
|
||||
return new FullEffectResult(null, false, false);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public abstract class EffectResult {
|
||||
|
||||
PLAY, ACTIVATE, DRAW_CARD_OR_PUT_INTO_HAND,
|
||||
|
||||
PUT_ON_THE_ONE_RING, REMOVE_BURDEN, ADD_BURDEN,
|
||||
PUT_ON_THE_ONE_RING, REMOVE_BURDEN, ADD_BURDEN, ADD_THREAT,
|
||||
|
||||
SKIRMISH_ABOUT_TO_END,
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.gempukku.lotro.logic.timing.results;
|
||||
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
public class AddThreatResult extends EffectResult {
|
||||
private PhysicalCard _source;
|
||||
private int _count;
|
||||
|
||||
public AddThreatResult(PhysicalCard source, int count) {
|
||||
super(Type.ADD_THREAT);
|
||||
_source = source;
|
||||
_count = count;
|
||||
}
|
||||
|
||||
public PhysicalCard getSource() {
|
||||
return _source;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return _count;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user