"Uruk Guard"
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
package com.gempukku.lotro.cards.modifiers;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.filters.Filter;
|
||||||
|
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.ModifiersQuerying;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PreventMinionBeingAssignedToCompanionModifier extends AbstractModifier {
|
||||||
|
private Filter _minionFilter;
|
||||||
|
|
||||||
|
public PreventMinionBeingAssignedToCompanionModifier(PhysicalCard source, Filter companionFilter, Filter minionFilter) {
|
||||||
|
super(source, "Is affected by assignment restriction", companionFilter);
|
||||||
|
_minionFilter = minionFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result) {
|
||||||
|
if (Filters.filter(minions, gameState, modifiersQuerying, _minionFilter).size() > 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,8 @@ import com.gempukku.lotro.game.state.GameState;
|
|||||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ProxyingModifier implements Modifier {
|
public class ProxyingModifier implements Modifier {
|
||||||
private PhysicalCard _card;
|
private PhysicalCard _card;
|
||||||
private Filter _filter;
|
private Filter _filter;
|
||||||
@@ -164,4 +166,12 @@ public class ProxyingModifier implements Modifier {
|
|||||||
return modifier.shouldSkipPhase(gameState, modifiersQuerying, phase, result);
|
return modifier.shouldSkipPhase(gameState, modifiersQuerying, phase, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result) {
|
||||||
|
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||||
|
if (modifier != null)
|
||||||
|
return modifier.isValidFreePlayerAssignments(gameState, modifiersQuerying, companion, minions, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.gempukku.lotro.cards.set1.isengard;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.cards.AbstractMinion;
|
||||||
|
import com.gempukku.lotro.cards.PlayConditions;
|
||||||
|
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
|
||||||
|
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
|
||||||
|
import com.gempukku.lotro.cards.modifiers.PreventMinionBeingAssignedToCompanionModifier;
|
||||||
|
import com.gempukku.lotro.common.CardType;
|
||||||
|
import com.gempukku.lotro.common.Culture;
|
||||||
|
import com.gempukku.lotro.common.Keyword;
|
||||||
|
import com.gempukku.lotro.common.Phase;
|
||||||
|
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.CostToEffectAction;
|
||||||
|
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||||
|
import com.gempukku.lotro.logic.timing.Action;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set: The Fellowship of the Ring
|
||||||
|
* Side: Shadow
|
||||||
|
* Culture: Isengard
|
||||||
|
* Twilight Cost: 4
|
||||||
|
* Type: Minion • Uruk-Hai
|
||||||
|
* Strength: 9
|
||||||
|
* Vitality: 2
|
||||||
|
* Site: 5
|
||||||
|
* Game Text: Damage +1. Assignment: Exert this minion and spot a companion to prevent the opponent from assigning that
|
||||||
|
* companion to this minion.
|
||||||
|
*/
|
||||||
|
public class Card1_147 extends AbstractMinion {
|
||||||
|
public Card1_147() {
|
||||||
|
super(4, 9, 2, 5, Culture.ISENGARD, "Uruk Guard", "1_147");
|
||||||
|
addKeyword(Keyword.URUK_HAI);
|
||||||
|
addKeyword(Keyword.DAMAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
|
||||||
|
List<Action> actions = new LinkedList<Action>();
|
||||||
|
|
||||||
|
appendPlayMinionAction(actions, game, self);
|
||||||
|
|
||||||
|
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.ASSIGNMENT, self, 0)
|
||||||
|
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
|
||||||
|
final CostToEffectAction action = new CostToEffectAction(self, "Exert this minion and spot a companion to prevent the opponent from assigning that companion to this minion.");
|
||||||
|
action.addCost(new ExertCharacterEffect(self));
|
||||||
|
action.addEffect(
|
||||||
|
new ChooseActiveCardEffect(playerId, "Choose a companion", Filters.type(CardType.COMPANION)) {
|
||||||
|
@Override
|
||||||
|
protected void cardSelected(LotroGame game, PhysicalCard companion) {
|
||||||
|
action.addEffect(
|
||||||
|
new AddUntilEndOfPhaseModifierEffect(
|
||||||
|
new PreventMinionBeingAssignedToCompanionModifier(self, Filters.sameCard(companion), Filters.sameCard(self))
|
||||||
|
, Phase.ASSIGNMENT));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
actions.add(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
return actions;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ import com.gempukku.lotro.filters.Filter;
|
|||||||
import com.gempukku.lotro.game.PhysicalCard;
|
import com.gempukku.lotro.game.PhysicalCard;
|
||||||
import com.gempukku.lotro.game.state.GameState;
|
import com.gempukku.lotro.game.state.GameState;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class AbstractModifier implements Modifier {
|
public abstract class AbstractModifier implements Modifier {
|
||||||
private PhysicalCard _physicalCard;
|
private PhysicalCard _physicalCard;
|
||||||
private String _text;
|
private String _text;
|
||||||
@@ -105,4 +107,9 @@ public abstract class AbstractModifier implements Modifier {
|
|||||||
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result) {
|
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,4 +163,12 @@ public class CompositeModifier implements Modifier {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result) {
|
||||||
|
for (Modifier modifier : _modifiers)
|
||||||
|
result = modifier.isValidFreePlayerAssignments(gameState, modifiersQuerying, companion, minions, result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.gempukku.lotro.common.Side;
|
|||||||
import com.gempukku.lotro.game.PhysicalCard;
|
import com.gempukku.lotro.game.PhysicalCard;
|
||||||
import com.gempukku.lotro.game.state.GameState;
|
import com.gempukku.lotro.game.state.GameState;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface Modifier {
|
public interface Modifier {
|
||||||
public PhysicalCard getSource();
|
public PhysicalCard getSource();
|
||||||
|
|
||||||
@@ -42,4 +44,6 @@ public interface Modifier {
|
|||||||
public boolean canPlayPhaseActions(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result);
|
public boolean canPlayPhaseActions(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result);
|
||||||
|
|
||||||
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result);
|
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result);
|
||||||
|
|
||||||
|
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,6 +239,15 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidFreePlayerAssignments(GameState gameState, PhysicalCard companion, List<PhysicalCard> minions) {
|
||||||
|
boolean result = true;
|
||||||
|
for (Modifier modifier : _modifiers)
|
||||||
|
if (affectsCardWithSkipSet(gameState, companion, modifier))
|
||||||
|
result = modifier.isValidFreePlayerAssignments(gameState, this, companion, minions, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private class ModifierHookImpl implements ModifierHook {
|
private class ModifierHookImpl implements ModifierHook {
|
||||||
private Modifier _modifier;
|
private Modifier _modifier;
|
||||||
|
|
||||||
|
|||||||
@@ -38,4 +38,6 @@ public interface ModifiersQuerying {
|
|||||||
public boolean canPlayPhaseActions(GameState gameState, Phase phase);
|
public boolean canPlayPhaseActions(GameState gameState, Phase phase);
|
||||||
|
|
||||||
public boolean shouldSkipPhase(GameState gameState, Phase phase);
|
public boolean shouldSkipPhase(GameState gameState, Phase phase);
|
||||||
|
|
||||||
|
public boolean isValidFreePlayerAssignments(GameState gameState, PhysicalCard companion, List<PhysicalCard> minions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ public class FreePeoplePlayerAssignsMinionsGameProcess implements GameProcess {
|
|||||||
unassignedMinions.removeAll(minionsAssigned);
|
unassignedMinions.removeAll(minionsAssigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<PhysicalCard, List<PhysicalCard>> assignment : assignments.entrySet())
|
||||||
|
if (!_game.getModifiersQuerying().isValidFreePlayerAssignments(_game.getGameState(), assignment.getKey(), assignment.getValue()))
|
||||||
|
throw new DecisionResultInvalidException(assignment.getKey().getBlueprint().getName() + " can't be assigned to these minions");
|
||||||
|
|
||||||
for (Map.Entry<PhysicalCard, List<PhysicalCard>> physicalCardListEntry : assignments.entrySet()) {
|
for (Map.Entry<PhysicalCard, List<PhysicalCard>> physicalCardListEntry : assignments.entrySet()) {
|
||||||
PhysicalCard fp = physicalCardListEntry.getKey();
|
PhysicalCard fp = physicalCardListEntry.getKey();
|
||||||
List<PhysicalCard> minions = physicalCardListEntry.getValue();
|
List<PhysicalCard> minions = physicalCardListEntry.getValue();
|
||||||
|
|||||||
Reference in New Issue
Block a user