"Hobbit Intuition"

This commit is contained in:
marcins78@gmail.com
2011-09-05 00:34:53 +00:00
parent 070441a414
commit 9398f6da96
5 changed files with 117 additions and 25 deletions

View File

@@ -0,0 +1,11 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
public class CancelSkirmishEffect extends UnrespondableEffect {
@Override
public void playEffect(LotroGame game) {
game.getGameState().getSkirmish().cancel();
}
}

View File

@@ -0,0 +1,65 @@
package com.gempukku.lotro.cards.set1.shire;
import com.gempukku.lotro.cards.AbstractLotroCardBlueprint;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.cards.effects.CancelSkirmishEffect;
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
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.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: The Fellowship of the Ring
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Event
* Game Text: Stealth. Skirmish: At sites 1 to 4, cancel a skirmish involving a Hobbit. At any other site, make a
* Hobbit strength +3.
*/
public class Card1_296 extends AbstractLotroCardBlueprint {
public Card1_296() {
super(Side.FREE_PEOPLE, CardType.EVENT, Culture.SHIRE, "Hobbit Intuition");
addKeyword(Keyword.STEALTH);
addKeyword(Keyword.SKIRMISH);
}
@Override
public int getTwilightCost() {
return 1;
}
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canPlayFPCardDuringPhase(game, Phase.SKIRMISH, self)) {
PhysicalCard fpCharacter = game.getGameState().getSkirmish().getFellowshipCharacter();
if (game.getGameState().getCurrentSiteNumber() > 4 || (fpCharacter != null && game.getModifiersQuerying().hasKeyword(game.getGameState(), fpCharacter, Keyword.HOBBIT))) {
final PlayEventAction action = new PlayEventAction(self);
if (game.getGameState().getCurrentSiteNumber() > 4) {
action.addEffect(
new ChooseActiveCardEffect(playerId, "Choose a Hobbit", Filters.keyword(Keyword.HOBBIT)) {
@Override
protected void cardSelected(PhysicalCard hobbit) {
action.addEffect(
new AddUntilEndOfPhaseModifierEffect(
new StrengthModifier(self, Filters.sameCard(hobbit), 3), Phase.SKIRMISH));
}
});
} else {
action.addEffect(
new CancelSkirmishEffect());
}
return Collections.singletonList(action);
}
}
return null;
}
}

View File

@@ -7,6 +7,7 @@ import java.util.List;
public class Skirmish {
private PhysicalCard _fellowshipCharacter;
private List<PhysicalCard> _shadowCharacters;
private boolean _cancelled;
public Skirmish(PhysicalCard fellowshipCharacter, List<PhysicalCard> shadowCharacters) {
_fellowshipCharacter = fellowshipCharacter;
@@ -20,4 +21,12 @@ public class Skirmish {
public List<PhysicalCard> getShadowCharacters() {
return _shadowCharacters;
}
public void cancel() {
_cancelled = true;
}
public boolean isCancelled() {
return _cancelled;
}
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.logic.timing.processes.turn.general;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.PlayOrder;
import com.gempukku.lotro.logic.decisions.CardActionSelectionDecision;
@@ -28,34 +29,39 @@ public class PlayersPlayPhaseActionsInOrderGameProcess implements GameProcess {
@Override
public void process() {
String playerId = _playOrder.getNextPlayer();
GatherPlayableActionsVisitor visitor = new GatherPlayableActionsVisitor(_game, playerId);
_game.getGameState().iterateActivableCards(playerId, visitor);
if (_game.getGameState().getCurrentPhase() == Phase.SKIRMISH
&& _game.getGameState().getSkirmish().isCancelled()) {
_nextProcess = _followingGameProcess;
} else {
String playerId = _playOrder.getNextPlayer();
GatherPlayableActionsVisitor visitor = new GatherPlayableActionsVisitor(_game, playerId);
_game.getGameState().iterateActivableCards(playerId, visitor);
List<? extends Action> actions = visitor.getActions();
List<? extends Action> actions = visitor.getActions();
List<Action> playableActions = new LinkedList<Action>();
for (Action action : actions)
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), action))
playableActions.add(action);
List<Action> playableActions = new LinkedList<Action>();
for (Action action : actions)
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), action))
playableActions.add(action);
_game.getUserFeedback().sendAwaitingDecision(playerId,
new CardActionSelectionDecision(1, "Choose action to play or press DONE", playableActions, true) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
Action action = getSelectedAction(result);
if (action != null) {
_nextProcess = new PlayersPlayPhaseActionsInOrderGameProcess(_game, _playOrder, 0, _followingGameProcess);
_game.getActionsEnvironment().addActionToStack(action);
} else {
_consecutivePasses++;
if (_consecutivePasses >= _playOrder.getPlayerCount())
_nextProcess = _followingGameProcess;
else
_nextProcess = new PlayersPlayPhaseActionsInOrderGameProcess(_game, _playOrder, _consecutivePasses, _followingGameProcess);
_game.getUserFeedback().sendAwaitingDecision(playerId,
new CardActionSelectionDecision(1, "Choose action to play or press DONE", playableActions, true) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
Action action = getSelectedAction(result);
if (action != null) {
_nextProcess = new PlayersPlayPhaseActionsInOrderGameProcess(_game, _playOrder, 0, _followingGameProcess);
_game.getActionsEnvironment().addActionToStack(action);
} else {
_consecutivePasses++;
if (_consecutivePasses >= _playOrder.getPlayerCount())
_nextProcess = _followingGameProcess;
else
_nextProcess = new PlayersPlayPhaseActionsInOrderGameProcess(_game, _playOrder, _consecutivePasses, _followingGameProcess);
}
}
}
});
});
}
}
@Override

View File

@@ -17,7 +17,8 @@ public class ResolveSkirmishGameProcess implements GameProcess {
@Override
public void process() {
Skirmish skirmish = _game.getGameState().getSkirmish();
_game.getActionsEnvironment().addActionToStack(new ResolveSkirmishAction(_game, skirmish));
if (!skirmish.isCancelled())
_game.getActionsEnvironment().addActionToStack(new ResolveSkirmishAction(_game, skirmish));
}
@Override