Removing effects reworked.
This commit is contained in:
@@ -14,4 +14,5 @@
|
||||
6_125,6_39
|
||||
6_126,6_49
|
||||
6_127,6_68
|
||||
6_128,6_103
|
||||
6_128,6_103
|
||||
7_1,1_2
|
||||
@@ -9,17 +9,23 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class TriggeringResultEffect extends AbstractSuccessfulEffect {
|
||||
private Type _effectType;
|
||||
private EffectResult _effectResult;
|
||||
private String _text;
|
||||
|
||||
public TriggeringResultEffect(EffectResult effectResult, String text) {
|
||||
this(null, effectResult, text);
|
||||
}
|
||||
|
||||
public TriggeringResultEffect(Effect.Type effectType, EffectResult effectResult, String text) {
|
||||
_effectType = effectType;
|
||||
_effectResult = effectResult;
|
||||
_text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect.Type getType() {
|
||||
return null;
|
||||
return _effectType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,8 @@ public interface Effect {
|
||||
public enum Type {
|
||||
BEFORE_WOUND, BEFORE_EXERT, BEFORE_ADD_BURDENS, BEFORE_DISCARD_FROM_PLAY,
|
||||
BEFORE_ADD_TWILIGHT, BEFORE_KILLED, BEFORE_HEALED,
|
||||
BEFORE_TAKE_CONTROL_OF_A_SITE
|
||||
BEFORE_TAKE_CONTROL_OF_A_SITE,
|
||||
START_OF_PHASE, END_OF_PHASE, END_OF_TURN
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.logic.timing.processes.turn;
|
||||
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.effects.TriggeringResultEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.actions.SimpleEffectAction;
|
||||
import com.gempukku.lotro.logic.timing.processes.GameProcess;
|
||||
import com.gempukku.lotro.logic.timing.results.EndOfTurnResult;
|
||||
@@ -15,7 +16,7 @@ public class EndOfTurnGameProcess implements GameProcess {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
_game.getActionsEnvironment().addActionToStack(new SimpleEffectAction(new TriggeringResultEffect(new EndOfTurnResult(), "End of turn"), "End of turn"));
|
||||
_game.getActionsEnvironment().addActionToStack(new SimpleEffectAction(new TriggeringResultEffect(Effect.Type.END_OF_TURN, new EndOfTurnResult(), "End of turn"), "End of turn"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.effects.TriggeringResultEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.actions.SimpleEffectAction;
|
||||
import com.gempukku.lotro.logic.timing.processes.GameProcess;
|
||||
import com.gempukku.lotro.logic.timing.results.EndOfPhaseResult;
|
||||
@@ -20,7 +21,7 @@ public class EndOfPhaseGameProcess implements GameProcess {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
_game.getActionsEnvironment().addActionToStack(new SimpleEffectAction(new TriggeringResultEffect(new EndOfPhaseResult(_phase), "End of " + _phase + " phase"), "End of " + _phase + " phase"));
|
||||
_game.getActionsEnvironment().addActionToStack(new SimpleEffectAction(new TriggeringResultEffect(Effect.Type.END_OF_PHASE, new EndOfPhaseResult(_phase), "End of " + _phase + " phase"), "End of " + _phase + " phase"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.effects.TriggeringResultEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.actions.SimpleEffectAction;
|
||||
import com.gempukku.lotro.logic.timing.processes.GameProcess;
|
||||
import com.gempukku.lotro.logic.timing.results.StartOfPhaseResult;
|
||||
@@ -21,7 +22,7 @@ public class StartOfPhaseGameProcess implements GameProcess {
|
||||
@Override
|
||||
public void process() {
|
||||
_game.getGameState().setCurrentPhase(_phase);
|
||||
_game.getActionsEnvironment().addActionToStack(new SimpleEffectAction(new TriggeringResultEffect(new StartOfPhaseResult(_phase), "Start of " + _phase + " phase"), "Start of " + _phase + " phase"));
|
||||
_game.getActionsEnvironment().addActionToStack(new SimpleEffectAction(new TriggeringResultEffect(Effect.Type.START_OF_PHASE, new StartOfPhaseResult(_phase), "Start of " + _phase + " phase"), "Start of " + _phase + " phase"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.game.state.actions.DefaultActionsEnvironment;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersLogic;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
import com.gempukku.lotro.logic.timing.actions.SimpleEffectAction;
|
||||
|
||||
@@ -26,8 +26,8 @@ public class EndEffectsAndActionsRule {
|
||||
_actionsEnvironment.addAlwaysOnActionProxy(
|
||||
new AbstractActionProxy() {
|
||||
@Override
|
||||
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
|
||||
if (effectResult.getType() == EffectResult.Type.START_OF_PHASE)
|
||||
public List<? extends Action> getRequiredBeforeTriggers(LotroGame game, Effect effect) {
|
||||
if (effect.getType() == Effect.Type.START_OF_PHASE)
|
||||
return Collections.<Action>singletonList(new SimpleEffectAction(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
@@ -38,7 +38,7 @@ public class EndEffectsAndActionsRule {
|
||||
}
|
||||
}, "Remove effects"
|
||||
));
|
||||
else if (effectResult.getType() == EffectResult.Type.END_OF_PHASE)
|
||||
else if (effect.getType() == Effect.Type.END_OF_PHASE)
|
||||
return Collections.<Action>singletonList(new SimpleEffectAction(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
@@ -49,7 +49,7 @@ public class EndEffectsAndActionsRule {
|
||||
}
|
||||
}, "Remove effects"
|
||||
));
|
||||
else if (effectResult.getType() == EffectResult.Type.END_OF_TURN)
|
||||
else if (effect.getType() == Effect.Type.END_OF_TURN)
|
||||
return Collections.<Action>singletonList(new SimpleEffectAction(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
|
||||
@@ -59,6 +59,24 @@ public class LotroServer extends AbstractServer {
|
||||
}
|
||||
}
|
||||
|
||||
if (test) {
|
||||
for (int i = 7; i <= 7; i++) {
|
||||
for (int j = 1; j <= 365; j++) {
|
||||
String blueprintId = i + "_" + j;
|
||||
try {
|
||||
LotroCardBlueprint cardBlueprint = _lotroCardBlueprintLibrary.getLotroCardBlueprint(blueprintId);
|
||||
CardType cardType = cardBlueprint.getCardType();
|
||||
if (cardType == CardType.SITE || cardType == CardType.THE_ONE_RING)
|
||||
_defaultCollection.addCards(blueprintId, cardBlueprint, 1);
|
||||
else
|
||||
_defaultCollection.addCards(blueprintId, cardBlueprint, 4);
|
||||
} catch (IllegalArgumentException exp) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_playerDao = new PlayerDAO(dbAccess);
|
||||
_deckDao = new DeckDAO(dbAccess);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user