"Swordarm of the White Tower
This commit is contained in:
@@ -0,0 +1,58 @@
|
|||||||
|
package com.gempukku.lotro.cards.set1.gondor;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.cards.AbstractEvent;
|
||||||
|
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||||
|
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
|
||||||
|
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.LotroGame;
|
||||||
|
import com.gempukku.lotro.game.state.Skirmish;
|
||||||
|
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set: The Fellowship of the Ring
|
||||||
|
* Side: Free
|
||||||
|
* Culture: Gondor
|
||||||
|
* Twilight Cost: 0
|
||||||
|
* Type: Event
|
||||||
|
* Game Text: Skirmish: Make a ranger strength +2 (or +4 when skirmishing a roaming minion).
|
||||||
|
*/
|
||||||
|
public class Card1_117 extends AbstractEvent {
|
||||||
|
public Card1_117() {
|
||||||
|
super(Side.FREE_PEOPLE, Culture.GONDOR, "Swordarm of the White Tower", Phase.SKIRMISH);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlayEventAction getPlayCardAction(String playerId, final LotroGame game, final PhysicalCard self, int twilightModifier) {
|
||||||
|
final PlayEventAction action = new PlayEventAction(self);
|
||||||
|
|
||||||
|
action.addEffect(
|
||||||
|
new ChooseActiveCardEffect(playerId, "Choose a GONDOR companion", Filters.culture(Culture.GONDOR), Filters.type(CardType.COMPANION)) {
|
||||||
|
@Override
|
||||||
|
protected void cardSelected(PhysicalCard gondorCompanion) {
|
||||||
|
int bonus = 2;
|
||||||
|
Skirmish skirmish = game.getGameState().getSkirmish();
|
||||||
|
if (skirmish != null && skirmish.getFellowshipCharacter() == gondorCompanion
|
||||||
|
&& Filters.filter(skirmish.getShadowCharacters(), game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.ROAMING)).size() > 0)
|
||||||
|
bonus = 4;
|
||||||
|
|
||||||
|
action.addEffect(
|
||||||
|
new AddUntilEndOfPhaseModifierEffect(
|
||||||
|
new StrengthModifier(self, Filters.sameCard(gondorCompanion), bonus), Phase.SKIRMISH));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTwilightCost() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -203,11 +203,25 @@ public class GameState {
|
|||||||
public void removeCardFromZone(PhysicalCard card) {
|
public void removeCardFromZone(PhysicalCard card) {
|
||||||
Zone zone = card.getZone();
|
Zone zone = card.getZone();
|
||||||
|
|
||||||
removeAllTokens(card);
|
|
||||||
|
|
||||||
boolean b = getZoneCards(card.getOwner(), card.getBlueprint().getCardType(), zone).remove(card);
|
boolean b = getZoneCards(card.getOwner(), card.getBlueprint().getCardType(), zone).remove(card);
|
||||||
if (!b)
|
if (!b)
|
||||||
throw new RuntimeException("Card was not found in the expected zone");
|
throw new RuntimeException("Card was not found in the expected zone");
|
||||||
|
|
||||||
|
for (Skirmish assignment : new LinkedList<Skirmish>(_assignments)) {
|
||||||
|
if (assignment.getFellowshipCharacter() == card)
|
||||||
|
removeAssignment(assignment);
|
||||||
|
if (assignment.getShadowCharacters().remove(card))
|
||||||
|
removeAssignment(assignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_skirmish != null) {
|
||||||
|
if (_skirmish.getFellowshipCharacter() == card)
|
||||||
|
_skirmish.setFellowshipCharacter(card);
|
||||||
|
_skirmish.getShadowCharacters().remove(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeAllTokens(card);
|
||||||
|
|
||||||
if (isZonePublic(zone))
|
if (isZonePublic(zone))
|
||||||
for (GameStateListener listener : getAllGameStateListeners())
|
for (GameStateListener listener : getAllGameStateListeners())
|
||||||
listener.cardRemoved(card);
|
listener.cardRemoved(card);
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ public class Skirmish {
|
|||||||
return _shadowCharacters;
|
return _shadowCharacters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFellowshipCharacter(PhysicalCard fellowshipCharacter) {
|
||||||
|
_fellowshipCharacter = fellowshipCharacter;
|
||||||
|
}
|
||||||
|
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
_cancelled = true;
|
_cancelled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean affectsCardWithSkipSet(GameState gameState, PhysicalCard physicalCard, Modifier modifier) {
|
private boolean affectsCardWithSkipSet(GameState gameState, PhysicalCard physicalCard, Modifier modifier) {
|
||||||
if (!_skipSet.contains(modifier)) {
|
if (!_skipSet.contains(modifier) && physicalCard != null) {
|
||||||
_skipSet.add(modifier);
|
_skipSet.add(modifier);
|
||||||
boolean result = modifier.affectsCard(gameState, this, physicalCard);
|
boolean result = modifier.affectsCard(gameState, this, physicalCard);
|
||||||
_skipSet.remove(modifier);
|
_skipSet.remove(modifier);
|
||||||
|
|||||||
@@ -60,20 +60,22 @@ public class ResolveSkirmishAction implements Action {
|
|||||||
final GameState gameState = _game.getGameState();
|
final GameState gameState = _game.getGameState();
|
||||||
|
|
||||||
PhysicalCard fp = _skirmish.getFellowshipCharacter();
|
PhysicalCard fp = _skirmish.getFellowshipCharacter();
|
||||||
int fpStrength = _game.getModifiersQuerying().getStrength(gameState, fp);
|
int fpStrength = 0;
|
||||||
|
if (fp != null)
|
||||||
|
fpStrength = _game.getModifiersQuerying().getStrength(gameState, fp);
|
||||||
|
|
||||||
int shadowStrength = 0;
|
int shadowStrength = 0;
|
||||||
for (PhysicalCard minion : _skirmish.getShadowCharacters())
|
for (PhysicalCard minion : _skirmish.getShadowCharacters())
|
||||||
shadowStrength += _game.getModifiersQuerying().getStrength(gameState, minion);
|
shadowStrength += _game.getModifiersQuerying().getStrength(gameState, minion);
|
||||||
|
|
||||||
if (_game.getModifiersQuerying().isOverwhelmedByStrength(gameState, fp, fpStrength, shadowStrength))
|
if (_game.getModifiersQuerying().isOverwhelmedByStrength(gameState, fp, fpStrength, shadowStrength))
|
||||||
effects.add(new OverwhelmedEffect(_skirmish.getShadowCharacters(), Collections.singletonList(fp)));
|
effects.add(new OverwhelmedEffect(_skirmish.getShadowCharacters(), fpList(fp)));
|
||||||
else if (shadowStrength >= fpStrength)
|
else if (shadowStrength >= fpStrength)
|
||||||
effects.add(new SkirmishResolvedEffect(_skirmish.getShadowCharacters(), Collections.singletonList(fp)));
|
effects.add(new SkirmishResolvedEffect(_skirmish.getShadowCharacters(), fpList(fp)));
|
||||||
else if (fpStrength >= 2 * shadowStrength)
|
else if (fpStrength >= 2 * shadowStrength)
|
||||||
effects.add(new OverwhelmedEffect(Collections.singletonList(fp), _skirmish.getShadowCharacters()));
|
effects.add(new OverwhelmedEffect(fpList(fp), _skirmish.getShadowCharacters()));
|
||||||
else
|
else
|
||||||
effects.add(new SkirmishResolvedEffect(Collections.singletonList(fp), _skirmish.getShadowCharacters()));
|
effects.add(new SkirmishResolvedEffect(fpList(fp), _skirmish.getShadowCharacters()));
|
||||||
|
|
||||||
effects.add(new UnrespondableEffect() {
|
effects.add(new UnrespondableEffect() {
|
||||||
@Override
|
@Override
|
||||||
@@ -84,4 +86,11 @@ public class ResolveSkirmishAction implements Action {
|
|||||||
|
|
||||||
return effects.iterator();
|
return effects.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<PhysicalCard> fpList(PhysicalCard card) {
|
||||||
|
if (card != null)
|
||||||
|
return Collections.singletonList(card);
|
||||||
|
else
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user