"Streaming to the Field"

This commit is contained in:
marcins78@gmail.com
2011-11-14 17:06:50 +00:00
parent 7da3930e45
commit 6d01cc205d
5 changed files with 102 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
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;
import com.gempukku.lotro.logic.modifiers.evaluator.ConstantEvaluator;
import com.gempukku.lotro.logic.modifiers.evaluator.Evaluator;
public class InitiativeHandSizeModifier extends AbstractModifier {
private Condition _condition;
private Evaluator _evaluator;
public InitiativeHandSizeModifier(PhysicalCard source, int modifier) {
this(source, null, modifier);
}
public InitiativeHandSizeModifier(PhysicalCard source, Condition condition, int modifier) {
this(source, condition, new ConstantEvaluator(modifier));
}
public InitiativeHandSizeModifier(PhysicalCard source, Condition condition, Evaluator evaluator) {
super(source, null, null, ModifierEffect.INITIATIVE_MODIFIER);
_condition = condition;
_evaluator = evaluator;
}
@Override
public int getInitiativeHandSizeModifier(GameState gameState, ModifiersQuerying modifiersQuerying) {
if (_condition == null || _condition.isFullfilled(gameState, modifiersQuerying))
return _evaluator.evaluateExpression(gameState, modifiersQuerying, null);
else
return 0;
}
}

View File

@@ -0,0 +1,52 @@
package com.gempukku.lotro.cards.set8.wraith;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.choose.ChooseAndAddUntilEOPStrengthBonusEffect;
import com.gempukku.lotro.cards.modifiers.InitiativeHandSizeModifier;
import com.gempukku.lotro.cards.modifiers.evaluator.CountSpottableEvaluator;
import com.gempukku.lotro.common.*;
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.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: Siege of Gondor
* Side: Shadow
* Culture: Wraith
* Twilight Cost: 3
* Type: Condition • Support Area
* Game Text: For each [WRAITH] Orc you can spot, the Free Peoples player must have an additional card in hand to have
* initiative. Skirmish: Discard this condition to make a [WRAITH] Orc strength +2.
*/
public class Card8_078 extends AbstractPermanent {
public Card8_078() {
super(Side.SHADOW, 3, CardType.CONDITION, Culture.WRAITH, Zone.SUPPORT, "Streaming to the Field", true);
}
@Override
public List<? extends Modifier> getAlwaysOnModifiers(LotroGame game, PhysicalCard self) {
return Collections.singletonList(
new InitiativeHandSizeModifier(self, null, new CountSpottableEvaluator(Culture.WRAITH, Race.ORC)));
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.SKIRMISH, self, 0)
&& PlayConditions.canSelfDiscard(self, game)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new DiscardCardsFromPlayEffect(self, self));
action.appendEffect(
new ChooseAndAddUntilEOPStrengthBonusEffect(action, self, playerId, 2, Culture.WRAITH, Race.ORC));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -252,4 +252,9 @@ public abstract class AbstractModifier implements Modifier {
public Side hasInitiative(GameState gameState, ModifiersQuerying modifiersQuerying) { public Side hasInitiative(GameState gameState, ModifiersQuerying modifiersQuerying) {
return null; return null;
} }
@Override
public int getInitiativeHandSizeModifier(GameState gameState, ModifiersQuerying modifiersQuerying) {
return 0;
}
} }

View File

@@ -100,4 +100,6 @@ public interface Modifier {
public boolean hasFlagActive(GameState gameState, ModifiersQuerying modifiersQuerying, ModifierFlag modifierFlag); public boolean hasFlagActive(GameState gameState, ModifiersQuerying modifiersQuerying, ModifierFlag modifierFlag);
public Side hasInitiative(GameState gameState, ModifiersQuerying modifiersQuerying); public Side hasInitiative(GameState gameState, ModifiersQuerying modifiersQuerying);
public int getInitiativeHandSizeModifier(GameState gameState, ModifiersQuerying modifiersQuerying);
} }

View File

@@ -564,7 +564,12 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
int freePeopleInitiativeHandSize = gameState.getHand(gameState.getCurrentPlayerId()).size() int freePeopleInitiativeHandSize = gameState.getHand(gameState.getCurrentPlayerId()).size()
+ gameState.getVoid(gameState.getCurrentPlayerId()).size(); + gameState.getVoid(gameState.getCurrentPlayerId()).size();
if (freePeopleInitiativeHandSize < 4)
int initiativeHandSize = 4;
for (Modifier modifier : getModifiers(ModifierEffect.INITIATIVE_MODIFIER))
initiativeHandSize += modifier.getInitiativeHandSizeModifier(gameState, this);
if (freePeopleInitiativeHandSize < initiativeHandSize)
return Side.SHADOW; return Side.SHADOW;
else else
return Side.FREE_PEOPLE; return Side.FREE_PEOPLE;