"Orc-bane"
This commit is contained in:
@@ -0,0 +1,94 @@
|
|||||||
|
package com.gempukku.lotro.cards.set2.shire;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.cards.AbstractEvent;
|
||||||
|
import com.gempukku.lotro.cards.PlayConditions;
|
||||||
|
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||||
|
import com.gempukku.lotro.cards.costs.ChooseActiveCardsCost;
|
||||||
|
import com.gempukku.lotro.cards.costs.ExertCharactersCost;
|
||||||
|
import com.gempukku.lotro.common.Culture;
|
||||||
|
import com.gempukku.lotro.common.Phase;
|
||||||
|
import com.gempukku.lotro.common.Race;
|
||||||
|
import com.gempukku.lotro.common.Side;
|
||||||
|
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.decisions.DecisionResultInvalidException;
|
||||||
|
import com.gempukku.lotro.logic.decisions.IntegerAwaitingDecision;
|
||||||
|
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
|
||||||
|
import com.gempukku.lotro.logic.effects.ChooseActiveCardsEffect;
|
||||||
|
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
|
||||||
|
import com.gempukku.lotro.logic.effects.WoundCharacterEffect;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set: Mines of Moria
|
||||||
|
* Side: Free
|
||||||
|
* Culture: Shire
|
||||||
|
* Twilight Cost: 0
|
||||||
|
* Type: Event
|
||||||
|
* Game Text: Maneuver: Spot Sting or Glamdring and exert its bearer X times to wound X Orcs or X Uruk-hai.
|
||||||
|
*/
|
||||||
|
public class Card2_109 extends AbstractEvent {
|
||||||
|
public Card2_109() {
|
||||||
|
super(Side.FREE_PEOPLE, Culture.SHIRE, "Orc-bane", Phase.MANEUVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||||
|
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
|
||||||
|
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), Filters.hasAttached(Filters.or(Filters.name("Sting"), Filters.name("Glamdring"))));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTwilightCost() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlayEventAction getPlayCardAction(final String playerId, final LotroGame game, final PhysicalCard self, int twilightModifier) {
|
||||||
|
final PlayEventAction action = new PlayEventAction(self);
|
||||||
|
action.appendCost(
|
||||||
|
new ChooseActiveCardsCost(playerId, "Choose Sting or Glamdring bearer", 1, 1, Filters.hasAttached(Filters.or(Filters.name("Sting"), Filters.name("Glamdring"))), Filters.canExert(self)) {
|
||||||
|
@Override
|
||||||
|
protected void cardsSelected(Collection<PhysicalCard> cards, boolean success) {
|
||||||
|
if (success) {
|
||||||
|
final PhysicalCard bearer = cards.iterator().next();
|
||||||
|
int vitality = game.getModifiersQuerying().getVitality(game.getGameState(), bearer);
|
||||||
|
action.insertCost(
|
||||||
|
new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
|
||||||
|
new IntegerAwaitingDecision(1, "Choose how many times to exert", 1, vitality - 1) {
|
||||||
|
@Override
|
||||||
|
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||||
|
final int exertionCount = getValidatedResult(result);
|
||||||
|
for (int i = 0; i < exertionCount; i++) {
|
||||||
|
action.insertCost(
|
||||||
|
new ExertCharactersCost(self, bearer));
|
||||||
|
}
|
||||||
|
action.appendEffect(
|
||||||
|
new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
|
||||||
|
new MultipleChoiceAwaitingDecision(1, "Choose action to perform", new String[]{"Wound " + exertionCount + " Orcs", "Wound " + exertionCount + " Uruk-hai"}) {
|
||||||
|
@Override
|
||||||
|
protected void validDecisionMade(int index, String result) {
|
||||||
|
Filter filter = (index == 0) ? Filters.race(Race.ORC) : Filters.race(Race.URUK_HAI);
|
||||||
|
action.insertEffect(
|
||||||
|
new ChooseActiveCardsEffect(playerId, "Choose minions to wound", exertionCount, exertionCount, filter) {
|
||||||
|
@Override
|
||||||
|
protected void cardsSelected(Collection<PhysicalCard> cards) {
|
||||||
|
action.insertEffect(
|
||||||
|
new WoundCharacterEffect(playerId, Filters.in(cards)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -78,6 +78,16 @@ public class Filters {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Filter canExert(final PhysicalCard source) {
|
||||||
|
return new Filter() {
|
||||||
|
@Override
|
||||||
|
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||||
|
return modifiersQuerying.getVitality(gameState, physicalCard) > 1
|
||||||
|
&& modifiersQuerying.canBeExerted(gameState, source, physicalCard);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static Filter exhausted() {
|
public static Filter exhausted() {
|
||||||
return new Filter() {
|
return new Filter() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user