"Berserk Rager"
This commit is contained in:
@@ -291,6 +291,10 @@ public class PlayConditions {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canRemoveTokens(LotroGame game, Token token, int count, Filterable... fromFilters) {
|
||||
return Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.and(fromFilters, Filters.hasToken(token, count))).size() > 0;
|
||||
}
|
||||
|
||||
public static boolean canRemoveToken(GameState gameState, PhysicalCard from, Token token) {
|
||||
return canRemoveToken(gameState, from, token, 1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.gempukku.lotro.cards.effects.choose;
|
||||
|
||||
import com.gempukku.lotro.common.Filterable;
|
||||
import com.gempukku.lotro.common.Token;
|
||||
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.effects.ChooseActiveCardEffect;
|
||||
|
||||
public class ChooseAndRemoveTokensFromCardEffect extends ChooseActiveCardEffect {
|
||||
private Token _token;
|
||||
private int _count;
|
||||
|
||||
public ChooseAndRemoveTokensFromCardEffect(PhysicalCard source, String playerId, Token token, int count, Filterable... filters) {
|
||||
super(source, playerId, "Choose card to remove tokens from", filters);
|
||||
_token = token;
|
||||
_count = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filter getExtraFilter() {
|
||||
return Filters.hasToken(_token, _count);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||
game.getGameState().removeTokens(card, _token, _count);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.gempukku.lotro.cards.set5.isengard;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractMinion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndRemoveTokensFromCardEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
|
||||
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.ActivateCardAction;
|
||||
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
import com.gempukku.lotro.logic.modifiers.evaluator.Evaluator;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Battle of Helm's Deep
|
||||
* Side: Shadow
|
||||
* Culture: Isengard
|
||||
* Twilight Cost: 5
|
||||
* Type: Minion • Uruk-Hai
|
||||
* Strength: 10
|
||||
* Vitality: 3
|
||||
* Site: 5
|
||||
* Game Text: Damage +1. Berserk Rager is strength +1 for each wound on a character in its skirmish. Skirmish: Remove
|
||||
* 3 [ISENGARD] tokens from a machine and exert Berserk Rager twice to wound every ally twice.
|
||||
*/
|
||||
public class Card5_045 extends AbstractMinion {
|
||||
public Card5_045() {
|
||||
super(5, 10, 3, 5, Race.URUK_HAI, Culture.ISENGARD, "Berserk Rager", true);
|
||||
addKeyword(Keyword.DAMAGE, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Modifier> getAlwaysOnModifiers(LotroGame game, PhysicalCard self) {
|
||||
return Collections.singletonList(
|
||||
new StrengthModifier(self, Filters.and(Filters.sameCard(self), Filters.inSkirmish),
|
||||
null,
|
||||
new Evaluator() {
|
||||
@Override
|
||||
public int evaluateExpression(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) {
|
||||
int wounds = 0;
|
||||
for (PhysicalCard physicalCard : Filters.filterActive(gameState, modifiersQuerying, Filters.inSkirmish))
|
||||
wounds += gameState.getWounds(physicalCard);
|
||||
return wounds;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self, 0)
|
||||
&& PlayConditions.canExert(self, game, 2, Filters.sameCard(self))
|
||||
&& PlayConditions.canRemoveTokens(game, Token.ISENGARD, 3, Keyword.MACHINE)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new ChooseAndRemoveTokensFromCardEffect(self, playerId, Token.ISENGARD, 3, Keyword.MACHINE));
|
||||
action.appendCost(
|
||||
new ExertCharactersEffect(self, self));
|
||||
action.appendCost(
|
||||
new ExertCharactersEffect(self, self));
|
||||
action.appendEffect(
|
||||
new WoundCharactersEffect(self, CardType.ALLY));
|
||||
action.appendEffect(
|
||||
new WoundCharactersEffect(self, CardType.ALLY));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -67,10 +67,14 @@ public class Filters {
|
||||
}
|
||||
|
||||
public static Filter hasToken(final Token token) {
|
||||
return hasToken(token, 1);
|
||||
}
|
||||
|
||||
public static Filter hasToken(final Token token, final int count) {
|
||||
return new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
return gameState.getTokenCount(physicalCard, token) > 0;
|
||||
return gameState.getTokenCount(physicalCard, token) >= count;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gempukku.lotro.logic.effects;
|
||||
|
||||
import com.gempukku.lotro.common.Filterable;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
@@ -14,7 +15,7 @@ import java.util.Collections;
|
||||
public class WoundCharactersEffect extends AbstractPreventableCardEffect {
|
||||
private Collection<PhysicalCard> _sources;
|
||||
|
||||
public WoundCharactersEffect(Collection<PhysicalCard> sources, Filter filter) {
|
||||
public WoundCharactersEffect(Collection<PhysicalCard> sources, Filterable... filter) {
|
||||
super(filter);
|
||||
_sources = sources;
|
||||
}
|
||||
@@ -25,7 +26,7 @@ public class WoundCharactersEffect extends AbstractPreventableCardEffect {
|
||||
_sources = Collections.singleton(source);
|
||||
}
|
||||
|
||||
public WoundCharactersEffect(PhysicalCard source, Filter filter) {
|
||||
public WoundCharactersEffect(PhysicalCard source, Filterable... filter) {
|
||||
super(filter);
|
||||
if (source != null)
|
||||
_sources = Collections.singleton(source);
|
||||
|
||||
Reference in New Issue
Block a user