"Rapid Reload"
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.gempukku.lotro.cards.modifiers;
|
||||
|
||||
import com.gempukku.lotro.common.Filterable;
|
||||
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;
|
||||
|
||||
public class CantReplaceSiteByFPPlayerModifier extends AbstractModifier {
|
||||
public CantReplaceSiteByFPPlayerModifier(PhysicalCard source, Condition condition, Filterable affectFilter) {
|
||||
super(source, "Can't be replaced by Free Peoples player", affectFilter, condition, ModifierEffect.REPLACE_SITE_MODIFIER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSiteReplaceable(GameState gameState, ModifiersQuerying modifiersQuerying, String playerId) {
|
||||
if (playerId.equals(gameState.getCurrentPlayerId()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.gempukku.lotro.cards.set15.men;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractPermanent;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.CantReplaceSiteByFPPlayerModifier;
|
||||
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.actions.ActivateCardAction;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.SpotCondition;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Hunters
|
||||
* Side: Shadow
|
||||
* Culture: Men
|
||||
* Twilight Cost: 1
|
||||
* Type: Condition • Support Area
|
||||
* Game Text: While you can spot a [MEN] Man, the Free Peoples player cannot replace a site in the current region.
|
||||
* Archery: Spot a [MEN] Man and remove (3) to exert an unbound companion.
|
||||
*/
|
||||
public class Card15_089 extends AbstractPermanent {
|
||||
public Card15_089() {
|
||||
super(Side.SHADOW, 1, CardType.CONDITION, Culture.MEN, Zone.SUPPORT, "Rapid Reload");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Modifier getAlwaysOnModifier(PhysicalCard self) {
|
||||
return new CantReplaceSiteByFPPlayerModifier(self, new SpotCondition(Culture.MEN, Race.MAN), Filters.siteInCurrentRegion);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.ARCHERY, self, 3)
|
||||
&& PlayConditions.canSpot(game, Culture.MEN, Race.MAN)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new RemoveTwilightEffect(3));
|
||||
action.appendEffect(
|
||||
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.unboundCompanion));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.gempukku.lotro.game.state.Assignment;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.game.state.Skirmish;
|
||||
import com.gempukku.lotro.logic.GameUtils;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
|
||||
import java.util.*;
|
||||
@@ -569,6 +570,22 @@ public class Filters {
|
||||
};
|
||||
}
|
||||
|
||||
public static Filter siteInCurrentRegion = Filters.and(CardType.SITE,
|
||||
new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
int siteNumber = physicalCard.getSiteNumber();
|
||||
int region;
|
||||
if (siteNumber <= 3)
|
||||
region = 1;
|
||||
else if (siteNumber > 3 && siteNumber <= 6)
|
||||
region = 2;
|
||||
else
|
||||
region = 3;
|
||||
return GameUtils.getRegion(gameState) == region;
|
||||
}
|
||||
});
|
||||
|
||||
public static Filter region(final int region) {
|
||||
return new Filter() {
|
||||
@Override
|
||||
|
||||
@@ -93,7 +93,9 @@ public class PlaySiteEffect extends AbstractEffect {
|
||||
|
||||
Collection<PhysicalCard> newSite = getMatchingSites(game);
|
||||
|
||||
if (newSite.size() > 0) {
|
||||
PhysicalCard currentSite = game.getGameState().getSite(siteNumber);
|
||||
|
||||
if (newSite.size() > 0 && (currentSite == null || game.getModifiersQuerying().canReplaceSite(game.getGameState(), _playerId, currentSite))) {
|
||||
SubAction subAction = new SubAction(_action);
|
||||
subAction.appendEffect(
|
||||
new ChooseArbitraryCardsEffect(_playerId, "Choose site to play", newSite, 1, 1) {
|
||||
@@ -143,6 +145,9 @@ public class PlaySiteEffect extends AbstractEffect {
|
||||
|
||||
game.getActionsEnvironment().addActionToStack(subAction);
|
||||
return new FullEffectResult(true, true);
|
||||
} else if (newSite.size() > 0) {
|
||||
game.getGameState().sendMessage("Can't replace a site");
|
||||
return new FullEffectResult(false, false);
|
||||
} else {
|
||||
game.getGameState().sendMessage("Can't find a matching site to play in " + _playerId + " adventure deck");
|
||||
return new FullEffectResult(false, false);
|
||||
|
||||
@@ -291,6 +291,11 @@ public abstract class AbstractModifier implements Modifier {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSiteReplaceable(GameState gameState, ModifiersQuerying modifiersQuerying, String playerId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Side hasInitiative(GameState gameState, ModifiersQuerying modifiersQuerying) {
|
||||
return null;
|
||||
|
||||
@@ -116,6 +116,8 @@ public interface Modifier {
|
||||
|
||||
public boolean hasFlagActive(GameState gameState, ModifiersQuerying modifiersQuerying, ModifierFlag modifierFlag);
|
||||
|
||||
public boolean isSiteReplaceable(GameState gameState, ModifiersQuerying modifiersQuerying, String playerId);
|
||||
|
||||
public Side hasInitiative(GameState gameState, ModifiersQuerying modifiersQuerying);
|
||||
|
||||
public int getInitiativeHandSizeModifier(GameState gameState, ModifiersQuerying modifiersQuerying);
|
||||
|
||||
@@ -11,7 +11,7 @@ public enum ModifierEffect {
|
||||
|
||||
EXTRA_ACTION_MODIFIER, INITIATIVE_MODIFIER, TEXT_MODIFIER,
|
||||
|
||||
SPECIAL_FLAG_MODIFIER,
|
||||
SPECIAL_FLAG_MODIFIER, REPLACE_SITE_MODIFIER,
|
||||
|
||||
ADDITIONAL_CARD_TYPE,
|
||||
|
||||
|
||||
@@ -840,6 +840,15 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReplaceSite(GameState gameState, String playerId, PhysicalCard siteToReplace) {
|
||||
for (Modifier modifier : getModifiersAffectingCard(gameState, ModifierEffect.REPLACE_SITE_MODIFIER, siteToReplace))
|
||||
if (!modifier.isSiteReplaceable(gameState, this, playerId))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private class ModifierHookImpl implements ModifierHook {
|
||||
private Modifier _modifier;
|
||||
|
||||
|
||||
@@ -115,4 +115,6 @@ public interface ModifiersQuerying {
|
||||
public int getSpotCount(GameState gameState, Filter filter, int inPlayCount);
|
||||
|
||||
public boolean hasFlagActive(GameState gameState, ModifierFlag modifierFlag);
|
||||
|
||||
public boolean canReplaceSite(GameState gameState, String playerId, PhysicalCard siteToReplace);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user