mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
[STX] fixed Journey to the Oracle not returning to hand (fixes #7827)
This commit is contained in:
parent
e9189f1d9d
commit
a85bf3af79
1 changed files with 29 additions and 25 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
|
|
@ -9,6 +8,7 @@ import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -56,31 +56,35 @@ public class ReturnToHandSourceEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller == null) {
|
||||||
MageObject mageObject;
|
return false;
|
||||||
if (returnFromNextZone
|
}
|
||||||
&& game.getState().getZoneChangeCounter(source.getSourceId()) == source.getSourceObjectZoneChangeCounter() + 1) {
|
MageObject mageObject;
|
||||||
mageObject = game.getObject(source.getSourceId());
|
if (returnFromNextZone
|
||||||
} else {
|
&& game.getState().getZoneChangeCounter(source.getSourceId()) == source.getSourceObjectZoneChangeCounter() + 1) {
|
||||||
mageObject = source.getSourceObjectIfItStillExists(game);
|
mageObject = game.getObject(source.getSourceId());
|
||||||
}
|
} else {
|
||||||
if (mageObject != null) {
|
mageObject = source.getSourceObjectIfItStillExists(game);
|
||||||
switch (game.getState().getZone(mageObject.getId())) {
|
}
|
||||||
case BATTLEFIELD:
|
if (mageObject == null) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
return controller.moveCards(permanent, Zone.HAND, source, game);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GRAVEYARD:
|
|
||||||
Card card = (Card) mageObject;
|
|
||||||
if (!fromBattlefieldOnly) {
|
|
||||||
return controller.moveCards(card, Zone.HAND, source, game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
switch (game.getState().getZone(mageObject.getId())) {
|
||||||
|
case BATTLEFIELD:
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (permanent != null) {
|
||||||
|
return controller.moveCards(permanent, Zone.HAND, source, game);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GRAVEYARD:
|
||||||
|
Card card = (Card) mageObject;
|
||||||
|
return !fromBattlefieldOnly && controller.moveCards(card, Zone.HAND, source, game);
|
||||||
|
case STACK:
|
||||||
|
Spell spell = game.getSpell(source.getSourceId());
|
||||||
|
return !fromBattlefieldOnly
|
||||||
|
&& spell != null
|
||||||
|
&& controller.moveCards(spell.getMainCard(), Zone.HAND, source, game);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue