"Whip of Many Thongs", "Ancient Serpentine Weapon"

This commit is contained in:
marcins78
2013-02-04 16:01:27 +00:00
parent 605669ca65
commit b354e79d2c
18 changed files with 124 additions and 23 deletions

View File

@@ -12,6 +12,7 @@ import com.gempukku.lotro.logic.modifiers.ModifierFlag;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
public class PlayConditions {
@@ -242,7 +243,7 @@ public class PlayConditions {
return game.getGameState().getBurdens() >= count && game.getModifiersQuerying().canRemoveBurden(game.getGameState(), card);
}
public static boolean canWound(PhysicalCard source, final LotroGame game, final int times, final int count, Filterable... filters) {
public static boolean canWound(final PhysicalCard source, final LotroGame game, final int times, final int count, Filterable... filters) {
final GameState gameState = game.getGameState();
final ModifiersQuerying modifiersQuerying = game.getModifiersQuerying();
final Filter filter = Filters.and(filters, Filters.character);
@@ -254,7 +255,7 @@ public class PlayConditions {
public boolean visitPhysicalCard(PhysicalCard physicalCard) {
if (filter.accepts(gameState, modifiersQuerying, physicalCard)
&& modifiersQuerying.getVitality(gameState, physicalCard) > times
&& modifiersQuerying.canTakeWounds(gameState, physicalCard, times))
&& modifiersQuerying.canTakeWounds(gameState, Collections.singleton(source), physicalCard, times))
_woundableCount++;
return _woundableCount >= count;
}

View File

@@ -12,6 +12,8 @@ import com.gempukku.lotro.logic.modifiers.ModifierEffect;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.modifiers.condition.PhaseCondition;
import java.util.Collection;
public class CantTakeMoreThanXWoundsModifier extends AbstractModifier {
private int _count;
@@ -26,7 +28,7 @@ public class CantTakeMoreThanXWoundsModifier extends AbstractModifier {
}
@Override
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersLogic, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersQuerying, Collection<PhysicalCard> woundSources, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
return woundsAlreadyTaken + woundsToTake <= _count;
}
}

View File

@@ -0,0 +1,35 @@
package com.gempukku.lotro.cards.modifiers;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
import com.gempukku.lotro.logic.modifiers.Condition;
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import java.util.Collection;
public class CantWoundWithCardModifier extends AbstractModifier {
private Filterable _preventWoundWithFilter;
public CantWoundWithCardModifier(PhysicalCard source, Filterable affectFilter, Filterable preventWoundWithFilter) {
this(source, affectFilter, null, preventWoundWithFilter);
}
public CantWoundWithCardModifier(PhysicalCard source, Filterable affectFilter, Condition condition, Filterable preventWoundWithFilter) {
super(source, "Affected by wound preventing effect", affectFilter, condition, ModifierEffect.WOUND_MODIFIER);
_preventWoundWithFilter = preventWoundWithFilter;
}
@Override
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersQuerying, Collection<PhysicalCard> woundSources, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
for (PhysicalCard woundSource : woundSources) {
if (Filters.and(_preventWoundWithFilter).accepts(gameState, modifiersQuerying, woundSource))
return false;
}
return true;
}
}

View File

@@ -56,7 +56,7 @@ public class Card17_020 extends AbstractFollower {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a minion", CardType.MINION,
Filters.or(
Filters.and(Race.WIZARD, Filters.canTakeWound),
Filters.and(Race.WIZARD, Filters.canTakeWounds(self, 1)),
Filters.and(Filters.not(Race.WIZARD), Filters.canExert(self))
)) {
@Override

View File

@@ -46,7 +46,7 @@ public class Card20_073 extends AbstractCompanion {
for (final PhysicalCard revealedCard : revealedCards) {
if (Filters.and(Culture.ELVEN).accepts(game.getGameState(), game.getModifiersQuerying(), revealedCard)) {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a minion to wound", Filters.canTakeWound, CardType.MINION) {
new ChooseActiveCardEffect(self, playerId, "Choose a minion to wound", Filters.canTakeWounds(self, 1), CardType.MINION) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard minion) {
action.appendEffect(

View File

@@ -24,7 +24,7 @@ public class Card20_145 extends AbstractEvent {
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, final PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
final PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a companion", CardType.COMPANION, Filters.inSkirmishAgainst(Keyword.SOUTHRON), Filters.canTakeWound) {
new ChooseActiveCardEffect(self, playerId, "Choose a companion", CardType.COMPANION, Filters.inSkirmishAgainst(Keyword.SOUTHRON), Filters.canTakeWounds(self, 1)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
int count = Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Side.FREE_PEOPLE, Filters.attachedTo(card));

View File

@@ -0,0 +1,44 @@
package com.gempukku.lotro.cards.set20.moria;
import com.gempukku.lotro.cards.AbstractAttachable;
import com.gempukku.lotro.cards.modifiers.CantExertWithCardModifier;
import com.gempukku.lotro.cards.modifiers.CantWoundWithCardModifier;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import java.util.LinkedList;
import java.util.List;
/**
* 1
* •Whip of Many Thongs, Ancient Serpentine Weapon
* Moria Artifact • Hand Weapon
* 1
* Bearer must be the Balrog. The Balrog may only be wounded or exerted by spells.
*/
public class Card20_283 extends AbstractAttachable {
public Card20_283() {
super(Side.SHADOW, CardType.ARTIFACT, 1, Culture.MORIA, PossessionClass.HAND_WEAPON, "Whip of Many Thongs", "Ancient Serpentine Weapon", true);
}
@Override
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.balrog;
}
@Override
public List<? extends Modifier> getAlwaysOnModifiers(LotroGame game, PhysicalCard self) {
List<Modifier> modifiers = new LinkedList<Modifier>();
modifiers.add(
new StrengthModifier(self, Filters.hasAttached(self), 1));
modifiers.add(
new CantExertWithCardModifier(self, Filters.balrog, Filters.not(Keyword.SPELL)));
modifiers.add(
new CantWoundWithCardModifier(self, Filters.balrog, Filters.not(Keyword.SPELL)));
return modifiers;
}
}

View File

@@ -41,7 +41,7 @@ public class Card4_115 extends AbstractOldEvent {
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Culture.GONDOR, Race.MAN));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose minion", CardType.MINION, Filters.canTakeWound) {
new ChooseActiveCardEffect(self, playerId, "Choose minion", CardType.MINION, Filters.canTakeWounds(self, 1)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
boolean urukHai = (card.getBlueprint().getRace() == Race.URUK_HAI);

View File

@@ -38,7 +38,7 @@ public class Card6_039 extends AbstractPermanent {
action.appendCost(
new ChooseAndDiscardCardsFromHandEffect(action, playerId, false, 3));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a minion", CardType.MINION, Filters.inSkirmishAgainst(Filters.smeagol), Filters.canTakeWound) {
new ChooseActiveCardEffect(self, playerId, "Choose a minion", CardType.MINION, Filters.inSkirmishAgainst(Filters.smeagol), Filters.canTakeWounds(self, 1)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.insertEffect(

View File

@@ -407,11 +407,20 @@ public class Filters {
}
};
public static final Filter canTakeWounds(final int count) {
public static final Filter canTakeWounds(final PhysicalCard woundSource, final int count) {
return new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return modifiersQuerying.canTakeWounds(gameState, physicalCard, count) && modifiersQuerying.getVitality(gameState, physicalCard) >= count;
return modifiersQuerying.canTakeWounds(gameState, Collections.singleton(woundSource), physicalCard, count) && modifiersQuerying.getVitality(gameState, physicalCard) >= count;
}
};
}
public static final Filter canTakeWounds(final Collection<PhysicalCard> woundSources, final int count) {
return new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return modifiersQuerying.canTakeWounds(gameState, woundSources, physicalCard, count) && modifiersQuerying.getVitality(gameState, physicalCard) >= count;
}
};
}
@@ -434,8 +443,6 @@ public class Filters {
};
}
public static final Filter canTakeWound = canTakeWounds(1);
public static final Filter exhausted = new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {

View File

@@ -32,12 +32,12 @@ public class ChooseAndWoundCharactersEffect extends ChooseActiveCardsEffect {
@Override
protected Filter getExtraFilterForPlaying(LotroGame game) {
return Filters.canTakeWound;
return Filters.canTakeWounds(_action.getActionSource(), 1);
}
@Override
protected Filter getExtraFilterForPlayabilityCheck(LotroGame game) {
return Filters.canTakeWounds(_count);
return Filters.canTakeWounds(_action.getActionSource(), _count);
}
@Override

View File

@@ -54,7 +54,7 @@ public class WoundCharactersEffect extends AbstractPreventableCardEffect {
return new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return modifiersQuerying.canTakeWounds(gameState, physicalCard, 1);
return modifiersQuerying.canTakeWounds(gameState, _sources, physicalCard, 1);
}
};
}
@@ -78,7 +78,7 @@ public class WoundCharactersEffect extends AbstractPreventableCardEffect {
for (PhysicalCard woundedCard : cards) {
game.getGameState().addWound(woundedCard);
game.getModifiersEnvironment().addedWound(woundedCard);
game.getActionsEnvironment().emitEffectResult(new WoundResult(woundedCard));
game.getActionsEnvironment().emitEffectResult(new WoundResult(_sources, woundedCard));
}
}

View File

@@ -9,6 +9,7 @@ import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -133,7 +134,7 @@ public abstract class AbstractModifier implements Modifier {
}
@Override
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersQuerying, Collection<PhysicalCard> woundSources, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
return true;
}

View File

@@ -4,6 +4,8 @@ import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import java.util.Collection;
public class CantTakeWoundsModifier extends AbstractModifier {
public CantTakeWoundsModifier(PhysicalCard source, Filterable affectFilter) {
super(source, "Can't take wounds", affectFilter, ModifierEffect.WOUND_MODIFIER);
@@ -14,7 +16,7 @@ public class CantTakeWoundsModifier extends AbstractModifier {
}
@Override
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersLogic, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersQuerying, Collection<PhysicalCard> woundSources, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
return false;
}
}

View File

@@ -7,6 +7,7 @@ import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -54,7 +55,7 @@ public interface Modifier {
public int getOverwhelmMultiplier(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard);
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int woundsAlreadyTakenInPhase, int woundsToTake);
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersQuerying, Collection<PhysicalCard> woundSources, PhysicalCard physicalCard, int woundsAlreadyTakenInPhase, int woundsToTake);
public boolean canTakeWoundsFromLosingSkirmish(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, Set<PhysicalCard> winners);

View File

@@ -526,14 +526,14 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
}
@Override
public boolean canTakeWounds(GameState gameState, PhysicalCard card, int woundsToTake) {
public boolean canTakeWounds(GameState gameState, Collection<PhysicalCard> woundSources, PhysicalCard card, int woundsToTake) {
LoggingThreadLocal.logMethodStart(card, "canTakeWound");
try {
for (Modifier modifier : getModifiersAffectingCard(gameState, ModifierEffect.WOUND_MODIFIER, card)) {
Integer woundsTaken = _woundsPerPhaseMap.get(card.getCardId());
if (woundsTaken == null)
woundsTaken = 0;
if (!modifier.canTakeWounds(gameState, this, card, woundsTaken, woundsToTake))
if (!modifier.canTakeWounds(gameState, this, woundSources, card, woundsTaken, woundsToTake))
return false;
}
return true;

View File

@@ -65,7 +65,7 @@ public interface ModifiersQuerying {
public boolean isAdditionalCardType(GameState gameState, PhysicalCard card, CardType cardType);
// Wounds/exertions
public boolean canTakeWounds(GameState gameState, PhysicalCard card, int woundsToTake);
public boolean canTakeWounds(GameState gameState, Collection<PhysicalCard> woundSources, PhysicalCard card, int woundsToTake);
public boolean canTakeWoundsFromLosingSkirmish(GameState gameState, PhysicalCard card, Set<PhysicalCard> winners);

View File

@@ -3,14 +3,22 @@ package com.gempukku.lotro.logic.timing.results;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collection;
public class WoundResult extends EffectResult {
private Collection<PhysicalCard> _sources;
private PhysicalCard _card;
public WoundResult(PhysicalCard card) {
public WoundResult(Collection<PhysicalCard> sources, PhysicalCard card) {
super(EffectResult.Type.FOR_EACH_WOUNDED);
_sources = sources;
_card = card;
}
public Collection<PhysicalCard> getSources() {
return _sources;
}
public PhysicalCard getWoundedCard() {
return _card;
}