mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
Fixed wrong behaviour of return state of ReturnToHandTargetEffect.
This commit is contained in:
parent
361ac7f602
commit
b40d242dc7
1 changed files with 10 additions and 4 deletions
|
@ -59,25 +59,31 @@ public class ReturnToHandTargetEffect extends OneShotEffect<ReturnToHandTargetEf
|
|||
|
||||
@Override
|
||||
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)) {
|
||||
switch (game.getState().getZone(targetId)) {
|
||||
case BATTLEFIELD:
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
result |= permanent.moveToZone(Zone.HAND, source.getId(), game, false);
|
||||
permanent.moveToZone(Zone.HAND, source.getId(), game, false);
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
break;
|
||||
case GRAVEYARD:
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
result |= card.moveToZone(Zone.HAND, source.getId(), game, true);
|
||||
card.moveToZone(Zone.HAND, source.getId(), game, true);
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
break;
|
||||
case EXILED:
|
||||
card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
result |= card.moveToZone(Zone.HAND, source.getId(), game, true);
|
||||
card.moveToZone(Zone.HAND, source.getId(), game, true);
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue