Easterling Regiment

This commit is contained in:
marcins78
2013-11-20 16:33:13 +00:00
parent eb0fcf92af
commit b2d9321e0f
5 changed files with 63 additions and 20 deletions

View File

@@ -20,6 +20,7 @@ public class ExertCharactersEffect extends AbstractPreventableCardEffect {
private Action _action;
private PhysicalCard _source;
private Set<PhysicalCard> _placeNoWound = new HashSet<PhysicalCard>();
private boolean _forToil;
public ExertCharactersEffect(Action action, PhysicalCard source, Filterable... filter) {
super(filter);
@@ -33,6 +34,10 @@ public class ExertCharactersEffect extends AbstractPreventableCardEffect {
_source = source;
}
public void setForToil(boolean forToil) {
_forToil = forToil;
}
@Override
protected Filter getExtraAffectableFilter() {
return new Filter() {
@@ -63,7 +68,7 @@ public class ExertCharactersEffect extends AbstractPreventableCardEffect {
for (PhysicalCard woundedCard : cards) {
if (!_placeNoWound.contains(woundedCard))
game.getGameState().addWound(woundedCard);
game.getActionsEnvironment().emitEffectResult(new ExertResult(_action, woundedCard));
game.getActionsEnvironment().emitEffectResult(new ExertResult(_action, woundedCard, _forToil));
forEachExertedByEffect(woundedCard);
}
}

View File

@@ -20,6 +20,8 @@ public class ChooseAndExertCharactersEffect extends ChooseActiveCardsEffect {
private Filterable[] _filters;
private SubAction _resultSubAction;
private boolean _forToil;
public ChooseAndExertCharactersEffect(Action action, String playerId, int minimum, int maximum, Filterable... filters) {
this(action, playerId, minimum, maximum, 1, filters);
}
@@ -31,6 +33,10 @@ public class ChooseAndExertCharactersEffect extends ChooseActiveCardsEffect {
_filters = filters;
}
public void setForToil(boolean forToil) {
_forToil = forToil;
}
@Override
protected Filter getExtraFilterForPlaying(LotroGame game) {
int times = _times;
@@ -66,13 +72,16 @@ public class ChooseAndExertCharactersEffect extends ChooseActiveCardsEffect {
_resultSubAction = new SubAction(_action);
for (int i = 0; i < _times; i++) {
final boolean first = (i==0);
_resultSubAction.appendEffect(new ExertCharactersEffect(_action, _action.getActionSource(), characters.toArray(new PhysicalCard[characters.size()])) {
final ExertCharactersEffect effect = new ExertCharactersEffect(_action, _action.getActionSource(), characters.toArray(new PhysicalCard[characters.size()])) {
@Override
protected void forEachExertedByEffect(PhysicalCard physicalCard) {
if (first)
ChooseAndExertCharactersEffect.this.forEachCardExertedCallback(physicalCard);
}
});
};
if (_forToil)
effect.setForToil(true);
_resultSubAction.appendEffect(effect);
}
game.getActionsEnvironment().addActionToStack(_resultSubAction);
cardsToBeExertedCallback(characters);

View File

@@ -69,13 +69,14 @@ public class ToilDiscountEffect extends AbstractSubActionEffect implements Disco
}
SubAction subAction = new SubAction(_action);
subAction.appendEffect(
new ChooseAndExertCharactersEffect(subAction, _ownerId, minimalExerts, Integer.MAX_VALUE, Filters.owner(_ownerId), _culture, Filters.character) {
@Override
protected void forEachCardExertedCallback(PhysicalCard character) {
_exertedCount++;
}
});
final ChooseAndExertCharactersEffect effect = new ChooseAndExertCharactersEffect(subAction, _ownerId, minimalExerts, Integer.MAX_VALUE, Filters.owner(_ownerId), _culture, Filters.character) {
@Override
protected void forEachCardExertedCallback(PhysicalCard character) {
_exertedCount++;
}
};
effect.setForToil(true);
subAction.appendEffect(effect);
processSubAction(game, subAction);
}
}

View File

@@ -1,22 +1,44 @@
package com.gempukku.lotro.cards.set20.fallenRealms;
import com.gempukku.lotro.cards.AbstractMinion;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Race;
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.effects.AddThreatsEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.results.ExertResult;
import java.util.Collections;
import java.util.List;
/**
* 5
* Easterling Regiment
* Fallen Realms Minion • Man
* 11 3 4
* Easterling. Toil 1. Fierce.
* ❺ Easterling Regiment [Fal]
* Minion • Man
* Strength: 9 Vitality: 3 Roaming: 4
* Easterling. Enduring. (For each wound on this character, this character is strength +2.)
* Each time you exert this minion using toil, you may add a threat.
* <p/>
* http://lotrtcg.org/coreset/fallenrealms/easterlingregiment(r3).jpg
*/
public class Card20_118 extends AbstractMinion {
public Card20_118() {
super(5, 11, 3, 4, Race.MAN, Culture.FALLEN_REALMS, "Easterling Regiment");
super(5, 9, 3, 4, Race.MAN, Culture.FALLEN_REALMS, "Easterling Regiment");
addKeyword(Keyword.EASTERLING);
addKeyword(Keyword.TOIL, 1);
addKeyword(Keyword.FIERCE);
addKeyword(Keyword.ENDURING);
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.forEachExerted(game, effectResult, self) && ((ExertResult) effectResult).isForToil()) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new AddThreatsEffect(playerId, self, 1));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,17 +1,19 @@
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;
import com.gempukku.lotro.logic.timing.EffectResult;
public class ExertResult extends EffectResult {
private Action _action;
private PhysicalCard _card;
private boolean _forToil;
public ExertResult(Action action, PhysicalCard card) {
public ExertResult(Action action, PhysicalCard card, boolean forToil) {
super(Type.FOR_EACH_EXERTED);
_action = action;
_card = card;
_forToil = forToil;
}
public PhysicalCard getExertedCard() {
@@ -21,4 +23,8 @@ public class ExertResult extends EffectResult {
public Action getAction() {
return _action;
}
public boolean isForToil() {
return _forToil;
}
}