"Gandalf's Staff", "Dispeller of Darkness"
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.gempukku.lotro.cards.modifiers;
|
||||
|
||||
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 ShadowCantHaveInitiativeModifier extends AbstractModifier {
|
||||
public ShadowCantHaveInitiativeModifier(PhysicalCard source, Condition condition) {
|
||||
super(source, "Shadow can't have initiative", null, condition, ModifierEffect.INITIATIVE_MODIFIER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shadowCanHaveInitiative(GameState gameState, ModifiersQuerying modifiersQuerying) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.gempukku.lotro.cards.set20.gandalf;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfTurnModifierEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.ResistanceModifier;
|
||||
import com.gempukku.lotro.cards.modifiers.ShadowCantHaveInitiativeModifier;
|
||||
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.actions.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 2
|
||||
* •Gandalf's Staff, Dispeller of Darkness
|
||||
* Gandalf Artifact • Staff
|
||||
* 1 1
|
||||
* Bearer must be Gandalf.
|
||||
* During the turn Gandalf's Staff is played, the Shadow player may not gain initiative.
|
||||
* Maneuver: Exert Gandalf twice to discard a Shadow condition.
|
||||
*/
|
||||
public class Card20_159 extends AbstractAttachableFPPossession {
|
||||
public Card20_159() {
|
||||
super(2, 0, 1, Culture.GANDALF, CardType.ARTIFACT, PossessionClass.STAFF, "Gandalf's Staff", "Dispeller of Darkness", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
|
||||
return Filters.gandalf;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Modifier> getNonBasicStatsModifiers(PhysicalCard self) {
|
||||
return Collections.singletonList(
|
||||
new ResistanceModifier(self, Filters.hasAttached(self), 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.played(game, effectResult, self)) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfTurnModifierEffect(
|
||||
new ShadowCantHaveInitiativeModifier(self, null)));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.MANEUVER, self)
|
||||
&& PlayConditions.canExert(self, game, 2, Filters.gandalf)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 2, Filters.gandalf));
|
||||
action.appendEffect(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Side.SHADOW, CardType.CONDITION));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -322,6 +322,11 @@ public abstract class AbstractModifier implements Modifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shadowCanHaveInitiative(GameState gameState, ModifiersQuerying modifiersQuerying) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Side hasInitiative(GameState gameState, ModifiersQuerying modifiersQuerying) {
|
||||
return null;
|
||||
|
||||
@@ -128,6 +128,8 @@ public interface Modifier {
|
||||
|
||||
public boolean canPlaySite(GameState gameState, ModifiersQuerying modifiersQuerying, String playerId);
|
||||
|
||||
public boolean shadowCanHaveInitiative(GameState gameState, ModifiersQuerying modifiersQuerying);
|
||||
|
||||
public Side hasInitiative(GameState gameState, ModifiersQuerying modifiersQuerying);
|
||||
|
||||
public int getInitiativeHandSizeModifier(GameState gameState, ModifiersQuerying modifiersQuerying);
|
||||
|
||||
@@ -917,6 +917,11 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
|
||||
@Override
|
||||
public Side hasInitiative(GameState gameState) {
|
||||
for (Modifier modifier : getModifiers(gameState, ModifierEffect.INITIATIVE_MODIFIER)) {
|
||||
if (!modifier.shadowCanHaveInitiative(gameState, this))
|
||||
return Side.FREE_PEOPLE;
|
||||
}
|
||||
|
||||
for (Modifier modifier : getModifiers(gameState, ModifierEffect.INITIATIVE_MODIFIER)) {
|
||||
Side initiative = modifier.hasInitiative(gameState, this);
|
||||
if (initiative != null)
|
||||
|
||||
Reference in New Issue
Block a user