Fixed wrong behaviour of return state of ReturnToHandTargetEffect.

This commit is contained in:
LevelX2 2013-04-14 01:18:19 +02:00
parent 361ac7f602
commit b40d242dc7

View file

@ -59,25 +59,31 @@ public class ReturnToHandTargetEffect extends OneShotEffect<ReturnToHandTargetEf
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
boolean result = false; boolean result = true; // in case no target is selected
for (UUID targetId : targetPointer.getTargets(game, source)) { for (UUID targetId : targetPointer.getTargets(game, source)) {
switch (game.getState().getZone(targetId)) { switch (game.getState().getZone(targetId)) {
case BATTLEFIELD: case BATTLEFIELD:
Permanent permanent = game.getPermanent(targetId); Permanent permanent = game.getPermanent(targetId);
if (permanent != null) { if (permanent != null) {
result |= permanent.moveToZone(Zone.HAND, source.getId(), game, false); permanent.moveToZone(Zone.HAND, source.getId(), game, false);
} else {
result = false;
} }
break; break;
case GRAVEYARD: case GRAVEYARD:
Card card = game.getCard(targetId); Card card = game.getCard(targetId);
if (card != null) { if (card != null) {
result |= card.moveToZone(Zone.HAND, source.getId(), game, true); card.moveToZone(Zone.HAND, source.getId(), game, true);
} else {
result = false;
} }
break; break;
case EXILED: case EXILED:
card = game.getCard(targetId); card = game.getCard(targetId);
if (card != null) { if (card != null) {
result |= card.moveToZone(Zone.HAND, source.getId(), game, true); card.moveToZone(Zone.HAND, source.getId(), game, true);
} else {
result = false;
} }
break; break;
} }