"Under the Living Earth"
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.gempukku.lotro.cards.decisions;
|
||||
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.decisions.IntegerAwaitingDecision;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class ForEachTwilightTokenYouSpotDecision extends IntegerAwaitingDecision {
|
||||
protected ForEachTwilightTokenYouSpotDecision(int id, int twilightTokens) {
|
||||
super(id, "Choose number of twilight tokens you wish to spot", 0, twilightTokens);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getDecisionParameters() {
|
||||
Map<String, Object> result = super.getDecisionParameters();
|
||||
result.put("defaultValue", result.get("max"));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||
twilightTokensSpotted(getValidatedResult(result));
|
||||
}
|
||||
|
||||
protected abstract void twilightTokensSpotted(int twilightTokensSpotted);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.cards.decisions.ForEachTwilightTokenYouSpotDecision;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
public abstract class ForEachTwilightTokenYouSpotEffect implements Effect {
|
||||
private String _playerId;
|
||||
|
||||
protected ForEachTwilightTokenYouSpotEffect(String playerId) {
|
||||
_playerId = playerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EffectResult.Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EffectResult[] playEffect(LotroGame game) {
|
||||
int twilightPool = game.getGameState().getTwilightPool();
|
||||
if (twilightPool == 0)
|
||||
twilightTokensSpotted(0);
|
||||
else
|
||||
game.getUserFeedback().sendAwaitingDecision(_playerId,
|
||||
new ForEachTwilightTokenYouSpotDecision(1, twilightPool) {
|
||||
@Override
|
||||
protected void twilightTokensSpotted(int twilightTokensSpotted) {
|
||||
ForEachTwilightTokenYouSpotEffect.this.twilightTokensSpotted(twilightTokensSpotted);
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void twilightTokensSpotted(int twilightTokens);
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasSuccessful() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasCarriedOut() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.gempukku.lotro.cards.set4.gandalf;
|
||||
|
||||
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.effects.ForEachTwilightTokenYouSpotEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
|
||||
/**
|
||||
* Set: The Two Towers
|
||||
* Side: Free
|
||||
* Culture: Gandalf
|
||||
* Twilight Cost: 1
|
||||
* Type: Event
|
||||
* Game Text: Skirmish: Make Gandalf strength +1 for each twilight token you spot (limit +5).
|
||||
*/
|
||||
public class Card4_105 extends AbstractEvent {
|
||||
public Card4_105() {
|
||||
super(Side.FREE_PEOPLE, Culture.GANDALF, "Under the Living Earth", Phase.SKIRMISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTwilightCost() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, final PhysicalCard self, int twilightModifier) {
|
||||
final PlayEventAction action = new PlayEventAction(self);
|
||||
action.appendEffect(
|
||||
new ForEachTwilightTokenYouSpotEffect(playerId) {
|
||||
@Override
|
||||
protected void twilightTokensSpotted(int twilightTokens) {
|
||||
int bonus = Math.min(5, twilightTokens);
|
||||
action.insertEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new StrengthModifier(self, Filters.name("Gandalf"), bonus), Phase.SKIRMISH));
|
||||
}
|
||||
});
|
||||
return action;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user