- Finally (hopefully) fixed "The One Ring" bug that prevented Frodo from taking it off, when he was supposed to.

This commit is contained in:
marcins78@gmail.com
2011-10-18 23:48:39 +00:00
parent dd61d72793
commit 868226674b
8 changed files with 90 additions and 52 deletions

View File

@@ -0,0 +1,18 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.game.ActionProxy;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
public class AddUntilEndOfTurnActionProxyEffect extends UnrespondableEffect {
private ActionProxy _actionProxy;
public AddUntilEndOfTurnActionProxyEffect(ActionProxy actionProxy) {
_actionProxy = actionProxy;
}
@Override
public void doPlayEffect(LotroGame game) {
game.getActionsEnvironment().addUntilEndOfTurnActionProxy(_actionProxy);
}
}

View File

@@ -69,35 +69,37 @@ public class Card1_001 extends AbstractAttachable {
action.appendEffect(new AddBurdenEffect(self, 2));
action.appendEffect(new PutOnTheOneRingEffect());
if (game.getGameState().getCurrentPhase() == Phase.REGROUP) {
action.appendEffect(new AddUntilEndOfPhaseActionProxyEffect(
new AbstractActionProxy() {
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.END_OF_PHASE
&& ((StartOfPhaseResult) effectResult).getPhase() == Phase.REGROUP) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(new TakeOffTheOneRingEffect());
return Collections.singletonList(action);
action.appendEffect(
new AddUntilEndOfTurnActionProxyEffect(
new AbstractActionProxy() {
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.END_OF_PHASE
&& ((StartOfPhaseResult) effectResult).getPhase() == Phase.REGROUP) {
ActivateCardAction action = new ActivateCardAction(null);
action.appendEffect(new TakeOffTheOneRingEffect());
return Collections.singletonList(action);
}
return null;
}
}
return null;
}
}
, Phase.REGROUP));
));
} else {
action.appendEffect(new AddUntilStartOfPhaseActionProxyEffect(
new AbstractActionProxy() {
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.START_OF_PHASE
&& ((StartOfPhaseResult) effectResult).getPhase() == Phase.REGROUP) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(new TakeOffTheOneRingEffect());
return Collections.singletonList(action);
action.appendEffect(
new AddUntilEndOfTurnActionProxyEffect(
new AbstractActionProxy() {
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.START_OF_PHASE
&& ((StartOfPhaseResult) effectResult).getPhase() == Phase.REGROUP) {
ActivateCardAction action = new ActivateCardAction(null);
action.appendEffect(new TakeOffTheOneRingEffect());
return Collections.singletonList(action);
}
return null;
}
}
return null;
}
}
, Phase.REGROUP));
));
}
actions.add(action);

View File

@@ -67,20 +67,21 @@ public class Card1_002 extends AbstractAttachable {
action.appendEffect(new PreventCardEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new AddBurdenEffect(self, 1));
action.appendEffect(new PutOnTheOneRingEffect());
action.appendEffect(new AddUntilStartOfPhaseActionProxyEffect(
new AbstractActionProxy() {
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.START_OF_PHASE
&& ((StartOfPhaseResult) effectResult).getPhase() == Phase.REGROUP) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(new TakeOffTheOneRingEffect());
return Collections.singletonList(action);
action.appendEffect(
new AddUntilEndOfTurnActionProxyEffect(
new AbstractActionProxy() {
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.START_OF_PHASE
&& ((StartOfPhaseResult) effectResult).getPhase() == Phase.REGROUP) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(new TakeOffTheOneRingEffect());
return Collections.singletonList(action);
}
return null;
}
}
return null;
}
}
, Phase.REGROUP));
));
actions.add(action);
return actions;

View File

@@ -73,20 +73,21 @@ public class Card4_001 extends AbstractAttachable {
new AddBurdenEffect(self, 1));
action.appendEffect(
new PutOnTheOneRingEffect());
action.appendEffect(new AddUntilStartOfPhaseActionProxyEffect(
new AbstractActionProxy() {
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.START_OF_PHASE
&& ((StartOfPhaseResult) effectResult).getPhase() == Phase.REGROUP) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(new TakeOffTheOneRingEffect());
return Collections.singletonList(action);
action.appendEffect(
new AddUntilEndOfTurnActionProxyEffect(
new AbstractActionProxy() {
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.START_OF_PHASE
&& ((StartOfPhaseResult) effectResult).getPhase() == Phase.REGROUP) {
ActivateCardAction action = new ActivateCardAction(null);
action.appendEffect(new TakeOffTheOneRingEffect());
return Collections.singletonList(action);
}
return null;
}
}
return null;
}
}
, Phase.REGROUP));
));
return Collections.singletonList(action);
}
return null;

View File

@@ -26,5 +26,7 @@ public interface ActionsEnvironment {
public void addUntilEndOfPhaseActionProxy(ActionProxy actionProxy, Phase phase);
public void addUntilEndOfTurnActionProxy(ActionProxy actionProxy);
public void addActionToStack(Action action);
}

View File

@@ -24,6 +24,7 @@ public class DefaultActionsEnvironment implements ActionsEnvironment {
private List<ActionProxy> _actionProxies = new LinkedList<ActionProxy>();
private Map<Phase, List<ActionProxy>> _untilStartOfPhaseActionProxies = new HashMap<Phase, List<ActionProxy>>();
private Map<Phase, List<ActionProxy>> _untilEndOfPhaseActionProxies = new HashMap<Phase, List<ActionProxy>>();
private List<ActionProxy> _untilEndOfTurnActionProxies = new LinkedList<ActionProxy>();
public DefaultActionsEnvironment(LotroGame lotroGame, ActionStack actionStack) {
_lotroGame = lotroGame;
@@ -50,6 +51,11 @@ public class DefaultActionsEnvironment implements ActionsEnvironment {
}
}
public void removeEndOfTurnActionProxies() {
_actionProxies.removeAll(_untilEndOfTurnActionProxies);
_untilEndOfTurnActionProxies.clear();
}
@Override
public void addUntilStartOfPhaseActionProxy(ActionProxy actionProxy, Phase phase) {
_actionProxies.add(actionProxy);
@@ -72,6 +78,12 @@ public class DefaultActionsEnvironment implements ActionsEnvironment {
list.add(actionProxy);
}
@Override
public void addUntilEndOfTurnActionProxy(ActionProxy actionProxy) {
_actionProxies.add(actionProxy);
_untilEndOfTurnActionProxies.add(actionProxy);
}
@Override
public List<Action> getRequiredBeforeTriggers(Effect effect) {
GatherRequiredBeforeTriggers gatherActions = new GatherRequiredBeforeTriggers(effect);

View File

@@ -56,6 +56,7 @@ public class EndEffectsAndActionsRule {
@Override
public void doPlayEffect(LotroGame game) {
_modifiersLogic.removeEndOfTurn();
_actionsEnvironment.removeEndOfTurnActionProxies();
}
}, "Remove effects"
));

View File

@@ -12,6 +12,7 @@ twilight cost, instead of just making it cheaper to play.
- System messages ("player joined/left room") are now different color, so they could be easily distinguishable.
- Winning player in the hall now shows differently on the table, once the game is finished.
- Increased how long the table is up after the game was finished to 10 minutes to give better bragging opportunity.
- Finally (hopefully) fixed "The One Ring" bug that prevented Frodo from taking it off, when he was supposed to.
<b>17 Oct. 2011</b>
- "Coming for the Ring" is no longed considered Free People card by the game.