"Legolas' Bow"
This commit is contained in:
@@ -4,17 +4,24 @@ import com.gempukku.lotro.common.Phase;
|
||||
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.AbstractCostToEffectAction;
|
||||
import com.gempukku.lotro.logic.actions.SubAction;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
public class CheckLimitEffect extends UnrespondableEffect {
|
||||
private ActivateCardAction _action;
|
||||
private Action _action;
|
||||
private PhysicalCard _card;
|
||||
private int _limit;
|
||||
private Phase _phase;
|
||||
private Effect _limitedEffect;
|
||||
|
||||
public CheckLimitEffect(ActivateCardAction action, PhysicalCard card, int limit, Phase phase, Effect limitedEffect) {
|
||||
public CheckLimitEffect(Action action, PhysicalCard card, int limit, Effect limitedEffect) {
|
||||
this(action, card, limit, null, limitedEffect);
|
||||
}
|
||||
|
||||
public CheckLimitEffect(Action action, PhysicalCard card, int limit, Phase phase, Effect limitedEffect) {
|
||||
_card = card;
|
||||
_limit = limit;
|
||||
_phase = phase;
|
||||
@@ -24,9 +31,16 @@ public class CheckLimitEffect extends UnrespondableEffect {
|
||||
|
||||
@Override
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
int count = game.getModifiersEnvironment().getUntilEndOfPhaseLimitCounter(_card, _phase).incrementCounter();
|
||||
Phase phase = _phase;
|
||||
if (phase == null)
|
||||
phase = game.getGameState().getCurrentPhase();
|
||||
|
||||
int count = game.getModifiersEnvironment().getUntilEndOfPhaseLimitCounter(_card, phase).incrementCounter();
|
||||
if (count <= _limit) {
|
||||
_action.appendEffect(_limitedEffect);
|
||||
SubAction subAction = new SubAction(_action);
|
||||
subAction.appendEffect(
|
||||
_limitedEffect);
|
||||
game.getActionsEnvironment().addActionToStack(subAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,14 @@ import com.gempukku.lotro.logic.GameUtils;
|
||||
import com.gempukku.lotro.logic.effects.AbstractPreventableCardEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.results.ExertResult;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class ExertCharactersEffect extends AbstractPreventableCardEffect {
|
||||
private String _playerId;
|
||||
private Action _action;
|
||||
private PhysicalCard _source;
|
||||
|
||||
public ExertCharactersEffect(PhysicalCard source, PhysicalCard... cards) {
|
||||
@@ -27,6 +29,12 @@ public class ExertCharactersEffect extends AbstractPreventableCardEffect {
|
||||
_source = source;
|
||||
}
|
||||
|
||||
public ExertCharactersEffect(Action action, PhysicalCard source, Filterable... filter) {
|
||||
super(filter);
|
||||
_action = action;
|
||||
_source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filter getExtraAffectableFilter() {
|
||||
return new Filter() {
|
||||
@@ -56,7 +64,7 @@ public class ExertCharactersEffect extends AbstractPreventableCardEffect {
|
||||
|
||||
for (PhysicalCard woundedCard : cards) {
|
||||
game.getGameState().addWound(woundedCard);
|
||||
game.getActionsEnvironment().emitEffectResult(new ExertResult(woundedCard));
|
||||
game.getActionsEnvironment().emitEffectResult(new ExertResult(_action, woundedCard));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ChooseAndExertCharactersEffect extends ChooseActiveCardsEffect {
|
||||
protected final void cardsSelected(LotroGame game, Collection<PhysicalCard> characters) {
|
||||
_resultSubAction = new SubAction(_action);
|
||||
for (int i = 0; i < _count; i++) {
|
||||
_resultSubAction.appendEffect(new ExertCharactersEffect(_action.getActionSource(), Filters.in(characters)));
|
||||
_resultSubAction.appendEffect(new ExertCharactersEffect(_action, _action.getActionSource(), Filters.in(characters)));
|
||||
}
|
||||
game.getActionsEnvironment().addActionToStack(_resultSubAction);
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.gempukku.lotro.cards.set11.elven;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.CheckLimitEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.KeywordModifier;
|
||||
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.results.ExertResult;
|
||||
import com.gempukku.lotro.logic.effects.HealCharactersEffect;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Set: Shadows
|
||||
* Side: Free
|
||||
* Culture: Elven
|
||||
* Twilight Cost: 2
|
||||
* Type: Possession • Ranged Weapon
|
||||
* Game Text: Bearer must be an Elf. Bearer is an archer. If bearer is Legolas, each time you exert him to play
|
||||
* an [ELVEN] condition or [ELVEN] event, you may heal him (limit once per phase).
|
||||
*/
|
||||
public class Card11_023 extends AbstractAttachableFPPossession {
|
||||
public Card11_023() {
|
||||
super(2, 0, 0, Culture.ELVEN, PossessionClass.RANGED_WEAPON, "Legolas' Bow", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
|
||||
return Race.ELF;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Modifier> getNonBasicStatsModifiers(PhysicalCard self) {
|
||||
return Collections.singletonList(
|
||||
new KeywordModifier(self, Filters.hasAttached(self), Keyword.ARCHER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.forEachExerted(game, effectResult, self)
|
||||
&& self.getAttachedTo().getBlueprint().getName().equals("Legolas")) {
|
||||
ExertResult exertResult = (ExertResult) effectResult;
|
||||
if (exertResult.getAction() != null && exertResult.getAction().getType() == Action.Type.PLAY_CARD) {
|
||||
PhysicalCard playedCard = exertResult.getAction().getActionSource();
|
||||
if (playedCard != null && Filters.and(Culture.ELVEN, Filters.or(CardType.CONDITION, CardType.EVENT)).accepts(game.getGameState(), game.getModifiersQuerying(), playedCard)) {
|
||||
OptionalTriggerAction action= new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new CheckLimitEffect(action, self, 1,
|
||||
new HealCharactersEffect(self, self.getAttachedTo())));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,23 @@ package com.gempukku.lotro.logic.timing.results;
|
||||
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
public class ExertResult extends EffectResult {
|
||||
private Action _action;
|
||||
private PhysicalCard _card;
|
||||
|
||||
public ExertResult(PhysicalCard card) {
|
||||
public ExertResult(Action action, PhysicalCard card) {
|
||||
super(Type.FOR_EACH_EXERTED);
|
||||
_action = action;
|
||||
_card = card;
|
||||
}
|
||||
|
||||
public PhysicalCard getExertedCard() {
|
||||
return _card;
|
||||
}
|
||||
|
||||
public Action getAction() {
|
||||
return _action;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user