* Alhammarret's Archive - Fixed that the draw effect was also applied on cards drawn from other players.

This commit is contained in:
LevelX2 2016-01-21 22:01:10 +01:00
parent 539ec1f679
commit 3a01e97d6e

View file

@ -87,11 +87,6 @@ class AlhammarretsArchiveEffect extends ReplacementEffectImpl {
return new AlhammarretsArchiveEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(event.getAmount() * 2);
@ -132,9 +127,9 @@ class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.drawCards(2, game, event.getAppliedEffects());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(2, game, event.getAppliedEffects());
}
return true;
}
@ -146,15 +141,17 @@ class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getPhase().getStep().getType().equals(PhaseStep.DRAW)) {
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep");
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
if (event.getPlayerId().equals(source.getControllerId())) {
if (game.getActivePlayerId().equals(event.getPlayerId())
&& game.getPhase().getStep().getType().equals(PhaseStep.DRAW)) {
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep");
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
return true;
}
} else {
return true;
}
} else {
return true;
}
return false;
}
}